public static function header($code, $message = '') { switch ($code) { case 400: header('HTTP/1.1 400 Bad Request'); break; case 404: header('HTTP/1.1 404 Not Found'); break; case 503: default: header('HTTP/1.1 503 Service Unavailable'); break; } try { TPL::trash(); TPL::$dirpath = ESCMS_PATH_TPL . '.debug/'; TPL::add(array('EXCEPTION_MESSAGE' => $message)); if (!TPL::addTpl('header' . $code)) { switch ($code) { case 400: die('<h1>HTTP/1.1 400 Bad Request</h1><p>' . $message . '</p>'); break; case 404: die('<h1>HTTP/1.1 404 Not Found</h1>'); break; case 503: default: throw new Exception($message); } } else { TPL::pack(); die; } } catch (Exception $exc) { die('<h1>503 Service Unavailable</h1><p>' . $exc->getMessage() . '</p>'); } }
case 'timestamp': $cfg['etc'][$item->module][$item->name] = strtotime($item->value); if ((int) $item->assign) { TPL::add(strtoupper($item->name), formatDateTime($cfg['etc'][$item->module][$item->name])); } break; default: $cfg['etc'][$item->module][$item->name] = $item->value; if ((int) $item->assign) { TPL::add(strtoupper($item->name), $cfg['etc'][$item->module][$item->name]); } break; } } } // Configure the template system if (defined('TEMPLATE_DIRPATH')) { TPL::$dirpath = TEMPLATE_DIRPATH; } else { TPL::$dirpath = './styles/' . $cfg['etc']['core']['site_style'] . '/'; } // Init the language system if (defined('IN_SYS') && IN_SYS) { Langs::$dirpath = './langs/' . $cfg['etc']['core']['site_lang'] . '/'; } else { Langs::$dirpath = './langs/' . $cfg['etc']['core']['acp_lang'] . '/'; } define('SITE_ROOT_PATH', $cfg['etc']['core']['SITE_ROOT_PATH']); TPL::add('HTTP_REFERER', $_SERVER['HTTP_REFERER']); // Init the modules Modules::load();
<?php require_once './app/config.php'; header('Content-Type: text/html; charset=' . ESCMS_OUTPUT_ENCODING); require_once './app/layers/debug.layer.php'; set_exception_handler(array('Debug', 'catchException')); set_error_handler(array('Debug', 'catchError')); date_default_timezone_set(ESCMS_TIMEZONE); Debug::$enabled = ESCMS_DEBUG_ENABLE; require_once './app/layers/lib.layer.php'; require_once './app/layers/dal.layer.php'; require_once './app/layers/tpl.layer.php'; require_once './app/layers/core.layer.php'; Lib::$dirpath = ESCMS_PATH_LIB; SQL::$dirpath = ESCMS_PATH_DAL_DRIVERS; TPL::$dirpath = ESCMS_PATH_TPL . 'looksmog/'; # replace! -> db TPL::add('SITE_ROOT_PATH', SITE_ROOT_PATH); switch (ESCMS_DB_TYPE) { case 'sqlite2': $params = array('file' => ESCMS_DB_FILE); break; } SQL::openConnection(array('type' => ESCMS_DB_TYPE, 'prefix' => ESCMS_DB_PREFIX, 'params' => $params)); if (defined('REQUEST_RAW') && !defined('REDIRECTED')) { $e = explode(SITE_ROOT_PATH, 'http://' . $_SERVER['HTTP_HOST'] . REQUEST_RAW, 2); TPL::add('PAGE_URI', SITE_ROOT_PATH . $e[1]); define('REQUEST', '/' . end($e)); require_once './app/resolve.php'; die; } else {