From 8b1636a55fbc0ef7ef41227fbb4c2cd4e939120b Mon Sep 17 00:00:00 2001 From: Amin MasterkinG Date: Sun, 31 Mar 2019 02:38:35 +0430 Subject: [PATCH] Add debug mode to config file. --- application/config/config.php.sample | 2 ++ application/loader.php | 40 ++++++++++++---------------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/application/config/config.php.sample b/application/config/config.php.sample index 9038d02..c290e31 100644 --- a/application/config/config.php.sample +++ b/application/config/config.php.sample @@ -21,6 +21,8 @@ $config['game_version'] = '3.3.5a (12340)'; // Your game version $config['expansion'] = '2'; // 1 = TBC, 2 = Lichking $config['template'] = 'light'; // Change template name ( 'light' or 'icecrown' or 'kaelthas' ) +$config['debug_mode'] = 'false'; // Enable debug mode to display system errors. + $config['realmlists'] = array( // Add your realmlist here "1" => array( 'realmid' => 1, diff --git a/application/loader.php b/application/loader.php index 3283b5b..137bf78 100644 --- a/application/loader.php +++ b/application/loader.php @@ -10,34 +10,28 @@ ob_start(); header("X-Powered-Framework:MasterkinG-Framework"); header("X-Powered-CMS:MasterkinG-CMS"); session_start(); -define('ENVIRONMENT', 'production'); -switch (ENVIRONMENT) -{ - case 'development': - @error_reporting(-1); - @ini_set('display_errors', 1); - break; - case 'production': - @ini_set('display_errors', 0); - if (version_compare(PHP_VERSION, '5.3', '>=')) - { - @error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); - } - else - { - @error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); - } - break; - default: - header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); - echo 'The application environment is not set correctly.'; - exit(1); -} define('base_path',str_replace("application/loader.php","",str_replace("\\","/",__FILE__))); define('app_path',str_replace("application/loader.php","",str_replace("\\","/",__FILE__))."application/"); require_once app_path.'vendor/autoload.php'; require_once app_path.'config/config.php'; require_once app_path.'include/functions.php'; + +if(get_config('debug_mode')) +{ + @error_reporting(-1); + @ini_set('display_errors', 1); +}else{ + @ini_set('display_errors', 0); + if (version_compare(PHP_VERSION, '5.3', '>=')) + { + @error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); + } + else + { + @error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); + } +} + require_once app_path.'include/database.php'; require_once app_path.'include/user.php'; require_once app_path.'include/status.php';