# maxsite/cms architecture

> Architecture diagram of the GitHub repository maxsite/cms, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maxsite/cms
- Repository: https://github.com/maxsite/cms

## Overview

#### Purpose and Runtime
MaxSite CMS is a PHP CMS for content sites, blogs, business sites, and landing pages. It runs on a web server with Apache `.htaccess`/`mod_rewrite`, PHP 7.1+ (recommended PHP 8), and MySQL/MariaDB 5.6+. The repository embeds a legacy CodeIgniter runtime plus the MaxSite application layer.

#### HTTP Entry and Framework Boot
`index.php` is the public front controller; it boots CodeIgniter, whose routing and request lifecycle reside in `system/core/CodeIgniter.php`, `system/core/Router.php`, and `system/core/Output.php`. Application routes/controllers are configured under `application/config/routes.php` and implemented primarily by `application/controllers/maxsite.php`. Requests are dispatched into MaxSite’s own content/admin/AJAX modes rather than a conventional controller-per-feature MVC structure.

#### MaxSite Core Initialization and Extension Points
The CMS runtime is centered on initialization, hooks, options, plugins, security, and output services in `application/maxsite/common/core/init.php`, `application/maxsite/common/core/hooks.php`, and `application/maxsite/common/core/page-out.php`. This is the main boundary between CodeIgniter infrastructure and CMS behavior. Hooks and plugin discovery allow core, templates, and extensions to inject behavior during request processing.

#### Content and Persistence Flow
Public content handling is organized around pages, categories, comments, and page-query/formatting modules: `application/maxsite/common/page.php`, `application/maxsite/common/page/get-pages.php`, and `application/maxsite/common/comments.php`. Database access is configured from `application/config/database.php-distr` during installation and uses CodeIgniter MySQL/MySQLi drivers (`system/database/DB.php`, `system/database/drivers/mysqli/mysqli_driver.php`); an additional PDO abstraction exists at `application/maxsite/common/psr4/Pdo/PdoConnect.php`. Runtime file storage is separated into `uploads/` and protected application storage at `application/storage/.htaccess`.

#### Rendering, Types, and Themes
A request resolves to a CMS page type—home, page, archive, category, search, feeds, users, etc.—whose shared render definitions live in `application/maxsite/shared/type/`. Template selection and composition are managed by the core template services and the active template, shipped as `application/maxsite/templates/default/index.php`, `application/maxsite/templates/default/main/main.php`, and `application/maxsite/templates/default/main/blocks/`. Templates can supply PHP components, shortcodes, custom options, layouts, and front-end assets, making them an application-level customization boundary.

#### Administration and Authoring
The admin entry flow is in `application/maxsite/admin/admin.php`, with shared admin behavior in `application/maxsite/admin/common.php` and layout in `application/maxsite/admin/template/default/template.php`. Admin plugins implement content CRUD, category/menu/sidebar/user management, system options, plugins, files, and editors—for example `application/maxsite/admin/plugins/admin_page/`, `application/maxsite/admin/plugins/admin_users/`, and `application/maxsite/admin/plugins/admin_options/`. Several operations expose dedicated AJAX PHP endpoints, so authorization and input validation must be preserved across both page and AJAX flows.

#### Plugin Ecosystem and Integrations
Feature plugins are filesystem-discovered modules under `application/maxsite/plugins/`, conventionally with `index.php` execution and `info.php` metadata. They extend parsing, comments, feeds, caching, SEO, forms, authentication, scheduled work, and external services. Notable integration surfaces include SMTP email (`application/maxsite/plugins/smtp_mail/`), Facebook/Loginza authentication (`application/maxsite/plugins/fbauth/`, `application/maxsite/plugins/loginza_auth/`), RSS import (`application/maxsite/plugins/rss_get/`), and Markdown via bundled Parsedown (`application/maxsite/plugins/parser_markdown/Parsedown/Parsedown.php`).

#### Installation, Updates, and Cache
First-time installation begins at `install/index.php`; installer stages collect database settings and apply the bundled schema from `install/installer/model.sql.txt`. The remote updater is a separate secured entry point at `update-maxsite/index.php`, using `update-maxsite/_key.php` and archive extraction. Cache domains are filesystem-backed under `application/cache/db/`, `application/cache/html/`, and `application/cache/rss/`; the core cache layer is `application/maxsite/common/core/cache.php`.

