4 error_reporting(E_ALL
);
6 // show all error uncaught
7 ini_set('display_errors', true);
10 Define some paths and get current config
12 define('IN_CMS', true);
13 define('PATH', pathinfo(dirname(__FILE__
), PATHINFO_DIRNAME
) . '/');
18 function random($length = 16) {
19 $pool = str_split('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 1);
22 for ($i = 0; $i < $length; $i++
) {
23 $value .= $pool[mt_rand(0, 61)];
32 require PATH
. 'system/classes/autoload.php';
33 require PATH
. 'system/classes/helpers.php';
36 Autoloader
::map(array(
37 'Schema' => PATH
. 'upgrade/classes/schema.php',
38 'Migrations' => PATH
. 'upgrade/classes/migrations.php'
41 // tell the autoloader where to find classes
42 Autoloader
::directory(array(
43 PATH
. 'system/classes/'
46 // register the auto loader
47 Autoloader
::register();
50 Report all errors let our error class decide which to display
55 Error display will be handled by our error class
57 ini_safe_set('display_errors', false);
59 // Register the default timezone for the application.
60 date_default_timezone_set(Config
::get('application.timezone'));
62 // Register the PHP exception handler.
63 set_exception_handler(array('Error', 'exception'));
65 // Register the PHP error handler.
66 set_error_handler(array('Error', 'native'));
68 // Register the shutdown handler.
69 register_shutdown_function(array('Error', 'shutdown'));
71 // load current config file
72 Config
::load(PATH
. 'config.php');
74 // add and apply migrations
75 require PATH
. 'upgrade/migrations.php';
77 // write any config changes
78 Config
::write(PATH
. 'config.php', Config
::get());
81 header('Location: complete.php');