Compare commits

...

34 Commits

Author SHA1 Message Date
f61ebb642e 2023.10.25 2023-10-25 15:10:31 +07:00
77e7a96f96 fix wrong file check in cron, error only for newly installed 2023-10-25 15:10:22 +07:00
5c57c5df11 fix wrong cheking file 2023-10-25 10:03:25 +07:00
9e09611816 Fix expired notification 2023-10-24 15:12:10 +07:00
09ead77d7b Merge branch 'master' into Development 2023-10-24 14:11:11 +07:00
703f9a7463 2023.10.24 2023-10-24 14:09:50 +07:00
ef25633275 Assign router to NAS 2023-10-24 14:09:50 +07:00
02a68589a1 check file if exists 2023-10-24 14:09:50 +07:00
25cd07e975 pagination Nas List 2023-10-24 14:09:49 +07:00
4e7a60aa6f change pagination class 2023-10-24 14:09:49 +07:00
baca2d706f alert move to tpl 2023-10-24 14:09:49 +07:00
4f975fbf0d fix logic pool_expired radius 2023-10-24 14:09:49 +07:00
cded80a632 2023.10.24 2023-10-24 14:08:18 +07:00
f0d130b6b9 Assign router to NAS 2023-10-24 13:55:34 +07:00
a18c07ba42 check file if exists 2023-10-24 13:38:58 +07:00
36b47a3e8d pagination Nas List 2023-10-24 12:30:15 +07:00
37f72d881e change pagination class 2023-10-24 12:27:30 +07:00
e99108a34a alert move to tpl 2023-10-24 09:27:51 +07:00
ddb3b8a718 fix logic pool_expired radius 2023-10-24 09:19:35 +07:00
3c4920f958 Update issue templates 2023-10-21 11:36:23 +07:00
e2da5b67bf Update issue templates 2023-10-21 11:34:28 +07:00
49c8fe5d55 Update issue templates 2023-10-21 11:33:52 +07:00
9402da311c 2023.10.20 2023-10-20 15:00:54 +07:00
51ab4a35c5 Transaction list 2023-10-20 14:31:56 +07:00
d037b2bef4 move alert 2023-10-20 14:07:49 +07:00
d95e4d1d84 resend invoice 2023-10-20 13:57:12 +07:00
7ebf95f4be paginator dynamic 2023-10-20 10:34:24 +07:00
8cbe32e313 StandWithPalestine 2023-10-20 08:53:42 +07:00
0d27503e8d view INVOICE again 2023-10-18 17:49:54 +07:00
1ae687bda2 Voucher Template 2023-10-18 17:26:02 +07:00
d59f696fde Voucher Template Full Custom 2023-10-18 17:24:00 +07:00
b9537d4a4b Voucher Format 2023-10-18 17:23:47 +07:00
e88d1f02a6 fix url update 2023-10-18 15:35:56 +07:00
eda7967f66 fix info cron 2023-10-18 15:35:45 +07:00
54 changed files with 987 additions and 529 deletions

27
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ibnux
---
**Describe the bug**
A clear and concise description of what the bug is. Error connecting to router is not a bug, is your router port is not accessable, ask community for help, go to discussion or telegram group
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -2,6 +2,23 @@
# CHANGELOG
## 2023.10.25
- fix wrong file check in cron, error only for newly installed
## 2023.10.24
- Fix logic cronjob
- assign router to NAS, but not yet used
- Fix Pagination
- Move Alert from hardcode
## 2023.10.20
- View Invoice
- Resend Invoice
- Custom Voucher
## 2023.10.17
- Happy Birthday To Me 🎂 \(^o^)/

View File

@ -2,6 +2,8 @@
![PHPNuxBill](install/img/logo.png)
![StandWithPalestine](https://raw.githubusercontent.com/Safouene1/support-palestine-banner/master/StandWithPalestine.svg)
## Feature
- Voucher Generator and Print

View File

@ -9,7 +9,8 @@ CREATE TABLE `nas` (
`secret` varchar(60) COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'secret',
`server` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL,
`community` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
`description` varchar(200) COLLATE utf8mb4_general_ci DEFAULT 'RADIUS Client'
`description` varchar(200) COLLATE utf8mb4_general_ci DEFAULT 'RADIUS Client',
`routers` varchar(32) COLLATE utf8mb4_general_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `radacct`;

View File

@ -1,31 +1,27 @@
<center><strong style="font-size:38px">{$_c['CompanyName']}</strong></center>
<table width="100%" border="1" cellspacing="0" cellpadding="4" bordercolor="#757575">
<tbody>
<tr>
<td valign="top" align="left">Pendaftaran dan Informasi Billing buka <b>billing.ibnux.net</b></td>
</tr>
<tr>
<td valign="top" align="left">Wireless Hotspot:
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td>iBNuXnet</td>
<td>iBNuXnet-P</td>
<td>iBNuXnet-Q</td>
</tr>
<tr>
<td>CitraGadingBlokP 3/4</td>
<td>CitraGadingBlokQ 2/3/4/5/6</td>
<td>iBNuXnet 5Ghz</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" align="left">Voucher yang sudah dibeli tidak dapat dikembalikan</td>
</tr>
<tr>
<td valign="top" align="center"><b>hotspot.ibnux.net</b></td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="0" cellpadding="2">
<tr>
<td valign="middle">
<center><strong style="font-size:38px">[[company_name]]</strong></center>
<table width="100%" border="1" cellspacing="0" cellpadding="1" bordercolor="#757575">
<tbody>
<tr>
<td rowspan="4" width="1">[[qrcode]]
</td>
</tr>
<tr>
<td valign="middle" align="center" style="font-size:25px">
[[price]]</td>
</tr>
<tr>
<td valign="middle" align="center" style="font-size:20px">
[[voucher_code]]</td>
</tr>
<tr>
<td valign="middle" align="center" style="font-size:15px">
[[plan]]</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>

View File

@ -86,4 +86,17 @@ class Lang
{
return ucwords(str_replace('_', ' ', $text));
}
public static function randomUpLowCase($text){
$jml = strlen($text);
$result = '';
for($i = 0; $i < $jml;$i++){
if(rand(0,99)%2){
$result .= strtolower(substr($text,$i,1));
}else{
$result .= substr($text,$i,1);
}
}
return $result;
}
}

View File

@ -75,4 +75,30 @@ class Message
}
return "$via: $msg";
}
public static function sendInvoice($cust, $trx){
global $config;
$textInvoice = Lang::getNotifText('invoice_paid');
$textInvoice = str_replace('[[company_name]]', $config['CompanyName'], $textInvoice);
$textInvoice = str_replace('[[address]]', $config['address'], $textInvoice);
$textInvoice = str_replace('[[phone]]', $config['phone'], $textInvoice);
$textInvoice = str_replace('[[invoice]]', $trx['invoice'], $textInvoice);
$textInvoice = str_replace('[[date]]', Lang::dateAndTimeFormat($trx['recharged_on'], $trx['recharged_time']), $textInvoice);
$textInvoice = str_replace('[[payment_gateway]]', $config['gateway'], $textInvoice);
$textInvoice = str_replace('[[payment_channel]]', $config['channel'], $textInvoice);
$textInvoice = str_replace('[[type]]', $trx['type'], $textInvoice);
$textInvoice = str_replace('[[plan_name]]', $trx['plan_name'], $textInvoice);
$textInvoice = str_replace('[[plan_price]]', Lang::moneyFormat($trx['price']), $textInvoice);
$textInvoice = str_replace('[[name]]', $cust['fullname'], $textInvoice);
$textInvoice = str_replace('[[user_name]]', $trx['username'], $textInvoice);
$textInvoice = str_replace('[[user_password]]', $cust['password'], $textInvoice);
$textInvoice = str_replace('[[expired_date]]', Lang::dateAndTimeFormat($trx['expiration'], $trx['time']), $textInvoice);
$textInvoice = str_replace('[[footer]]', $config['note'], $textInvoice);
if ($config['user_notification_payment'] == 'sms') {
Message::sendSMS($cust['phonenumber'], $textInvoice);
} else if ($config['user_notification_payment'] == 'wa') {
Message::sendWhatsapp($cust['phonenumber'], $textInvoice);
}
}
}

View File

@ -317,29 +317,7 @@ class Package
}
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
$textInvoice = Lang::getNotifText('invoice_paid');
$textInvoice = str_replace('[[company_name]]', $_c['CompanyName'], $textInvoice);
$textInvoice = str_replace('[[address]]', $_c['address'], $textInvoice);
$textInvoice = str_replace('[[phone]]', $_c['phone'], $textInvoice);
$textInvoice = str_replace('[[invoice]]', $in['invoice'], $textInvoice);
$textInvoice = str_replace('[[date]]', Lang::dateTimeFormat($date_now), $textInvoice);
$textInvoice = str_replace('[[payment_gateway]]', $_c['gateway'], $textInvoice);
$textInvoice = str_replace('[[payment_channel]]', $_c['channel'], $textInvoice);
$textInvoice = str_replace('[[type]]', $in['type'], $textInvoice);
$textInvoice = str_replace('[[plan_name]]', $in['plan_name'], $textInvoice);
$textInvoice = str_replace('[[plan_price]]', Lang::moneyFormat($in['price']), $textInvoice);
$textInvoice = str_replace('[[name]]', $c['fullname'], $textInvoice);
$textInvoice = str_replace('[[user_name]]', $in['username'], $textInvoice);
$textInvoice = str_replace('[[user_password]]', $c['password'], $textInvoice);
$textInvoice = str_replace('[[expired_date]]', Lang::dateAndTimeFormat($in['expiration'], $in['time']), $textInvoice);
$textInvoice = str_replace('[[footer]]', $_c['note'], $textInvoice);
if ($_c['user_notification_payment'] == 'sms') {
Message::sendSMS($c['phonenumber'], $textInvoice);
} else if ($_c['user_notification_payment'] == 'wa') {
Message::sendWhatsapp($c['phonenumber'], $textInvoice);
}
Message::sendInvoice($c, $in);
return true;
}

View File

