Merge pull request #298 from Focuslinkstech/Development

add styles to some tables
This commit is contained in:
iBNu Maksum 2024-09-12 23:40:11 +07:00 committed by GitHub
commit 5f50d725f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 303 additions and 235 deletions

View File

@ -13,25 +13,27 @@ class Admin
{ {
global $db_pass, $config; global $db_pass, $config;
$enable_session_timeout = $config['enable_session_timeout']; $enable_session_timeout = $config['enable_session_timeout'];
if ($enable_session_timeout) { $session_timeout_duration = $config['session_timeout_duration'] ? intval($config['session_timeout_duration'] * 60) : intval(60 * 60); // Convert minutes to seconds
$timeout = 60;
if ($config['session_timeout_duration']) {
$timeout = intval($config['session_timeout_duration']);
}
$session_timeout_duration = $timeout * 60; // Convert minutes to seconds
}
if (isset($_SESSION['aid']) && isset($_SESSION['aid_expiration']) && $_SESSION['aid_expiration'] > time()) { // 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']; return $_SESSION['aid'];
} elseif ($enable_session_timeout && isset($_SESSION['aid']) && isset($_SESSION['aid_expiration']) && $_SESSION['aid_expiration'] <= time()) { }
// Session expired, log out the user
elseif ($enable_session_timeout && $_SESSION['aid_expiration'] <= time()) {
self::removeCookie(); self::removeCookie();
session_destroy(); session_destroy();
_alert(Lang::T('Session has expired. Please log in again.'), 'danger', "admin"); _alert(Lang::T('Session has expired. Please log in again.'), 'danger', "admin");
return 0; return 0;
} }
// Check if cookie is set and valid }
// Check if the cookie is set and valid
elseif (isset($_COOKIE['aid'])) { elseif (isset($_COOKIE['aid'])) {
// id.time.sha1
$tmp = explode('.', $_COOKIE['aid']); $tmp = explode('.', $_COOKIE['aid']);
if (sha1($tmp[0] . '.' . $tmp[1] . '.' . $db_pass) == $tmp[2]) { if (sha1($tmp[0] . '.' . $tmp[1] . '.' . $db_pass) == $tmp[2]) {
if (time() - $tmp[1] < 86400 * 7) { if (time() - $tmp[1] < 86400 * 7) {

View File

@ -214,6 +214,12 @@ if ($config['router_check']) {
$ui->assign('routeroffs', $routeroffs); $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 // Assign the monthly sales data to Smarty
$ui->assign('start_date', $start_date); $ui->assign('start_date', $start_date);
$ui->assign('current_date', $current_date); $ui->assign('current_date', $current_date);

View File

@ -1,6 +1,27 @@
<?php <?php
include "../init.php"; include "../init.php";
$lockFile = "$CACHE_PATH/router_monitor.lock";
if (!is_dir($CACHE_PATH)) {
echo "Directory '$CACHE_PATH' does not exist. Exiting...\n";
exit;
}
$lock = fopen($lockFile, 'c');
if ($lock === false) {
echo "Failed to open lock file. Exiting...\n";
exit;
}
if (!flock($lock, LOCK_EX | LOCK_NB)) {
echo "Script is already running. Exiting...\n";
fclose($lock);
exit;
}
$isCli = true; $isCli = true;
if (php_sapi_name() !== 'cli') { if (php_sapi_name() !== 'cli') {
$isCli = false; $isCli = false;
@ -81,27 +102,7 @@ foreach ($d as $ds) {
if ($config['router_check']) { if ($config['router_check']) {
echo "Checking router status...\n";
$lockFile = $CACHE_PATH . '/router_monitor.lock';
if (!is_dir($CACHE_PATH)) {
echo "Directory '$CACHE_PATH' does not exist. Exiting...\n";
exit;
}
$lock = fopen($lockFile, 'c');
if ($lock === false) {
echo "Failed to open lock file. Exiting...\n";
exit;
}
if (!flock($lock, LOCK_EX | LOCK_NB)) {
echo "Script is already running. Exiting...\n";
fclose($lock);
exit;
}
$routers = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many(); $routers = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
if (!$routers) { if (!$routers) {
echo "No active routers found in the database.\n"; echo "No active routers found in the database.\n";
@ -186,14 +187,20 @@ if ($config['router_check']) {
Message::SendEmail($adminEmail, $subject, $message); Message::SendEmail($adminEmail, $subject, $message);
sendTelegram($message); sendTelegram($message);
} }
echo "Router monitoring finished\n";
if (defined('PHP_SAPI') && PHP_SAPI === 'cli') {
echo "Cronjob finished\n";
} else {
echo "</pre>";
}
flock($lock, LOCK_UN);
fclose($lock);
unlink($lockFile);
} }
if (defined('PHP_SAPI') && PHP_SAPI === 'cli') {
echo "Cronjob finished\n";
} else {
echo "</pre>";
}
flock($lock, LOCK_UN);
fclose($lock);
unlink($lockFile);
$timestampFile = "$UPLOAD_PATH/cron_last_run.txt";
file_put_contents($timestampFile, time());

View File

@ -194,6 +194,25 @@
</div> </div>
</div> </div>
{/if} {/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}
<div class="panel panel-warning panel-hovered mb20 activities">
<div class="panel-heading"><i class="fa fa-clock-o"></i> &nbsp; {Lang::T('Cron has not run for over 1 hour. Please
check your setup.')}</div>
</div>
{else}
<div class="panel panel-success panel-hovered mb20 activities">
<div class="panel-heading">{Lang::T('Cron Job last ran on')}: {$run_date}</div>
</div>
{/if}
{else}
<div class="panel panel-danger panel-hovered mb20 activities">
<div class="panel-heading"><i class="fa fa-warning"></i> &nbsp; {Lang::T('Cron appear not been setup, please check
your cron setup.')}</div>
</div>
{/if}
{if $_c['hide_pg'] != 'yes'} {if $_c['hide_pg'] != 'yes'}
<div class="panel panel-success panel-hovered mb20 activities"> <div class="panel panel-success panel-hovered mb20 activities">
<div class="panel-heading">{Lang::T('Payment Gateway')}: {str_replace(',',', ',$_c['payment_gateway'])} <div class="panel-heading">{Lang::T('Payment Gateway')}: {str_replace(',',', ',$_c['payment_gateway'])}

View File

@ -104,12 +104,14 @@
</div> </div>
</form> </form>
<div class="table-responsive"> <div class="table-responsive">
<div style="margin-left: 5px; margin-right: 5px;">
<table class="table table-bordered table-striped table-condensed"> <table class="table table-bordered table-striped table-condensed">
<thead> <thead>
<tr> <tr>
<th></th> <th></th>
<th colspan="5" class="text-center">{Lang::T('Internet Package')}</th> <th colspan="5" class="text-center">{Lang::T('Internet Package')}</th>
<th colspan="2" class="text-center" style="background-color: rgb(246, 244, 244);">{Lang::T('Limit')}</th> <th colspan="2" class="text-center" style="background-color: rgb(246, 244, 244);">
{Lang::T('Limit')}</th>
<th colspan="2"></th> <th colspan="2"></th>
<th colspan="2" class="text-center" style="background-color: rgb(243, 241, 172);"> <th colspan="2" class="text-center" style="background-color: rgb(243, 241, 172);">
{Lang::T('Expired')}</th> {Lang::T('Expired')}</th>
@ -163,14 +165,15 @@
<a href="{$_url}services/edit/{$ds['id']}" <a href="{$_url}services/edit/{$ds['id']}"
class="btn btn-info btn-xs">{Lang::T('Edit')}</a> class="btn btn-info btn-xs">{Lang::T('Edit')}</a>
<a href="{$_url}services/delete/{$ds['id']}" id="{$ds['id']}" <a href="{$_url}services/delete/{$ds['id']}" id="{$ds['id']}"
onclick="return confirm('{Lang::T('Delete')}?')" class="btn btn-danger btn-xs"><i onclick="return confirm('{Lang::T('Delete')}?')"
class="glyphicon glyphicon-trash"></i></a> class="btn btn-danger btn-xs"><i class="glyphicon glyphicon-trash"></i></a>
</td> </td>
</tr> </tr>
{/foreach} {/foreach}
</tbody> </tbody>
</table> </table>
</div> </div>
</div>
<div class="panel-footer"> <div class="panel-footer">
{include file="pagination.tpl"} {include file="pagination.tpl"}
<div class="bs-callout bs-callout-info" id="callout-navbar-role"> <div class="bs-callout bs-callout-info" id="callout-navbar-role">

View File

@ -17,7 +17,7 @@
</div> *} </div> *}
{/if} {/if}
&nbsp; &nbsp;
{Lang::T('Active Customers')} {Lang::T('Active Customers')}
</div> </div>
<form id="site-search" method="post" action="{$_url}plan/list/"> <form id="site-search" method="post" action="{$_url}plan/list/">
<div class="panel-body"> <div class="panel-body">
@ -70,6 +70,7 @@
</div> </div>
</form> </form>
<div class="table-responsive"> <div class="table-responsive">
<div style="margin-left: 5px; margin-right: 5px;">&nbsp;
<table id="datatable" class="table table-bordered table-striped table-condensed"> <table id="datatable" class="table table-bordered table-striped table-condensed">
<thead> <thead>
<tr> <tr>
@ -85,7 +86,7 @@
</thead> </thead>
<tbody> <tbody>
{foreach $d as $ds} {foreach $d as $ds}
<tr {if $ds['status']=='off'}class="danger" {/if}> <tr {if $ds['status']=='off' }class="danger" {/if}>
<td> <td>
{if $ds['customer_id'] == '0'} {if $ds['customer_id'] == '0'}
<a href="{$_url}plan/voucher/&search={$ds['username']}">{$ds['username']}</a> <a href="{$_url}plan/voucher/&search={$ds['username']}">{$ds['username']}</a>
@ -108,8 +109,8 @@
style="color: black;">{Lang::T('Edit')}</a> style="color: black;">{Lang::T('Edit')}</a>
{if in_array($_admin['user_type'],['SuperAdmin','Admin'])} {if in_array($_admin['user_type'],['SuperAdmin','Admin'])}
<a href="{$_url}plan/delete/{$ds['id']}" id="{$ds['id']}" <a href="{$_url}plan/delete/{$ds['id']}" id="{$ds['id']}"
onclick="return confirm('{Lang::T('Delete')}?')" class="btn btn-danger btn-xs"><i onclick="return confirm('{Lang::T('Delete')}?')"
class="glyphicon glyphicon-trash"></i></a> class="btn btn-danger btn-xs"><i class="glyphicon glyphicon-trash"></i></a>
{/if} {/if}
{if $ds['status']=='off' && $_c['extend_expired']} {if $ds['status']=='off' && $_c['extend_expired']}
<a href="javascript:extend('{$ds['id']}')" <a href="javascript:extend('{$ds['id']}')"
@ -121,6 +122,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div>
{include file="pagination.tpl"} {include file="pagination.tpl"}
</div> </div>
</div> </div>
@ -131,7 +133,7 @@
var res = prompt("Extend for many days?", "3"); var res = prompt("Extend for many days?", "3");
if (res) { if (res) {
if (confirm("Extend for " + res + " days?")) { 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()}";
} }
} }
} }

View File

@ -104,6 +104,7 @@
</div> </div>
</form> </form>
<div class="table-responsive"> <div class="table-responsive">
<div style="margin-left: 5px; margin-right: 5px;">
<table class="table table-bordered table-striped table-condensed"> <table class="table table-bordered table-striped table-condensed">
<thead> <thead>
<tr> <tr>
@ -131,9 +132,10 @@
</thead> </thead>
<tbody> <tbody>
{foreach $d as $ds} {foreach $d as $ds}
<tr {if $ds['enabled'] != 1}class="danger" title="disabled" {/if}> <tr {if $ds['enabled'] !=1}class="danger" title="disabled" {/if}>
<td>{$ds['name_plan']}</td> <td>{$ds['name_plan']}</td>
<td>{$ds['plan_type']} {if $ds['prepaid'] != 'yes'}<b>{Lang::T('Postpaid')}</b>{else}{Lang::T('Prepaid')}{/if}</td> <td>{$ds['plan_type']} {if $ds['prepaid'] !=
'yes'}<b>{Lang::T('Postpaid')}</b>{else}{Lang::T('Prepaid')}{/if}</td>
<td>{$ds['name_bw']}</td> <td>{$ds['name_bw']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td> <td>{Lang::moneyFormat($ds['price'])}</td>
<td>{$ds['validity']} {$ds['validity_unit']}</td> <td>{$ds['validity']} {$ds['validity_unit']}</td>
@ -165,6 +167,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div>
<div class="panel-footer"> <div class="panel-footer">
{include file="pagination.tpl"} {include file="pagination.tpl"}
<div class="bs-callout bs-callout-info" id="callout-navbar-role"> <div class="bs-callout bs-callout-info" id="callout-navbar-role">

View File

@ -148,12 +148,26 @@
color: inherit; color: inherit;
background-color: transparent; background-color: transparent;
border-color: transparent; border-color: transparent;
border-bottom-right-radius: 21px;
border-bottom-left-radius: 21px;
} }
.panel-primary>.panel-heading { .panel-success>.panel-heading {
color: inherit; border-bottom-right-radius: 21px;
background-color: transparent; border-bottom-left-radius: 21px;
border-color: transparent; }
.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 { .panel-heading {
@ -656,6 +670,9 @@
} }
.toggle-container { .toggle-container {
position: absolute;
top: 17px;
right: 15px;
cursor: pointer; cursor: pointer;
} }
@ -666,6 +683,11 @@
} }
@media (max-width: 600px) { @media (max-width: 600px) {
.toggle-container {
top: 15px;
right: 60px;
}
.toggle-container .toggle-icon { .toggle-container .toggle-icon {
font-size: 20px; font-size: 20px;
color: rgb(100 116 139); color: rgb(100 116 139);

View File

@ -19,8 +19,9 @@
{if in_array($_admin['user_type'],['SuperAdmin','Admin'])} {if in_array($_admin['user_type'],['SuperAdmin','Admin'])}
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<a class="btn btn-danger btn-xs" title="Remove used Voucher" href="{$_url}plan/remove-voucher" <a class="btn btn-danger btn-xs" title="Remove used Voucher" href="{$_url}plan/remove-voucher"
onclick="return confirm('Delete all used voucher code more than 3 months?')"><span class="glyphicon glyphicon-trash" onclick="return confirm('Delete all used voucher code more than 3 months?')"><span
aria-hidden="true"></span> {Lang::T('Delete')} &gt; {Lang::T('3 Months')}</a> class="glyphicon glyphicon-trash" aria-hidden="true"></span> {Lang::T('Delete')} &gt; {Lang::T('3
Months')}</a>
</div> </div>
{/if} {/if}
&nbsp; &nbsp;
@ -76,8 +77,8 @@
class="fa fa-search"></span></button> class="fa fa-search"></span></button>
</div> </div>
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<a class="btn btn-warning btn-block" title="Clear Search Query" href="{$_url}plan/voucher/"><span <a class="btn btn-warning btn-block" title="Clear Search Query"
class="glyphicon glyphicon-remove-circle"></span></a> href="{$_url}plan/voucher/"><span class="glyphicon glyphicon-remove-circle"></span></a>
</div> </div>
</div> </div>
</div> </div>
@ -85,6 +86,7 @@
</form> </form>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<div style="margin-left: 5px; margin-right: 5px;">&nbsp;
<table id="datatable" class="table table-bordered table-striped table-condensed"> <table id="datatable" class="table table-bordered table-striped table-condensed">
<thead> <thead>
<tr> <tr>
@ -102,7 +104,7 @@
</thead> </thead>
<tbody> <tbody>
{foreach $d as $ds} {foreach $d as $ds}
<tr {if $ds['status'] eq '1'}class="danger" {/if}> <tr {if $ds['status'] eq '1' }class="danger" {/if}>
<td>{$ds['id']}</td> <td>{$ds['id']}</td>
<td>{$ds['type']}</td> <td>{$ds['type']}</td>
<td>{$ds['routers']}</td> <td>{$ds['routers']}</td>
@ -119,7 +121,8 @@
{/if}</td> {/if}</td>
<td>{if $ds['used_date']}{Lang::dateTimeFormat($ds['used_date'])}{/if}</td> <td>{if $ds['used_date']}{Lang::dateTimeFormat($ds['used_date'])}{/if}</td>
<td>{if $ds['generated_by']} <td>{if $ds['generated_by']}
<a href="{$_url}settings/users-view/{$ds['generated_by']}">{$admins[$ds['generated_by']]}</a> <a
href="{$_url}settings/users-view/{$ds['generated_by']}">{$admins[$ds['generated_by']]}</a>
{else} - {else} -
{/if} {/if}
</td> </td>
@ -129,8 +132,8 @@
class="btn btn-success btn-xs">&nbsp;&nbsp;{Lang::T('View')}&nbsp;&nbsp;</a> class="btn btn-success btn-xs">&nbsp;&nbsp;{Lang::T('View')}&nbsp;&nbsp;</a>
{/if} {/if}
{if in_array($_admin['user_type'],['SuperAdmin','Admin'])} {if in_array($_admin['user_type'],['SuperAdmin','Admin'])}
<a href="{$_url}plan/voucher-delete/{$ds['id']}" id="{$ds['id']}" class="btn btn-danger btn-xs" <a href="{$_url}plan/voucher-delete/{$ds['id']}" id="{$ds['id']}"
onclick="return confirm('{Lang::T('Delete')}?')"><i class="btn btn-danger btn-xs" onclick="return confirm('{Lang::T('Delete')}?')"><i
class="glyphicon glyphicon-trash"></i></a> class="glyphicon glyphicon-trash"></i></a>
{/if} {/if}
</td> </td>
@ -139,6 +142,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div>
{include file="pagination.tpl"} {include file="pagination.tpl"}
</div> </div>
{include file="sections/footer.tpl"} {include file="sections/footer.tpl"}