diff --git a/CHANGELOG.md b/CHANGELOG.md index 74f9470e..b89b11e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Fix Customer counter in dashboard - Show Customer Balance in header - Fix Plugin Manager using Http::Get +- Show Some error page when crash ## 2023.9.7 - Fix PPPOE Delete Customer diff --git a/system/boot.php b/system/boot.php index 799324bb..a3c055f5 100644 --- a/system/boot.php +++ b/system/boot.php @@ -73,39 +73,52 @@ function _get($param, $defvalue = '') return safedata($_GET[$param]); } } +try { -require_once File::pathFixer('system/orm.php'); + require_once File::pathFixer('system/orm.php'); -ORM::configure("mysql:host=$db_host;dbname=$db_name"); -ORM::configure('username', $db_user); -ORM::configure('password', $db_password); -ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); -ORM::configure('return_result_sets', true); -if ($_app_stage != 'Live') { - ORM::configure('logging', true); -} - -$result = ORM::for_table('tbl_appconfig')->find_many(); -foreach ($result as $value) { - $config[$value['setting']] = $value['value']; -} - -date_default_timezone_set($config['timezone']); -$_c = $config; - -// check if proxy setup in database -if(empty($http_proxy) && !empty($config['http_proxy'])){ - $http_proxy = $config['http_proxy']; - if(empty($http_proxyauth) && !empty($config['http_proxyauth'])){ - $http_proxyauth = $config['http_proxyauth']; + ORM::configure("mysql:host=$db_host;dbname=$db_name"); + ORM::configure('username', $db_user); + ORM::configure('password', $db_password); + ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); + ORM::configure('return_result_sets', true); + if ($_app_stage != 'Live') { + ORM::configure('logging', true); } -} -if ($config['radius_mode']) { - ORM::configure("mysql:host=$radius_host;dbname=$radius_name", null, 'radius'); - ORM::configure('username', $radius_user, 'radius'); - ORM::configure('password', $radius_password, 'radius'); - ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'), 'radius'); - ORM::configure('return_result_sets', true, 'radius'); + + $result = ORM::for_table('tbl_appconfig')->find_many(); + foreach ($result as $value) { + $config[$value['setting']] = $value['value']; + } + + date_default_timezone_set($config['timezone']); + $_c = $config; + + // check if proxy setup in database + if (empty($http_proxy) && !empty($config['http_proxy'])) { + $http_proxy = $config['http_proxy']; + if (empty($http_proxyauth) && !empty($config['http_proxyauth'])) { + $http_proxyauth = $config['http_proxyauth']; + } + } + if ($config['radius_mode']) { + ORM::configure("mysql:host=$radius_host;dbname=$radius_name", null, 'radius'); + ORM::configure('username', $radius_user, 'radius'); + ORM::configure('password', $radius_password, 'radius'); + ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'), 'radius'); + ORM::configure('return_result_sets', true, 'radius'); + } +} catch (Exception $e) { + $ui = new Smarty(); + $ui->setTemplateDir(['custom' => File::pathFixer('ui/ui_custom/'), 'default' => File::pathFixer('ui/ui/')]); + $ui->assign('_url', APP_URL . '/index.php?_route='); + $ui->setCompileDir(File::pathFixer('ui/compiled/')); + $ui->setConfigDir(File::pathFixer('ui/conf/')); + $ui->setCacheDir(File::pathFixer('ui/cache/')); + $ui->assign("error_title", "PHPNuxBill Crash"); + $ui->assign("error_message", $e->getMessage()); + $ui->display('router-error.tpl'); + die(); } function _notify($msg, $type = 'e') @@ -323,10 +336,9 @@ try { } else { r2(U . 'dashboard', 'e', 'not found'); } - } catch (Exception $e) { $ui->assign("error_title", "PHPNuxBill Crash"); $ui->assign("error_message", $e->getMessage()); $ui->display('router-error.tpl'); die(); -} \ No newline at end of file +}