Compare commits
22 Commits
2023.10.20
...
2023.10.25
Author | SHA1 | Date | |
---|---|---|---|
f61ebb642e | |||
77e7a96f96 | |||
5c57c5df11 | |||
9e09611816 | |||
09ead77d7b | |||
703f9a7463 | |||
ef25633275 | |||
02a68589a1 | |||
25cd07e975 | |||
4e7a60aa6f | |||
baca2d706f | |||
4f975fbf0d | |||
cded80a632 | |||
f0d130b6b9 | |||
a18c07ba42 | |||
36b47a3e8d | |||
37f72d881e | |||
e99108a34a | |||
ddb3b8a718 | |||
3c4920f958 | |||
e2da5b67bf | |||
49c8fe5d55 |
27
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
27
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal 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.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal 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.
|
11
CHANGELOG.md
11
CHANGELOG.md
@ -2,6 +2,17 @@
|
|||||||
|
|
||||||
# CHANGELOG
|
# 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
|
## 2023.10.20
|
||||||
|
|
||||||
- View Invoice
|
- View Invoice
|
||||||
|
@ -9,7 +9,8 @@ CREATE TABLE `nas` (
|
|||||||
`secret` varchar(60) COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'secret',
|
`secret` varchar(60) COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'secret',
|
||||||
`server` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`server` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
`community` varchar(50) 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;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `radacct`;
|
DROP TABLE IF EXISTS `radacct`;
|
||||||
|
@ -18,10 +18,10 @@ class Paginator
|
|||||||
$page = (int)(empty(_get('p')) ? 1 : _get('p'));
|
$page = (int)(empty(_get('p')) ? 1 : _get('p'));
|
||||||
$pagination = "";
|
$pagination = "";
|
||||||
foreach($colVal as $k=>$v) {
|
foreach($colVal as $k=>$v) {
|
||||||
if(!empty($query)){
|
if(strpos($v,'%') === false) {
|
||||||
$table = $table->where_like($k, $v);
|
|
||||||
}else{
|
|
||||||
$table = $table->where($k, $v);
|
$table = $table->where($k, $v);
|
||||||
|
}else{
|
||||||
|
$table = $table->where_like($k, $v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$totalReq = $table->count();
|
$totalReq = $table->count();
|
||||||
|
@ -43,20 +43,7 @@ class Radius
|
|||||||
return ORM::for_table('radusergroup', 'radius');
|
return ORM::for_table('radusergroup', 'radius');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function nasList($search = null)
|
public static function nasAdd($name, $ip, $ports, $secret, $routers = "", $description = "", $type = 'other', $server = null, $community = 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)
|
|
||||||
{
|
{
|
||||||
$n = Radius::getTableNas()->create();
|
$n = Radius::getTableNas()->create();
|
||||||
$n->nasname = $ip;
|
$n->nasname = $ip;
|
||||||
@ -67,11 +54,12 @@ class Radius
|
|||||||
$n->description = $description;
|
$n->description = $description;
|
||||||
$n->server = $server;
|
$n->server = $server;
|
||||||
$n->community = $community;
|
$n->community = $community;
|
||||||
|
$n->routers = $routers;
|
||||||
$n->save();
|
$n->save();
|
||||||
return $n->id();
|
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);
|
$n = Radius::getTableNas()->find_one($id);
|
||||||
if (empty($n)) {
|
if (empty($n)) {
|
||||||
@ -85,6 +73,7 @@ class Radius
|
|||||||
$n->description = $description;
|
$n->description = $description;
|
||||||
$n->server = $server;
|
$n->server = $server;
|
||||||
$n->community = $community;
|
$n->community = $community;
|
||||||
|
$n->routers = $routers;
|
||||||
return $n->save();
|
return $n->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,17 +121,17 @@ class Radius
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function customerDeactivate($username, $radiusDisconnect = true) {
|
public static function customerDeactivate($username, $radiusDisconnect = true)
|
||||||
{
|
{ {
|
||||||
global $radius_pass;
|
global $radius_pass;
|
||||||
$r = Radius::getTableCustomer()->where_equal('username', $username)->whereEqual('attribute', 'Cleartext-Password')->findOne();
|
$r = Radius::getTableCustomer()->where_equal('username', $username)->whereEqual('attribute', 'Cleartext-Password')->findOne();
|
||||||
if ($r) {
|
if ($r) {
|
||||||
// no need to delete, because it will make ID got higher
|
// no need to delete, because it will make ID got higher
|
||||||
// we just change the password
|
// we just change the password
|
||||||
$r->value = md5(time() . $username . $radius_pass);
|
$r->value = md5(time() . $username . $radius_pass);
|
||||||
$r->save();
|
$r->save();
|
||||||
if($radiusDisconnect)
|
if ($radiusDisconnect)
|
||||||
return Radius::disconnectCustomer($username);
|
return Radius::disconnectCustomer($username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
|
@ -22,10 +22,10 @@ switch ($action) {
|
|||||||
run_hook('view_list_bandwidth'); #HOOK
|
run_hook('view_list_bandwidth'); #HOOK
|
||||||
$name = _post('name');
|
$name = _post('name');
|
||||||
if ($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();
|
$d = ORM::for_table('tbl_bandwidth')->where_like('name_bw','%'.$name.'%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
|
||||||
}else{
|
}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();
|
$d = ORM::for_table('tbl_bandwidth')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,14 +24,19 @@ switch ($action) {
|
|||||||
$search = _post('search');
|
$search = _post('search');
|
||||||
run_hook('list_customers'); #HOOK
|
run_hook('list_customers'); #HOOK
|
||||||
if ($search != '') {
|
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')
|
$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])
|
->where_raw("(`username` LIKE '%$search%' OR `fullname` LIKE '%$search%' OR `phonenumber` LIKE '%$search%' OR `email` LIKE '%$search%')", [$search, $search, $search, $search])
|
||||||
->offset($paginator['startpoint'])
|
->offset($paginator['startpoint'])
|
||||||
->limit($paginator['limit'])
|
->limit($paginator['limit'])
|
||||||
->order_by_desc('id')->find_many();
|
->order_by_desc('id')->find_many();
|
||||||
} else {
|
} else {
|
||||||
$paginator = Paginator::bootstrap('tbl_customers');
|
$paginator = Paginator::build(ORM::for_table('tbl_customers'));
|
||||||
$d = ORM::for_table('tbl_customers')
|
$d = ORM::for_table('tbl_customers')
|
||||||
->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
|
->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
|
||||||
}
|
}
|
||||||
@ -125,25 +130,24 @@ switch ($action) {
|
|||||||
$v = $routes['3'];
|
$v = $routes['3'];
|
||||||
if (empty($v) || $v == 'order') {
|
if (empty($v) || $v == 'order') {
|
||||||
$v = 'order';
|
$v = 'order';
|
||||||
// $paginator = Paginator::bootstrap('tbl_payment_gateway', 'username', $customer['username']);
|
$paginator = Paginator::build(ORM::for_table('tbl_payment_gateway'),['username'=>$customer['username']]);
|
||||||
// print_r($paginator);
|
|
||||||
$order = ORM::for_table('tbl_payment_gateway')
|
$order = ORM::for_table('tbl_payment_gateway')
|
||||||
->where('username', $customer['username'])
|
->where('username', $customer['username'])
|
||||||
->offset(0)
|
->offset($paginator['startpoint'])
|
||||||
->limit(30)
|
->limit($paginator['limit'])
|
||||||
->order_by_desc('id')
|
->order_by_desc('id')
|
||||||
->find_many();
|
->find_many();
|
||||||
// $ui->assign('paginator', $paginator);
|
$ui->assign('paginator', $paginator);
|
||||||
$ui->assign('order', $order);
|
$ui->assign('order', $order);
|
||||||
} else if ($v == 'activation') {
|
} 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')
|
$activation = ORM::for_table('tbl_transactions')
|
||||||
->where('username', $customer['username'])
|
->where('username', $customer['username'])
|
||||||
->offset(0)
|
->offset($paginator['startpoint'])
|
||||||
->limit(30)
|
->limit($paginator['limit'])
|
||||||
->order_by_desc('id')
|
->order_by_desc('id')
|
||||||
->find_many();
|
->find_many();
|
||||||
// $ui->assign('paginator', $paginator);
|
$ui->assign('paginator', $paginator);
|
||||||
$ui->assign('activation', $activation);
|
$ui->assign('activation', $activation);
|
||||||
}
|
}
|
||||||
$package = ORM::for_table('tbl_user_recharges')->where('username', $customer['username'])->find_one();
|
$package = ORM::for_table('tbl_user_recharges')->where('username', $customer['username'])->find_one();
|
||||||
|
@ -19,7 +19,7 @@ switch ($action) {
|
|||||||
break;
|
break;
|
||||||
case 'history':
|
case 'history':
|
||||||
$ui->assign('_system_menu', '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')
|
$d = ORM::for_table('tbl_payment_gateway')
|
||||||
->where('username', $user['username'])
|
->where('username', $user['username'])
|
||||||
->order_by_desc('id')
|
->order_by_desc('id')
|
||||||
|
@ -24,10 +24,10 @@ switch ($action) {
|
|||||||
|
|
||||||
$name = _post('name');
|
$name = _post('name');
|
||||||
if ($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();
|
$d = ORM::for_table('tbl_pool')->where_like('pool_name', '%' . $name . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
|
||||||
} else {
|
} 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();
|
$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);
|
$d = ORM::for_table('tbl_pool')->find_one($id);
|
||||||
if ($d) {
|
if ($d) {
|
||||||
if ($d['routers'] != 'radius') {
|
if ($d['routers'] != 'radius') {
|
||||||
try{
|
try {
|
||||||
$mikrotik = Mikrotik::info($d['routers']);
|
$mikrotik = Mikrotik::info($d['routers']);
|
||||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||||
Mikrotik::removePool($client, $d['pool_name']);
|
Mikrotik::removePool($client, $d['pool_name']);
|
||||||
}catch(Exception $e){
|
} catch (Exception $e) {
|
||||||
//ignore exception, it means router has already deleted
|
//ignore exception, it means router has already deleted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,10 +67,10 @@ switch ($action) {
|
|||||||
$ui->assign('_title', $_L['Customers']);
|
$ui->assign('_title', $_L['Customers']);
|
||||||
$username = _post('username');
|
$username = _post('username');
|
||||||
if ($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();
|
$d = ORM::for_table('tbl_user_recharges')->where_like('username', '%' . $username . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
|
||||||
} else {
|
} 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();
|
$d = ORM::for_table('tbl_user_recharges')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,16 +142,16 @@ switch ($action) {
|
|||||||
$d = ORM::for_table('tbl_transactions')->where('id', $id)->find_one();
|
$d = ORM::for_table('tbl_transactions')->where('id', $id)->find_one();
|
||||||
$ui->assign('in', $d);
|
$ui->assign('in', $d);
|
||||||
|
|
||||||
if(!empty($routes['3']) && $routes['3']=='send'){
|
if (!empty($routes['3']) && $routes['3'] == 'send') {
|
||||||
$c = ORM::for_table('tbl_customers')->where('username', $d['username'])->find_one();
|
$c = ORM::for_table('tbl_customers')->where('username', $d['username'])->find_one();
|
||||||
if($c){
|
if ($c) {
|
||||||
Message::sendInvoice($c, $d);
|
Message::sendInvoice($c, $d);
|
||||||
r2(U . 'prepaid/view/'.$id, 's', "Success send to customer");
|
r2(U . 'prepaid/view/' . $id, 's', "Success send to customer");
|
||||||
}
|
}
|
||||||
r2(U . 'prepaid/view/'.$id, 'd', "Customer not found");
|
r2(U . 'prepaid/view/' . $id, 'd', "Customer not found");
|
||||||
}
|
}
|
||||||
$ui->assign('_title', 'View Invoice');
|
$ui->assign('_title', 'View Invoice');
|
||||||
$ui->assign('date', Lang::dateAndTimeFormat($d['recharged_on'],$d['recharged_time']));
|
$ui->assign('date', Lang::dateAndTimeFormat($d['recharged_on'], $d['recharged_time']));
|
||||||
$ui->display('invoice.tpl');
|
$ui->display('invoice.tpl');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ switch ($action) {
|
|||||||
$d = ORM::for_table('tbl_transactions')->where('id', $id)->find_one();
|
$d = ORM::for_table('tbl_transactions')->where('id', $id)->find_one();
|
||||||
$ui->assign('d', $d);
|
$ui->assign('d', $d);
|
||||||
|
|
||||||
$ui->assign('date', Lang::dateAndTimeFormat($d['recharged_on'],$d['recharged_time']));
|
$ui->assign('date', Lang::dateAndTimeFormat($d['recharged_on'], $d['recharged_time']));
|
||||||
run_hook('print_invoice'); #HOOK
|
run_hook('print_invoice'); #HOOK
|
||||||
$ui->display('invoice-print.tpl');
|
$ui->display('invoice-print.tpl');
|
||||||
break;
|
break;
|
||||||
@ -242,7 +242,7 @@ switch ($action) {
|
|||||||
$code = _post('code');
|
$code = _post('code');
|
||||||
if ($code != '') {
|
if ($code != '') {
|
||||||
$ui->assign('code', $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')
|
$d = ORM::for_table('tbl_plans')->where('enabled', '1')
|
||||||
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
|
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
|
||||||
->where_like('tbl_voucher.code', '%' . $code . '%')
|
->where_like('tbl_voucher.code', '%' . $code . '%')
|
||||||
@ -250,7 +250,7 @@ switch ($action) {
|
|||||||
->limit($paginator['limit'])
|
->limit($paginator['limit'])
|
||||||
->find_many();
|
->find_many();
|
||||||
} else {
|
} else {
|
||||||
$paginator = Paginator::bootstrap('tbl_voucher');
|
$paginator = Paginator::build(ORM::for_table('tbl_voucher'));
|
||||||
$d = ORM::for_table('tbl_plans')->where('enabled', '1')
|
$d = ORM::for_table('tbl_plans')->where('enabled', '1')
|
||||||
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
|
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
|
||||||
->offset($paginator['startpoint'])
|
->offset($paginator['startpoint'])
|
||||||
@ -282,13 +282,13 @@ switch ($action) {
|
|||||||
$pagebreak = _post('pagebreak');
|
$pagebreak = _post('pagebreak');
|
||||||
$limit = _post('limit');
|
$limit = _post('limit');
|
||||||
$vpl = _post('vpl');
|
$vpl = _post('vpl');
|
||||||
if(empty($vpl)){
|
if (empty($vpl)) {
|
||||||
$vpl = 3;
|
$vpl = 3;
|
||||||
}
|
}
|
||||||
if ($pagebreak < 1) $pagebreak = 12;
|
if ($pagebreak < 1) $pagebreak = 12;
|
||||||
|
|
||||||
if ($limit < 1) $limit = $pagebreak * 2;
|
if ($limit < 1) $limit = $pagebreak * 2;
|
||||||
if(empty($from_id)){
|
if (empty($from_id)) {
|
||||||
$from_id = 0;
|
$from_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ switch ($action) {
|
|||||||
$n++;
|
$n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ui->assign('voucher',$voucher);
|
$ui->assign('voucher', $voucher);
|
||||||
$ui->assign('vc', $vc);
|
$ui->assign('vc', $vc);
|
||||||
|
|
||||||
//for counting pagebreak
|
//for counting pagebreak
|
||||||
|
@ -21,6 +21,7 @@ switch ($action) {
|
|||||||
case 'nas-add':
|
case 'nas-add':
|
||||||
$ui->assign('_system_menu', 'network');
|
$ui->assign('_system_menu', 'network');
|
||||||
$ui->assign('_title', "Network Access Server");
|
$ui->assign('_title', "Network Access Server");
|
||||||
|
$ui->assign('routers', ORM::for_table('tbl_routers')->find_many());
|
||||||
$ui->display('radius-nas-add.tpl');
|
$ui->display('radius-nas-add.tpl');
|
||||||
break;
|
break;
|
||||||
case 'nas-add-post':
|
case 'nas-add-post':
|
||||||
@ -32,6 +33,7 @@ switch ($action) {
|
|||||||
$server = _post('server', null);
|
$server = _post('server', null);
|
||||||
$community = _post('community', null);
|
$community = _post('community', null);
|
||||||
$description = _post('description');
|
$description = _post('description');
|
||||||
|
$routers = _post('routers');
|
||||||
$msg = '';
|
$msg = '';
|
||||||
|
|
||||||
if (Validator::Length($shortname, 30, 2) == false) {
|
if (Validator::Length($shortname, 30, 2) == false) {
|
||||||
@ -54,7 +56,7 @@ switch ($action) {
|
|||||||
$msg .= 'NAS IP Exists<br>';
|
$msg .= 'NAS IP Exists<br>';
|
||||||
}
|
}
|
||||||
if ($msg == '') {
|
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) {
|
if ($id > 0) {
|
||||||
r2(U . 'radius/nas-list/', 's', "NAS Added");
|
r2(U . 'radius/nas-list/', 's', "NAS Added");
|
||||||
} else {
|
} else {
|
||||||
@ -74,6 +76,7 @@ switch ($action) {
|
|||||||
$d = ORM::for_table('nas', 'radius')->where_equal('shortname', _get('name'))->find_one();
|
$d = ORM::for_table('nas', 'radius')->where_equal('shortname', _get('name'))->find_one();
|
||||||
}
|
}
|
||||||
if ($d) {
|
if ($d) {
|
||||||
|
$ui->assign('routers', ORM::for_table('tbl_routers')->find_many());
|
||||||
$ui->assign('d', $d);
|
$ui->assign('d', $d);
|
||||||
$ui->display('radius-nas-edit.tpl');
|
$ui->display('radius-nas-edit.tpl');
|
||||||
} else {
|
} else {
|
||||||
@ -91,6 +94,7 @@ switch ($action) {
|
|||||||
$server = _post('server', null);
|
$server = _post('server', null);
|
||||||
$community = _post('community', null);
|
$community = _post('community', null);
|
||||||
$description = _post('description');
|
$description = _post('description');
|
||||||
|
$routers = _post('routers');
|
||||||
$msg = '';
|
$msg = '';
|
||||||
|
|
||||||
if (Validator::Length($shortname, 30, 2) == false) {
|
if (Validator::Length($shortname, 30, 2) == false) {
|
||||||
@ -109,7 +113,7 @@ switch ($action) {
|
|||||||
$type = null;
|
$type = null;
|
||||||
}
|
}
|
||||||
if ($msg == '') {
|
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");
|
r2(U . 'radius/list/', 's', "NAS Saved");
|
||||||
} else {
|
} else {
|
||||||
r2(U . 'radius/nas-add', 'e', 'NAS NOT Exists');
|
r2(U . 'radius/nas-add', 'e', 'NAS NOT Exists');
|
||||||
@ -131,10 +135,22 @@ switch ($action) {
|
|||||||
$ui->assign('_title', "Network Access Server");
|
$ui->assign('_title', "Network Access Server");
|
||||||
$name = _post('name');
|
$name = _post('name');
|
||||||
if (empty($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 {
|
} 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('name', $name);
|
||||||
$ui->assign('nas', $nas);
|
$ui->assign('nas', $nas);
|
||||||
$ui->display('radius-nas.tpl');
|
$ui->display('radius-nas.tpl');
|
||||||
|
@ -59,11 +59,8 @@ switch ($do) {
|
|||||||
$ui->assign('address', $address);
|
$ui->assign('address', $address);
|
||||||
$ui->assign('email', $email);
|
$ui->assign('email', $email);
|
||||||
$ui->assign('phonenumber', $phonenumber);
|
$ui->assign('phonenumber', $phonenumber);
|
||||||
$ui->assign('notify', '<div class="alert alert-success">
|
$ui->assign('notify', 'Wrong Verification code');
|
||||||
<button type="button" class="close" data-dismiss="alert">
|
$ui->assign('notify_t', 'd');
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
<div>Verification code is Wrong</div></div>');
|
|
||||||
$ui->display('register-otp.tpl');
|
$ui->display('register-otp.tpl');
|
||||||
exit();
|
exit();
|
||||||
}else{
|
}else{
|
||||||
@ -95,11 +92,8 @@ switch ($do) {
|
|||||||
$ui->assign('address', $address);
|
$ui->assign('address', $address);
|
||||||
$ui->assign('email', $email);
|
$ui->assign('email', $email);
|
||||||
$ui->assign('phonenumber', $phonenumber);
|
$ui->assign('phonenumber', $phonenumber);
|
||||||
$ui->assign('notify', '<div class="alert alert-danger">
|
$ui->assign('notify', 'Failed to register');
|
||||||
<button type="button" class="close" data-dismiss="alert">
|
$ui->assign('notify_t', 'd');
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
<div>Failed to register</div></div>');
|
|
||||||
run_hook('view_otp_register'); #HOOK
|
run_hook('view_otp_register'); #HOOK
|
||||||
$ui->display('register-rotp.tpl');
|
$ui->display('register-rotp.tpl');
|
||||||
}
|
}
|
||||||
@ -109,11 +103,8 @@ switch ($do) {
|
|||||||
$ui->assign('address', $address);
|
$ui->assign('address', $address);
|
||||||
$ui->assign('email', $email);
|
$ui->assign('email', $email);
|
||||||
$ui->assign('phonenumber', $phonenumber);
|
$ui->assign('phonenumber', $phonenumber);
|
||||||
$ui->assign('notify', '<div class="alert alert-danger">
|
$ui->assign('notify', $msg);
|
||||||
<button type="button" class="close" data-dismiss="alert">
|
$ui->assign('notify_t', 'd');
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
<div>' . $msg . '</div></div>');
|
|
||||||
$ui->display('register.tpl');
|
$ui->display('register.tpl');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -134,22 +125,16 @@ switch ($do) {
|
|||||||
//expired 10 minutes
|
//expired 10 minutes
|
||||||
if(file_exists($otpPath) && time()-filemtime($otpPath)<1200){
|
if(file_exists($otpPath) && time()-filemtime($otpPath)<1200){
|
||||||
$ui->assign('username', $username);
|
$ui->assign('username', $username);
|
||||||
$ui->assign('notify', '<div class="alert alert-success">
|
$ui->assign('notify', 'Please wait '.(1200-(time()-filemtime($otpPath))).' seconds before sending another SMS');
|
||||||
<button type="button" class="close" data-dismiss="alert">
|
$ui->assign('notify_t', 'd');
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
<div>Please wait '.(1200-(time()-filemtime($otpPath))).' seconds before sending another SMS</div></div>');
|
|
||||||
$ui->display('register-otp.tpl');
|
$ui->display('register-otp.tpl');
|
||||||
}else{
|
}else{
|
||||||
$otp = rand(100000,999999);
|
$otp = rand(100000,999999);
|
||||||
file_put_contents($otpPath, $otp);
|
file_put_contents($otpPath, $otp);
|
||||||
Message::sendSMS($username,$config['CompanyName']."\nYour Verification code are: $otp");
|
Message::sendSMS($username,$config['CompanyName']."\nYour Verification code are: $otp");
|
||||||
$ui->assign('username', $username);
|
$ui->assign('username', $username);
|
||||||
$ui->assign('notify', '<div class="alert alert-success">
|
$ui->assign('notify', 'Verification code has been sent to your phone');
|
||||||
<button type="button" class="close" data-dismiss="alert">
|
$ui->assign('notify_t', 's');
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
<div>Verification code has been sent to your phone</div></div>');
|
|
||||||
$ui->display('register-otp.tpl');
|
$ui->display('register-otp.tpl');
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
@ -48,7 +48,7 @@ switch ($action) {
|
|||||||
$ui->display('reports-activation.tpl');
|
$ui->display('reports-activation.tpl');
|
||||||
break;
|
break;
|
||||||
case 'daily-report':
|
case 'daily-report':
|
||||||
$paginator = Paginator::bootstrap('tbl_transactions', 'recharged_on', $mdate);
|
$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();
|
$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');
|
$dr = ORM::for_table('tbl_transactions')->where('recharged_on', $mdate)->sum('price');
|
||||||
|
|
||||||
|
@ -27,10 +27,10 @@ switch ($action) {
|
|||||||
|
|
||||||
$name = _post('name');
|
$name = _post('name');
|
||||||
if ($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();
|
$d = ORM::for_table('tbl_routers')->where_like('name', '%' . $name . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
|
||||||
} else {
|
} 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();
|
$d = ORM::for_table('tbl_routers')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,10 +120,10 @@ switch ($action) {
|
|||||||
|
|
||||||
$name = _post('name');
|
$name = _post('name');
|
||||||
if ($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();
|
$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 {
|
} 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();
|
$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']) {
|
if ($d['is_radius']) {
|
||||||
Radius::planDelete($d['id']);
|
Radius::planDelete($d['id']);
|
||||||
} else {
|
} else {
|
||||||
try{
|
try {
|
||||||
$mikrotik = Mikrotik::info($d['routers']);
|
$mikrotik = Mikrotik::info($d['routers']);
|
||||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||||
Mikrotik::removeHotspotPlan($client, $d['name_plan']);
|
Mikrotik::removeHotspotPlan($client, $d['name_plan']);
|
||||||
}catch(Exception $e){
|
} catch (Exception $e) {
|
||||||
//ignore exception, it means router has already deleted
|
//ignore exception, it means router has already deleted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -377,10 +377,10 @@ switch ($action) {
|
|||||||
|
|
||||||
$name = _post('name');
|
$name = _post('name');
|
||||||
if ($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();
|
$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 {
|
} 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();
|
$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']) {
|
if ($d['is_radius']) {
|
||||||
Radius::planDelete($d['id']);
|
Radius::planDelete($d['id']);
|
||||||
} else {
|
} else {
|
||||||
try{
|
try {
|
||||||
$mikrotik = Mikrotik::info($d['routers']);
|
$mikrotik = Mikrotik::info($d['routers']);
|
||||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||||
Mikrotik::removePpoePlan($client, $d['name_plan']);
|
Mikrotik::removePpoePlan($client, $d['name_plan']);
|
||||||
}catch(Exception $e){
|
} catch (Exception $e) {
|
||||||
//ignore exception, it means router has already deleted
|
//ignore exception, it means router has already deleted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -613,10 +613,10 @@ switch ($action) {
|
|||||||
$ui->assign('_title', Lang::T('Balance Plans'));
|
$ui->assign('_title', Lang::T('Balance Plans'));
|
||||||
$name = _post('name');
|
$name = _post('name');
|
||||||
if ($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();
|
$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 {
|
} 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();
|
$d = ORM::for_table('tbl_plans')->where('tbl_plans.type', 'Balance')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
||||||
* by https://t.me/ibnux
|
* by https://t.me/ibnux
|
||||||
@ -22,11 +23,11 @@ switch ($action) {
|
|||||||
$logo = 'system/uploads/logo.default.png';
|
$logo = 'system/uploads/logo.default.png';
|
||||||
}
|
}
|
||||||
$ui->assign('logo', $logo);
|
$ui->assign('logo', $logo);
|
||||||
if(empty($_c['radius_client'])){
|
if (empty($_c['radius_client'])) {
|
||||||
try{
|
try {
|
||||||
$_c['radius_client'] = Radius::getClient();
|
$_c['radius_client'] = Radius::getClient();
|
||||||
$ui->assign('_c', $_c);
|
$ui->assign('_c', $_c);
|
||||||
}catch(Exception $e){
|
} catch (Exception $e) {
|
||||||
//ignore
|
//ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,11 +39,11 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$php = trim(shell_exec('which php'));
|
$php = trim(shell_exec('which php'));
|
||||||
if(empty($php)){
|
if (empty($php)) {
|
||||||
$php = 'php';
|
$php = 'php';
|
||||||
}
|
}
|
||||||
$ui->assign('php', $php);
|
$ui->assign('php', $php);
|
||||||
$ui->assign('dir', str_replace('controllers','', __DIR__));
|
$ui->assign('dir', str_replace('controllers', '', __DIR__));
|
||||||
$ui->assign('themes', $themes);
|
$ui->assign('themes', $themes);
|
||||||
run_hook('view_app_settings'); #HOOK
|
run_hook('view_app_settings'); #HOOK
|
||||||
$ui->display('app-settings.tpl');
|
$ui->display('app-settings.tpl');
|
||||||
@ -76,10 +77,10 @@ switch ($action) {
|
|||||||
|
|
||||||
$username = _post('username');
|
$username = _post('username');
|
||||||
if ($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();
|
$d = ORM::for_table('tbl_users')->where_like('username', '%' . $username . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_asc('id')->find_many();
|
||||||
} else {
|
} 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();
|
$d = ORM::for_table('tbl_users')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_asc('id')->find_many();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,11 +262,11 @@ switch ($action) {
|
|||||||
|
|
||||||
|
|
||||||
if (!empty($_FILES['logo']['name'])) {
|
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');
|
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);
|
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']);
|
if (file_exists($_FILES['logo']['tmp_name'])) unlink($_FILES['logo']['tmp_name']);
|
||||||
}else{
|
} else {
|
||||||
r2(U . 'settings/app', 'e', 'PHP GD is not installed');
|
r2(U . 'settings/app', 'e', 'PHP GD is not installed');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ switch ($action) {
|
|||||||
|
|
||||||
case 'list-activated':
|
case 'list-activated':
|
||||||
$ui->assign('_system_menu', '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();
|
$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);
|
$ui->assign('d', $d);
|
||||||
|
@ -35,6 +35,18 @@ if (php_sapi_name() !== 'cli') {
|
|||||||
echo "<pre>";
|
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 '../config.php';
|
||||||
require_once 'orm.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();
|
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
|
||||||
|
|
||||||
if ($p['is_radius']) {
|
if ($p['is_radius']) {
|
||||||
if (!empty($p['pool_expired'])) {
|
if (empty($p['pool_expired'])) {
|
||||||
print_r(Radius::customerDeactivate($c['username']));
|
print_r(Radius::customerDeactivate($c['username']));
|
||||||
} else {
|
} else {
|
||||||
Radius::upsertCustomerAttr($c['username'], 'Framed-Pool', $plan['pool_expired'], ':=');
|
Radius::upsertCustomerAttr($c['username'], 'Framed-Pool', $plan['pool_expired'], ':=');
|
||||||
@ -117,8 +129,8 @@ foreach ($d as $ds) {
|
|||||||
Mikrotik::removeHotspotUser($client, $c['username']);
|
Mikrotik::removeHotspotUser($client, $c['username']);
|
||||||
}
|
}
|
||||||
Mikrotik::removeHotspotActiveUser($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
|
//update database user dengan status off
|
||||||
$u->status = 'off';
|
$u->status = 'off';
|
||||||
$u->save();
|
$u->save();
|
||||||
@ -157,7 +169,7 @@ foreach ($d as $ds) {
|
|||||||
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
|
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
|
||||||
|
|
||||||
if ($p['is_radius']) {
|
if ($p['is_radius']) {
|
||||||
if (!empty($p['pool_expired'])) {
|
if (empty($p['pool_expired'])) {
|
||||||
print_r(Radius::customerDeactivate($c['username']));
|
print_r(Radius::customerDeactivate($c['username']));
|
||||||
} else {
|
} else {
|
||||||
Radius::upsertCustomerAttr($c['username'], 'Framed-Pool', $plan['pool_expired'], ':=');
|
Radius::upsertCustomerAttr($c['username'], 'Framed-Pool', $plan['pool_expired'], ':=');
|
||||||
@ -171,8 +183,8 @@ foreach ($d as $ds) {
|
|||||||
Mikrotik::removePpoeUser($client, $c['username']);
|
Mikrotik::removePpoeUser($client, $c['username']);
|
||||||
}
|
}
|
||||||
Mikrotik::removePpoeActive($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->status = 'off';
|
||||||
$u->save();
|
$u->save();
|
||||||
|
@ -35,6 +35,19 @@ if(php_sapi_name() !== 'cli'){
|
|||||||
echo "<pre>";
|
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 '../config.php';
|
||||||
require_once 'orm.php';
|
require_once 'orm.php';
|
||||||
require_once 'autoload/PEAR2/Autoload.php';
|
require_once 'autoload/PEAR2/Autoload.php';
|
||||||
|
@ -32,5 +32,8 @@
|
|||||||
],
|
],
|
||||||
"2023.10.1" : [
|
"2023.10.1" : [
|
||||||
"ALTER TABLE `tbl_plans` ADD `is_radius` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '1 is radius' AFTER `routers`; "
|
"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`;"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -57,6 +57,18 @@
|
|||||||
<p class="help-block">{Lang::T('Explain Coverage of router')}</p>
|
<p class="help-block">{Lang::T('Explain Coverage of router')}</p>
|
||||||
</div>
|
</div>
|
||||||
</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="form-group">
|
||||||
<div class="col-lg-offset-2 col-lg-10">
|
<div class="col-lg-offset-2 col-lg-10">
|
||||||
<button class="btn btn-primary waves-effect waves-light"
|
<button class="btn btn-primary waves-effect waves-light"
|
||||||
|
@ -57,6 +57,19 @@
|
|||||||
<p class="help-block">{Lang::T('Explain Coverage of router')}</p>
|
<p class="help-block">{Lang::T('Explain Coverage of router')}</p>
|
||||||
</div>
|
</div>
|
||||||
</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="form-group">
|
||||||
<div class="col-lg-offset-2 col-lg-10">
|
<div class="col-lg-offset-2 col-lg-10">
|
||||||
<button class="btn btn-primary waves-effect waves-light"
|
<button class="btn btn-primary waves-effect waves-light"
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
<th>Port</th>
|
<th>Port</th>
|
||||||
<th>Server</th>
|
<th>Server</th>
|
||||||
<th>Community</th>
|
<th>Community</th>
|
||||||
|
<th>Routers</th>
|
||||||
<th>{$_L['Manage']}</th>
|
<th>{$_L['Manage']}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -51,6 +52,7 @@
|
|||||||
<td>{$ds['ports']}</td>
|
<td>{$ds['ports']}</td>
|
||||||
<td>{$ds['server']}</td>
|
<td>{$ds['server']}</td>
|
||||||
<td>{$ds['community']}</td>
|
<td>{$ds['community']}</td>
|
||||||
|
<td>{$ds['routers']}</td>
|
||||||
<td align="center">
|
<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-edit/{$ds['id']}" class="btn btn-info btn-xs">{$_L['Edit']}</a>
|
||||||
<a href="{$_url}radius/nas-delete/{$ds['id']}" id="{$ds['id']}"
|
<a href="{$_url}radius/nas-delete/{$ds['id']}" id="{$ds['id']}"
|
||||||
|
@ -22,10 +22,11 @@
|
|||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
{if isset($notify)}
|
{if isset($notify)}
|
||||||
<div class="row">
|
<div class="alert alert-{if $notify_t == 's'}success{else}danger{/if}">
|
||||||
<div class="col-md-6 col-md-offset-3">
|
<button type="button" class="close" data-dismiss="alert">
|
||||||
{$notify}
|
<span aria-hidden="true">×</span>
|
||||||
</div>
|
</button>
|
||||||
|
<div>{$notify}</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -34,10 +34,11 @@
|
|||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
{if isset($notify)}
|
{if isset($notify)}
|
||||||
<div class="row">
|
<div class="alert alert-{if $notify_t == 's'}success{else}danger{/if}">
|
||||||
<div class="col-md-6 col-md-offset-3">
|
<button type="button" class="close" data-dismiss="alert">
|
||||||
{$notify}
|
<span aria-hidden="true">×</span>
|
||||||
</div>
|
</button>
|
||||||
|
<div>{$notify}</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -22,10 +22,11 @@
|
|||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
{if isset($notify)}
|
{if isset($notify)}
|
||||||
<div class="row">
|
<div class="alert alert-{if $notify_t == 's'}success{else}danger{/if}">
|
||||||
<div class="col-md-6 col-md-offset-3">
|
<button type="button" class="close" data-dismiss="alert">
|
||||||
{$notify}
|
<span aria-hidden="true">×</span>
|
||||||
</div>
|
</button>
|
||||||
|
<div>{$notify}</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -21,10 +21,11 @@
|
|||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
{if isset($notify)}
|
{if isset($notify)}
|
||||||
<div class="row">
|
<div class="alert alert-{if $notify_t == 's'}success{else}danger{/if}">
|
||||||
<div class="col-sm-6 col-sm-offset-3">
|
<button type="button" class="close" data-dismiss="alert">
|
||||||
{$notify}
|
<span aria-hidden="true">×</span>
|
||||||
</div>
|
</button>
|
||||||
|
<div>{$notify}</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "2023.10.20"
|
"version": "2023.10.25"
|
||||||
}
|
}
|
Reference in New Issue
Block a user