@ -8,6 +8,88 @@
class Paginator
{
public static function build($table, $colVal = [], $query='', $per_page = '10')
{
global $routes;
global $_L;
$url = U . implode('/', $routes);
$query = urlencode($query);
$adjacents = "2";
$page = (int)(empty(_get('p')) ? 1 : _get('p'));
$pagination = "";
foreach($colVal as $k=>$v) {
if(strpos($v,'%') === false) {
$table = $table->where($k, $v);
}else{
$table = $table->where_like($k, $v);
}
}
$totalReq = $table->count();
$page = ($page == 0 ? 1 : $page);
$next = $page + 1;
$lastpage = ceil($totalReq / $per_page);
$lpm1 = $lastpage - 1;
$limit = $per_page;
$startpoint = ($page * $limit) - $limit;
if ($lastpage >= 1) {
$pagination .= '<ul class="pagination pagination-sm">';
if ($lastpage < 7 + ($adjacents * 2)) {
for ($counter = 1; $counter <= $lastpage; $counter++) {
if ($counter == $page)
$pagination .= "<li class='active'><a href='javascript:void(0);'>$counter</a></li>";
else
$pagination .= "<li><a href='{$url}&p=$counter&q=$query'>$counter</a></li>";
}
} elseif ($lastpage > 5 + ($adjacents * 2)) {
if ($page < 1 + ($adjacents * 2)) {
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) {
if ($counter == $page)
$pagination .= "<li class='active'><a href='javascript:void(0);'>$counter</a></li>";
else
$pagination .= "<li><a href='{$url}&p=$counter&q=$query'>$counter</a></li>";
}
$pagination .= "<li class='disabled'><a href='#'>...</a></li>";
$pagination .= "<li><a href='{$url}&p=$lpm1&q=$query'>$lpm1</a></li>";
$pagination .= "<li><a href='{$url}&p=$lastpage&q=$query'>$lastpage</a></li>";
} elseif ($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) {
$pagination .= "<li><a href='{$url}&p=1&q=$query'>1</a></li>";
$pagination .= "<li><a href='{$url}&p=2&q=$query'>2</a></li>";
$pagination .= "<li class='disabled'><a href='#'>...</a></li>";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) {
if ($counter == $page)
$pagination .= "<li class='active'><a href='javascript:void(0);'>$counter</a></li>";
else
$pagination .= "<li><a href='{$url}&p=$counter&q=$query'>$counter</a></li>";
}
$pagination .= "<li class='disabled'><a href='#'>...</a></li>";
$pagination .= "<li><a href='{$url}&p=$lpm1&q=$query'>$lpm1</a></li>";
$pagination .= "<li><a href='{$url}&p=$lastpage&q=$query'>$lastpage</a></li>";
} else {
$pagination .= "<li><a href='{$url}&p=1&q=$query'>1</a></li>";
$pagination .= "<li><a href='{$url}&p=2&q=$query'>2</a></li>";
$pagination .= "<li><a href='#'>...</a></li>";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) {
if ($counter == $page)
$pagination .= "<li class='active'><a class='disabled'>$counter</a></li>";
else
$pagination .= "<li><a href='{$url}&p=$counter&q=$query'>$counter</a></li>";
}
}
}
if ($page < $counter - 1) {
$pagination .= "<li><a href='{$url}&p=$next&q=$query'>" . $_L['Next'] . "</a></li>";
$pagination .= "<li><a href='{$url}&p=$lastpage&q=$query'>" . $_L['Last'] . "</a></li>";
} else {
$pagination .= "<li class='disabled'><a class='disabled'>" . $_L['Next'] . "</a></li>";
$pagination .= "<li class='disabled'><a class='disabled'>" . $_L['Last'] . "</a></li>";
}
$pagination .= "</ul>";
return array("startpoint" => $startpoint, "limit" => $limit, "found" => $totalReq, "page" => $page, "lastpage" => $lastpage, "contents" => $pagination);
}
}
public static function bootstrap($table, $w1 = '', $c1 = '', $w2 = '', $c2 = '', $w3 = '', $c3 = '', $w4 = '', $c4 = '', $per_page = '10')
{
global $routes;
@ -17,16 +99,30 @@ class Paginator
$page = (int)(!isset($routes['2']) ? 1 : $routes['2']);
$pagination = "";
if ($w1 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->count();
} elseif ($w2 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->count();
} elseif ($w3 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->count();
} elseif ($w4 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->where($w4, $c4)->count();
} else {
$totalReq = ORM::for_table($table)->count();
if(is_object($table)){
if ($w1 != '') {
$totalReq = $table->where($w1, $c1)->count();
} elseif ($w2 != '') {
$totalReq = $table->where($w1, $c1)->where($w2, $c2)->count();
} elseif ($w3 != '') {
$totalReq = $table->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->count();
} elseif ($w4 != '') {
$totalReq = $table->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->where($w4, $c4)->count();
} else {
$totalReq = $table->count();
}
}else{
if ($w1 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->count();
} elseif ($w2 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->count();
} elseif ($w3 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->count();
} elseif ($w4 != '') {
$totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->where($w4, $c4)->count();
} else {
$totalReq = ORM::for_table($table)->count();
}
}
$i = 0;
@ -109,11 +205,18 @@ class Paginator
$adjacents = "2";
$page = (int)(!isset($routes['2']) ? 1 : $routes['2']);
$pagination = "";
if ($w1 != '') {
$totalReq = ORM::for_table($table)->where_raw($w1, $c1)->count();
} else {
$totalReq = ORM::for_table($table)->count();
if(is_object($table)){
if ($w1 != '') {
$totalReq = $table->where_raw($w1, $c1)->count();
} else {
$totalReq = $table->count();
}
}else{
if ($w1 != '') {
$totalReq = ORM::for_table($table)->where_raw($w1, $c1)->count();
} else {
$totalReq = ORM::for_table($table)->count();
}
}
$i = 0;

View File

@ -43,20 +43,7 @@ class Radius
return ORM::for_table('radusergroup', 'radius');
}
public static function nasList($search = null)
{
if ($search == null) {
return ORM::for_table('nas', 'radius')->find_many();
} else {
return ORM::for_table('nas', 'radius')
->where_like('nasname', $search)
->where_like('shortname', $search)
->where_like('description', $search)
->find_many();
}
}
public static function nasAdd($name, $ip, $ports, $secret, $description = "", $type = 'other', $server = null, $community = null)
public static function nasAdd($name, $ip, $ports, $secret, $routers = "", $description = "", $type = 'other', $server = null, $community = null)
{
$n = Radius::getTableNas()->create();
$n->nasname = $ip;
@ -67,11 +54,12 @@ class Radius
$n->description = $description;
$n->server = $server;
$n->community = $community;
$n->routers = $routers;
$n->save();
return $n->id();
}
public static function nasUpdate($id, $name, $ip, $ports, $secret, $description = "", $type = 'other', $server = null, $community = null)
public static function nasUpdate($id, $name, $ip, $ports, $secret, $routers = "", $description = "", $type = 'other', $server = null, $community = null)
{
$n = Radius::getTableNas()->find_one($id);
if (empty($n)) {
@ -85,6 +73,7 @@ class Radius
$n->description = $description;
$n->server = $server;
$n->community = $community;
$n->routers = $routers;
return $n->save();
}
@ -132,17 +121,17 @@ class Radius
}
}
public static function customerDeactivate($username, $radiusDisconnect = true) {
{
global $radius_pass;
$r = Radius::getTableCustomer()->where_equal('username', $username)->whereEqual('attribute', 'Cleartext-Password')->findOne();
if ($r) {
// no need to delete, because it will make ID got higher
// we just change the password
$r->value = md5(time() . $username . $radius_pass);
$r->save();
if($radiusDisconnect)
return Radius::disconnectCustomer($username);
public static function customerDeactivate($username, $radiusDisconnect = true)
{ {
global $radius_pass;
$r = Radius::getTableCustomer()->where_equal('username', $username)->whereEqual('attribute', 'Cleartext-Password')->findOne();
if ($r) {
// no need to delete, because it will make ID got higher
// we just change the password
$r->value = md5(time() . $username . $radius_pass);
$r->save();
if ($radiusDisconnect)
return Radius::disconnectCustomer($username);
}
}
return '';

View File

@ -164,19 +164,8 @@ function _msglog($type, $msg)
if (isset($_SESSION['notify'])) {
$notify = $_SESSION['notify'];
$ntype = $_SESSION['ntype'];
if ($ntype == 's') {
$ui->assign('notify', '<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>' . $notify . '</div></div>');
} else {
$ui->assign('notify', '<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>' . $notify . '</div></div>');
}
$ui->assign('notify', $notify);
$ui->assign('notify_t', $ntype);
unset($_SESSION['notify']);
unset($_SESSION['ntype']);
}

View File

@ -22,10 +22,10 @@ switch ($action) {
run_hook('view_list_bandwidth'); #HOOK
$name = _post('name');
if ($name != ''){
$paginator = Paginator::bootstrap('tbl_bandwidth','name_bw','%'.$name.'%');
$paginator = Paginator::build(ORM::for_table('tbl_bandwidth'), ['name_bw' => '%' . $name . '%'], $name);
$d = ORM::for_table('tbl_bandwidth')->where_like('name_bw','%'.$name.'%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}else{
$paginator = Paginator::bootstrap('tbl_bandwidth');
$paginator = Paginator::build(ORM::for_table('tbl_bandwidth'));
$d = ORM::for_table('tbl_bandwidth')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}

View File

@ -24,14 +24,19 @@ switch ($action) {
$search = _post('search');
run_hook('list_customers'); #HOOK
if ($search != '') {
$paginator = Paginator::bootstrapRaw('tbl_customers', "(`username` LIKE '%$search%' OR `fullname` LIKE '%$search%' OR `phonenumber` LIKE '%$search%' OR `email` LIKE '%$search%')", [$search, $search, $search, $search]);
$paginator = Paginator::build(ORM::for_table('tbl_customers'), [
'username' => '%' . $search . '%',
'fullname' => '%' . $search . '%',
'phonenumber' => '%' . $search . '%',
'email' => '%' . $search . '%'
], $search);
$d = ORM::for_table('tbl_customers')
->where_raw("(`username` LIKE '%$search%' OR `fullname` LIKE '%$search%' OR `phonenumber` LIKE '%$search%' OR `email` LIKE '%$search%')", [$search, $search, $search, $search])
->offset($paginator['startpoint'])
->limit($paginator['limit'])
->order_by_desc('id')->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_customers');
$paginator = Paginator::build(ORM::for_table('tbl_customers'));
$d = ORM::for_table('tbl_customers')
->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
@ -125,25 +130,24 @@ switch ($action) {
$v = $routes['3'];
if (empty($v) || $v == 'order') {
$v = 'order';
// $paginator = Paginator::bootstrap('tbl_payment_gateway', 'username', $customer['username']);
// print_r($paginator);
$paginator = Paginator::build(ORM::for_table('tbl_payment_gateway'),['username'=>$customer['username']]);
$order = ORM::for_table('tbl_payment_gateway')
->where('username', $customer['username'])
->offset(0)
->limit(30)
->offset($paginator['startpoint'])
->limit($paginator['limit'])
->order_by_desc('id')
->find_many();
// $ui->assign('paginator', $paginator);
$ui->assign('paginator', $paginator);
$ui->assign('order', $order);
} else if ($v == 'activation') {
// $paginator = Paginator::bootstrap('tbl_transactions', 'username', $customer['username']);
$paginator = Paginator::build(ORM::for_table('tbl_transactions'),['username'=>$customer['username']]);
$activation = ORM::for_table('tbl_transactions')
->where('username', $customer['username'])
->offset(0)
->limit(30)
->offset($paginator['startpoint'])
->limit($paginator['limit'])
->order_by_desc('id')
->find_many();
// $ui->assign('paginator', $paginator);
$ui->assign('paginator', $paginator);
$ui->assign('activation', $activation);
}
$package = ORM::for_table('tbl_user_recharges')->where('username', $customer['username'])->find_one();

View File

@ -20,43 +20,42 @@ if ($admin['user_type'] != 'Admin') {
switch ($action) {
case 'list':
$name = _post('name');
$q = (_post('q') ? _post('q') : _get('q'));
$keep = _post('keep');
if (!empty($keep)) {
ORM::raw_execute("DELETE FROM tbl_logs WHERE date < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL $keep DAY))");
r2(U . "logs/list/", 's', "Delete logs older than $keep days");
}
if ($name != '') {
$paginator = Paginator::bootstrap('tbl_logs', 'description', '%' . $name . '%');
$d = ORM::for_table('tbl_logs')->where_like('description', '%' . $name . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
if ($q != '') {
$paginator = Paginator::build(ORM::for_table('tbl_logs'), ['description' => '%' . $q . '%'], $q);
$d = ORM::for_table('tbl_logs')->where_like('description', '%' . $q . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_logs');
$paginator = Paginator::build(ORM::for_table('tbl_logs'));
$d = ORM::for_table('tbl_logs')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
$ui->assign('name', $name);
$ui->assign('d', $d);
$ui->assign('q', $q);
$ui->assign('paginator', $paginator);
$ui->display('logs.tpl');
break;
case 'radius':
$name = _post('name');
$q = (_post('q') ? _post('q') : _get('q'));
$keep = _post('keep');
$page = (isset($routes['2']) ? intval($routes['2']) : 0);
$pageNow = $page * 20;
if (!empty($keep)) {
ORM::raw_execute("DELETE FROM radpostauth WHERE UNIX_TIMESTAMP(authdate) < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL $keep DAY))", [], 'radius');
r2(U . "logs/radius/", 's', "Delete logs older than $keep days");
}
if ($name != '') {
$d = ORM::for_table('radpostauth', 'radius')->where_like('username', '%' . $name . '%')->offset($pageNow)->limit(10)->order_by_desc('id')->find_many();
if ($q != '') {
$paginator = Paginator::build(ORM::for_table('radpostauth', 'radius'), ['username' => '%' . $q . '%'], $q);
$d = ORM::for_table('radpostauth', 'radius')->where_like('username', '%' . $q . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
} else {
$d = ORM::for_table('radpostauth', 'radius')->offset($pageNow)->limit(10)->order_by_desc('id')->find_many();
$paginator = Paginator::build(ORM::for_table('radpostauth', 'radius'));
$d = ORM::for_table('radpostauth', 'radius')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
$ui->assign('page', $page);
$ui->assign('name', $name);
$ui->assign('d', $d);
$ui->assign('q', $q);
$ui->assign('paginator', $paginator);
$ui->display('logs-radius.tpl');
break;

View File

@ -19,7 +19,7 @@ switch ($action) {
break;
case 'history':
$ui->assign('_system_menu', 'history');
$paginator = Paginator::bootstrap('tbl_payment_gateway', 'username', $user['username']);
$paginator = Paginator::build(ORM::for_table('tbl_payment_gateway'),['username'=>$user['username']]);
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->order_by_desc('id')
@ -31,49 +31,58 @@ switch ($action) {
run_hook('customer_view_order_history'); #HOOK
$ui->display('user-orderHistory.tpl');
break;
case 'package':
if (strpos($user['email'], '@') === false) {
r2(U . 'accounts/profile', 'e', Lang::T("Please enter your email address"));
}
$ui->assign('_title', 'Order Plan');
$ui->assign('_system_menu', 'package');
if (!empty($_SESSION['nux-router'])) {
if ($_SESSION['nux-router'] == 'radius') {
case 'balance':
if (strpos($user['email'], '@') === false) {
r2(U . 'accounts/profile', 'e', Lang::T("Please enter your email address"));
}
$ui->assign('_title', 'Top Up');
$ui->assign('_system_menu', 'balance');
$plans_balance = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Balance')->find_many();
$ui->assign('plans_balance', $plans_balance);
$ui->display('user-orderBalance.tpl');
break;
case 'package':
if (strpos($user['email'], '@') === false) {
r2(U . 'accounts/profile', 'e', Lang::T("Please enter your email address"));
}
$ui->assign('_title', 'Order Plan');
$ui->assign('_system_menu', 'package');
if (!empty($_SESSION['nux-router'])) {
if ($_SESSION['nux-router'] == 'radius') {
$radius_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'PPPOE')->find_many();
$radius_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'Hotspot')->find_many();
} else {
$routers = ORM::for_table('tbl_routers')->where('id', $_SESSION['nux-router'])->find_many();
$rs = [];
foreach ($routers as $r) {
$rs[] = $r['name'];
}
$plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('is_radius', 0)->where('type', 'PPPOE')->find_many();
$plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('is_radius', 0)->where('type', 'Hotspot')->find_many();
}
} else {
$radius_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'PPPOE')->find_many();
$radius_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'Hotspot')->find_many();
} else {
$routers = ORM::for_table('tbl_routers')->where('id', $_SESSION['nux-router'])->find_many();
$rs = [];
foreach ($routers as $r) {
$rs[] = $r['name'];
}
$plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('is_radius', 0)->where('type', 'PPPOE')->find_many();
$plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where_in('routers', $rs)->where('is_radius', 0)->where('type', 'Hotspot')->find_many();
}
} else {
$radius_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'PPPOE')->find_many();
$radius_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 1)->where('type', 'Hotspot')->find_many();
$routers = ORM::for_table('tbl_routers')->find_many();
$plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 0)->where('type', 'PPPOE')->find_many();
$plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 0)->where('type', 'Hotspot')->find_many();
}
$plans_balance = ORM::for_table('tbl_plans')->where('enabled', '1')->where('type', 'Balance')->find_many();
$ui->assign('routers', $routers);
$ui->assign('radius_pppoe', $radius_pppoe);
$ui->assign('radius_hotspot', $radius_hotspot);
$ui->assign('plans_pppoe', $plans_pppoe);
$ui->assign('plans_hotspot', $plans_hotspot);
$ui->assign('plans_balance', $plans_balance);
run_hook('customer_view_order_plan'); #HOOK
$ui->display('user-orderPlan.tpl');
break;
$routers = ORM::for_table('tbl_routers')->find_many();
$plans_pppoe = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 0)->where('type', 'PPPOE')->find_many();
$plans_hotspot = ORM::for_table('tbl_plans')->where('enabled', '1')->where('is_radius', 0)->where('type', 'Hotspot')->find_many();
}
$ui->assign('routers', $routers);
$ui->assign('radius_pppoe', $radius_pppoe);
$ui->assign('radius_hotspot', $radius_hotspot);
$ui->assign('plans_pppoe', $plans_pppoe);
$ui->assign('plans_hotspot', $plans_hotspot);
run_hook('customer_view_order_plan'); #HOOK
$ui->display('user-orderPlan.tpl');
break;
case 'unpaid':
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)
->find_one();
run_hook('customer_find_unpaid'); #HOOK
run_hook('custome
r_find_unpaid'); #HOOK
if ($d) {
if (empty($d['pg_url_payment'])) {
r2(U . "order/buy/" . $trx['routers_id'] . '/' . $trx['plan_id'], 'w', Lang::T("Checking payment"));

View File

@ -12,7 +12,19 @@ $action = $routes['1'];
$admin = Admin::_info();
$ui->assign('_admin', $admin);
if(strpos($action,"-post")===false){
if(strpos($action,"-reset")!==false){
$action = str_replace("-reset","",$action);
$path = "pages/".str_replace(".","",$action).".html";
$temp = "pages_template/".str_replace(".","",$action).".html";
if(file_exists($temp)){
if(!copy($temp, $path)){
file_put_contents($path, Http::getData('https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/pages_template/'.$action.'.html'));
}
}else{
file_put_contents($path, Http::getData('https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/pages_template/'.$action.'.html'));
}
r2(U . 'pages/'.$action);
}else if(strpos($action,"-post")===false){
$path = "pages/".str_replace(".","",$action).".html";
//echo $path;
run_hook('view_edit_pages'); #HOOK

View File

@ -24,10 +24,10 @@ switch ($action) {
$name = _post('name');
if ($name != '') {
$paginator = Paginator::bootstrap('tbl_pool', 'pool_name', '%' . $name . '%');
$paginator = Paginator::build(ORM::for_table('tbl_pool'), ['pool_name' => '%' . $name . '%'], $name);
$d = ORM::for_table('tbl_pool')->where_like('pool_name', '%' . $name . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_pool');
$paginator = Paginator::build(ORM::for_table('tbl_pool'));
$d = ORM::for_table('tbl_pool')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
@ -62,11 +62,11 @@ switch ($action) {
$d = ORM::for_table('tbl_pool')->find_one($id);
if ($d) {
if ($d['routers'] != 'radius') {
try{
try {
$mikrotik = Mikrotik::info($d['routers']);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removePool($client, $d['pool_name']);
}catch(Exception $e){
} catch (Exception $e) {
//ignore exception, it means router has already deleted
}
}

View File

@ -1,4 +1,5 @@
<?php
/**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
* by https://t.me/ibnux
@ -49,9 +50,9 @@ switch ($action) {
}
$p = ORM::for_table('tbl_plans')->findOne($plan['plan_id']);
$c = ORM::for_table('tbl_customers')->findOne($plan['customer_id']);
if($plan['routers'] == 'radius'){
Radius::customerAddPlan($c, $p, $plan['expiration'].' '.$plan['time']);
}else{
if ($plan['routers'] == 'radius') {
Radius::customerAddPlan($c, $p, $plan['expiration'] . ' ' . $plan['time']);
} else {
if ($plan['type'] == 'Hotspot') {
Mikrotik::addHotspotUser($client, $p, $c);
} else if ($plan['type'] == 'PPPOE') {
@ -66,10 +67,10 @@ switch ($action) {
$ui->assign('_title', $_L['Customers']);
$username = _post('username');
if ($username != '') {
$paginator = Paginator::bootstrap('tbl_user_recharges', 'username', '%' . $username . '%');
$paginator = Paginator::build(ORM::for_table('tbl_user_recharges'), ['username' => '%' . $username . '%'], $username);
$d = ORM::for_table('tbl_user_recharges')->where_like('username', '%' . $username . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_user_recharges');
$paginator = Paginator::build(ORM::for_table('tbl_user_recharges'));
$d = ORM::for_table('tbl_user_recharges')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
@ -136,12 +137,31 @@ switch ($action) {
}
break;
case 'view':
$id = $routes['2'];
$d = ORM::for_table('tbl_transactions')->where('id', $id)->find_one();
$ui->assign('in', $d);
if (!empty($routes['3']) && $routes['3'] == 'send') {
$c = ORM::for_table('tbl_customers')->where('username', $d['username'])->find_one();
if ($c) {
Message::sendInvoice($c, $d);
r2(U . 'prepaid/view/' . $id, 's', "Success send to customer");
}
r2(U . 'prepaid/view/' . $id, 'd', "Customer not found");
}
$ui->assign('_title', 'View Invoice');
$ui->assign('date', Lang::dateAndTimeFormat($d['recharged_on'], $d['recharged_time']));
$ui->display('invoice.tpl');
break;
case 'print':
$id = _post('id');
$d = ORM::for_table('tbl_transactions')->where('id', $id)->find_one();
$ui->assign('d', $d);
$ui->assign('date', date("Y-m-d H:i:s"));
$ui->assign('date', Lang::dateAndTimeFormat($d['recharged_on'], $d['recharged_time']));
run_hook('print_invoice'); #HOOK
$ui->display('invoice-print.tpl');
break;
@ -222,7 +242,7 @@ switch ($action) {
$code = _post('code');
if ($code != '') {
$ui->assign('code', $code);
$paginator = Paginator::bootstrap('tbl_voucher', 'code', '%' . $code . '%');
$paginator = Paginator::build(ORM::for_table('tbl_voucher'), ['code' => '%' . $code . '%'], $code);
$d = ORM::for_table('tbl_plans')->where('enabled', '1')
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
->where_like('tbl_voucher.code', '%' . $code . '%')
@ -230,7 +250,7 @@ switch ($action) {
->limit($paginator['limit'])
->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_voucher');
$paginator = Paginator::build(ORM::for_table('tbl_voucher'));
$d = ORM::for_table('tbl_plans')->where('enabled', '1')
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
->offset($paginator['startpoint'])
@ -261,10 +281,16 @@ switch ($action) {
$planid = _post('planid');
$pagebreak = _post('pagebreak');
$limit = _post('limit');
if ($pagebreak < 1) $pagebreak = 6;
$vpl = _post('vpl');
if (empty($vpl)) {
$vpl = 3;
}
if ($pagebreak < 1) $pagebreak = 12;
if ($limit < 1) $limit = $pagebreak * 2;
if (empty($from_id)) {
$from_id = 0;
}
if ($from_id > 0 && $planid > 0) {
$v = ORM::for_table('tbl_plans')
@ -315,9 +341,12 @@ switch ($action) {
->where('tbl_voucher.status', '0')
->count();
}
$template = file_get_contents("pages/Voucher.html");
$template = str_replace('[[company_name]]', $config['CompanyName'], $template);
$ui->assign('_title', $_L['Voucher_Hotspot']);
$ui->assign('from_id', $from_id);
$ui->assign('vpl', $vpl);
$ui->assign('pagebreak', $pagebreak);
$plans = ORM::for_table('tbl_plans')->find_many();
@ -325,7 +354,20 @@ switch ($action) {
$ui->assign('limit', $limit);
$ui->assign('planid', $planid);
$ui->assign('v', $v);
$voucher = [];
$n = 1;
foreach ($v as $vs) {
$temp = $template;
$temp = str_replace('[[qrcode]]', '<img src="qrcode/?data=' . $vs['code'] . '">', $temp);
$temp = str_replace('[[price]]', Lang::moneyFormat($vs['price']), $temp);
$temp = str_replace('[[voucher_code]]', $vs['code'], $temp);
$temp = str_replace('[[plan]]', $vs['name_plan'], $temp);
$temp = str_replace('[[counter]]', $n, $temp);
$voucher[] = $temp;
$n++;
}
$ui->assign('voucher', $voucher);
$ui->assign('vc', $vc);
//for counting pagebreak
@ -354,7 +396,11 @@ switch ($action) {
run_hook('create_voucher'); #HOOK
for ($i = 0; $i < $numbervoucher; $i++) {
$code = strtoupper(substr(md5(time() . rand(10000, 99999)), 0, $lengthcode));
//TODO: IMPLEMENT Voucher Generator
if ($config['voucher_format'] == 'low') {
$code = strtolower($code);
} else if ($config['voucher_format'] == 'rand') {
$code = Lang::randomUpLowCase($code);
}
$d = ORM::for_table('tbl_voucher')->create();
$d->type = $type;
$d->routers = $server;

View File

@ -21,6 +21,7 @@ switch ($action) {
case 'nas-add':
$ui->assign('_system_menu', 'network');
$ui->assign('_title', "Network Access Server");
$ui->assign('routers', ORM::for_table('tbl_routers')->find_many());
$ui->display('radius-nas-add.tpl');
break;
case 'nas-add-post':
@ -32,6 +33,7 @@ switch ($action) {
$server = _post('server', null);
$community = _post('community', null);
$description = _post('description');
$routers = _post('routers');
$msg = '';
if (Validator::Length($shortname, 30, 2) == false) {
@ -54,7 +56,7 @@ switch ($action) {
$msg .= 'NAS IP Exists<br>';
}
if ($msg == '') {
$id = Radius::nasAdd($shortname, $nasname, $ports, $secret, $description, $type, $server, $community);
$id = Radius::nasAdd($shortname, $nasname, $ports, $secret, $routers, $description, $type, $server, $community);
if ($id > 0) {
r2(U . 'radius/nas-list/', 's', "NAS Added");
} else {
@ -74,6 +76,7 @@ switch ($action) {
$d = ORM::for_table('nas', 'radius')->where_equal('shortname', _get('name'))->find_one();
}
if ($d) {
$ui->assign('routers', ORM::for_table('tbl_routers')->find_many());
$ui->assign('d', $d);
$ui->display('radius-nas-edit.tpl');
} else {
@ -91,6 +94,7 @@ switch ($action) {
$server = _post('server', null);
$community = _post('community', null);
$description = _post('description');
$routers = _post('routers');
$msg = '';
if (Validator::Length($shortname, 30, 2) == false) {
@ -109,7 +113,7 @@ switch ($action) {
$type = null;
}
if ($msg == '') {
if (Radius::nasUpdate($id, $shortname, $nasname, $ports, $secret, $description, $type, $server, $community)) {
if (Radius::nasUpdate($id, $shortname, $nasname, $ports, $secret, $routers, $description, $type, $server, $community)) {
r2(U . 'radius/list/', 's', "NAS Saved");
} else {
r2(U . 'radius/nas-add', 'e', 'NAS NOT Exists');
@ -131,10 +135,22 @@ switch ($action) {
$ui->assign('_title', "Network Access Server");
$name = _post('name');
if (empty($name)) {
$nas = Radius::nasList();
$paginator = Paginator::build(ORM::for_table('nas', 'radius'));
$nas = ORM::for_table('nas', 'radius')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
} else {
$nas = Radius::nasList($name);
$paginator = Paginator::build(ORM::for_table('nas', 'radius'), [
'nasname' => '%'.$search.'%',
'shortname' => '%'.$search.'%',
'description' => '%'.$search.'%'
]);
$nas = ORM::for_table('nas', 'radius')
->where_like('nasname', $search)
->where_like('shortname', $search)
->where_like('description', $search)
->offset($paginator['startpoint'])->limit($paginator['limit'])
->find_many();
}
$ui->assign('paginator', $paginator);
$ui->assign('name', $name);
$ui->assign('nas', $nas);
$ui->display('radius-nas.tpl');

View File

@ -59,11 +59,8 @@ switch ($do) {
$ui->assign('address', $address);
$ui->assign('email', $email);
$ui->assign('phonenumber', $phonenumber);
$ui->assign('notify', '<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>Verification code is Wrong</div></div>');
$ui->assign('notify', 'Wrong Verification code');
$ui->assign('notify_t', 'd');
$ui->display('register-otp.tpl');
exit();
}else{
@ -95,11 +92,8 @@ switch ($do) {
$ui->assign('address', $address);
$ui->assign('email', $email);
$ui->assign('phonenumber', $phonenumber);
$ui->assign('notify', '<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>Failed to register</div></div>');
$ui->assign('notify', 'Failed to register');
$ui->assign('notify_t', 'd');
run_hook('view_otp_register'); #HOOK
$ui->display('register-rotp.tpl');
}
@ -109,11 +103,8 @@ switch ($do) {
$ui->assign('address', $address);
$ui->assign('email', $email);
$ui->assign('phonenumber', $phonenumber);
$ui->assign('notify', '<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>' . $msg . '</div></div>');
$ui->assign('notify', $msg);
$ui->assign('notify_t', 'd');
$ui->display('register.tpl');
}
break;
@ -134,22 +125,16 @@ switch ($do) {
//expired 10 minutes
if(file_exists($otpPath) && time()-filemtime($otpPath)<1200){
$ui->assign('username', $username);
$ui->assign('notify', '<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>Please wait '.(1200-(time()-filemtime($otpPath))).' seconds before sending another SMS</div></div>');
$ui->assign('notify', 'Please wait '.(1200-(time()-filemtime($otpPath))).' seconds before sending another SMS');
$ui->assign('notify_t', 'd');
$ui->display('register-otp.tpl');
}else{
$otp = rand(100000,999999);
file_put_contents($otpPath, $otp);
Message::sendSMS($username,$config['CompanyName']."\nYour Verification code are: $otp");
$ui->assign('username', $username);
$ui->assign('notify', '<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>Verification code has been sent to your phone</div></div>');
$ui->assign('notify', 'Verification code has been sent to your phone');
$ui->assign('notify_t', 's');
$ui->display('register-otp.tpl');
}
}else{

View File

@ -1,4 +1,5 @@
<?php
/**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
* by https://t.me/ibnux
@ -12,8 +13,8 @@ $action = $routes['1'];
$admin = Admin::_info();
$ui->assign('_admin', $admin);
if($admin['user_type'] != 'Admin' AND $admin['user_type'] != 'Sales'){
r2(U."dashboard",'e',$_L['Do_Not_Access']);
if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
}
$mdate = date('Y-m-d');
@ -26,24 +27,44 @@ $month_n = date('n');
switch ($action) {
case 'by-date':
case 'daily-report':
$paginator = Paginator::bootstrap('tbl_transactions','recharged_on',$mdate);
$d = ORM::for_table('tbl_transactions')->where('recharged_on',$mdate)->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
$dr = ORM::for_table('tbl_transactions')->where('recharged_on',$mdate)->sum('price');
case 'activation':
$q = (_post('q') ? _post('q') : _get('q'));
$keep = _post('keep');
if (!empty($keep)) {
ORM::raw_execute("DELETE FROM tbl_transactions WHERE date < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL $keep DAY))");
r2(U . "logs/list/", 's', "Delete logs older than $keep days");
}
if ($q != '') {
$paginator = Paginator::build(ORM::for_table('tbl_transactions'), ['invoice' => '%' . $q . '%'], $q);
$d = ORM::for_table('tbl_transactions')->where_like('invoice', '%' . $q . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
} else {
$paginator = Paginator::build(ORM::for_table('tbl_transactions'));
$d = ORM::for_table('tbl_transactions')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
$ui->assign('d',$d);
$ui->assign('dr',$dr);
$ui->assign('mdate',$mdate);
$ui->assign('mtime',$mtime);
$ui->assign('paginator',$paginator);
$ui->assign('activation', $d);
$ui->assign('q', $q);
$ui->assign('paginator', $paginator);
$ui->display('reports-activation.tpl');
break;
case 'daily-report':
$paginator = Paginator::build(ORM::for_table('tbl_transactions'), ['recharged_on' => $mdate]);
$d = ORM::for_table('tbl_transactions')->where('recharged_on', $mdate)->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
$dr = ORM::for_table('tbl_transactions')->where('recharged_on', $mdate)->sum('price');
$ui->assign('d', $d);
$ui->assign('dr', $dr);
$ui->assign('mdate', $mdate);
$ui->assign('mtime', $mtime);
$ui->assign('paginator', $paginator);
run_hook('view_daily_reports'); #HOOK
$ui->display('reports-daily.tpl');
break;
case 'by-period':
$ui->assign('mdate',$mdate);
$ui->assign('mtime',$mtime);
$ui->assign('tdate', $tdate);
$ui->assign('mdate', $mdate);
$ui->assign('mtime', $mtime);
$ui->assign('tdate', $tdate);
run_hook('view_reports_by_period'); #HOOK
$ui->display('reports-period.tpl');
break;
@ -54,33 +75,33 @@ switch ($action) {
$stype = _post('stype');
$d = ORM::for_table('tbl_transactions');
if ($stype != ''){
$d->where('type', $stype);
}
if ($stype != '') {
$d->where('type', $stype);
}
$d->where_gte('recharged_on', $fdate);
$d->where_lte('recharged_on', $tdate);
$d->order_by_desc('id');
$x = $d->find_many();
$dr = ORM::for_table('tbl_transactions');
if ($stype != ''){
$dr->where('type', $stype);
}
$dr = ORM::for_table('tbl_transactions');
if ($stype != '') {
$dr->where('type', $stype);
}
$dr->where_gte('recharged_on', $fdate);
$dr->where_lte('recharged_on', $tdate);
$xy = $dr->sum('price');
$xy = $dr->sum('price');
$ui->assign('d',$x);
$ui->assign('dr',$xy);
$ui->assign('fdate',$fdate);
$ui->assign('tdate',$tdate);
$ui->assign('stype',$stype);
$ui->assign('d', $x);
$ui->assign('dr', $xy);
$ui->assign('fdate', $fdate);
$ui->assign('tdate', $tdate);
$ui->assign('stype', $stype);
run_hook('view_reports_period'); #HOOK
$ui->display('reports-period-view.tpl');
break;
default:
$ui->display('a404.tpl');
}
}

View File

@ -27,10 +27,10 @@ switch ($action) {
$name = _post('name');
if ($name != '') {
$paginator = Paginator::bootstrap('tbl_routers', 'name', '%' . $name . '%');
$paginator = Paginator::build(ORM::for_table('tbl_routers'), ['name' => '%' . $name . '%'], $name);
$d = ORM::for_table('tbl_routers')->where_like('name', '%' . $name . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_routers');
$paginator = Paginator::build(ORM::for_table('tbl_routers'));
$d = ORM::for_table('tbl_routers')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}

View File

@ -120,10 +120,10 @@ switch ($action) {
$name = _post('name');
if ($name != '') {
$paginator = Paginator::bootstrap('tbl_plans', 'name_plan', '%' . $name . '%', 'type', 'Hotspot');
$paginator = Paginator::build(ORM::for_table('tbl_plans'), ['name_plan' => '%' . $name . '%', 'type' => 'Hotspot'], $name);
$d = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'Hotspot')->where_like('tbl_plans.name_plan', '%' . $name . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_plans', 'type', 'Hotspot');
$paginator = Paginator::build(ORM::for_table('tbl_plans'), ['type' => 'Hotspot']);
$d = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'Hotspot')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
}
@ -167,11 +167,11 @@ switch ($action) {
if ($d['is_radius']) {
Radius::planDelete($d['id']);
} else {
try{
try {
$mikrotik = Mikrotik::info($d['routers']);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotPlan($client, $d['name_plan']);
}catch(Exception $e){
} catch (Exception $e) {
//ignore exception, it means router has already deleted
}
}
@ -377,10 +377,10 @@ switch ($action) {
$name = _post('name');
if ($name != '') {
$paginator = Paginator::bootstrap('tbl_plans', 'name_plan', '%' . $name . '%', 'type', 'Hotspot');
$paginator = Paginator::build(ORM::for_table('tbl_plans'), ['name_plan' => '%' . $name . '%', 'type' => 'PPPOE'], $name);
$d = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'PPPOE')->where_like('tbl_plans.name_plan', '%' . $name . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_plans', 'type', 'Hotspot');
$paginator = Paginator::build(ORM::for_table('tbl_plans'), ['type' => 'PPPOE'], $name);
$d = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'PPPOE')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
}
@ -431,11 +431,11 @@ switch ($action) {
if ($d['is_radius']) {
Radius::planDelete($d['id']);
} else {
try{
try {
$mikrotik = Mikrotik::info($d['routers']);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removePpoePlan($client, $d['name_plan']);
}catch(Exception $e){
} catch (Exception $e) {
//ignore exception, it means router has already deleted
}
}
@ -613,10 +613,10 @@ switch ($action) {
$ui->assign('_title', Lang::T('Balance Plans'));
$name = _post('name');
if ($name != '') {
$paginator = Paginator::bootstrap('tbl_plans', 'name_plan', '%' . $name . '%', 'type', 'Balance');
$paginator = Paginator::build(ORM::for_table('tbl_plans'), ['name_plan' => '%' . $name . '%', 'type' => 'Balance'], $name);
$d = ORM::for_table('tbl_plans')->where('tbl_plans.type', 'Balance')->where_like('tbl_plans.name_plan', '%' . $name . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_plans', 'type', 'Hotspot');
$paginator = Paginator::build(ORM::for_table('tbl_plans'), ['type' => 'Balance'], $name);
$d = ORM::for_table('tbl_plans')->where('tbl_plans.type', 'Balance')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
}

View File

@ -1,4 +1,5 @@
<?php
/**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
* by https://t.me/ibnux
@ -22,11 +23,11 @@ switch ($action) {
$logo = 'system/uploads/logo.default.png';
}
$ui->assign('logo', $logo);
if(empty($_c['radius_client'])){
try{
if (empty($_c['radius_client'])) {
try {
$_c['radius_client'] = Radius::getClient();
$ui->assign('_c', $_c);
}catch(Exception $e){
} catch (Exception $e) {
//ignore
}
}
@ -38,11 +39,11 @@ switch ($action) {
}
}
$php = trim(shell_exec('which php'));
if(empty($php)){
if (empty($php)) {
$php = 'php';
}
$ui->assign('php', $php);
$ui->assign('dir', str_replace('controllers','', __DIR__));
$ui->assign('dir', str_replace('controllers', '', __DIR__));
$ui->assign('themes', $themes);
run_hook('view_app_settings'); #HOOK
$ui->display('app-settings.tpl');
@ -76,10 +77,10 @@ switch ($action) {
$username = _post('username');
if ($username != '') {
$paginator = Paginator::bootstrap('tbl_users', 'username', '%' . $username . '%');
$paginator = Paginator::build(ORM::for_table('tbl_users'), ['username' => '%' . $username . '%'], $username);
$d = ORM::for_table('tbl_users')->where_like('username', '%' . $username . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_asc('id')->find_many();
} else {
$paginator = Paginator::bootstrap('tbl_users');
$paginator = Paginator::build(ORM::for_table('tbl_users'));
$d = ORM::for_table('tbl_users')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_asc('id')->find_many();
}
@ -256,15 +257,16 @@ switch ($action) {
$radius_enable = _post('radius_enable');
$radius_client = _post('radius_client');
$theme = _post('theme');
$voucher_format = _post('voucher_format');
run_hook('save_settings'); #HOOK
if (!empty($_FILES['logo']['name'])) {
if(function_exists('imagecreatetruecolor')){
if (function_exists('imagecreatetruecolor')) {
if (file_exists('system/uploads/logo.png')) unlink('system/uploads/logo.png');
File::resizeCropImage($_FILES['logo']['tmp_name'], 'system/uploads/logo.png', 1078, 200, 100);
if (file_exists($_FILES['logo']['tmp_name'])) unlink($_FILES['logo']['tmp_name']);
}else{
} else {
r2(U . 'settings/app', 'e', 'PHP GD is not installed');
}
}
@ -330,6 +332,16 @@ switch ($action) {
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'voucher_format')->find_one();
if ($d) {
$d->value = $voucher_format;
$d->save();
} else {
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'voucher_format';
$d->value = $voucher_format;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'disable_voucher')->find_one();
if ($d) {
$d->value = $disable_voucher;

View File

@ -42,7 +42,7 @@ switch ($action) {
case 'list-activated':
$ui->assign('_system_menu', 'list-activated');
$paginator = Paginator::bootstrap('tbl_transactions', 'username', $user['username']);
$paginator = Paginator::build(ORM::for_table('tbl_transactions'), ['username' => $user['username']]);
$d = ORM::for_table('tbl_transactions')->where('username', $user['username'])->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
$ui->assign('d', $d);

View File

@ -35,6 +35,18 @@ if (php_sapi_name() !== 'cli') {
echo "<pre>";
}
if(!file_exists('../config.php')){
die("config.php file not found");
}
if(!file_exists('orm.php')){
die("orm.php file not found");
}
if(!file_exists('uploads/notifications.default.json')){
die("uploads/notifications.default.json file not found");
}
require_once '../config.php';
require_once 'orm.php';
@ -103,7 +115,7 @@ foreach ($d as $ds) {
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
if ($p['is_radius']) {
if (!empty($p['pool_expired'])) {
if (empty($p['pool_expired'])) {
print_r(Radius::customerDeactivate($c['username']));
} else {
Radius::upsertCustomerAttr($c['username'], 'Framed-Pool', $plan['pool_expired'], ':=');
@ -117,8 +129,8 @@ foreach ($d as $ds) {
Mikrotik::removeHotspotUser($client, $c['username']);
}
Mikrotik::removeHotspotActiveUser($client, $c['username']);
Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $textExpired, $config['user_notification_expired']);
}
Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $textExpired, $config['user_notification_expired']);
//update database user dengan status off
$u->status = 'off';
$u->save();
@ -157,7 +169,7 @@ foreach ($d as $ds) {
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
if ($p['is_radius']) {
if (!empty($p['pool_expired'])) {
if (empty($p['pool_expired'])) {
print_r(Radius::customerDeactivate($c['username']));
} else {
Radius::upsertCustomerAttr($c['username'], 'Framed-Pool', $plan['pool_expired'], ':=');
@ -171,8 +183,8 @@ foreach ($d as $ds) {
Mikrotik::removePpoeUser($client, $c['username']);
}
Mikrotik::removePpoeActive($client, $c['username']);
Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $textExpired, $config['user_notification_expired']);
}
Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $textExpired, $config['user_notification_expired']);
$u->status = 'off';
$u->save();

View File

@ -35,6 +35,19 @@ if(php_sapi_name() !== 'cli'){
echo "<pre>";
}
if(!file_exists('../config.php')){
die("config.php file not found");
}
if(!file_exists('orm.php')){
die("orm.php file not found");
}
if(!file_exists('uploads/notifications.default.json')){
die("uploads/notifications.default.json file not found");
}
require_once '../config.php';
require_once 'orm.php';
require_once 'autoload/PEAR2/Autoload.php';

View File

@ -355,7 +355,7 @@ $_L['Invoice_Balance_Message'] = 'Invoice Balance Message';
$_L['Invoice_Notification_Payment'] = 'Invoice Notification Payment';
$_L['Balance_Notification_Payment'] = 'Balance Notification Payment';
$_L['Balance_Plans'] = 'Balance Plans';
$_L['Buy_Balance'] = 'Buy Balance?';
$_L['Buy_Balance'] = 'Buy Balance';
$_L['Price'] = 'Price';
$_L['Validity'] = 'Validity';
$_L['Disable_auto_renewal'] = 'Disable auto renewal?';
@ -403,6 +403,8 @@ $_L['Deactivate'] = 'Deactivate';
$_L['Sync'] = 'Sync';
$_L['Failed_to_create_PaymeTrust_transaction'] = 'Failed to create PaymeTrust transaction.';
$_L['Location'] = 'Location';
$_L['Radius_Plans'] = 'Radius Plans';
$_L['Change_title_in_user_Plan_order'] = 'Change title in user Plan order';
$_L['Logs'] = 'Logs';
$_L['Radius_Plans'] = 'Radius Plans';
$_L['Change_title_in_user_Plan_order'] = 'Change title in user Plan order';
$_L['Logs'] = 'Logs';
$_L['Voucher_Format'] = 'Voucher Format';
$_L['Resend_To_Customer'] = 'Resend To Customer';

View File

@ -355,7 +355,7 @@ $_L['User_Cannot_change_this_only_admin_if_it_Empty_it_will_use_user_password']
$_L['Invoice_Balance_Message'] = 'Invoice Balance Message';
$_L['Invoice_Notification_Payment'] = 'Invoice Notification Payment';
$_L['Balance_Notification_Payment'] = 'Balance Notification Payment';
$_L['Buy_Balance'] = 'Buy Balance?';
$_L['Buy_Balance'] = 'Buy Balance';
$_L['Price'] = 'Price';
$_L['Validity'] = 'Validity';
$_L['Disable_auto_renewal'] = 'Disable auto renewal?';
@ -398,3 +398,4 @@ $_L['Deactivate'] = 'Deactivate';
$_L['Sync'] = 'Sync';
$_L['Failed_to_create_PaymeTrust_transaction'] = 'Failed to create PaymeTrust transaction.';
$_L['Location'] = 'Location';
$_L['Voucher_Format'] = 'Voucher Format';

View File

@ -354,7 +354,7 @@ $_L['User_Cannot_change_this_only_admin_if_it_Empty_it_will_use_user_password']
$_L['Invoice_Balance_Message'] = 'Invoice Balance Message';
$_L['Invoice_Notification_Payment'] = 'Invoice Notification Payment';
$_L['Balance_Notification_Payment'] = 'Balance Notification Payment';
$_L['Buy_Balance'] = 'Buy Balance?';
$_L['Buy_Balance'] = 'Buy Balance';
$_L['Price'] = 'Price';
$_L['Validity'] = 'Validity';
$_L['Disable_auto_renewal'] = 'Disable auto renewal?';
@ -401,3 +401,4 @@ $_L['Deactivate'] = 'Deactivate';
$_L['Sync'] = 'Sync';
$_L['Failed_to_create_PaymeTrust_transaction'] = 'Failed to create PaymeTrust transaction.';
$_L['Location'] = 'Location';
$_L['Voucher_Format'] = 'Voucher Format';

View File

@ -330,7 +330,7 @@ $_L['Invoice_Balance_Message'] = 'Invoice Balance Message';
$_L['Invoice_Notification_Payment'] = 'Invoice Notification Payment';
$_L['Balance_Notification_Payment'] = 'Balance Notification Payment';
$_L['Balance_Plans'] = 'Balance Plans';
$_L['Buy_Balance'] = 'Buy Balance?';
$_L['Buy_Balance'] = 'Buy Balance';
$_L['Price'] = 'Price';
$_L['Validity'] = 'Validity';
$_L['Disable_auto_renewal'] = 'Disable auto renewal?';
@ -378,3 +378,4 @@ $_L['Deactivate'] = 'Deactivate';
$_L['Sync'] = 'Sync';
$_L['Failed_to_create_PaymeTrust_transaction'] = 'Failed to create PaymeTrust transaction.';
$_L['Location'] = 'Location';
$_L['Voucher_Format'] = 'Voucher Format';

View File

@ -32,5 +32,8 @@
],
"2023.10.1" : [
"ALTER TABLE `tbl_plans` ADD `is_radius` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '1 is radius' AFTER `routers`; "
],
"2023.10.24" : [
"ALTER TABLE `nas` ADD `routers` VARCHAR(32) NOT NULL DEFAULT '' AFTER `description`;"
]
}

View File

@ -54,17 +54,37 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Theme</label>
<div class="col-md-6">
<select name="theme" id="theme" class="form-control">
<option value="default" {if $_c['theme'] eq 'default'}selected="selected" {/if}>Default</option>
{foreach $themes as $theme}
<option value="{$theme}" {if $_c['theme'] eq $theme}selected="selected" {/if}>{Lang::ucWords($theme)}</option>
{/foreach}
</select>
</div>
<p class="help-block col-md-4"><a href="https://github.com/hotspotbilling/phpnuxbill/wiki/Themes" target="_blank">Theme info</a></p>
<label class="col-md-2 control-label">Theme</label>
<div class="col-md-6">
<select name="theme" id="theme" class="form-control">
<option value="default" {if $_c['theme'] eq 'default'}selected="selected" {/if}>Default
</option>
{foreach $themes as $theme}
<option value="{$theme}" {if $_c['theme'] eq $theme}selected="selected" {/if}>
{Lang::ucWords($theme)}</option>
{/foreach}
</select>
</div>
<p class="help-block col-md-4"><a
href="https://github.com/hotspotbilling/phpnuxbill/wiki/Themes" target="_blank">Theme
info</a></p>
</div>
<div class="form-group">
<label class="col-md-2 control-label">APP URL</label>
<div class="col-md-6">
<input type="text" readonly class="form-control" value="{$app_url}">
</div>
<p class="help-block col-md-4">edit at config.php</p>
</div>
</div>
<div class="panel-heading">
<div class="btn-group pull-right">
<button class="btn btn-primary btn-xs" title="save" type="submit"><span
class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span></button>
</div>
Voucher
</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Disable Voucher')}</label>
<div class="col-md-6">
@ -78,24 +98,44 @@
<p class="help-block col-md-4">{Lang::T('Voucher activation menu will be hidden')}</p>
</div>
<div class="form-group">
<label class="col-md-2 control-label">APP URL</label>
<label class="col-md-2 control-label">{Lang::T('Voucher Format')}</label>
<div class="col-md-6">
<input type="text" readonly class="form-control" value="{$app_url}">
<select name="voucher_format" id="voucher_format" class="form-control">
<option value="up" {if $_c['voucher_format'] == 'up'}selected="selected" {/if}>UPPERCASE
</option>
<option value="low" {if $_c['voucher_format'] == 'low'}selected="selected" {/if}>
lowercase
</option>
<option value="rand" {if $_c['voucher_format'] == 'rand'}selected="selected" {/if}>
RaNdoM
</option>
</select>
</div>
<p class="help-block col-md-4">edit at config.php</p>
<p class="help-block col-md-4">UPPERCASE lowercase RaNdoM</p>
</div>
</div>
<div class="panel-heading">
<div class="btn-group pull-right">
<button class="btn btn-primary btn-xs" title="save" type="submit"><span
class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span></button>
</div>
FreeRadius
</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label text-muted">Enable Radius</label>
<label class="col-md-2 control-label">Enable Radius</label>
<div class="col-md-6">
<select name="radius_enable" id="radius_enable" class="form-control text-muted">
<option value="0">No</option>
<option value="1" {if $_c['radius_enable']}selected="selected" {/if}>Yes</option>
</select>
</div>
<p class="help-block col-md-4"><a href="https://github.com/hotspotbilling/phpnuxbill/wiki/FreeRadius" target="_blank">Radius Instructions</a></p>
<p class="help-block col-md-4"><a
href="https://github.com/hotspotbilling/phpnuxbill/wiki/FreeRadius"
target="_blank">Radius Instructions</a></p>
</div>
<div class="form-group">
<label class="col-md-2 control-label text-muted">Radius Client</label>
<label class="col-md-2 control-label">Radius Client</label>
<div class="col-md-6">
<input type="text" class="form-control" name="radius_client" value="{$_c['radius_client']}">
</div>
@ -152,8 +192,8 @@
<div class="form-group">
<label class="col-md-2 control-label">Telegram Bot Token</label>
<div class="col-md-6">
<input type="password" class="form-control" id="telegram_bot" name="telegram_bot" onmouseleave="this.type = 'password'"
onmouseenter="this.type = 'text'"
<input type="password" class="form-control" id="telegram_bot" name="telegram_bot"
onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'"
value="{$_c['telegram_bot']}" placeholder="123456:asdasgdkuasghddlashdashldhalskdklasd">
</div>
</div>
@ -316,9 +356,9 @@
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Proxy Server Login')}</label>
<div class="col-md-6">
<input type="password" class="form-control" id="http_proxyauth" name="http_proxyauth" autocomplete="off"
value="{$_c['http_proxyauth']}" placeholder="username:password" onmouseleave="this.type = 'password'"
onmouseenter="this.type = 'text'">
<input type="password" class="form-control" id="http_proxyauth" name="http_proxyauth"
autocomplete="off" value="{$_c['http_proxyauth']}" placeholder="username:password"
onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'">
</div>
</div>
</div>
@ -335,14 +375,14 @@
add dst-host={$_domain}
add dst-host=*.{$_domain}</pre>
<pre>
<pre>
# Expired Cronjob Every 5 Minutes
*/5 * * * * cd {$dir} && {$php} cron.php
# Expired Cronjob Every 5 Minutes
# Expired Cronjob Every 1 Hour
0 * * * * cd {$dir} && {$php} cron.php
</pre>
<pre>
<pre>
# Reminder Cronjob Every 7 AM
0 7 * * * cd {$dir} && {$php} reminder.php
</pre>

View File

@ -124,6 +124,7 @@
{if Lang::arrayCount($activation)}
<thead>
<tr>
<th>{$_L['Invoice']}</th>
<th>{$_L['Username']}</th>
<th>{$_L['Plan_Name']}</th>
<th>{$_L['Plan_Price']}</th>
@ -135,7 +136,8 @@
</thead>
<tbody>
{foreach $activation as $ds}
<tr>
<tr onclick="window.location.href = '{$_url}prepaid/view/{$ds['id']}'" style="cursor:pointer;">
<td>{$ds['invoice']}</td>
<td>{$ds['username']}</td>
<td>{$ds['plan_name']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td>

View File

@ -149,7 +149,7 @@
$.getJSON("./version.json?" + Math.random(), function(data) {
var localVersion = data.version;
$('#version').html('Version: ' + localVersion);
$.getJSON("https://raw.githubusercontent.com/ibnux/phpnuxbill/master/version.json?" + Math
$.getJSON("https://raw.githubusercontent.com/hotspotbilling/phpnuxbill/master/version.json?" + Math
.random(),
function(data) {
var latestVersion = data.version;

View File

@ -1,9 +1,9 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-md-6 col-sm-12">
<div class="col-md-6 col-sm-12 col-md-offset-3">
<div class="panel panel-hovered panel-primary panel-stacked mb30">
<div class="panel-heading">PRINT INVOICE</div>
<div class="panel-heading">{$in['invoice']}</div>
<div class="panel-body">
<div class="well">
<fieldset>
@ -19,6 +19,7 @@
{$_L['Type']} : <b>{$in['type']}</b><br>
{$_L['Plan_Name']} : <b>{$in['plan_name']}</b><br>
{$_L['Plan_Price']} : <b>{Lang::moneyFormat($in['price'])}</b><br>
{$in['method']}<br>
<br>
{$_L['Username']} : <b>{$in['username']}</b><br>
{$_L['Password']} : **********<br>
@ -33,10 +34,12 @@
</div>
<form class="form-horizontal" method="post" action="{$_url}prepaid/print" target="_blank">
<input type="hidden" name="id" value="{$in['id']}">
<a href="{$_url}prepaid/list" class="btn btn-primary btn-sm"><i
class="ion-reply-all"></i>{$_L['Finish']}</a>
<a href="{$_url}prepaid/view/{$in['id']}/send" class="btn btn-info text-black btn-sm"><i
class="glyphicon glyphicon-envelope"></i> {Lang::T("Resend To Customer")}</a>
<button type="submit" class="btn btn-default btn-sm"><i class="fa fa-print"></i>
{$_L['Click_Here_to_Print']}</button>
<a href="{$_url}prepaid/list" class="btn btn-primary"><i
class="ion-reply-all"></i>{$_L['Finish']}</a>
</form>
</div>

View File

@ -14,7 +14,7 @@
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="name" class="form-control" value="{$name}"
<input type="text" name="q" class="form-control" value="{$q}"
placeholder="{$_L['Search_by_Name']}...">
<div class="input-group-btn">
<button class="btn btn-success" type="submit">{$_L['Search']}</button>
@ -53,16 +53,7 @@
</tbody>
</table>
</div>
<nav aria-label="...">
<ul class="pager">
{if $page > 0}
<li class="previous "><a href="{$_url}logs/radius/{$page-1}"><span
aria-hidden="true">&larr;</span> Newer</a></li>
{/if}
<li class="next"><a href="{$_url}logs/radius/{$page+1}">Older <span
aria-hidden="true">&rarr;</span></a></li>
</ul>
</nav>
{$paginator['contents']}
</div>
</div>
</div>

View File

@ -14,7 +14,7 @@
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="name" class="form-control" value="{$name}"
<input type="text" name="q" class="form-control" value="{$q}"
placeholder="{$_L['Search_by_Name']}...">
<div class="input-group-btn">
<button class="btn btn-success" type="submit">{$_L['Search']}</button>

View File

@ -2,40 +2,61 @@
<div class="row">
<div class="col-sm-12">
<div class="panel mb20 panel-primary panel-hovered">
<div class="panel-heading">{$pageHeader}</div>
<div id="myNicPanel" style="width: 100%;"></div>
<div id="panel-edit" class="panel-body">{$htmls}</div>
<div class="panel-heading">
<div class="btn-group pull-right">
<a class="btn btn-danger btn-xs" title="Reset File" href="{$_url}pages/{$PageFile}-reset" onclick="return confirm('Reset File?')"><span
class="glyphicon glyphicon-refresh" aria-hidden="true"></span></a>
</div>
{$pageHeader}
</div>
<div id="myNicPanel" style="width: 100%;"></div>
<div id="panel-edit" class="panel-body">{$htmls}</div>
{if $writeable}
<div class="panel-footer">
<a href="javascript:saveIt()" class="btn btn-primary btn-block">SAVE</a>
<br>
<p class="help-block">{$_L['Info_Page']}</p>
<input type="text" class="form-control" onclick="this.select()" readonly value="{$app_url}/pages/{$PageFile}.html">
<input type="text" class="form-control" onclick="this.select()" readonly
value="{$app_url}/pages/{$PageFile}.html">
</div>
{else}
<div class="panel-footer">
{$_L['Failed_Save_Page']}
</div>
{/if}
{if $PageFile=='Voucher'}
<div class="panel-footer">
<p class="help-block">
<b>[[company_name]]</b> Your Company Name at Settings.<br>
<b>[[price]]</b> Plan Price.<br>
<b>[[voucher_code]]</b> Voucher Code.<br>
<b>[[plan]]</b> Voucher Plan.<br>
<b>[[counter]]</b> Counter.<br>
</p>
</div>
{/if}
</div>
</div>
</div>
<form id="formpages" class="hidden" method="post" role="form" action="{$_url}pages/{$PageFile}-post" >
<form id="formpages" class="hidden" method="post" role="form" action="{$_url}pages/{$PageFile}-post">
<textarea name="html" id="html"></textarea>
</form>
<script src="ui/ui/scripts/nicEdit.js"></script>
<script type="text/javascript">
var myNicEditor
bkLib.onDomLoaded(function() {
myNicEditor = new nicEditor();
myNicEditor.setPanel('myNicPanel');
myNicEditor.addInstance('panel-edit');
});
function saveIt(){
//alert(document.getElementById('panel-edit').innerHTML);
document.getElementById('html').value = nicEditors.findEditor('panel-edit').getContent()
document.getElementById('formpages').submit();
}
</script>
{literal}
<script type="text/javascript">
var myNicEditor
bkLib.onDomLoaded(function() {
myNicEditor = new nicEditor({fullPanel : true});
myNicEditor.setPanel('myNicPanel');
myNicEditor.addInstance('panel-edit');
});
{include file="sections/footer.tpl"}
function saveIt() {
//alert(document.getElementById('panel-edit').innerHTML);
document.getElementById('html').value = nicEditors.findEditor('panel-edit').getContent()
document.getElementById('formpages').submit();
}
</script>
{/literal}
{include file="sections/footer.tpl"}

View File

@ -63,11 +63,13 @@
<form method="post" action="{$_url}prepaid/print-voucher/" class="no-print">
<table width="100%" border="0" cellspacing="0" cellpadding="1" class="btn btn-default btn-sm">
<tr>
<td>ID &gt; <input type="text" name="from_id" style="width:40px" value="{$from_id}"> limit <input
type="text" name="limit" style="width:40px" value="{$limit}"></td>
<td>From ID &gt; <input type="text" name="from_id" style="width:40px" value="{$from_id}"> limit
<input type="text" name="limit" style="width:40px" value="{$limit}"></td>
<td>Voucher PerLine <input type="text" style="width:40px" name="vpl" value="{$vpl}">
vouchers</td>
<td>PageBreak after <input type="text" style="width:40px" name="pagebreak" value="{$pagebreak}">
vouchers</td>
<td>Plans <select id="plan_id" name="planid" style="width:150px">
<td>Plans <select id="plan_id" name="planid" style="width:50px">
<option value="0">--all--</option>
{foreach $plans as $plan}
<option value="{$plan['id']}" {if $plan['id']==$planid}selected{/if}>{$plan['name_plan']}
@ -78,65 +80,31 @@
</tr>
</table>
<hr>
<center><button type="button" id="actprint"
<center><button type="button" onclick="window.print()"
class="btn btn-default btn-sm no-print">{$_L['Click_Here_to_Print']}</button><br>
{$_L['Print_Info']}<br>
show {$v|@count} vouchers from {$vc} vouchers<br>
from ID {$v[0]['id']} limit {$limit} vouchers
</center>
</form>
<div id="printable">
<div id="printable" align="center">
<hr>
{foreach $v as $vs}
{$n = 1}
{foreach $voucher as $vs}
{$jml = $jml + 1}
<table width="100%" height="200" border="0" cellspacing="0" cellpadding="1" style="margin-bottom:5px">
<tbody>
{if $n == 1}
<table>
<tr>
<td align="center" valign="middle"></td>
</tr>
<tr>
<td align="center" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="50%" valign="middle" style="padding-right:10px">
<center><strong style="font-size:38px">{$_L['Voucher_Hotspot']}</strong><span
class="no-print"> ID {$vs['id']}</span></center>
<table width="100%" border="1" cellspacing="0" cellpadding="1"
bordercolor="#757575">
<tbody>
<tr>
<td rowspan="5" width="1"><img src="qrcode/?data={$vs['code']}">
</td>
</tr>
<tr>
<td valign="middle" align="center" style="font-size:25px">
{Lang::moneyFormat($vs['price'])}</td>
</tr>
<tr>
<td valign="middle" align="center" style="font-size:20px">
{$_L['Code_Voucher']}</td>
</tr>
<tr>
<td valign="middle" align="center" style="font-size:25px">
{$vs['code']}</td>
</tr>
<tr>
<td valign="middle" align="center" style="font-size:15px">
{$vs['name_plan']}</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" style="padding-left:10px">
{include file="$_path/../pages/Voucher.html"}
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<hr>
{/if}
<td>{$vs}</td>
{if $n == $vpl}
</table>
{$n = 1}
{else}
{$n = $n + 1}
{/if}
{if $jml == $pagebreak}
{$jml = 0}
<!-- pageBreak -->

View File

@ -57,6 +57,18 @@
<p class="help-block">{Lang::T('Explain Coverage of router')}</p>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}routers/add">{$_L['Routers']}</a></label>
<div class="col-md-6">
<select id="routers" name="routers" class="form-control select2">
<option value="">No Router</option>
{foreach $routers as $rs}
<option value="{$rs['name']}">{$rs['name']}</option>
{/foreach}
</select>
</div>
<p class="help-block col-md-4">Assign NAS to Router</p>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light"

View File

@ -57,6 +57,19 @@
<p class="help-block">{Lang::T('Explain Coverage of router')}</p>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}routers/add">{$_L['Routers']}</a></label>
<div class="col-md-6">
<select id="routers" name="routers" class="form-control select2">
<option value="">No Router</option>
{foreach $routers as $rs}
<option {if $rs['name'] == $d['routers']}selected{/if} value="{$rs['name']}">{$rs['name']}</option>
{/foreach}
</select>
</div>
<p class="help-block col-md-4">Assign NAS to Router</p>
</div>
<div class="form-gro
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light"

View File

@ -38,6 +38,7 @@
<th>Port</th>
<th>Server</th>
<th>Community</th>
<th>Routers</th>
<th>{$_L['Manage']}</th>
</tr>
</thead>
@ -51,6 +52,7 @@
<td>{$ds['ports']}</td>
<td>{$ds['server']}</td>
<td>{$ds['community']}</td>
<td>{$ds['routers']}</td>
<td align="center">
<a href="{$_url}radius/nas-edit/{$ds['id']}" class="btn btn-info btn-xs">{$_L['Edit']}</a>
<a href="{$_url}radius/nas-delete/{$ds['id']}" id="{$ds['id']}"

View File

@ -22,10 +22,11 @@
<hr>
</div>
{if isset($notify)}
<div class="row">
<div class="col-md-6 col-md-offset-3">
{$notify}
</div>
<div class="alert alert-{if $notify_t == 's'}success{else}danger{/if}">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>{$notify}</div>
</div>
{/if}
<div class="row">

View File

@ -34,10 +34,11 @@
<hr>
</div>
{if isset($notify)}
<div class="row">
<div class="col-md-6 col-md-offset-3">
{$notify}
</div>
<div class="alert alert-{if $notify_t == 's'}success{else}danger{/if}">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>{$notify}</div>
</div>
{/if}
<div class="row">

View File

@ -22,10 +22,11 @@
<hr>
</div>
{if isset($notify)}
<div class="row">
<div class="col-md-6 col-md-offset-3">
{$notify}
</div>
<div class="alert alert-{if $notify_t == 's'}success{else}danger{/if}">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>{$notify}</div>
</div>
{/if}
<div class="row">

View File

@ -0,0 +1,70 @@
{include file="sections/header.tpl"}
<!-- pool -->
<div class="row">
<div class="col-sm-12">
<div class="panel panel-hovered mb20 panel-primary">
<div class="panel-heading">
Activity Log
</div>
<div class="panel-body">
<div class="text-center" style="padding: 15px">
<div class="col-md-4">
<form id="site-search" method="post" action="{$_url}reports/activation">
<div class="input-group">
<div class="input-group-addon">
<span class="fa fa-search"></span>
</div>
<input type="text" name="q" class="form-control" value="{$q}"
placeholder="{$_L['Invoice']}...">
<div class="input-group-btn">
<button class="btn btn-success" type="submit">{$_L['Search']}</button>
</div>
</div>
</form>
</div>
<div class="col-md-8">
</div>&nbsp;
</div>
<br>
<div class="table-responsive">
<table id="datatable" class="table table-bordered table-striped">
<thead>
<tr>
<th>{$_L['Invoice']}</th>
<th>{$_L['Username']}</th>
<th>{$_L['Plan_Name']}</th>
<th>{$_L['Plan_Price']}</th>
<th>{$_L['Type']}</th>
<th>{$_L['Created_On']}</th>
<th>{$_L['Expires_On']}</th>
<th>{$_L['Method']}</th>
</tr>
</thead>
<tbody>
{foreach $activation as $ds}
<tr>
<td onclick="window.location.href = '{$_url}prepaid/view/{$ds['id']}'"
style="cursor:pointer;">{$ds['invoice']}</td>
<td onclick="window.location.href = '{$_url}customers/viewu/{$ds['username']}'"
style="cursor:pointer;">{$ds['username']}</td>
<td>{$ds['plan_name']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td>
<td>{$ds['type']}</td>
<td class="text-success">
{Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])}
</td>
<td class="text-danger">{Lang::dateAndTimeFormat($ds['expiration'],$ds['time'])}</td>
<td>{$ds['method']}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{$paginator['contents']}
</div>
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View File

@ -183,6 +183,8 @@
href="{$_url}reports/daily-report">{$_L['Daily_Report']}</a></li>
<li {if $_routes[1] eq 'by-period'}class="active" {/if}><a
href="{$_url}reports/by-period">{$_L['Period_Reports']}</a></li>
<li {if $_routes[1] eq 'activation'}class="active" {/if}><a
href="{$_url}reports/activation">{Lang::T('Activation History')}</a></li>
{$_MENU_REPORTS}
</ul>
</li>
@ -301,4 +303,11 @@
</section>
<section class="content">
{if isset($notify)}{$notify}{/if}
{if isset($notify)}
<div class="alert alert-{if $notify_t == 's'}success{else}danger{/if}">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>{$notify}</div>
</div>
{/if}

View File

@ -125,6 +125,14 @@
</li>
{/if}
{if $_c['payment_gateway'] != 'none' or $_c['payment_gateway'] == '' }
{if $_c['enable_balance'] == 'yes'}
<li {if $_system_menu eq 'balance'}class="active" {/if}>
<a href="{$_url}order/balance">
<i class="ion ion-ios-cart"></i>
<span>{Lang::T('Buy Balance')}</span>
</a>
</li>
{/if}
<li {if $_system_menu eq 'package'}class="active" {/if}>
<a href="{$_url}order/package">
<i class="ion ion-ios-cart"></i>
@ -157,4 +165,12 @@
</h1>
</section>
<section class="content">
{if isset($notify)}{$notify}{/if}
{if isset($notify)}
<div class="alert alert-{if $notify_t == 's'}success{else}danger{/if}">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>{$notify}</div>
</div>
{/if}

View File

@ -21,10 +21,11 @@
<hr>
</div>
{if isset($notify)}
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
{$notify}
</div>
<div class="alert alert-{if $notify_t == 's'}success{else}danger{/if}">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<div>{$notify}</div>
</div>
{/if}
<div class="row">

View File

@ -0,0 +1,37 @@
{include file="sections/user-header.tpl"}
<!-- user-orderPlan -->
<div class="row">
<div class="col-sm-12">
{if $_c['enable_balance'] == 'yes'}
<div class="box box-solid box-success bg-gray-light">
<div class="box-header">{Lang::T('Balance Plans')}</div>
<div class="box-body row">
{foreach $plans_balance as $plan}
<div class="col col-md-4">
<div class="box box-solid box-default">
<div class="box-header text-bold">{$plan['name_plan']}</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>{Lang::T('Price')}</td>
<td>{Lang::moneyFormat($plan['price'])}</td>
</tr>
</tbody>
</table>
</div>
<div class="box-body">
<a href="{$_url}order/buy/0/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy Balance')}?')"
class="btn btn-sm btn-block btn-primary">Buy</a>
</div>
</div>
</div>
{/foreach}
</div>
</div>
{/if}
</div>
</div>
</div>
{include file="sections/user-footer.tpl"}

View File

@ -5,153 +5,125 @@
<div class="box box-solid box-default">
<div class="box-header">{Lang::T('Order Internet Package')}</div>
</div>
{if $_c['enable_balance'] == 'yes'}
<div class="box box-solid box-success bg-gray-light">
<div class="box-header">{Lang::T('Balance Plans')}</div>
<div class="box-body row">
{foreach $plans_balance as $plan}
{if $_c['radius_enable']}
{if Lang::arrayCount($radius_hotspot)>0}
<ol class="breadcrumb">
<li>{if $_c['radius_plan']==''}Radius Plan{else}{$_c['radius_plan']}{/if}</li>
<li>{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}</li>
</ol>
<div class="row">
{foreach $radius_hotspot as $plan}
<div class="col col-md-4">
<div class="box box-primary">
<div class="box-header text-bold">{$plan['name_plan']}</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>{Lang::T('Type')}</td>
<td>{$plan['type']}</td>
</tr>
<tr>
<td>{Lang::T('Price')}</td>
<td>{Lang::moneyFormat($plan['price'])}</td>
</tr>
<tr>
<td>{Lang::T('Validity')}</td>
<td>{$plan['validity']} {$plan['validity_unit']}</td>
</tr>
</tbody>
</table>
</div>
<div class="box-body">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<a href="{$_url}order/buy/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-warning text-black">Buy</a>
{if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/pay/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Pay this with Balance? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-success">{Lang::T('Pay With Balance')}</a>
{/if}
</div>
{if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/send/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this for friend account?')}')"
class="btn btn-sm btn-block btn-primary">{Lang::T('Buy for friend')}</a>
{/if}
</div>
</div>
</div>
{/foreach}
</div>
{/if}
{if Lang::arrayCount($radius_pppoe)>0}
<ol class="breadcrumb">
<li>{if $_c['radius_plan']==''}Radius Plan{else}{$_c['radius_plan']}{/if}</li>
<li>{if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}</li>
</ol>
<div class="row">
{foreach $radius_pppoe as $plan}
<div class="col col-md-4">
<div class="box box-solid box-default">
<div class="box box- box-primary">
<div class="box-header text-bold">{$plan['name_plan']}</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>{Lang::T('Type')}</td>
<td>{$plan['type']}</td>
</tr>
<tr>
<td>{Lang::T('Price')}</td>
<td>{Lang::moneyFormat($plan['price'])}</td>
</tr>
<tr>
<td>{Lang::T('Validity')}</td>
<td>{$plan['validity']} {$plan['validity_unit']}</td>
</tr>
</tbody>
</table>
</div>
<div class="box-body">
<a href="{$_url}order/buy/0/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy Balance?')}')"
class="btn btn-sm btn-block btn-primary">Buy</a>
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<a href="{$_url}order/buy/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-warning text-black">Buy</a>
{if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/pay/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Pay this with Balance? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-success">{Lang::T('Pay With Balance')}</a>
{/if}
</div>
{if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/send/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this for friend account?')}')"
class="btn btn-sm btn-block btn-primary">{Lang::T('Buy for friend')}</a>
{/if}
</div>
</div>
</div>
{/foreach}
</div>
</div>
{/if}
{if $_c['radius_enable']}
<div class="box box-solid box-info bg-gray-light">
<div class="box-header text-black text-bold">{if $_c['radius_plan']==''}Radius
Plan{else}{$_c['radius_plan']}
{/if}</div>
{if Lang::arrayCount($radius_hotspot)>0}
<div class="box-header text-black">{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}</div>
<div class="box-body row">
{foreach $radius_hotspot as $plan}
<div class="col col-md-4">
<div class="box box-primary">
<div class="box-header text-bold">{$plan['name_plan']}</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>{Lang::T('Type')}</td>
<td>{$plan['type']}</td>
</tr>
<tr>
<td>{Lang::T('Price')}</td>
<td>{Lang::moneyFormat($plan['price'])}</td>
</tr>
<tr>
<td>{Lang::T('Validity')}</td>
<td>{$plan['validity']} {$plan['validity_unit']}</td>
</tr>
</tbody>
</table>
</div>
<div class="box-body">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<a href="{$_url}order/buy/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-warning text-black">Buy</a>
{if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/pay/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Pay this with Balance? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-success">{Lang::T('Pay With Balance')}</a>
{/if}
</div>
{if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/send/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this for friend account?')}')"
class="btn btn-sm btn-block btn-primary">{Lang::T('Buy for friend')}</a>
{/if}
</div>
</div>
</div>
{/foreach}
</div>
{/if}
{if Lang::arrayCount($radius_pppoe)>0}
<div class="box-header text-black">{if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}</div>
<div class="box-body row">
{foreach $radius_pppoe as $plan}
<div class="col col-md-4">
<div class="box box- box-primary">
<div class="box-header text-bold">{$plan['name_plan']}</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>{Lang::T('Type')}</td>
<td>{$plan['type']}</td>
</tr>
<tr>
<td>{Lang::T('Price')}</td>
<td>{Lang::moneyFormat($plan['price'])}</td>
</tr>
<tr>
<td>{Lang::T('Validity')}</td>
<td>{$plan['validity']} {$plan['validity_unit']}</td>
</tr>
</tbody>
</table>
</div>
<div class="box-body">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<a href="{$_url}order/buy/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-warning text-black">Buy</a>
{if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/pay/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Pay this with Balance? your active package will be overwrite')}')"
class="btn btn-sm btn-block btn-success">{Lang::T('Pay With Balance')}</a>
{/if}
</div>
{if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']}
<a href="{$_url}order/send/radius/{$plan['id']}"
onclick="return confirm('{Lang::T('Buy this for friend account?')}')"
class="btn btn-sm btn-block btn-primary">{Lang::T('Buy for friend')}</a>
{/if}
</div>
</div>
</div>
{/foreach}
</div>
{/if}
</div>
{/if}
{/if}
{foreach $routers as $router}
{if Validator::isRouterHasPlan($plans_hotspot, $router['name']) || Validator::isRouterHasPlan($plans_pppoe, $router['name'])}
<div class="box box-solid box-info bg-gray-light">
<div class="box-header text-black text-bold">{$router['name']}</div>
<div class="box box-solid box-primary bg-gray">
<div class="box-header text-white text-bold">{$router['name']}</div>
{if $router['description'] != ''}
<div class="box-body">
{$router['description']}
</div>
{/if}
{if Validator::countRouterPlan($plans_hotspot, $router['name'])>0}
<div class="box-header text-black">{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}</div>
<div class="box-header text-white">{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}</div>
<div class="box-body row">
{foreach $plans_hotspot as $plan}
{if $router['name'] eq $plan['routers']}
<div class="col col-md-4">
<div class="box box-primary">
<div class="box-header text-bold">{$plan['name_plan']}</div>
<div class="box-header text-center text-bold">{$plan['name_plan']}</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
@ -194,13 +166,13 @@
</div>
{/if}
{if Validator::countRouterPlan($plans_pppoe,$router['name'])>0}
<div class="box-header text-black">{if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}</div>
<div class="box-header text-white">{if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}</div>
<div class="box-body row">
{foreach $plans_pppoe as $plan}
{if $router['name'] eq $plan['routers']}
<div class="col col-md-4">
<div class="box box- box-primary">
<div class="box-header text-bold">{$plan['name_plan']}</div>
<div class="box-header text-bold text-center">{$plan['name_plan']}</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>

View File

@ -1,3 +1,3 @@
{
"version": "2023.10.17"
"version": "2023.10.25"
}