diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -1,6 +1,11 @@ <?php require_once 'config.php'; +if (CONFIG_DEBUG) { + error_reporting(E_ALL); +} else { + error_reporting(E_ALL & ~E_DEPRECATED); +} if (CONFIG_SQL_PASS === '%MYSQL_OPENSLX_PASS%') { Header('Content-Type: text/plain; charset=utf-8'); @@ -43,7 +48,7 @@ abstract class Page public static function render() { $pageTitle = self::$module->getPageTitle(); - if ($pageTitle !== false) { + if (!empty($pageTitle)) { Render::setTitle($pageTitle, false); } self::$instance->doRender(); @@ -77,7 +82,7 @@ abstract class Page Module::init(); self::$module = Module::get($name); if (self::$module === false) { - Util::traceError('Invalid Module: ' . $name); + ErrorHandler::traceError('Invalid Module: ' . $name); } self::$module->activate(null, null); self::$instance = self::$module->newPage(); @@ -150,9 +155,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!Util::verifyToken()) { if (AJAX) { die('CSRF/XSS? Missing token in POST request!'); - } else { - Util::redirect('?do=Main'); } + Util::redirect('?do=Main'); } } @@ -185,7 +189,7 @@ if (defined('CONFIG_DEBUG') && CONFIG_DEBUG) { * @param int $code Error code to map * @return string Readable error type */ - function mapErrorCode($code) + function mapErrorCode(int $code): string { switch ($code) { case E_PARSE: @@ -229,7 +233,8 @@ if (CONFIG_DEBUG) { Render::addTemplate('footer', array('text' => round($duration, 3) . 's, ' . Database::getQueryCount() . ' queries, ' - . round(Database::getQueryTime(), 3) . 's query time total'), 'main'); + . round(Database::getQueryTime(), 3) . 's query time total' + ), 'main'); } // Send page to client. |