Path Configuration

This commit is contained in:
Ibnu Maksum
2024-02-26 14:38:04 +07:00
parent 617e628b04
commit d2fa9be8d1
18 changed files with 270 additions and 242 deletions

View File

@ -9,11 +9,14 @@ try {
require_once 'init.php';
} catch (Throwable $e) {
$ui = new Smarty();
$ui->setTemplateDir(['custom' => File::pathFixer('ui/ui_custom/'), 'default' => File::pathFixer('ui/ui/')]);
$ui->setTemplateDir([
'custom' => File::pathFixer($UI_PATH . '/ui_custom/'),
'default' => File::pathFixer($UI_PATH . '/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->setCompileDir(File::pathFixer($UI_PATH . '/compiled/'));
$ui->setConfigDir(File::pathFixer($UI_PATH . '/conf/'));
$ui->setCacheDir(File::pathFixer($UI_PATH . '/cache/'));
$ui->assign("error_title", "PHPNuxBill Crash");
if (_auth()) {
$ui->assign("error_message", $e->getMessage() . '<br>');
@ -24,11 +27,14 @@ try {
die();
} catch (Exception $e) {
$ui = new Smarty();
$ui->setTemplateDir(['custom' => File::pathFixer('ui/ui_custom/'), 'default' => File::pathFixer('ui/ui/')]);
$ui->setTemplateDir([
'custom' => File::pathFixer($UI_PATH . '/ui_custom/'),
'default' => File::pathFixer($UI_PATH . '/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->setCompileDir(File::pathFixer($UI_PATH . '/compiled/'));
$ui->setConfigDir(File::pathFixer($UI_PATH . '/conf/'));
$ui->setCacheDir(File::pathFixer($UI_PATH . '/cache/'));
$ui->assign("error_title", "PHPNuxBill Crash");
if (_auth()) {
$ui->assign("error_message", $e->getMessage() . '<br>');
@ -48,24 +54,33 @@ function _notify($msg, $type = 'e')
$ui = new Smarty();
$ui->assign('_kolaps', $_COOKIE['kolaps']);
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/')]);
$_theme = APP_URL . '/' . $UI_PATH . '/themes/' . $config['theme'];
$ui->setTemplateDir([
'custom' => File::pathFixer($UI_PATH . '/ui_custom/'),
'theme' => File::pathFixer($UI_PATH . '/themes/' . $config['theme']),
'default' => File::pathFixer($UI_PATH . '/ui/')
]);
} else {
$_theme = APP_URL . '/ui/ui';
$ui->setTemplateDir(['custom' => File::pathFixer('ui/ui_custom/'), 'default' => File::pathFixer('ui/ui/')]);
$_theme = APP_URL . '/' . $UI_PATH . '/ui';
$ui->setTemplateDir([
'custom' => File::pathFixer($UI_PATH . '/ui_custom/'),
'default' => File::pathFixer($UI_PATH . '/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->addTemplateDir($PAYMENTGATEWAY_PATH . File::pathFixer('/ui/'), 'pg');
$ui->addTemplateDir($PLUGIN_PATH . File::pathFixer('/ui/'), 'plugin');
$ui->setCompileDir(File::pathFixer($UI_PATH . '/compiled/'));
$ui->setConfigDir(File::pathFixer($UI_PATH . '/conf/'));
$ui->setCacheDir(File::pathFixer($UI_PATH . '/cache/'));
$ui->assign('app_url', APP_URL);
$ui->assign('_domain', str_replace('www.', '', parse_url(APP_URL, PHP_URL_HOST)));
$ui->assign('_url', APP_URL . '/index.php?_route=');
$ui->assign('_path', __DIR__);
$ui->assign('_c', $config);
$ui->assign('_L', $_L);
$ui->assign('UPLOAD_PATH', $UPLOAD_PATH);
$ui->assign('CACHE_PATH', $CACHE_PATH);
$ui->assign('PAGES_PATH', $PAGES_PATH);
$ui->assign('_system_menu', 'dashboard');
function _msglog($type, $msg)
@ -93,7 +108,7 @@ if ($handler == '') {
}
$admin = Admin::_info();
try {
$sys_render = $root_path.File::pathFixer('system/controllers/' . $handler . '.php');
$sys_render = $root_path . File::pathFixer('system/controllers/' . $handler . '.php');
if (file_exists($sys_render)) {
$menus = array();
// "name" => $name,
@ -103,7 +118,7 @@ try {
$ui->assign('_system_menu', $routes[0]);
foreach ($menu_registered as $menu) {
if ($menu['admin'] && _admin(false)) {
if(count($menu['auth'])==0 || in_array($admin['user_type'], $menu['auth'])){
if (count($menu['auth']) == 0 || in_array($admin['user_type'], $menu['auth'])) {
$menus[$menu['position']] .= '<li' . (($routes[1] == $menu['function']) ? ' class="active"' : '') . '><a href="' . U . 'plugin/' . $menu['function'] . '">';
if (!empty($menu['icon'])) {
$menus[$menu['position']] .= '<i class="' . $menu['icon'] . '"></i>';