d4f43e39c44f77fe35dd0a7107f4d8a4f7b17399
1 <?php
defined('IN_CMS') or die('No direct access allowed.');
6 if(version_compare(PHP_VERSION
, '5.3.0', '<')) {
7 // echo and exit with some usful information
8 echo 'Test CMS requires PHP 5.3 or newer, your current environment is running PHP ' . PHP_VERSION
;
13 require PATH
. 'system/classes/helpers.php';
14 require PATH
. 'system/classes/autoload.php';
16 // directly map classes for super fast loading
17 Autoloader
::map(array(
18 'Config' => PATH
. 'system/classes/config.php',
19 'Error' => PATH
. 'system/classes/error.php',
20 'Session' => PATH
. 'system/classes/session.php',
21 'TestCMS' => PATH
. 'system/classes/testcms.php',
22 'Template' => PATH
. 'system/classes/template.php',
23 'Request' => PATH
. 'system/classes/request.php',
24 'Response' => PATH
. 'system/classes/response.php',
25 'Log' => PATH
. 'system/classes/log.php',
26 'Db' => PATH
. 'system/classes/db.php',
27 'IoC' => PATH
. 'system/classes/ioc.php',
28 'Url' => PATH
. 'system/classes/url.php'
31 // tell the autoloader where to find classes
32 Autoloader
::directory(array(
33 PATH
. 'system/classes/'
36 // register the auto loader
37 Autoloader
::register();
40 Report all errors let our error class decide which to display
45 Error display will be handled by our error class
47 ini_safe_set('display_errors', false);
51 note: magic quotes is deprecated in PHP 5.3
52 src: php.net/manual/en/security.magicquotes.disabling.php
54 if(function_exists('get_magic_quotes_gpc')) {
55 if(get_magic_quotes_gpc()) {
56 ini_safe_set('magic_quotes_gpc', false);
57 ini_safe_set('magic_quotes_runtime', false);
58 ini_safe_set('magic_quotes_sybase', false);
63 Check our installation
65 if(Config
::load(PATH
. 'config.php') === false) {
66 // looks like we are missing a config file
67 echo file_get_contents(PATH
. 'system/admin/theme/error_config.php');
71 // Register the default timezone for the application.
72 date_default_timezone_set(Config
::get('application.timezone'));
74 // Register the PHP exception handler.
75 set_exception_handler(array('Error', 'exception'));
77 // Register the PHP error handler.
78 set_error_handler(array('Error', 'native'));
80 // Register the shutdown handler.
81 register_shutdown_function(array('Error', 'shutdown'));