index.php
Go to the documentation of this file.00001 <?php
00002
00003 define('DEVELOPER', true);
00004
00032 class ApplicationEntryPoint {
00038 private static $instances = array (
00039 'cfg',
00040 'loader',
00041 'debug',
00042 'db',
00043 'io',
00044 'engine',
00045 'lang',
00046 'app',
00047 );
00048
00058 public static function app_die ($message = "", $code = false, $extraData = "", $silentMode = false) {
00059
00060 if (defined('EMERGENCY_EXIT_CALLED')) {
00061
00062 die($message);
00063 }
00064
00065
00066 define('EMERGENCY_EXIT_CALLED', true);
00067
00068
00069 if (empty($message)) {
00070
00071 $message = "No message provided!";
00072 }
00073
00074
00075 $configInstance = FrameworkConfiguration::getInstance();
00076
00077
00078 if (($configInstance->readConfig('product_install_mode') == "productive") || ($silentMode === true)) {
00079
00080 die();
00081 }
00082
00083
00084 $tpl = FrameworkConfiguration::getInstance()->readConfig('template_class');
00085 $lang = LanguageSystem::getInstance();
00086 $io = FileIoHandler::getInstance();
00087
00088
00089 $responseInstance = ApplicationHelper::getInstance()->getResponseInstance();
00090
00091
00092 if ((class_exists($tpl)) && (is_object($lang)) && (is_object($io))) {
00093
00094 try {
00095
00096 $templateInstance = ObjectFactory::createObjectByName($tpl, array(FrameworkConfiguration::getInstance()->readConfig('tpl_base_path'), $lang, $io));
00097 } catch (FrameworkException $e) {
00098 die(sprintf("[Main:] Could not initialize template engine for reason: <span class=\"exception_reason\">%s</span>",
00099 $e->getMessage()
00100 ));
00101 }
00102
00103
00104 $backtraceArray = debug_backtrace();
00105 $backtrace = "";
00106 foreach ($backtraceArray as $key => $trace) {
00107 if (!isset($trace['file'])) $trace['file'] = __FILE__;
00108 if (!isset($trace['line'])) $trace['line'] = __LINE__;
00109 if (!isset($trace['args'])) $trace['args'] = array();
00110 $backtrace .= "<span class=\"backtrace_file\">".basename($trace['file'])."</span>:".$trace['line'].", <span class=\"backtrace_function\">".$trace['function']."(".count($trace['args']).")</span><br />";
00111 }
00112
00113
00114 $appInstance = null;
00115
00116
00117 if (class_exists('ApplicationHelper')) {
00118
00119 $appInstance = ApplicationHelper::getInstance();
00120
00121
00122 $templateInstance->assignApplicationData($appInstance);
00123 }
00124
00125
00126 $templateInstance->assignVariable('message', $message);
00127 $templateInstance->assignVariable('code', $code);
00128 $templateInstance->assignVariable('extra', $extraData);
00129 $templateInstance->assignVariable('backtrace', $backtrace);
00130 $templateInstance->assignVariable('total_includes', ClassLoader::getInstance()->getTotal());
00131 $templateInstance->assignVariable('total_objects', ObjectFactory::getTotal());
00132 $templateInstance->assignVariable('title', $lang->getMessage('emergency_exit_title'));
00133
00134
00135 $templateInstance->loadCodeTemplate('emergency_exit');
00136
00137
00138 $templateInstance->compileTemplate();
00139
00140
00141 $templateInstance->compileVariables();
00142
00143
00144 $templateInstance->transferToResponse($responseInstance);
00145
00146
00147 $responseInstance->flushBuffer();
00148
00149
00150 exit();
00151 } else {
00152
00153 die(sprintf("[Main:] Emergency exit reached: <span class=\"emergency_span\">%s</span>",
00154 $message
00155 ));
00156 }
00157 }
00158
00167 public static function main () {
00168
00169 global $_SERVER;
00170
00171
00172 require(dirname(__FILE__) . '/inc/config.php');
00173
00174
00175 require($cfg->readConfig('base_path') . 'inc/includes.php');
00176
00177
00178 require($cfg->readConfig('base_path') . 'inc/classes.php');
00179
00180
00181 require($cfg->readConfig('base_path') . 'inc/selector.php');
00182 }
00183
00184 }
00185
00186
00187 ApplicationEntryPoint::main();
00188
00189
00190 ?>