GxMain Class
The GxMain class is the primary entry point handler of the GeniXCMS application. It is responsible for orchestrating the boot sequence, determining whether the system is installed, and dispatching the user to the correct controller layer (Frontend, Backend, or Installation).
⚡ Application Lifecycle
The lifecycle of a GeniXCMS request typically starts in the root index.php, which instantiates GxMain:
- Instantiation: Checks if
inc/config/config.php exists.
- If Yes: Initializes the
System class.
- If No: Redirects to the
install() method.
- Dispatching: Based on the requested URL, one of the following methods is called.
🛠️ Public Methods Reference
GxMain::__construct()
The constructor acts as the system's "Pre-flight" check.
- If
System::existConf() is true, it bootstraps the application core.
- If false, it immediately halts regular execution and starts the installation wizard.
GxMain::index()
Triggers the Frontend controller layer.
- Loads the theme defined in the site options.
- Delegates request handling to
Control::frontend().
GxMain::admin()
Handles all requests directed towards the administrative dashboard.
- Security Checks:
- Calls
User::secure() to ensure the user is logged in.
- Verifies that the user has an access level of 4 (Contributor) or higher to view the dashboard.
- Access Denied: If the user lacks permissions, it displays the
noaccess error page wrapped in the admin header/footer.
- Success: Delegates to
Control::handler('backend').
GxMain::install()
Initializes the standalone installation process.
- Starts a fresh session.
- Loads the specialized
install theme (header.php, footer.php).
- Delegates to
Control::handler('install').
📂 Implementation Details
In a typical index.php, the class is used as follows:
$v = new GxMain();
if (isset($_GET['admin'])) {
$v->admin();
} else {
$v->index();
}
See Also
- System Class — The core system initializer called by GxMain.
- Control Class — The dispatcher that GxMain hands off to.
- User Class — Used for session security in the
admin() method.