Formatting code
This commit is contained in:
parent
7c88be8865
commit
5dd430f9b2
@ -16,8 +16,10 @@ $menu_registered = array();
|
||||
* Admin/Sales menu: AFTER_DASHBOARD, CUSTOMERS, PREPAID, SERVICES, REPORTS, VOUCHER, AFTER_ORDER, NETWORK, SETTINGS, AFTER_PAYMENTGATEWAY
|
||||
* | Customer menu: AFTER_DASHBOARD, ORDER, HISTORY, ACCOUNTS
|
||||
* @param string icon from ion icon, ion-person, only for AFTER_
|
||||
* @param string label for showing label or number of notification or update
|
||||
* @param string color Label color
|
||||
*/
|
||||
function register_menu($name, $admin, $function, $position, $icon = '', $label = '', $color = '')
|
||||
function register_menu($name, $admin, $function, $position, $icon = '', $label = '', $color = 'success')
|
||||
{
|
||||
global $menu_registered;
|
||||
$menu_registered[] = [
|
||||
|
@ -108,6 +108,21 @@ try {
|
||||
ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'), 'radius');
|
||||
ORM::configure('return_result_sets', true, 'radius');
|
||||
}
|
||||
} catch (Throwable $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");
|
||||
if (isset($_SESSION['uid'])) {
|
||||
$ui->assign("error_message", $e->getMessage() . '<br>');
|
||||
} else {
|
||||
$ui->assign("error_message", $e->getMessage() . '<br><pre>' . $e->getTraceAsString() . '</pre>');
|
||||
}
|
||||
$ui->display('router-error.tpl');
|
||||
die();
|
||||
} catch (Exception $e) {
|
||||
$ui = new Smarty();
|
||||
$ui->setTemplateDir(['custom' => File::pathFixer('ui/ui_custom/'), 'default' => File::pathFixer('ui/ui/')]);
|
||||
@ -317,7 +332,6 @@ if ($handler == '') {
|
||||
$handler = 'default';
|
||||
}
|
||||
try {
|
||||
|
||||
$sys_render = File::pathFixer('system/controllers/' . $handler . '.php');
|
||||
if (file_exists($sys_render)) {
|
||||
$menus = array();
|
||||
@ -327,30 +341,28 @@ try {
|
||||
// "function" => $function
|
||||
$ui->assign('_system_menu', $routes[0]);
|
||||
foreach ($menu_registered as $menu) {
|
||||
if ($menu['admin'] && _admin(false)) {
|
||||
$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>';
|
||||
}
|
||||
if (!empty($menu['label'])) {
|
||||
$menus[$menu['position']] .= '<span class="pull-right-container">
|
||||
<small class="label pull-right bg-'. $menu['color'] .'">' . $menu['label'] . '</small>
|
||||
</span>';
|
||||
}
|
||||
$menus[$menu['position']] .= '<span class="text">' . $menu['name'] . '</span></a></li>';
|
||||
} else if (!$menu['admin'] && _auth(false)) {
|
||||
$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>';
|
||||
}
|
||||
if (!empty($menu['label'])) {
|
||||
$menus[$menu['position']] .= '<span class="pull-right-container">
|
||||
<small class="label pull-right bg-'. $menu['color'] .'">' . $menu['label'] . '</small>
|
||||
</span>';
|
||||
}
|
||||
$menus[$menu['position']] .= '<span class="text">' . $menu['name'] . '</span></a></li>';
|
||||
}
|
||||
}
|
||||
if ($menu['admin'] && _admin(false)) {
|
||||
$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>';
|
||||
}
|
||||
if (!empty($menu['label'])) {
|
||||
$menus[$menu['position']] .= '<span class="pull-right-container">';
|
||||
$menus[$menu['position']] .= '<small class="label pull-right bg-' . $menu['color'] . '">' . $menu['label'] . '</small></span>';
|
||||
}
|
||||
$menus[$menu['position']] .= '<span class="text">' . $menu['name'] . '</span></a></li>';
|
||||
} else if (!$menu['admin'] && _auth(false)) {
|
||||
$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>';
|
||||
}
|
||||
if (!empty($menu['label'])) {
|
||||
$menus[$menu['position']] .= '<span class="pull-right-container">';
|
||||
$menus[$menu['position']] .= '<small class="label pull-right bg-' . $menu['color'] . '">' . $menu['label'] . '</small></span>';
|
||||
}
|
||||
$menus[$menu['position']] .= '<span class="text">' . $menu['name'] . '</span></a></li>';
|
||||
}
|
||||
}
|
||||
foreach ($menus as $k => $v) {
|
||||
$ui->assign('_MENU_' . $k, $v);
|
||||
}
|
||||
@ -359,6 +371,14 @@ try {
|
||||
} else {
|
||||
r2(U . 'dashboard', 'e', 'not found');
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
if (!isset($_SESSION['aid']) || empty($_SESSION['aid'])) {
|
||||
r2(U . 'home', 'e', $e->getMessage());
|
||||
}
|
||||
$ui->assign("error_message", $e->getMessage() . '<br><pre>' . $e->getTraceAsString() . '</pre>');
|
||||
$ui->assign("error_title", "PHPNuxBill Crash");
|
||||
$ui->display('router-error.tpl');
|
||||
die();
|
||||
} catch (Exception $e) {
|
||||
if (!isset($_SESSION['aid']) || empty($_SESSION['aid'])) {
|
||||
r2(U . 'home', 'e', $e->getMessage());
|
||||
|
@ -14,7 +14,7 @@
|
||||
<link rel="stylesheet" href="ui/ui/fonts/MaterialDesign/css/materialdesignicons.min.css">
|
||||
|
||||
<link rel="stylesheet" href="ui/ui/styles/modern-AdminLTE.min.css">
|
||||
|
||||
|
||||
<style>
|
||||
::-moz-selection {
|
||||
/* Code for Firefox */
|
||||
@ -57,9 +57,16 @@
|
||||
<div class="box-footer">
|
||||
<div class="btn-group btn-group-justified" role="group" aria-label="...">
|
||||
<a href="./update.php?step=4" class="btn btn-info btn-sm btn-block">Update Database</a>
|
||||
<a href="{$_url}community#update" class="btn btn-primary btn-sm btn-block">Update
|
||||
<a href="{$_url}community#update" class="btn btn-success btn-sm btn-block">Update
|
||||
PHPNuxBill</a>
|
||||
</div>
|
||||
<br>
|
||||
<div class="btn-group btn-group-justified" role="group" aria-label="...">
|
||||
<a href="https://github.com/hotspotbilling/phpnuxbill/discussions" target="_blank"
|
||||
class="btn btn-success btn-sm btn-block">Ask Github Community</a>
|
||||
<a href="https://t.me/phpnuxbill" target="_blank"
|
||||
class="btn btn-primary btn-sm btn-block">Ask Telegram Community</a>
|
||||
</div>
|
||||
<br><br>
|
||||
<a href="javascript::history.back()" onclick="history.back()"
|
||||
class="btn btn-warning btn-block">back</a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user