'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'];
}
}
if ((!empty($radius_user) && $config['radius_enable']) || _post('radius_enable')) {
ORM::configure("mysql:host=$radius_host;dbname=$radius_name", null, 'radius');
ORM::configure('username', $radius_user, 'radius');
ORM::configure('password', $radius_pass, '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() . '
' . $e->getTraceAsString() . ''); $ui->display('router-error.tpl'); die(); } function _notify($msg, $type = 'e') { $_SESSION['ntype'] = $type; $_SESSION['notify'] = $msg; } $lan_file = File::pathFixer('system/lan/' . $config['language'] . '/common.lan.php'); require $lan_file; $ui = new Smarty(); if (!empty($config['theme']) && $config['theme'] != 'default') { $_theme = APP_URL . '/ui/themes/' . $config['theme']; $ui->setTemplateDir(['custom' => File::pathFixer('ui/ui_custom/'), 'theme' => File::pathFixer('ui/themes/' . $config['theme']), 'default' => File::pathFixer('ui/ui/')]); } else { $_theme = APP_URL . '/ui/ui'; $ui->setTemplateDir(['custom' => File::pathFixer('ui/ui_custom/'), 'default' => File::pathFixer('ui/ui/')]); } $ui->assign('_theme', $_theme); $ui->addTemplateDir(File::pathFixer('system/paymentgateway/ui/'), 'pg'); $ui->addTemplateDir(File::pathFixer('system/plugin/ui/'), 'plugin'); $ui->setCompileDir(File::pathFixer('ui/compiled/')); $ui->setConfigDir(File::pathFixer('ui/conf/')); $ui->setCacheDir(File::pathFixer('ui/cache/')); $ui->assign('app_url', APP_URL); $ui->assign('_domain', str_replace('www.', '', parse_url(APP_URL, PHP_URL_HOST))); define('U', APP_URL . '/index.php?_route='); $ui->assign('_url', APP_URL . '/index.php?_route='); $ui->assign('_path', __DIR__); $ui->assign('_c', $config); $ui->assign('_L', $_L); $ui->assign('_system_menu', 'dashboard'); $ui->assign('_title', $config['CompanyName']); function _msglog($type, $msg) { $_SESSION['ntype'] = $type; $_SESSION['notify'] = $msg; } if (isset($_SESSION['notify'])) { $notify = $_SESSION['notify']; $ntype = $_SESSION['ntype']; if ($ntype == 's') { $ui->assign('notify', '
' . $e->getTraceAsString() . ''); $ui->display('router-error.tpl'); die(); }