add hook
This commit is contained in:
parent
742e0df1f2
commit
e6f8826490
@ -16,6 +16,7 @@ require_once 'system/autoload/PEAR2/Autoload.php';
|
||||
switch ($action) {
|
||||
|
||||
case 'change-password':
|
||||
run_hook('customer_view_change_password'); #HOOK
|
||||
$ui->display('user-change-password.tpl');
|
||||
break;
|
||||
|
||||
@ -138,6 +139,7 @@ switch ($action) {
|
||||
$id = $_SESSION['uid'];
|
||||
$d = ORM::for_table('tbl_customers')->find_one($id);
|
||||
if($d){
|
||||
run_hook('customer_view_edit_profile'); #HOOK
|
||||
$ui->assign('d',$d);
|
||||
$ui->display('user-profile.tpl');
|
||||
}else{
|
||||
|
@ -39,12 +39,8 @@ switch ($do) {
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'login-display':
|
||||
$ui->display('admin.tpl');
|
||||
break;
|
||||
|
||||
default:
|
||||
run_hook('view_login'); #HOOK
|
||||
$ui->display('admin.tpl');
|
||||
break;
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
||||
* used for ajax
|
||||
**/
|
||||
|
||||
_admin();
|
||||
$ui->assign('_title', $_L['Network'].' - '. $config['CompanyName']);
|
||||
$ui->assign('_system_menu', 'network');
|
||||
@ -15,7 +17,6 @@ switch ($action) {
|
||||
$routers = _get('routers');
|
||||
$d = ORM::for_table('tbl_pool')->where('routers', $routers)->find_many();
|
||||
$ui->assign('d',$d);
|
||||
|
||||
$ui->display('autoload-pool.tpl');
|
||||
break;
|
||||
|
||||
|
@ -17,7 +17,7 @@ if($admin['user_type'] != 'Admin' AND $admin['user_type'] != 'Sales'){
|
||||
switch ($action) {
|
||||
case 'list':
|
||||
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/bandwidth.js"></script>');
|
||||
|
||||
run_hook('view_list_bandwidth'); #HOOK
|
||||
$name = _post('name');
|
||||
if ($name != ''){
|
||||
$paginator = Paginator::bootstrap('tbl_bandwidth','name_bw','%'.$name.'%');
|
||||
@ -33,11 +33,13 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
run_hook('view_add_bandwidth'); #HOOK
|
||||
$ui->display('bandwidth-add.tpl');
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$id = $routes['2'];
|
||||
run_hook('view_edit_bandwith'); #HOOK
|
||||
$d = ORM::for_table('tbl_bandwidth')->find_one($id);
|
||||
if($d){
|
||||
$ui->assign('d',$d);
|
||||
@ -49,6 +51,7 @@ switch ($action) {
|
||||
|
||||
case 'delete':
|
||||
$id = $routes['2'];
|
||||
run_hook('delete_bandwidth'); #HOOK
|
||||
$d = ORM::for_table('tbl_bandwidth')->find_one($id);
|
||||
if($d){
|
||||
$d->delete();
|
||||
@ -62,7 +65,7 @@ switch ($action) {
|
||||
$rate_down_unit = _post('rate_down_unit');
|
||||
$rate_up = _post('rate_up');
|
||||
$rate_up_unit = _post('rate_up_unit');
|
||||
|
||||
run_hook('add_bandwidth'); #HOOK
|
||||
$msg = '';
|
||||
if(Validator::Length($name,16,4) == false){
|
||||
$msg .= 'Name should be between 5 to 15 characters'. '<br>';
|
||||
@ -97,7 +100,7 @@ switch ($action) {
|
||||
$rate_down_unit = _post('rate_down_unit');
|
||||
$rate_up = _post('rate_up');
|
||||
$rate_up_unit = _post('rate_up_unit');
|
||||
|
||||
run_hook('edit_bandwidth'); #HOOK
|
||||
$msg = '';
|
||||
if(Validator::Length($name,16,4) == false){
|
||||
$msg .= 'Name should be between 5 to 15 characters'. '<br>';
|
||||
|
@ -10,6 +10,7 @@ $action = $routes['1'];
|
||||
if(file_exists('system/paymentgateway/'.$action.'.php')){
|
||||
include 'system/paymentgateway/'.$action.'.php';
|
||||
if(function_exists($action.'_payment_notification')){
|
||||
run_hook('callback_payment_notification'); #HOOK
|
||||
call_user_func($action.'_payment_notification');
|
||||
die();
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ switch ($action) {
|
||||
case 'list':
|
||||
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/customers.js"></script>');
|
||||
$username = _post('username');
|
||||
run_hook('list_customers'); #HOOK
|
||||
if ($username != '') {
|
||||
$paginator = Paginator::bootstrap('tbl_customers', 'username', '%' . $username . '%');
|
||||
$d = ORM::for_table('tbl_customers')->where_like('username', '%' . $username . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
|
||||
@ -38,11 +39,13 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
run_hook('view_add_customer'); #HOOK
|
||||
$ui->display('customers-add.tpl');
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$id = $routes['2'];
|
||||
run_hook('edit_customer'); #HOOK
|
||||
$d = ORM::for_table('tbl_customers')->find_one($id);
|
||||
if ($d) {
|
||||
$ui->assign('d', $d);
|
||||
@ -54,7 +57,7 @@ switch ($action) {
|
||||
|
||||
case 'delete':
|
||||
$id = $routes['2'];
|
||||
|
||||
run_hook('delete_customer'); #HOOK
|
||||
$d = ORM::for_table('tbl_customers')->find_one($id);
|
||||
if ($d) {
|
||||
$c = ORM::for_table('tbl_user_recharges')->where('username', $d['username'])->find_one();
|
||||
@ -145,7 +148,7 @@ switch ($action) {
|
||||
$cpassword = _post('cpassword');
|
||||
$address = _post('address');
|
||||
$phonenumber = _post('phonenumber');
|
||||
|
||||
run_hook('add_customer'); #HOOK
|
||||
$msg = '';
|
||||
if (Validator::Length($username, 35, 2) == false) {
|
||||
$msg .= 'Username should be between 3 to 55 characters' . '<br>';
|
||||
@ -186,7 +189,7 @@ switch ($action) {
|
||||
$cpassword = _post('cpassword');
|
||||
$address = _post('address');
|
||||
$phonenumber = _post('phonenumber');
|
||||
|
||||
run_hook('edit_customer'); #HOOK
|
||||
$msg = '';
|
||||
if (Validator::Length($username, 16, 2) == false) {
|
||||
$msg .= 'Username should be between 3 to 15 characters' . '<br>';
|
||||
@ -308,5 +311,5 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
default:
|
||||
echo 'action not defined';
|
||||
r2(U . 'customers/list', 'e', 'action not defined');
|
||||
}
|
||||
|
@ -72,4 +72,5 @@ foreach($tmp as $plan){
|
||||
$ui->assign('stocks',$stocks);
|
||||
$ui->assign('plans',$plans);
|
||||
|
||||
run_hook('view_dashboard'); #HOOK
|
||||
$ui->display('dashboard.tpl');
|
@ -40,7 +40,7 @@ switch ($action) {
|
||||
$ui->assign('dr',$xy);
|
||||
$ui->assign('mdate',$mdate);
|
||||
$ui->assign('recharged_on',$mdate);
|
||||
|
||||
run_hook('print_by_date'); #HOOK
|
||||
$ui->display('print-by-date.tpl');
|
||||
break;
|
||||
|
||||
@ -109,7 +109,7 @@ switch ($action) {
|
||||
$html .= '</table>
|
||||
<h4 class="text-uppercase text-bold">'.$_L['Total_Income'].':</h4>
|
||||
<h3 class="sum">'.$_c['currency_code'].' '.number_format($xy,2,$_c['dec_point'],$_c['thousands_sep']).'</h3>';
|
||||
|
||||
run_hook('print_pdf_by_date'); #HOOK
|
||||
define('_MPDF_PATH','system/vendors/mpdf/');
|
||||
|
||||
require('system/vendors/mpdf/mpdf.php');
|
||||
@ -201,7 +201,7 @@ EOF;
|
||||
$ui->assign('fdate',$fdate);
|
||||
$ui->assign('tdate',$tdate);
|
||||
$ui->assign('stype',$stype);
|
||||
|
||||
run_hook('print_by_period'); #HOOK
|
||||
$ui->display('print-by-period.tpl');
|
||||
break;
|
||||
|
||||
@ -283,6 +283,7 @@ EOF;
|
||||
<h4 class="text-uppercase text-bold">'.$_L['Total_Income'].':</h4>
|
||||
<h3 class="sum">'.$_c['currency_code'].' '.number_format($xy,2,$_c['dec_point'],$_c['thousands_sep']).'</h3>';
|
||||
|
||||
run_hook('pdf_by_period'); #HOOK
|
||||
define('_MPDF_PATH','system/vendors/mpdf/');
|
||||
|
||||
require('system/vendors/mpdf/mpdf.php');
|
||||
|
@ -18,5 +18,5 @@ $ui->assign('unpaid', ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $user['username'])
|
||||
->where('status', 1)
|
||||
->find_one());
|
||||
|
||||
run_hook('view_customer_dashboard'); #HOOK
|
||||
$ui->display('user-dashboard.tpl');
|
||||
|
@ -15,6 +15,7 @@ switch ($do) {
|
||||
case 'post':
|
||||
$username = _post('username');
|
||||
$password = _post('password');
|
||||
run_hook('customer_login'); #HOOK
|
||||
if ($username != '' and $password != '') {
|
||||
$d = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
|
||||
if ($d) {
|
||||
@ -41,11 +42,8 @@ switch ($do) {
|
||||
|
||||
break;
|
||||
|
||||
case 'login-display':
|
||||
$ui->display('login.tpl');
|
||||
break;
|
||||
|
||||
default:
|
||||
run_hook('customer_view_login'); #HOOK
|
||||
$ui->display('login.tpl');
|
||||
break;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
||||
**/
|
||||
run_hook('customer_logout'); #HOOK
|
||||
if (session_status() == PHP_SESSION_NONE) session_start();
|
||||
session_destroy();
|
||||
header('location: index.php');
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
||||
**/
|
||||
_admin();
|
||||
$ui->assign('_title', $_L['Private_Message'].'- '. $config['CompanyName']);
|
||||
$ui->assign('_system_menu', 'message');
|
||||
|
||||
$action = $routes['1'];
|
||||
$admin = Admin::_info();
|
||||
$ui->assign('_admin', $admin);
|
||||
|
||||
switch ($action) {
|
||||
default:
|
||||
$ui->display('a404.tpl');
|
||||
}
|
@ -12,6 +12,7 @@ $ui->assign('_user', $user);
|
||||
switch ($action) {
|
||||
case 'voucher':
|
||||
$ui->assign('_title', $_L['Order_Voucher'] . ' - ' . $config['CompanyName']);
|
||||
run_hook('customer_view_order'); #HOOK
|
||||
$ui->display('user-order.tpl');
|
||||
break;
|
||||
case 'history':
|
||||
@ -22,21 +23,24 @@ switch ($action) {
|
||||
$ui->assign('paginator', $paginator);
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('_title', Lang::T('Order History') . ' - ' . $config['CompanyName']);
|
||||
run_hook('customer_view_order_history'); #HOOK
|
||||
$ui->display('user-orderHistory.tpl');
|
||||
break;
|
||||
case 'package':
|
||||
$ui->assign('_title', 'Order PPOE Internet - ' . $config['CompanyName']);
|
||||
$ui->assign('_title', 'Order Plan - ' . $config['CompanyName']);
|
||||
$routers = ORM::for_table('tbl_routers')->find_many();
|
||||
$plans = ORM::for_table('tbl_plans')->where('enabled', '1')->find_many();
|
||||
$ui->assign('routers', $routers);
|
||||
$ui->assign('plans', $plans);
|
||||
$ui->display('user-orderPackage.tpl');
|
||||
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
|
||||
if ($d) {
|
||||
if (empty($d['pg_url_payment'])) {
|
||||
r2(U . "order/buy/" . $trx['routers_id'] . '/' . $trx['plan_id'], 'w', Lang::T("Checking payment"));
|
||||
@ -51,6 +55,7 @@ switch ($action) {
|
||||
$trx = ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $user['username'])
|
||||
->find_one($trxid);
|
||||
run_hook('customer_view_payment'); #HOOK
|
||||
// jika tidak ditemukan, berarti punya orang lain
|
||||
if (empty($trx)) {
|
||||
r2(U . "order/package", 'w', Lang::T("Payment not found"));
|
||||
@ -63,11 +68,13 @@ switch ($action) {
|
||||
if (!file_exists('system/paymentgateway/' . $trx['gateway'] . '.php')) {
|
||||
r2(U . 'order/view/' . $trxid, 'e', Lang::T("No Payment Gateway Available"));
|
||||
}
|
||||
run_hook('customer_check_payment_status'); #HOOK
|
||||
include 'system/paymentgateway/' . $trx['gateway'] . '.php';
|
||||
call_user_func($trx['gateway'] . '_validate_config');
|
||||
call_user_func($_c['payment_gateway'] . '_get_status', $trx, $user);
|
||||
|
||||
} else if ($routes['3'] == 'cancel') {
|
||||
run_hook('customer_cancel_payment'); #HOOK
|
||||
$trx->pg_paid_response = '{}';
|
||||
$trx->status = 4;
|
||||
$trx->paid_date = date('Y-m-d H:i:s');
|
||||
@ -99,6 +106,7 @@ switch ($action) {
|
||||
if (!file_exists('system/paymentgateway/' . $_c['payment_gateway'] . '.php')) {
|
||||
r2(U . 'home', 'e', Lang::T("No Payment Gateway Available"));
|
||||
}
|
||||
run_hook('customer_buy_plan'); #HOOK
|
||||
include 'system/paymentgateway/' . $_c['payment_gateway'] . '.php';
|
||||
call_user_func($_c['payment_gateway'] . '_validate_config');
|
||||
|
||||
|
@ -13,6 +13,7 @@ $ui->assign('_user', $user);
|
||||
if(file_exists(__DIR__."/../../pages/".str_replace(".","",$action).".html")){
|
||||
$ui->assign("PageFile",$action);
|
||||
$ui->assign("pageHeader",$action);
|
||||
run_hook('customer_view_page'); #HOOK
|
||||
$ui->display('user-pages.tpl');
|
||||
}else
|
||||
$ui->display('404.tpl');
|
@ -13,6 +13,7 @@ $ui->assign('_admin', $admin);
|
||||
if(strpos($action,"-post")===false){
|
||||
$path = __DIR__."/../../pages/".str_replace(".","",$action).".html";
|
||||
//echo $path;
|
||||
run_hook('view_edit_pages'); #HOOK
|
||||
if(file_exists($path)){
|
||||
$html = file_get_contents($path);
|
||||
$ui->assign("htmls",str_replace(["<div","</div>"],"",$html));
|
||||
@ -27,6 +28,7 @@ if(strpos($action,"-post")===false){
|
||||
$path = __DIR__."/../../pages/".str_replace(".","",$action).".html";
|
||||
if(file_exists($path)){
|
||||
$html = _post("html");
|
||||
run_hook('save_pages'); #HOOK
|
||||
if(file_put_contents($path, str_replace(["<div","</div>"],"",$html))){
|
||||
r2(U . 'pages/'.$action, 's', $_L['Success_Save_Page']);
|
||||
}else{
|
||||
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
||||
**/
|
||||
_auth();
|
||||
$ui->assign('_title', $_L['Private_Message'].'- '. $config['CompanyName']);
|
||||
$ui->assign('_system_menu', 'pm');
|
||||
|
||||
$action = $routes['1'];
|
||||
$user = User::_info();
|
||||
$ui->assign('_user', $user);
|
||||
|
||||
switch ($action) {
|
||||
default:
|
||||
$ui->display('404.tpl');
|
||||
}
|
@ -32,13 +32,14 @@ switch ($action) {
|
||||
|
||||
$ui->assign('d',$d);
|
||||
$ui->assign('paginator',$paginator);
|
||||
run_hook('view_pool'); #HOOK
|
||||
$ui->display('pool.tpl');
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
$r = ORM::for_table('tbl_routers')->find_many();
|
||||
$ui->assign('r',$r);
|
||||
|
||||
run_hook('view_add_pool'); #HOOK
|
||||
$ui->display('pool-add.tpl');
|
||||
break;
|
||||
|
||||
@ -47,6 +48,7 @@ switch ($action) {
|
||||
$d = ORM::for_table('tbl_pool')->find_one($id);
|
||||
if($d){
|
||||
$ui->assign('d',$d);
|
||||
run_hook('view_edit_pool'); #HOOK
|
||||
$ui->display('pool-edit.tpl');
|
||||
}else{
|
||||
r2(U . 'pool/list', 'e', $_L['Account_Not_Found']);
|
||||
@ -55,7 +57,7 @@ switch ($action) {
|
||||
|
||||
case 'delete':
|
||||
$id = $routes['2'];
|
||||
|
||||
run_hook('delete_pool'); #HOOK
|
||||
$d = ORM::for_table('tbl_pool')->find_one($id);
|
||||
$mikrotik = Router::_info($d['routers']);
|
||||
if($d){
|
||||
@ -88,7 +90,7 @@ switch ($action) {
|
||||
$name = _post('name');
|
||||
$ip_address = _post('ip_address');
|
||||
$routers = _post('routers');
|
||||
|
||||
run_hook('add_pool'); #HOOK
|
||||
$msg = '';
|
||||
if(Validator::Length($name,30,2) == false){
|
||||
$msg .= 'Name should be between 3 to 30 characters'. '<br>';
|
||||
@ -134,7 +136,7 @@ switch ($action) {
|
||||
$name = _post('name');
|
||||
$ip_address = _post('ip_address');
|
||||
$routers = _post('routers');
|
||||
|
||||
run_hook('edit_pool'); #HOOK
|
||||
$msg = '';
|
||||
if(Validator::Length($name,30,2) == false){
|
||||
$msg .= 'Name should be between 3 to 30 characters'. '<br>';
|
||||
|
@ -37,6 +37,7 @@ switch ($action) {
|
||||
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('paginator', $paginator);
|
||||
run_hook('view_list_billing'); #HOOK
|
||||
$ui->display('prepaid.tpl');
|
||||
break;
|
||||
|
||||
@ -47,7 +48,7 @@ switch ($action) {
|
||||
$ui->assign('p', $p);
|
||||
$r = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
|
||||
$ui->assign('r', $r);
|
||||
|
||||
run_hook('view_recharge'); #HOOK
|
||||
$ui->display('recharge.tpl');
|
||||
break;
|
||||
|
||||
@ -61,7 +62,7 @@ switch ($action) {
|
||||
$ui->assign('p', $p);
|
||||
$r = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
|
||||
$ui->assign('r', $r);
|
||||
|
||||
run_hook('view_recharge_customer'); #HOOK
|
||||
$ui->display('recharge-user.tpl');
|
||||
break;
|
||||
|
||||
@ -99,7 +100,7 @@ switch ($action) {
|
||||
$date_exp = $datetime[0];
|
||||
$time = $datetime[1];
|
||||
}
|
||||
|
||||
run_hook('recharge_customer'); #HOOK
|
||||
if ($type == 'Hotspot') {
|
||||
if ($b) {
|
||||
if(!$_c['radius_mode']){
|
||||
@ -448,9 +449,9 @@ switch ($action) {
|
||||
$ui->assign('d', $d);
|
||||
|
||||
$ui->assign('date', $date_now);
|
||||
run_hook('print_invoice'); #HOOK
|
||||
$ui->display('invoice-print.tpl');
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$id = $routes['2'];
|
||||
@ -459,7 +460,7 @@ switch ($action) {
|
||||
$ui->assign('d', $d);
|
||||
$p = ORM::for_table('tbl_plans')->where('enabled', '1')->find_many();
|
||||
$ui->assign('p', $p);
|
||||
|
||||
run_hook('view_edit_customer_plan'); #HOOK
|
||||
$ui->display('prepaid-edit.tpl');
|
||||
} else {
|
||||
r2(U . 'services/list', 'e', $_L['Account_Not_Found']);
|
||||
@ -472,6 +473,7 @@ switch ($action) {
|
||||
$d = ORM::for_table('tbl_user_recharges')->find_one($id);
|
||||
$mikrotik = Router::_info($d['routers']);
|
||||
if ($d) {
|
||||
run_hook('delete_customer_active_plan'); #HOOK
|
||||
if ($d['type'] == 'Hotspot') {
|
||||
if(!$_c['radius_mode']){
|
||||
try {
|
||||
@ -533,12 +535,13 @@ switch ($action) {
|
||||
}
|
||||
|
||||
if ($msg == '') {
|
||||
run_hook('edit_customer_plan'); #HOOK
|
||||
$d->username = $username;
|
||||
$d->plan_id = $id_plan;
|
||||
$d->recharged_on = $recharged_on;
|
||||
$d->expiration = $expiration;
|
||||
$d->save();
|
||||
|
||||
//TODO set mikrotik for editedd plan
|
||||
r2(U . 'prepaid/list', 's', $_L['Updated_Successfully']);
|
||||
} else {
|
||||
r2(U . 'prepaid/edit/' . $id, 'e', $msg);
|
||||
@ -568,6 +571,7 @@ switch ($action) {
|
||||
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('paginator', $paginator);
|
||||
run_hook('view_list_voucher'); #HOOK
|
||||
$ui->display('voucher.tpl');
|
||||
break;
|
||||
|
||||
@ -579,7 +583,7 @@ switch ($action) {
|
||||
$ui->assign('p', $p);
|
||||
$r = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
|
||||
$ui->assign('r', $r);
|
||||
|
||||
run_hook('view_add_voucher'); #HOOK
|
||||
$ui->display('voucher-add.tpl');
|
||||
break;
|
||||
|
||||
@ -657,7 +661,7 @@ switch ($action) {
|
||||
|
||||
//for counting pagebreak
|
||||
$ui->assign('jml', 0);
|
||||
|
||||
run_hook('view_print_voucher'); #HOOK
|
||||
$ui->display('print-voucher.tpl');
|
||||
break;
|
||||
case 'voucher-post':
|
||||
@ -678,9 +682,10 @@ switch ($action) {
|
||||
$msg .= 'The Length Code must be a number' . '<br>';
|
||||
}
|
||||
if ($msg == '') {
|
||||
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
|
||||
$d = ORM::for_table('tbl_voucher')->create();
|
||||
$d->type = $type;
|
||||
$d->routers = $server;
|
||||
@ -699,7 +704,7 @@ switch ($action) {
|
||||
|
||||
case 'voucher-delete':
|
||||
$id = $routes['2'];
|
||||
|
||||
run_hook('delete_voucher'); #HOOK
|
||||
$d = ORM::for_table('tbl_voucher')->find_one($id);
|
||||
if ($d) {
|
||||
$d->delete();
|
||||
@ -712,7 +717,7 @@ switch ($action) {
|
||||
|
||||
$c = ORM::for_table('tbl_customers')->find_many();
|
||||
$ui->assign('c', $c);
|
||||
|
||||
run_hook('view_refill'); #HOOK
|
||||
$ui->display('refill.tpl');
|
||||
|
||||
break;
|
||||
@ -746,7 +751,7 @@ switch ($action) {
|
||||
$date_exp = $datetime[0];
|
||||
$time = $datetime[1];
|
||||
}
|
||||
|
||||
run_hook('refill_customer'); #HOOK
|
||||
if ($v1) {
|
||||
if ($v1['type'] == 'Hotspot') {
|
||||
if ($b) {
|
||||
|
@ -14,11 +14,7 @@ if (isset($routes['1'])) {
|
||||
$do = 'register-display';
|
||||
}
|
||||
|
||||
use PEAR2\Net\RouterOS;
|
||||
|
||||
require_once 'system/autoload/PEAR2/Autoload.php';
|
||||
|
||||
$otpPath = 'system/uploads/sms/';
|
||||
$otpPath = 'system/cache/sms/';
|
||||
|
||||
switch ($do) {
|
||||
case 'post':
|
||||
@ -45,6 +41,7 @@ switch ($do) {
|
||||
|
||||
if(!empty($_c['sms_url'])){
|
||||
$otpPath .= sha1($username.$db_password).".txt";
|
||||
run_hook('validate_otp'); #HOOK
|
||||
if(file_exists($otpPath) && time()-filemtime($otpPath)>300){
|
||||
unlink($otpPath);
|
||||
r2(U . 'register', 's', 'Verification code expired');
|
||||
@ -74,6 +71,7 @@ switch ($do) {
|
||||
$msg .= $_L['account_already_exist'] . '<br>';
|
||||
}
|
||||
if ($msg == '') {
|
||||
run_hook('register_user'); #HOOK
|
||||
$d = ORM::for_table('tbl_customers')->create();
|
||||
$d->username = $username;
|
||||
$d->password = $password;
|
||||
@ -93,7 +91,8 @@ switch ($do) {
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<div>Failed to register</div></div>');
|
||||
r2(U . 'register', 's', 'Failed to register');
|
||||
run_hook('view_otp_register'); #HOOK
|
||||
$ui->display('register-rotp.tpl');
|
||||
}
|
||||
} else {
|
||||
$ui->assign('username', $username);
|
||||
@ -143,6 +142,7 @@ switch ($do) {
|
||||
$ui->display('register-otp.tpl');
|
||||
}
|
||||
}else{
|
||||
run_hook('view_otp_register'); #HOOK
|
||||
$ui->display('register-rotp.tpl');
|
||||
}
|
||||
}else{
|
||||
@ -150,6 +150,7 @@ switch ($do) {
|
||||
$ui->assign('fullname', "");
|
||||
$ui->assign('address', "");
|
||||
$ui->assign('otp', false);
|
||||
run_hook('view_register'); #HOOK
|
||||
$ui->display('register.tpl');
|
||||
}
|
||||
break;
|
||||
|
@ -27,57 +27,57 @@ switch ($action) {
|
||||
$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');
|
||||
|
||||
|
||||
$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);
|
||||
|
||||
run_hook('view_reports_by_period'); #HOOK
|
||||
$ui->display('reports-period.tpl');
|
||||
break;
|
||||
|
||||
|
||||
case 'period-view':
|
||||
$fdate = _post('fdate');
|
||||
$tdate = _post('tdate');
|
||||
$stype = _post('stype');
|
||||
|
||||
|
||||
$d = ORM::for_table('tbl_transactions');
|
||||
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->where_gte('recharged_on', $fdate);
|
||||
$dr->where_lte('recharged_on', $tdate);
|
||||
$xy = $dr->sum('price');
|
||||
|
||||
|
||||
$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:
|
||||
echo 'action not defined';
|
||||
}
|
@ -33,12 +33,12 @@ switch ($action) {
|
||||
|
||||
$ui->assign('d',$d);
|
||||
$ui->assign('paginator',$paginator);
|
||||
run_hook('view_list_routers'); #HOOK
|
||||
$ui->display('routers.tpl');
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
$d = ORM::for_table('tbl_routers')->find_many();
|
||||
$ui->assign('d',$d);
|
||||
run_hook('view_add_routers'); #HOOK
|
||||
$ui->display('routers-add.tpl');
|
||||
break;
|
||||
|
||||
@ -47,6 +47,7 @@ switch ($action) {
|
||||
$d = ORM::for_table('tbl_routers')->find_one($id);
|
||||
if($d){
|
||||
$ui->assign('d',$d);
|
||||
run_hook('view_router_edit'); #HOOK
|
||||
$ui->display('routers-edit.tpl');
|
||||
}else{
|
||||
r2(U . 'routers/list', 'e', $_L['Account_Not_Found']);
|
||||
@ -55,7 +56,7 @@ switch ($action) {
|
||||
|
||||
case 'delete':
|
||||
$id = $routes['2'];
|
||||
|
||||
run_hook('router_delete'); #HOOK
|
||||
$d = ORM::for_table('tbl_routers')->find_one($id);
|
||||
if($d){
|
||||
$d->delete();
|
||||
@ -94,6 +95,7 @@ switch ($action) {
|
||||
}
|
||||
|
||||
if($msg == ''){
|
||||
run_hook('add_router'); #HOOK
|
||||
$d = ORM::for_table('tbl_routers')->create();
|
||||
$d->name = $name;
|
||||
$d->ip_address = $ip_address;
|
||||
@ -160,6 +162,7 @@ switch ($action) {
|
||||
|
||||
|
||||
if($msg == ''){
|
||||
run_hook('router_edit'); #HOOK
|
||||
$d->name = $name;
|
||||
$d->ip_address = $ip_address;
|
||||
$d->username = $username;
|
||||
|
@ -35,6 +35,7 @@ switch ($action) {
|
||||
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('paginator', $paginator);
|
||||
run_hook('view_list_plans'); #HOOK
|
||||
$ui->display('hotspot.tpl');
|
||||
break;
|
||||
|
||||
@ -43,7 +44,7 @@ switch ($action) {
|
||||
$ui->assign('d', $d);
|
||||
$r = ORM::for_table('tbl_routers')->find_many();
|
||||
$ui->assign('r', $r);
|
||||
|
||||
run_hook('view_add_plan'); #HOOK
|
||||
$ui->display('hotspot-add.tpl');
|
||||
break;
|
||||
|
||||
@ -56,7 +57,7 @@ switch ($action) {
|
||||
$ui->assign('b', $b);
|
||||
$r = ORM::for_table('tbl_routers')->find_many();
|
||||
$ui->assign('r', $r);
|
||||
|
||||
run_hook('view_edit_plan'); #HOOK
|
||||
$ui->display('hotspot-edit.tpl');
|
||||
} else {
|
||||
r2(U . 'services/hotspot', 'e', $_L['Account_Not_Found']);
|
||||
@ -68,6 +69,7 @@ switch ($action) {
|
||||
|
||||
$d = ORM::for_table('tbl_plans')->find_one($id);
|
||||
if ($d) {
|
||||
run_hook('delete_plan'); #HOOK
|
||||
if(!$_c['radius_mode']){
|
||||
$mikrotik = Router::_info($d['routers']);
|
||||
try {
|
||||
@ -127,6 +129,8 @@ switch ($action) {
|
||||
$msg .= $_L['Plan_already_exist'] . '<br>';
|
||||
}
|
||||
|
||||
run_hook('add_plan'); #HOOK
|
||||
|
||||
if ($msg == '') {
|
||||
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
||||
if ($b['rate_down_unit'] == 'Kbps') {
|
||||
@ -216,7 +220,7 @@ switch ($action) {
|
||||
} else {
|
||||
$msg .= $_L['Data_Not_Found'] . '<br>';
|
||||
}
|
||||
|
||||
run_hook('edit_plan'); #HOOK
|
||||
if ($msg == '') {
|
||||
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
||||
if ($b['rate_down_unit'] == 'Kbps') {
|
||||
@ -290,6 +294,7 @@ switch ($action) {
|
||||
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('paginator', $paginator);
|
||||
run_hook('view_list_ppoe'); #HOOK
|
||||
$ui->display('pppoe.tpl');
|
||||
break;
|
||||
|
||||
@ -300,7 +305,7 @@ switch ($action) {
|
||||
$ui->assign('p', $p);
|
||||
$r = ORM::for_table('tbl_routers')->find_many();
|
||||
$ui->assign('r', $r);
|
||||
|
||||
run_hook('view_add_ppoe'); #HOOK
|
||||
$ui->display('pppoe-add.tpl');
|
||||
break;
|
||||
|
||||
@ -315,7 +320,7 @@ switch ($action) {
|
||||
$ui->assign('p', $p);
|
||||
$r = ORM::for_table('tbl_routers')->find_many();
|
||||
$ui->assign('r', $r);
|
||||
|
||||
run_hook('view_edit_ppoe'); #HOOK
|
||||
$ui->display('pppoe-edit.tpl');
|
||||
} else {
|
||||
r2(U . 'services/pppoe', 'e', $_L['Account_Not_Found']);
|
||||
@ -327,6 +332,7 @@ switch ($action) {
|
||||
|
||||
$d = ORM::for_table('tbl_plans')->find_one($id);
|
||||
if ($d) {
|
||||
run_hook('delete_ppoe'); #HOOK
|
||||
if(!$_c['radius_mode']){
|
||||
$mikrotik = Router::_info($d['routers']);
|
||||
try {
|
||||
@ -378,7 +384,7 @@ switch ($action) {
|
||||
if ($d) {
|
||||
$msg .= $_L['Plan_already_exist'] . '<br>';
|
||||
}
|
||||
|
||||
run_hook('add_ppoe'); #HOOK
|
||||
if ($msg == '') {
|
||||
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
||||
if ($b['rate_down_unit'] == 'Kbps') {
|
||||
@ -456,7 +462,7 @@ switch ($action) {
|
||||
} else {
|
||||
$msg .= $_L['Data_Not_Found'] . '<br>';
|
||||
}
|
||||
|
||||
run_hook('edit_ppoe'); #HOOK
|
||||
if ($msg == '') {
|
||||
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
||||
if ($b['rate_down_unit'] == 'Kbps') {
|
||||
|
@ -17,7 +17,7 @@ switch ($action) {
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
run_hook('view_app_settings'); #HOOK
|
||||
$ui->display('app-settings.tpl');
|
||||
break;
|
||||
|
||||
@ -31,6 +31,7 @@ switch ($action) {
|
||||
$timezonelist = Timezone::timezoneList();
|
||||
$ui->assign('tlist', $timezonelist);
|
||||
$ui->assign('xjq', ' $("#tzone").select2(); ');
|
||||
run_hook('view_localisation'); #HOOK
|
||||
$ui->display('app-localisation.tpl');
|
||||
break;
|
||||
|
||||
@ -52,6 +53,7 @@ switch ($action) {
|
||||
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('paginator', $paginator);
|
||||
run_hook('view_list_admin'); #HOOK
|
||||
$ui->display('users.tpl');
|
||||
break;
|
||||
|
||||
@ -59,7 +61,7 @@ switch ($action) {
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
run_hook('view_add_admin'); #HOOK
|
||||
$ui->display('users-add.tpl');
|
||||
break;
|
||||
|
||||
@ -72,6 +74,7 @@ switch ($action) {
|
||||
$d = ORM::for_table('tbl_users')->find_one($id);
|
||||
if ($d) {
|
||||
$ui->assign('d', $d);
|
||||
run_hook('view_edit_admin'); #HOOK
|
||||
$ui->display('users-edit.tpl');
|
||||
} else {
|
||||
r2(U . 'settings/users', 'e', $_L['Account_Not_Found']);
|
||||
@ -89,6 +92,7 @@ switch ($action) {
|
||||
}
|
||||
$d = ORM::for_table('tbl_users')->find_one($id);
|
||||
if ($d) {
|
||||
run_hook('delete_admin'); #HOOK
|
||||
$d->delete();
|
||||
r2(U . 'settings/users', 's', $_L['User_Delete_Ok']);
|
||||
} else {
|
||||
@ -121,6 +125,7 @@ switch ($action) {
|
||||
$msg .= $_L['account_already_exist'] . '<br>';
|
||||
}
|
||||
$date_now = date("Y-m-d H:i:s");
|
||||
run_hook('add_admin'); #HOOK
|
||||
if ($msg == '') {
|
||||
$password = Password::_crypt($password);
|
||||
$d = ORM::for_table('tbl_users')->create();
|
||||
@ -175,7 +180,7 @@ switch ($action) {
|
||||
$msg .= $_L['account_already_exist'] . '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
run_hook('edit_admin'); #HOOK
|
||||
if ($msg == '') {
|
||||
$d->username = $username;
|
||||
if ($password != '') {
|
||||
@ -207,6 +212,7 @@ switch ($action) {
|
||||
$address = _post('address');
|
||||
$tawkto = _post('tawkto');
|
||||
$radius_mode = _post('radius_mode')*1;
|
||||
run_hook('save_settings'); #HOOK
|
||||
if ($company == '') {
|
||||
r2(U . 'settings/app', 'e', $_L['All_field_is_required']);
|
||||
} else {
|
||||
@ -305,6 +311,7 @@ switch ($action) {
|
||||
$tzone = _post('tzone');
|
||||
$date_format = _post('date_format');
|
||||
$lan = _post('lan');
|
||||
run_hook('save_localisation'); #HOOK
|
||||
if ($tzone == '' or $date_format == '' or $lan == '') {
|
||||
r2(U . 'settings/app', 'e', $_L['All_field_is_required']);
|
||||
} else {
|
||||
@ -348,7 +355,7 @@ switch ($action) {
|
||||
if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
run_hook('view_change_password'); #HOOK
|
||||
$ui->display('change-password.tpl');
|
||||
break;
|
||||
|
||||
@ -356,6 +363,7 @@ switch ($action) {
|
||||
$password = _post('password');
|
||||
if ($password != '') {
|
||||
$d = ORM::for_table('tbl_users')->where('username', $admin['username'])->find_one();
|
||||
run_hook('change_password'); #HOOK
|
||||
if ($d) {
|
||||
$d_pass = $d['password'];
|
||||
if (Password::_verify($password, $d_pass) == true) {
|
||||
@ -409,6 +417,7 @@ switch ($action) {
|
||||
|
||||
$ui->assign('tables', $tables);
|
||||
$ui->assign('dbsize', $mbytes);
|
||||
run_hook('view_database'); #HOOK
|
||||
$ui->display('dbstatus.tpl');
|
||||
}
|
||||
break;
|
||||
@ -419,6 +428,7 @@ switch ($action) {
|
||||
}
|
||||
|
||||
try {
|
||||
run_hook('backup_database'); #HOOK
|
||||
$mysqli = new mysqli($db_host, $db_user, $db_password, $db_name);
|
||||
if ($mysqli->connect_errno) {
|
||||
throw new Exception("Failed to connect to MySQL: " . $mysqli->connect_error);
|
||||
@ -506,7 +516,7 @@ switch ($action) {
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
run_hook('view_add_language'); #HOOK
|
||||
$ui->display('language-add.tpl');
|
||||
break;
|
||||
|
||||
@ -523,6 +533,7 @@ switch ($action) {
|
||||
if ($d) {
|
||||
$msg .= $_L['Lang_already_exist'] . '<br>';
|
||||
}
|
||||
run_hook('save_language'); #HOOK
|
||||
if ($msg == '') {
|
||||
$b = ORM::for_table('tbl_language')->create();
|
||||
$b->name = $name;
|
||||
|
@ -19,12 +19,12 @@ require_once 'system/autoload/PEAR2/Autoload.php';
|
||||
switch ($action) {
|
||||
|
||||
case 'activation':
|
||||
run_hook('view_activate_voucher'); #HOOK
|
||||
$ui->display('user-activation.tpl');
|
||||
break;
|
||||
|
||||
case 'activation-post':
|
||||
$code = _post('code');
|
||||
|
||||
$v1 = ORM::for_table('tbl_voucher')->where('code', $code)->where('status', 0)->find_one();
|
||||
|
||||
$c = ORM::for_table('tbl_customers')->find_one($user['id']);
|
||||
@ -49,6 +49,7 @@ switch ($action) {
|
||||
$date_exp = $datetime[0];
|
||||
$time = $datetime[1];
|
||||
}
|
||||
run_hook('customer_activate_voucher'); #HOOK
|
||||
if ($v1) {
|
||||
if ($v1['type'] == 'Hotspot') {
|
||||
if ($b) {
|
||||
@ -377,6 +378,7 @@ switch ($action) {
|
||||
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('paginator', $paginator);
|
||||
run_hook('customer_view_activation_list'); #HOOK
|
||||
$ui->display('user-activation-list.tpl');
|
||||
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user