00001 <?php
00002
00003
00004
00005 define('APP_START_MICROTIME', microtime(true));
00006
00007
00008
00009
00010 date_default_timezone_set(date_default_timezone_get());
00011
00012
00013
00014
00015
00016 define ('GYRO_CORE_DIR', dirname(__FILE__) . '/');
00017 define ('GYRO_ROOT_DIR', GYRO_CORE_DIR . '../');
00018 require_once GYRO_CORE_DIR . 'config.cls.php';
00019 Config::set_value(Config::VERSION, 0.6);
00020 require_once GYRO_CORE_DIR . 'constants.inc.php';
00021
00022
00023 if (Config::has_feature(Config::TESTMODE)) {
00024 ini_set('display_errors', 1);
00025 ini_set('log_errors', 1);
00026 error_reporting(E_ALL | E_STRICT);
00027 }
00028 else {
00029 ini_set('display_errors', 0);
00030 ini_set('log_errors', 1);
00031 if (defined('E_DEPRECATED')) {
00032
00033 error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
00034 } else {
00035 error_reporting(E_ALL ^ E_NOTICE);
00036 }
00037 }
00038
00039
00040 require_once GYRO_CORE_DIR . 'lib/includes.inc.php';
00041
00042 require_once GYRO_CORE_DIR . 'load.cls.php';
00043 Load::add_module_base_dir(GYRO_ROOT_DIR . 'modules/');
00044
00045
00046
00047 GyroLocale::set_locale(APP_LANG, APP_CHARSET);
00048
00049
00050 if (Config::has_feature(Config::VALIDATE_URL)) {
00051 Url::validate_current();
00052 }
00053
00054
00055 Common::preprocess_input();
00056
00057
00058 if (Config::has_feature(Config::THROW_ON_WARNING)) {
00059 function ___errhandler($errno, $errstr, $errfile, $errline) {
00060 $msg = $errno . ': ' . $errstr;
00061 $msg .= "\n\n";
00062 $msg .= 'File: ' . $errfile . ' -- Line: ' . $errline;
00063 if (ini_get('log_errors')) {
00064 error_log($msg);
00065 }
00066 throw new Exception($msg);
00067 }
00068 set_error_handler('___errhandler', E_WARNING);
00069 }
00070
00071 if (file_exists(APP_INCLUDE_ABSPATH . 'modules.php')) {
00072
00073 include_once APP_INCLUDE_ABSPATH . 'modules.php';
00074 }
00075
00076
00077 if (Config::has_feature(Config::FORCE_FULL_DOMAINNAME)) {
00078 $url_cur = Url::current();
00079 $url_domain = Url::current()->set_host(Config::get_value(Config::URL_DOMAIN));
00080 if ($url_domain->build() != $url_cur->build()) {
00081 $url_domain->redirect(Url::PERMANENT);
00082 exit;
00083 }
00084 }
00085
00086
00087 Load::directories('lib/helpers');
00088
00089 GyroHeaders::sync();
00090
00091 Load::directories('lib/interfaces');
00092
00093 if (Config::has_feature(Config::TESTMODE)) {
00094
00095 Load::components('logger');
00096 }
00097
00098
00099 Load::components('translator');
00100
00101
00102
00103 Load::directories('model/base');
00104 Load::directories('model/base/fields');
00105 Load::directories('model/base/constraints');
00106 Load::directories('model/base/queries');
00107 Load::first_file('model/base/sqlbuilder/dbsqlbuilderfactory.cls.php');
00108 DB::initialize();
00109
00110
00111 Load::directories('controller/base');
00112
00113 Load::directories('view/base');
00114
00115 Load::directories('behaviour/base');
00116
00117 $session_handler_class = Config::get_value(Config::SESSION_HANDLER);
00118 if ($session_handler_class) {
00119
00120 Session::set_handler(new $session_handler_class());
00121 }
00122 if (Config::has_feature(Config::START_SESSION)) {
00123 Session::start();
00124 } else {
00125 Session::start_existing();
00126 }
00127
00128 if (file_exists(APP_INCLUDE_ABSPATH . 'enabled.inc.php')) {
00129
00130 include_once APP_INCLUDE_ABSPATH . 'enabled.inc.php';
00131 }
00132 Load::files('start.inc.php', Load::ORDER_DECORATORS);
00133
00134 AccessControl::load();