Architecture
Root files
Drake CMS is built to be small, functional and capable of running on any database engine (also Gladius DB).
The core of Drake CMS contains only some classes, include files and core plugins which build a small framework on top of which everything else can be built and run.
There are mainly 2 files though which the whole of the system is accessed
- index.php - main output renderer which renders the website with relative active component
- admin.php - main administrative interface output renderer
The root folder contains as well other important files:
- version.php - file holding the Drake CMS version and an auxiliary version information retrieval mechanism (disabled by default)
- core.php - the core inclusion file which sets up a valid Drake CMS framework
- docs.php - documentation references proxy which redirects to the requested documentation pages
- 404.php - a dummy file that can be used as redirection target for 404 not found HTTP errors
- index2.php - alternative output renderer which is used to render printable content without any template
- admin2.php - alternative admin interface output renderer without template (deprecated)
Main rendering explained
The index.php file rendering process goes through the following steps in order to provide a valid Drake CMS response:
- include core.php to prepare the Drake CMS framework; core.php will:
- record the page start time (into the $page_start_time global variable)
- include version.php
- if the config.php file does not exist in the private folder, redirect to install/index.php (to proceed with installation)
- include config.php from the private folder ($d_private)
- setup the custom error handler
- include includes/dracon.php which contains input validation functions
- include includes/adodb.php which will setup a working database connection through adoDB lite
- include includes/functions.php which contains various global functions necessary to Drake CMS execution
- include includes/header.php to prepare the HTTP response
serving
- setup $time (which is basically time() + a custom amount of hours (offset) specified in $d_offset
- start the session (an eventual custom session handler can be actived from here too)
- include and start the User class (recognizes already logged-in users and other preferences)
- include the localized common.php
- include includes/user_functions.php which contains functions needed for the user impersonation
- include and start the Pathway class
- include and start the DrabotHandler class
- include and start the Drake class - the main web response class
- if statistics are always enabled ($d_stats), hit them
- include the localized user.php
- serve the correct Content-Type and Content-Language headers
- setup UTF-8 support (will use emulated UTF-8 support if none available through PHP)
- check if the website is online; if it is not, show the offline message and exit
- initializes the only allowed globals which are $option, $Itemid and $catid (these are going to be removed too)
- buffer the main component output through ob_start()
- send the necessary HTTP headers
- render the template, which will output the buffered component output in the correct place (through Drake::DumpComponent())
Directory structure
See Directory structure for further details on each directory's role.