diff --git a/system/autoload/Admin.php b/system/autoload/Admin.php
index 66052cda..18d016c6 100644
--- a/system/autoload/Admin.php
+++ b/system/autoload/Admin.php
@@ -13,25 +13,27 @@ class Admin
{
global $db_pass, $config;
$enable_session_timeout = $config['enable_session_timeout'];
- if ($enable_session_timeout) {
- $timeout = 60;
- if ($config['session_timeout_duration']) {
- $timeout = intval($config['session_timeout_duration']);
+ $session_timeout_duration = $config['session_timeout_duration'] ? intval($config['session_timeout_duration'] * 60) : intval(60 * 60); // Convert minutes to seconds
+
+ // Check if the session is active and valid
+ if (isset($_SESSION['aid']) && isset($_SESSION['aid_expiration'])) {
+ if ($_SESSION['aid_expiration'] > time()) {
+ if ($enable_session_timeout) {
+ $_SESSION['aid_expiration'] = time() + $session_timeout_duration;
+ }
+ return $_SESSION['aid'];
+ }
+ // Session expired, log out the user
+ elseif ($enable_session_timeout && $_SESSION['aid_expiration'] <= time()) {
+ self::removeCookie();
+ session_destroy();
+ _alert(Lang::T('Session has expired. Please log in again.'), 'danger', "admin");
+ return 0;
}
- $session_timeout_duration = $timeout * 60; // Convert minutes to seconds
}
- if (isset($_SESSION['aid']) && isset($_SESSION['aid_expiration']) && $_SESSION['aid_expiration'] > time()) {
- return $_SESSION['aid'];
- } elseif ($enable_session_timeout && isset($_SESSION['aid']) && isset($_SESSION['aid_expiration']) && $_SESSION['aid_expiration'] <= time()) {
- self::removeCookie();
- session_destroy();
- _alert(Lang::T('Session has expired. Please log in again.'), 'danger', "admin");
- return 0;
- }
- // Check if cookie is set and valid
+ // Check if the cookie is set and valid
elseif (isset($_COOKIE['aid'])) {
- // id.time.sha1
$tmp = explode('.', $_COOKIE['aid']);
if (sha1($tmp[0] . '.' . $tmp[1] . '.' . $db_pass) == $tmp[2]) {
if (time() - $tmp[1] < 86400 * 7) {
diff --git a/system/controllers/dashboard.php b/system/controllers/dashboard.php
index 4d1c9849..9f1185b0 100644
--- a/system/controllers/dashboard.php
+++ b/system/controllers/dashboard.php
@@ -214,6 +214,12 @@ if ($config['router_check']) {
$ui->assign('routeroffs', $routeroffs);
}
+$timestampFile = "$UPLOAD_PATH/cron_last_run.txt";
+if (file_exists($timestampFile)) {
+ $lastRunTime = file_get_contents($timestampFile);
+ $ui->assign('run_date', date('Y-m-d h:i:s A', $lastRunTime));
+}
+
// Assign the monthly sales data to Smarty
$ui->assign('start_date', $start_date);
$ui->assign('current_date', $current_date);
diff --git a/system/cron.php b/system/cron.php
index e4e6719c..81d9f423 100644
--- a/system/cron.php
+++ b/system/cron.php
@@ -1,6 +1,27 @@
where('enabled', '1')->find_many();
if (!$routers) {
echo "No active routers found in the database.\n";
@@ -186,14 +187,20 @@ if ($config['router_check']) {
Message::SendEmail($adminEmail, $subject, $message);
sendTelegram($message);
}
-
- if (defined('PHP_SAPI') && PHP_SAPI === 'cli') {
- echo "Cronjob finished\n";
- } else {
- echo "";
- }
-
- flock($lock, LOCK_UN);
- fclose($lock);
- unlink($lockFile);
+ echo "Router monitoring finished\n";
}
+
+
+if (defined('PHP_SAPI') && PHP_SAPI === 'cli') {
+ echo "Cronjob finished\n";
+} else {
+ echo "";
+}
+
+flock($lock, LOCK_UN);
+fclose($lock);
+unlink($lockFile);
+
+$timestampFile = "$UPLOAD_PATH/cron_last_run.txt";
+file_put_contents($timestampFile, time());
+
diff --git a/ui/ui/dashboard.tpl b/ui/ui/dashboard.tpl
index eb6788da..f0432982 100644
--- a/ui/ui/dashboard.tpl
+++ b/ui/ui/dashboard.tpl
@@ -194,6 +194,25 @@
{/if}
+ {if $run_date}
+ {assign var="current_time" value=$smarty.now}
+ {assign var="run_time" value=strtotime($run_date)}
+ {if $current_time - $run_time > 3600}
+
+
{Lang::T('Cron has not run for over 1 hour. Please
+ check your setup.')}
+
+ {else}
+
+
{Lang::T('Cron Job last ran on')}: {$run_date}
+
+ {/if}
+ {else}
+
+
{Lang::T('Cron appear not been setup, please check
+ your cron setup.')}
+
+ {/if}
{if $_c['hide_pg'] != 'yes'}
{Lang::T('Payment Gateway')}: {str_replace(',',', ',$_c['payment_gateway'])}
diff --git a/ui/ui/hotspot.tpl b/ui/ui/hotspot.tpl
index d083d0b8..3df4710d 100644
--- a/ui/ui/hotspot.tpl
+++ b/ui/ui/hotspot.tpl
@@ -35,8 +35,8 @@
@@ -44,9 +44,9 @@
@@ -54,8 +54,8 @@
@@ -63,8 +63,8 @@
@@ -72,7 +72,7 @@
@@ -81,7 +81,7 @@
@@ -104,38 +104,40 @@
-
-
-
- |
- {Lang::T('Internet Package')} |
- {Lang::T('Limit')} |
- |
-
- {Lang::T('Expired')} |
- |
-
-
- {Lang::T('Name')} |
- {Lang::T('Type')} |
- Bandwidth |
- {Lang::T('Category')} |
- {Lang::T('Price')} |
- {Lang::T('Validity')} |
- {Lang::T('Time')} |
- {Lang::T('Data')} |
- {Lang::T('Location')} |
- {Lang::T('Device')} |
- {Lang::T('Internet Package')} |
- {Lang::T('Date')} |
- {Lang::T('ID')} |
- {Lang::T('Manage')} |
-
-
-
- {foreach $d as $ds}
+
+
+
+
+ |
+ {Lang::T('Internet Package')} |
+
+ {Lang::T('Limit')} |
+ |
+
+ {Lang::T('Expired')} |
+ |
+
+
+ {Lang::T('Name')} |
+ {Lang::T('Type')} |
+ Bandwidth |
+ {Lang::T('Category')} |
+ {Lang::T('Price')} |
+ {Lang::T('Validity')} |
+ {Lang::T('Time')} |
+ {Lang::T('Data')} |
+ {Lang::T('Location')} |
+ {Lang::T('Device')} |
+ {Lang::T('Internet Package')} |
+ {Lang::T('Date')} |
+ {Lang::T('ID')} |
+ {Lang::T('Manage')} |
+
+
+
+ {foreach $d as $ds}
+ }class="warning" title="Postpaid" {/if}>
{$ds['name_plan']} |
{if $ds['prepaid'] == no}Postpaid{else}Prepaid{/if} {$ds['plan_type']} |
{$ds['name_bw']} |
@@ -146,11 +148,11 @@
{$ds['data_limit']} {$ds['data_unit']} |
{if $ds['is_radius']}
- RADIUS
+ RADIUS
{else}
- {if $ds['routers']!=''}
- {$ds['routers']}
- {/if}
+ {if $ds['routers']!=''}
+ {$ds['routers']}
+ {/if}
{/if}
|
{$ds['device']} |
@@ -163,13 +165,14 @@
{Lang::T('Edit')}
+ onclick="return confirm('{Lang::T('Delete')}?')"
+ class="btn btn-danger btn-xs">
- {/foreach}
-
-
+ {/foreach}
+
+
+
-{include file="sections/footer.tpl"}
+{include file="sections/footer.tpl"}
\ No newline at end of file
diff --git a/ui/ui/plan.tpl b/ui/ui/plan.tpl
index 4cf71280..3cca5861 100644
--- a/ui/ui/plan.tpl
+++ b/ui/ui/plan.tpl
@@ -5,19 +5,19 @@
{if in_array($_admin['user_type'],['SuperAdmin','Admin'])}
-
- {*
*}
+
+ {*
*}
{/if}
-{Lang::T('Active Customers')}
+ {Lang::T('Active Customers')}
@@ -70,33 +70,34 @@
-
-
-
- {Lang::T('Username')} |
- {Lang::T('Plan Name')} |
- {Lang::T('Type')} |
- {Lang::T('Created On')} |
- {Lang::T('Expires On')} |
- {Lang::T('Method')} |
- {Lang::T('Location')} |
- {Lang::T('Manage')} |
-
-
-
- {foreach $d as $ds}
-
+
+
+
{include file="pagination.tpl"}
@@ -131,10 +133,10 @@
var res = prompt("Extend for many days?", "3");
if (res) {
if (confirm("Extend for " + res + " days?")) {
- window.location.href = "{$_url}plan/extend/"+idP+"/"+res+"&stoken={App::getToken()}";
+ window.location.href = "{$_url}plan/extend/" + idP + "/" + res + "&stoken={App::getToken()}";
}
}
}
-{include file="sections/footer.tpl"}
+{include file="sections/footer.tpl"}
\ No newline at end of file
diff --git a/ui/ui/pppoe.tpl b/ui/ui/pppoe.tpl
index 3c17d6b1..9dfc8711 100644
--- a/ui/ui/pppoe.tpl
+++ b/ui/ui/pppoe.tpl
@@ -35,8 +35,8 @@
@@ -44,9 +44,9 @@
@@ -54,8 +54,8 @@
@@ -63,8 +63,8 @@
@@ -72,7 +72,7 @@
@@ -81,7 +81,7 @@
@@ -104,36 +104,38 @@
-
-
-
- |
- {Lang::T('Internet Plan')} |
- |
-
- {Lang::T('Expired')} |
- |
-
-
- {Lang::T('Name')} |
- {Lang::T('Type')} |
- {Lang::T('Bandwidth')} |
- {Lang::T('Price')} |
- {Lang::T('Validity')} |
- {Lang::T('IP Pool')} |
- {Lang::T('Internet Plan')} |
- {Lang::T('Date')} |
- {Lang::T('Location')} |
- {Lang::T('Device')} |
- {Lang::T('Manage')} |
- ID |
-
-
-
- {foreach $d as $ds}
-
+
+
+
+
+ |
+ {Lang::T('Internet Plan')} |
+ |
+
+ {Lang::T('Expired')} |
+ |
+
+
+ {Lang::T('Name')} |
+ {Lang::T('Type')} |
+ {Lang::T('Bandwidth')} |
+ {Lang::T('Price')} |
+ {Lang::T('Validity')} |
+ {Lang::T('IP Pool')} |
+ {Lang::T('Internet Plan')} |
+ {Lang::T('Date')} |
+ {Lang::T('Location')} |
+ {Lang::T('Device')} |
+ {Lang::T('Manage')} |
+ ID |
+
+
+
+ {foreach $d as $ds}
+
{$ds['name_plan']} |
- {$ds['plan_type']} {if $ds['prepaid'] != 'yes'}{Lang::T('Postpaid')}{else}{Lang::T('Prepaid')}{/if} |
+ {$ds['plan_type']} {if $ds['prepaid'] !=
+ 'yes'}{Lang::T('Postpaid')}{else}{Lang::T('Prepaid')}{/if} |
{$ds['name_bw']} |
{Lang::moneyFormat($ds['price'])} |
{$ds['validity']} {$ds['validity_unit']} |
@@ -144,11 +146,11 @@
{if $ds['prepaid'] == no}{$ds['expired_date']}{/if} |
{if $ds['is_radius']}
- RADIUS
+ RADIUS
{else}
- {if $ds['routers']!=''}
- {$ds['routers']}
- {/if}
+ {if $ds['routers']!=''}
+ {$ds['routers']}
+ {/if}
{/if}
|
{$ds['device']} |
@@ -161,9 +163,10 @@
{$ds['id']} |
- {/foreach}
-
-
+ {/foreach}
+
+
+
-{include file="sections/footer.tpl"}
+{include file="sections/footer.tpl"}
\ No newline at end of file
diff --git a/ui/ui/sections/header.tpl b/ui/ui/sections/header.tpl
index bba3dbce..34b7f1e9 100644
--- a/ui/ui/sections/header.tpl
+++ b/ui/ui/sections/header.tpl
@@ -148,12 +148,26 @@
color: inherit;
background-color: transparent;
border-color: transparent;
+ border-bottom-right-radius: 21px;
+ border-bottom-left-radius: 21px;
}
- .panel-primary>.panel-heading {
- color: inherit;
- background-color: transparent;
- border-color: transparent;
+ .panel-success>.panel-heading {
+ border-bottom-right-radius: 21px;
+ border-bottom-left-radius: 21px;
+ }
+
+ .panel-warning>.panel-heading {
+ border-bottom-right-radius: 21px;
+ border-bottom-left-radius: 21px;
+ }
+
+ .panel-danger>.panel-heading {
+ color: #a94442;
+ background-color: #f2dede;
+ border-color: #ebccd1;
+ border-bottom-right-radius: 21px;
+ border-bottom-left-radius: 21px;
}
.panel-heading {
@@ -656,6 +670,9 @@
}
.toggle-container {
+ position: absolute;
+ top: 17px;
+ right: 15px;
cursor: pointer;
}
@@ -666,6 +683,11 @@
}
@media (max-width: 600px) {
+ .toggle-container {
+ top: 15px;
+ right: 60px;
+ }
+
.toggle-container .toggle-icon {
font-size: 20px;
color: rgb(100 116 139);
diff --git a/ui/ui/voucher.tpl b/ui/ui/voucher.tpl
index 6f357b48..abf652f0 100644
--- a/ui/ui/voucher.tpl
+++ b/ui/ui/voucher.tpl
@@ -17,11 +17,12 @@
{if in_array($_admin['user_type'],['SuperAdmin','Admin'])}
-
+
{/if}
@@ -41,8 +42,8 @@
@@ -50,7 +51,7 @@
@@ -65,7 +66,7 @@
@@ -76,8 +77,8 @@
class="fa fa-search">
@@ -85,24 +86,25 @@
-
-
-
- ID |
- {Lang::T('Type')} |
- {Lang::T('Routers')} |
- {Lang::T('Plan Name')} |
- {Lang::T('Code Voucher')} |
- {Lang::T('Status Voucher')} |
- {Lang::T('Customer')} |
- {Lang::T('Used Date')} |
- {Lang::T('Generated By')} |
- {Lang::T('Manage')} |
-
-
-
- {foreach $d as $ds}
-
+
+
+
+
+ ID |
+ {Lang::T('Type')} |
+ {Lang::T('Routers')} |
+ {Lang::T('Plan Name')} |
+ {Lang::T('Code Voucher')} |
+ {Lang::T('Status Voucher')} |
+ {Lang::T('Customer')} |
+ {Lang::T('Used Date')} |
+ {Lang::T('Generated By')} |
+ {Lang::T('Manage')} |
+
+
+
+ {foreach $d as $ds}
+
{$ds['id']} |
{$ds['type']} |
{$ds['routers']} |
@@ -112,33 +114,35 @@
onmouseenter="this.style.backgroundColor = 'white';">
{$ds['code']}
{if $ds['status'] eq '0'} {else}
+ {else}
{/if} |
{if $ds['user'] eq '0'} -
{else}{$ds['user']}
{/if} |
{if $ds['used_date']}{Lang::dateTimeFormat($ds['used_date'])}{/if} |
{if $ds['generated_by']}
- {$admins[$ds['generated_by']]}
+ {$admins[$ds['generated_by']]}
{else} -
{/if}
|
{if $ds['status'] neq '1'}
- {Lang::T('View')}
+ {Lang::T('View')}
{/if}
{if in_array($_admin['user_type'],['SuperAdmin','Admin'])}
-
+
{/if}
|
- {/foreach}
-
-
+ {/foreach}
+
+
+
{include file="pagination.tpl"}
-{include file="sections/footer.tpl"}
+{include file="sections/footer.tpl"}
\ No newline at end of file