Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
0745532951 | |||
b53116d22a | |||
f7df824145 | |||
f154322f99 | |||
a76ba6ee8b | |||
61b3f5b5f5 | |||
b153e5b595 | |||
9ab0b6a0fa | |||
a7f191f058 | |||
012a1ecfab | |||
dc70a49f52 | |||
bc7380eab7 | |||
f4da09a26e | |||
de3312055a | |||
699289662b |
@ -2,6 +2,12 @@
|
||||
|
||||
# CHANGELOG
|
||||
|
||||
## 2024.3.3
|
||||
|
||||
- Change loading button by @Focuslinkstech
|
||||
- Add Customer Announcements by @Gerandonk
|
||||
- Add PPPOE Period Validity by @Gerandonk
|
||||
|
||||
## 2024.2.29
|
||||
|
||||
- Fix Hook Functionality
|
||||
|
4
init.php
4
init.php
@ -238,7 +238,7 @@ function r2($to, $ntype = 'e', $msg = '')
|
||||
exit;
|
||||
}
|
||||
|
||||
function _alert($text, $type = 'success', $url = "home")
|
||||
function _alert($text, $type = 'success', $url = "home", $time = 3)
|
||||
{
|
||||
global $ui;
|
||||
if (!isset($ui)) return;
|
||||
@ -251,8 +251,10 @@ function _alert($text, $type = 'success', $url = "home")
|
||||
}
|
||||
$ui->assign('text', $text);
|
||||
$ui->assign('type', $type);
|
||||
$ui->assign('time', $time);
|
||||
$ui->assign('url', $url);
|
||||
$ui->display('alert.tpl');
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ CREATE TABLE `tbl_plans` (
|
||||
`data_limit` int(10) UNSIGNED DEFAULT NULL,
|
||||
`data_unit` enum('MB','GB') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`validity` int(10) NOT NULL,
|
||||
`validity_unit` enum('Mins','Hrs','Days','Months') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`validity_unit` enum('Mins','Hrs','Days','Months','Period') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`shared_users` int(10) DEFAULT NULL,
|
||||
`routers` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`is_radius` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1 is radius',
|
||||
|
@ -1 +1,3 @@
|
||||
Pengumuman!!<br>Besok libur<br><br>Announcement!!<br>Tomorrow holiday<br>
|
||||
Pengumuman!!<br>Besok libur<br><br>Announcement!!<br>Tomorrow holiday<br><br>
|
||||
<br>
|
||||
This Announcement is for Login Page.
|
8
pages_template/Announcement_Customer.html
Normal file
8
pages_template/Announcement_Customer.html
Normal file
@ -0,0 +1,8 @@
|
||||
Pengumuman Pelanggan!!<br>
|
||||
Besok libur<br>
|
||||
<br>
|
||||
Customer Announcement!!<br>
|
||||
Tomorrow holiday<br>
|
||||
<br>
|
||||
<br>
|
||||
This Announcement is for Customer Dashboard
|
@ -19,7 +19,7 @@ class Package
|
||||
*/
|
||||
public static function rechargeUser($id_customer, $router_name, $plan_id, $gateway, $channel)
|
||||
{
|
||||
global $config, $admin;
|
||||
global $config, $admin, $c, $p, $b, $t, $d;
|
||||
$date_now = date("Y-m-d H:i:s");
|
||||
$date_only = date("Y-m-d");
|
||||
$time_only = date("H:i:s");
|
||||
@ -94,9 +94,24 @@ class Package
|
||||
->where('Type', $p['type'])
|
||||
->find_one();
|
||||
|
||||
run_hook("recharge_user");
|
||||
|
||||
|
||||
$mikrotik = Mikrotik::info($router_name);
|
||||
if ($p['validity_unit'] == 'Months') {
|
||||
$date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' month'));
|
||||
} else if ($p['validity_unit'] == 'Period') {
|
||||
$date_tmp = date("Y-m-20", strtotime('+' . $p['validity'] . ' month'));
|
||||
$dt1 = new DateTime("$date_only");
|
||||
$dt2 = new DateTime("$date_tmp");
|
||||
$diff = $dt2->diff($dt1);
|
||||
$sum = $diff->format("%a");// => 453
|
||||
if ($sum >= 35) {
|
||||
$date_exp = date("Y-m-20", strtotime('+0 month'));
|
||||
} else {
|
||||
$date_exp = date("Y-m-20", strtotime('+' . $p['validity'] . ' month'));
|
||||
};
|
||||
$time = date("23:59:00");
|
||||
} else if ($p['validity_unit'] == 'Days') {
|
||||
$date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' day'));
|
||||
} else if ($p['validity_unit'] == 'Hrs') {
|
||||
@ -116,6 +131,9 @@ class Package
|
||||
if ($p['validity_unit'] == 'Months') {
|
||||
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
|
||||
$time = $b['time'];
|
||||
} else if ($p['validity_unit'] == 'Period') {
|
||||
$date_exp = date("Y-m-20", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
|
||||
$time = date("23:59:00");
|
||||
} else if ($p['validity_unit'] == 'Days') {
|
||||
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
|
||||
$time = $b['time'];
|
||||
@ -177,6 +195,12 @@ class Package
|
||||
$t->admin_id = '0';
|
||||
}
|
||||
$t->save();
|
||||
|
||||
Message::sendTelegram("#u$c[username] #recharge #Hotspot \n" . $p['name_plan'] .
|
||||
"\nRouter: " . $router_name .
|
||||
"\nGateway: " . $gateway .
|
||||
"\nChannel: " . $channel .
|
||||
"\nPrice: " . Lang::moneyFormat($p['price']));
|
||||
} else {
|
||||
if ($p['is_radius']) {
|
||||
Radius::customerAddPlan($c, $p, "$date_exp $time");
|
||||
@ -226,12 +250,14 @@ class Package
|
||||
$t->admin_id = '0';
|
||||
}
|
||||
$t->save();
|
||||
}
|
||||
Message::sendTelegram("#u$c[username] #buy #Hotspot \n" . $p['name_plan'] .
|
||||
|
||||
Message::sendTelegram("#u$c[username] #buy #Hotspot \n" . $p['name_plan'] .
|
||||
"\nRouter: " . $router_name .
|
||||
"\nGateway: " . $gateway .
|
||||
"\nChannel: " . $channel .
|
||||
"\nPrice: " . Lang::moneyFormat($p['price']));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if ($b) {
|
||||
@ -240,6 +266,9 @@ class Package
|
||||
if ($p['validity_unit'] == 'Months') {
|
||||
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
|
||||
$time = $b['time'];
|
||||
} else if ($p['validity_unit'] == 'Period') {
|
||||
$date_exp = date("Y-m-20", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
|
||||
$time = date("23:59:00");
|
||||
} else if ($p['validity_unit'] == 'Days') {
|
||||
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
|
||||
$time = $b['time'];
|
||||
@ -301,6 +330,12 @@ class Package
|
||||
$t->admin_id = '0';
|
||||
}
|
||||
$t->save();
|
||||
|
||||
Message::sendTelegram("#u$c[username] #recharge #PPPOE \n" . $p['name_plan'] .
|
||||
"\nRouter: " . $router_name .
|
||||
"\nGateway: " . $gateway .
|
||||
"\nChannel: " . $channel .
|
||||
"\nPrice: " . Lang::moneyFormat($p['price']));
|
||||
} else {
|
||||
if ($p['is_radius']) {
|
||||
Radius::customerAddPlan($c, $p, "$date_exp $time");
|
||||
@ -350,14 +385,16 @@ class Package
|
||||
}
|
||||
$t->type = "PPPOE";
|
||||
$t->save();
|
||||
}
|
||||
Message::sendTelegram("#u$c[username] #buy #PPPOE \n" . $p['name_plan'] .
|
||||
|
||||
Message::sendTelegram("#u$c[username] #buy #PPPOE \n" . $p['name_plan'] .
|
||||
"\nRouter: " . $router_name .
|
||||
"\nGateway: " . $gateway .
|
||||
"\nChannel: " . $channel .
|
||||
"\nPrice: " . Lang::moneyFormat($p['price']));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
run_hook("recharge_user_finish");
|
||||
Message::sendInvoice($c, $t);
|
||||
return true;
|
||||
}
|
||||
|
@ -78,9 +78,9 @@ $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('UPLOAD_PATH', $UPLOAD_PATH);
|
||||
$ui->assign('CACHE_PATH', $CACHE_PATH);
|
||||
$ui->assign('PAGES_PATH', $PAGES_PATH);
|
||||
$ui->assign('UPLOAD_PATH', str_replace($root_path, '', $UPLOAD_PATH));
|
||||
$ui->assign('CACHE_PATH', str_replace($root_path, '', $CACHE_PATH));
|
||||
$ui->assign('PAGES_PATH', str_replace($root_path, '', $PAGES_PATH));
|
||||
$ui->assign('_system_menu', 'dashboard');
|
||||
|
||||
function _msglog($type, $msg)
|
||||
|
@ -62,10 +62,11 @@ switch ($action) {
|
||||
$title = ' Reports [' . $mdate . ']';
|
||||
$title = str_replace('-', ' ', $title);
|
||||
|
||||
$UPLOAD_URL_PATH = str_replace($root_path, '', $UPLOAD_PATH);
|
||||
if (file_exists($UPLOAD_PATH . '/logo.png')) {
|
||||
$logo = $UPLOAD_PATH . '/logo.png';
|
||||
$logo = $UPLOAD_URL_PATH . '/logo.png';
|
||||
} else {
|
||||
$logo = $UPLOAD_PATH . '/logo.default.png';
|
||||
$logo = $UPLOAD_URL_PATH . '/logo.default.png';
|
||||
}
|
||||
|
||||
if ($x) {
|
||||
@ -234,10 +235,12 @@ EOF;
|
||||
|
||||
$title = ' Reports [' . $mdate . ']';
|
||||
$title = str_replace('-', ' ', $title);
|
||||
|
||||
$UPLOAD_URL_PATH = str_replace($root_path, '', $UPLOAD_PATH);
|
||||
if (file_exists($UPLOAD_PATH . '/logo.png')) {
|
||||
$logo = $UPLOAD_PATH . '/logo.png';
|
||||
$logo = $UPLOAD_URL_PATH . '/logo.png';
|
||||
} else {
|
||||
$logo = $UPLOAD_PATH . '/logo.default.png';
|
||||
$logo = $UPLOAD_URL_PATH . '/logo.default.png';
|
||||
}
|
||||
|
||||
if ($x) {
|
||||
|
@ -99,9 +99,6 @@ if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
|
||||
if(!$plan['enabled']){
|
||||
r2(U . "home", 'e', 'Plan is not exists');
|
||||
}
|
||||
if($plan['allow_purchase'] != 'yes'){
|
||||
r2(U . "home", 'e', 'Cannot recharge this plan');
|
||||
}
|
||||
if ($user['balance'] > $plan['price']) {
|
||||
r2(U . "order/pay/$router[id]/$bill[plan_id]", 'e', 'Order Plan');
|
||||
} else {
|
||||
|
@ -30,10 +30,11 @@ switch ($action) {
|
||||
r2(U . "settings/app", 's', 'Test Telegram has been send<br>Result: ' . $result);
|
||||
}
|
||||
|
||||
$UPLOAD_URL_PATH = str_replace($root_path,'', $UPLOAD_PATH);
|
||||
if (file_exists($UPLOAD_PATH . DIRECTORY_SEPARATOR . 'logo.png')) {
|
||||
$logo = $UPLOAD_PATH . DIRECTORY_SEPARATOR . 'logo.png?' . time();
|
||||
$logo = $UPLOAD_URL_PATH . DIRECTORY_SEPARATOR . 'logo.png?' . time();
|
||||
} else {
|
||||
$logo = $UPLOAD_PATH . DIRECTORY_SEPARATOR . 'logo.default.png';
|
||||
$logo = $UPLOAD_URL_PATH . DIRECTORY_SEPARATOR . 'logo.default.png';
|
||||
}
|
||||
$ui->assign('logo', $logo);
|
||||
if ($config['radius_enable'] && empty($config['radius_client'])) {
|
||||
|
@ -456,5 +456,9 @@
|
||||
"Click_Here": "Click Here",
|
||||
"danger": "danger",
|
||||
"Logout_Successful": "Logout Successful",
|
||||
"warning": "warning"
|
||||
"warning": "warning",
|
||||
"Users_Announcement": "Users Announcement",
|
||||
"Customer_Announcement": "Customer Announcement",
|
||||
"1_Period___1_Month__Expires_the_20th_of_each_month": "1 Period = 1 Month, Expires the 20th of each month",
|
||||
"Period": "Period"
|
||||
}
|
@ -69,5 +69,8 @@
|
||||
"2024.2.23" : [
|
||||
"ALTER TABLE `tbl_transactions` ADD `admin_id` INT NOT NULL DEFAULT '1' AFTER `type`;",
|
||||
"ALTER TABLE `tbl_user_recharges` ADD `admin_id` INT NOT NULL DEFAULT '1' AFTER `type`;"
|
||||
],
|
||||
"2024.3.3" : [
|
||||
"ALTER TABLE `tbl_plans` CHANGE `validity_unit` `validity_unit` ENUM('Mins','Hrs','Days','Months','Period') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;"
|
||||
]
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
<link rel="shortcut icon" href="ui/ui/images/logo.png" type="image/x-icon" />
|
||||
<link rel="stylesheet" href="ui/ui/styles/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="ui/ui/styles/modern-AdminLTE.min.css">
|
||||
<meta http-equiv="refresh" content="3; url={$url}">
|
||||
<meta http-equiv="refresh" content="{$time}; url={$url}">
|
||||
</head>
|
||||
|
||||
<body class="hold-transition lockscreen">
|
||||
@ -20,7 +20,7 @@
|
||||
{$text}
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<a href="{$url}" id="button" class="btn btn-{$type} btn-block btn-block">{Lang::T('Click Here')} (3)</a>
|
||||
<a href="{$url}" id="button" class="btn btn-{$type} btn-block btn-block">{Lang::T('Click Here')} ({$time})</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="lockscreen-footer text-center">
|
||||
@ -29,7 +29,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var time = 3;
|
||||
var time = {$time};
|
||||
timer();
|
||||
|
||||
function timer() {
|
||||
|
@ -60,6 +60,7 @@
|
||||
<label class="col-md-2 control-label">{Lang::T('Plan Validity')}</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="validity" name="validity">
|
||||
<p class="help-block">{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}</p>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select class="form-control" id="validity_unit" name="validity_unit">
|
||||
@ -67,6 +68,7 @@
|
||||
<option value="Hrs">{Lang::T('Hrs')}</option>
|
||||
<option value="Days">{Lang::T('Days')}</option>
|
||||
<option value="Months">{Lang::T('Months')}</option>
|
||||
<option value="Period">{Lang::T('Period')}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -62,6 +62,7 @@
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="validity" name="validity"
|
||||
value="{$d['validity']}">
|
||||
<p class="help-block">{Lang::T('1 Period = 30 Month, Expires the 20th of each month')}</p>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select class="form-control" id="validity_unit" name="validity_unit">
|
||||
@ -73,6 +74,7 @@
|
||||
</option>
|
||||
<option value="Months" {if $d['validity_unit'] eq 'Months'} selected {/if}>
|
||||
{Lang::T('Months')}</option>
|
||||
<option value="Period" {if $d['validity_unit'] eq 'Period'} selected {/if}>{Lang::T('Period')}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -27,7 +27,7 @@
|
||||
if (el.addEventListener) { // all browsers except IE before version 9
|
||||
el.addEventListener("click", function() {
|
||||
$(this).html(
|
||||
`<span class="glyphicon glyphicon-refresh" role="status" aria-hidden="true"></span>`
|
||||
`<span class="loading"></span>`
|
||||
);
|
||||
setTimeout(() => {
|
||||
$(this).prop("disabled", true);
|
||||
@ -37,7 +37,7 @@
|
||||
if (el.attachEvent) { // IE before version 9
|
||||
el.attachEvent("click", function() {
|
||||
$(this).html(
|
||||
`<span class="glyphicon glyphicon-refresh" role="status" aria-hidden="true"></span>`
|
||||
`<span class="loading"></span>`
|
||||
);
|
||||
setTimeout(() => {
|
||||
$(this).prop("disabled", true);
|
||||
|
@ -57,8 +57,36 @@
|
||||
max-height: 1em;
|
||||
line-height: 1em;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
.loading {
|
||||
pointer-events: none;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.loading::after {
|
||||
content: "";
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
vertical-align: middle;
|
||||
margin-left: 10px;
|
||||
border: 2px solid #fff;
|
||||
border-top-color: transparent;
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
{if isset($xheader)}
|
||||
{$xheader}
|
||||
{/if}
|
||||
@ -249,6 +277,8 @@
|
||||
href="{$_url}pages/Voucher">{Lang::T('Voucher')} Template</a></li>
|
||||
<li {if $_routes[1] eq 'Announcement'}class="active" {/if}><a
|
||||
href="{$_url}pages/Announcement">{Lang::T('Announcement')}</a></li>
|
||||
<li {if $_routes[1] eq 'Announcement_Customer'}class="active" {/if}><a
|
||||
href="{$_url}pages/Announcement_Customer">{Lang::T('Customer Announcement')}</a></li>
|
||||
<li {if $_routes[1] eq 'Registration_Info'}class="active" {/if}><a
|
||||
href="{$_url}pages/Registration_Info">{Lang::T('Registration Info')}</a></li>
|
||||
<li {if $_routes[1] eq 'Privacy_Policy'}class="active" {/if}><a
|
||||
|
@ -85,7 +85,7 @@
|
||||
if (el.addEventListener) { // all browsers except IE before version 9
|
||||
el.addEventListener("click", function() {
|
||||
$(this).html(
|
||||
`<span class="glyphicon glyphicon-refresh" role="status" aria-hidden="true"></span>`
|
||||
`<span class="loading"></span>`
|
||||
);
|
||||
setTimeout(() => {
|
||||
$(this).prop("disabled", true);
|
||||
@ -95,7 +95,7 @@
|
||||
if (el.attachEvent) { // IE before version 9
|
||||
el.attachEvent("click", function() {
|
||||
$(this).html(
|
||||
`<span class="glyphicon glyphicon-refresh" role="status" aria-hidden="true"></span>`
|
||||
`<span class="loading"></span>`
|
||||
);
|
||||
setTimeout(() => {
|
||||
$(this).prop("disabled", true);
|
||||
|
@ -37,7 +37,36 @@
|
||||
margin-top: 100px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
.loading {
|
||||
pointer-events: none;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.loading::after {
|
||||
content: "";
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
vertical-align: middle;
|
||||
margin-left: 10px;
|
||||
border: 2px solid #fff;
|
||||
border-top-color: transparent;
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
{if isset($xheader)}
|
||||
{$xheader}
|
||||
|
@ -53,7 +53,7 @@
|
||||
<h3 class="box-title">{Lang::T('Announcement')}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{include file="$_path/../pages/Announcement.html"}
|
||||
{include file="$_path/../pages/Announcement_Customer.html"}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": "2024.2.29"
|
||||
"version": "2024.3.3"
|
||||
}
|
Reference in New Issue
Block a user