Main entry points: [`application/maxsite/common/core/init.php`](https://github.com/maxsite/cms/blob/master/application/maxsite/common/core/init.php) (CMS initialization), [`application/controllers/maxsite.php`](https://github.com/maxsite/cms/blob/master/application/controllers/maxsite.php) (MaxSite controller), [`application/maxsite/common/page/get-pages.php`](https://github.com/maxsite/cms/blob/master/application/maxsite/common/page/get-pages.php) (Content queries), [`application/maxsite/common/core/page-out.php`](https://github.com/maxsite/cms/blob/master/application/maxsite/common/core/page-out.php) (CMS page output)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP &amp; Framework"]
  node_front["Public front controller<br/>PHP entry<br/>[index.php]"]
  node_ci["CodeIgniter lifecycle<br/>framework runtime<br/>[CodeIgniter.php]"]
  node_router["Router<br/>framework routing<br/>[Router.php]"]
  node_routes["Application routes<br/>route config<br/>[routes.php]"]
  node_controller["MaxSite controller<br/>request dispatcher<br/>[maxsite.php]"]
end

subgraph group_cms["CMS Runtime"]
  node_core["CMS initialization<br/>CMS core<br/>[init.php]"]
  node_hooks["Hooks &amp; plugin discovery<br/>extension runtime<br/>[hooks.php]"]
  node_content["Content queries<br/>content service<br/>[get-pages.php]"]
  node_page["Page handling<br/>content service<br/>[page.php]"]
  node_output["CMS page output<br/>render service<br/>[page-out.php]"]
  node_types["Page types<br/>shared render definitions"]
end

subgraph group_authoring["Administration"]
  node_admin["Admin entry<br/>admin runtime<br/>[admin.php]"]
  node_adminplugins["Admin plugins<br/>authoring modules"]
  node_adminlayout["Admin layout<br/>admin template<br/>[template.php]"]
end

subgraph group_extensions["Themes &amp; Plugins"]
  node_template["Default theme<br/>template boundary<br/>[index.php]"]
  node_plugins["Feature plugins<br/>discovered modules"]
end

subgraph group_operations["Install, Data &amp; Cache"]
  node_dbconfig["Database setup config<br/>installation config<br/>[database.php-distr]"]
  node_database[("MySQL / MariaDB<br/>relational database")]
  node_storage[("Uploads &amp; protected storage<br/>filesystem storage")]
  node_cache["Filesystem cache<br/>cache service<br/>[cache.php]"]
  node_installer["Installer &amp; schema<br/>installation entry<br/>[index.php]"]
  node_updater["Secure remote updater<br/>update entry<br/>[index.php]"]
end

node_front -->|"boots"| node_ci
node_ci -->|"routes request"| node_router
node_router -->|"loads"| node_routes
node_routes -->|"dispatches"| node_controller
node_controller -->|"enters CMS runtime"| node_core
node_core -->|"runs extension points"| node_hooks
node_core -->|"serves content"| node_content
node_content -->|"builds page data"| node_page
node_content -->|"queries"| node_database
node_core -->|"uses"| node_cache
node_core -->|"renders"| node_output
node_output -->|"resolves type"| node_types
node_output -->|"composes"| node_template
node_hooks -->|"discovers and invokes"| node_plugins
node_template -.->|"adds hooks and components"| node_hooks
node_controller -->|"admin mode"| node_admin
node_admin -->|"loads management modules"| node_adminplugins
node_admin -->|"renders"| node_adminlayout
node_adminplugins -->|"manages content"| node_database
node_core -->|"reads and writes files"| node_storage
node_dbconfig -.->|"connects"| node_database
node_installer -->|"writes settings"| node_dbconfig
node_installer -->|"applies schema"| node_database
node_updater -.->|"updates CMS files"| node_core

click node_front "https://github.com/maxsite/cms/blob/master/index.php"
click node_ci "https://github.com/maxsite/cms/blob/master/system/core/CodeIgniter.php"
click node_router "https://github.com/maxsite/cms/blob/master/system/core/Router.php"
click node_routes "https://github.com/maxsite/cms/blob/master/application/config/routes.php"
click node_controller "https://github.com/maxsite/cms/blob/master/application/controllers/maxsite.php"
click node_core "https://github.com/maxsite/cms/blob/master/application/maxsite/common/core/init.php"
click node_hooks "https://github.com/maxsite/cms/blob/master/application/maxsite/common/core/hooks.php"
click node_content "https://github.com/maxsite/cms/blob/master/application/maxsite/common/page/get-pages.php"
click node_page "https://github.com/maxsite/cms/blob/master/application/maxsite/common/page.php"
click node_output "https://github.com/maxsite/cms/blob/master/application/maxsite/common/core/page-out.php"
click node_template "https://github.com/maxsite/cms/blob/master/application/maxsite/templates/default/index.php"
click node_admin "https://github.com/maxsite/cms/blob/master/application/maxsite/admin/admin.php"
click node_adminlayout "https://github.com/maxsite/cms/blob/master/application/maxsite/admin/template/default/template.php"
click node_dbconfig "https://github.com/maxsite/cms/blob/master/application/config/database.php-distr"
click node_cache "https://github.com/maxsite/cms/blob/master/application/maxsite/common/core/cache.php"
click node_installer "https://github.com/maxsite/cms/blob/master/install/index.php"
click node_updater "https://github.com/maxsite/cms/blob/master/update-maxsite/index.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_front,node_ci,node_router,node_routes,node_controller toneBlue
class node_core,node_hooks,node_content,node_page,node_output,node_types toneAmber
class node_admin,node_adminplugins,node_adminlayout toneMint
class node_template,node_plugins toneRose
class node_dbconfig,node_database,node_storage,node_cache,node_installer,node_updater toneIndigo
```

## Components

### HTTP & Framework

- [Public front controller](https://github.com/maxsite/cms/blob/master/index.php): PHP entry · `index.php`
- [CodeIgniter lifecycle](https://github.com/maxsite/cms/blob/master/system/core/CodeIgniter.php): framework runtime · Bootstraps routing and response output. · `system/core/CodeIgniter.php`
- [Router](https://github.com/maxsite/cms/blob/master/system/core/Router.php): framework routing · `system/core/Router.php`
- [Application routes](https://github.com/maxsite/cms/blob/master/application/config/routes.php): route config · `application/config/routes.php`
- [MaxSite controller](https://github.com/maxsite/cms/blob/master/application/controllers/maxsite.php): request dispatcher · Selects CMS content, admin, or AJAX modes. · `application/controllers/maxsite.php`

### CMS Runtime

- [CMS initialization](https://github.com/maxsite/cms/blob/master/application/maxsite/common/core/init.php): CMS core · Boundary from CodeIgniter infrastructure into CMS behavior. · `application/maxsite/common/core/init.php`
- [Hooks & plugin discovery](https://github.com/maxsite/cms/blob/master/application/maxsite/common/core/hooks.php): extension runtime · `application/maxsite/common/core/hooks.php`
- [Content queries](https://github.com/maxsite/cms/blob/master/application/maxsite/common/page/get-pages.php): content service · Loads and formats pages, categories, and comments. · `application/maxsite/common/page/get-pages.php`
- [Page handling](https://github.com/maxsite/cms/blob/master/application/maxsite/common/page.php): content service · `application/maxsite/common/page.php`
- [CMS page output](https://github.com/maxsite/cms/blob/master/application/maxsite/common/core/page-out.php): render service · `application/maxsite/common/core/page-out.php`
- **Page types**: shared render definitions

### Administration

- [Admin entry](https://github.com/maxsite/cms/blob/master/application/maxsite/admin/admin.php): admin runtime · `application/maxsite/admin/admin.php`
- **Admin plugins**: authoring modules · CRUD and management for content, users, options, files, and editors.
- [Admin layout](https://github.com/maxsite/cms/blob/master/application/maxsite/admin/template/default/template.php): admin template · `application/maxsite/admin/template/default/template.php`

### Themes & Plugins

- [Default theme](https://github.com/maxsite/cms/blob/master/application/maxsite/templates/default/index.php): template boundary · Templates can add components, layouts, options, shortcodes, and assets. · `application/maxsite/templates/default/index.php`
- **Feature plugins**: discovered modules · Filesystem modules extending CMS behavior and integrations.

### Install, Data & Cache

- [Database setup config](https://github.com/maxsite/cms/blob/master/application/config/database.php-distr): installation config · `application/config/database.php-distr`
- **MySQL / MariaDB**: relational database
- **Uploads & protected storage**: filesystem storage
- [Filesystem cache](https://github.com/maxsite/cms/blob/master/application/maxsite/common/core/cache.php): cache service · Manages database, HTML, and RSS cache domains. · `application/maxsite/common/core/cache.php`
- [Installer & schema](https://github.com/maxsite/cms/blob/master/install/index.php): installation entry · Collects database settings and applies the bundled schema. · `install/index.php`
- [Secure remote updater](https://github.com/maxsite/cms/blob/master/update-maxsite/index.php): update entry · `update-maxsite/index.php`

## Connections

- Public front controller → CodeIgniter lifecycle: boots
- CodeIgniter lifecycle → Router: routes request
- Router → Application routes: loads
- Application routes → MaxSite controller: dispatches
- MaxSite controller → CMS initialization: enters CMS runtime
- CMS initialization → Hooks & plugin discovery: runs extension points
- CMS initialization → Content queries: serves content
- Content queries → Page handling: builds page data
- Content queries → MySQL / MariaDB: queries
- CMS initialization → Filesystem cache: uses
- CMS initialization → CMS page output: renders
- CMS page output → Page types: resolves type
- CMS page output → Default theme: composes
- Hooks & plugin discovery → Feature plugins: discovers and invokes
- Default theme → Hooks & plugin discovery: adds hooks and components
- MaxSite controller → Admin entry: admin mode
- Admin entry → Admin plugins: loads management modules
- Admin entry → Admin layout: renders
- Admin plugins → MySQL / MariaDB: manages content
- CMS initialization → Uploads & protected storage: reads and writes files
- Database setup config → MySQL / MariaDB: connects
- Installer & schema → Database setup config: writes settings
- Installer & schema → MySQL / MariaDB: applies schema
- Secure remote updater → CMS initialization: updates CMS files
