Fix Demo mode
This commit is contained in:
parent
29ad9dec73
commit
28ec7883e2
@ -68,7 +68,7 @@ class Package
|
|||||||
if ($p['prepaid'] == 'no') {
|
if ($p['prepaid'] == 'no') {
|
||||||
$day_exp = $p['expired_date'];
|
$day_exp = $p['expired_date'];
|
||||||
}
|
}
|
||||||
if(empty($day_exp)){
|
if (empty($day_exp)) {
|
||||||
$day_exp = 20;
|
$day_exp = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,13 +214,15 @@ class Package
|
|||||||
|
|
||||||
if ($isChangePlan || $b['status'] == 'off') {
|
if ($isChangePlan || $b['status'] == 'off') {
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->add_customer($c, $p);
|
(new $p['device'])->add_customer($c, $p);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$b->customer_id = $id_customer;
|
$b->customer_id = $id_customer;
|
||||||
$b->username = $c['username'];
|
$b->username = $c['username'];
|
||||||
@ -297,12 +299,14 @@ class Package
|
|||||||
} else {
|
} else {
|
||||||
// active plan not exists
|
// active plan not exists
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->add_customer($c, $p);
|
(new $p['device'])->add_customer($c, $p);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$d = ORM::for_table('tbl_user_recharges')->create();
|
$d = ORM::for_table('tbl_user_recharges')->create();
|
||||||
$d->customer_id = $id_customer;
|
$d->customer_id = $id_customer;
|
||||||
@ -397,23 +401,6 @@ class Package
|
|||||||
return $inv;
|
return $inv;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function changeTo($username, $plan_id, $from_id)
|
|
||||||
{
|
|
||||||
global $_app_stage;
|
|
||||||
$c = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
|
|
||||||
$p = ORM::for_table('tbl_plans')->where('id', $plan_id)->find_one();
|
|
||||||
$b = ORM::for_table('tbl_user_recharges')->find_one($from_id);
|
|
||||||
|
|
||||||
$dvc = Package::getDevice($p);
|
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
|
||||||
require_once $dvc;
|
|
||||||
(new $p['device'])->change_customer($b, $c, $p);
|
|
||||||
} else {
|
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static function _raid()
|
public static function _raid()
|
||||||
{
|
{
|
||||||
return ORM::for_table('tbl_transactions')->max('id') + 1;
|
return ORM::for_table('tbl_transactions')->max('id') + 1;
|
||||||
|
@ -44,13 +44,15 @@ switch ($action) {
|
|||||||
// if has active plan, change the password to devices
|
// if has active plan, change the password to devices
|
||||||
$p = ORM::for_table('tbl_plans')->where('id', $c['plan_id'])->find_one();
|
$p = ORM::for_table('tbl_plans')->where('id', $c['plan_id'])->find_one();
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->remove_customer($c, $p);
|
(new $p['device'])->remove_customer($c, $p);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$d->password = $npass;
|
$d->password = $npass;
|
||||||
$d->save();
|
$d->save();
|
||||||
|
|
||||||
|
@ -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
|
||||||
@ -19,21 +20,22 @@ switch ($action) {
|
|||||||
if ($bill['type'] == 'Hotspot' && $bill['status'] == 'on') {
|
if ($bill['type'] == 'Hotspot' && $bill['status'] == 'on') {
|
||||||
$p = ORM::for_table('tbl_plans')->find_one($bill['plan_id']);
|
$p = ORM::for_table('tbl_plans')->find_one($bill['plan_id']);
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
if ((new $p['device'])->online_customer($user, $bill['routers'])) {
|
if ((new $p['device'])->online_customer($user, $bill['routers'])) {
|
||||||
die('<a href="' . U . 'home&mikrotik=logout&id='.$bill['id'].'" onclick="return confirm(\''.Lang::T('Disconnect Internet?').'\')" class="btn btn-success btn-xs btn-block">'.Lang::T('You are Online, Logout?').'</a>');
|
die('<a href="' . U . 'home&mikrotik=logout&id=' . $bill['id'] . '" onclick="return confirm(\'' . Lang::T('Disconnect Internet?') . '\')" class="btn btn-success btn-xs btn-block">' . Lang::T('You are Online, Logout?') . '</a>');
|
||||||
} else {
|
} else {
|
||||||
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
|
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
|
||||||
die('<a href="' . U . 'home&mikrotik=login&id='.$bill['id'].'" onclick="return confirm(\''.Lang::T('Connect to Internet?').'\')" class="btn btn-danger btn-xs btn-block">'.Lang::T('Not Online, Login now?').'</a>');
|
die('<a href="' . U . 'home&mikrotik=login&id=' . $bill['id'] . '" onclick="return confirm(\'' . Lang::T('Connect to Internet?') . '\')" class="btn btn-danger btn-xs btn-block">' . Lang::T('Not Online, Login now?') . '</a>');
|
||||||
}else{
|
} else {
|
||||||
die(Lang::T('Your account not connected to internet'));
|
die(Lang::T('Your account not connected to internet'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
die('--');
|
die('--');
|
||||||
}
|
}
|
||||||
|
@ -214,12 +214,14 @@ switch ($action) {
|
|||||||
if ($p) {
|
if ($p) {
|
||||||
$p = ORM::for_table('tbl_plans')->where('id', $c['plan_id'])->find_one();
|
$p = ORM::for_table('tbl_plans')->where('id', $c['plan_id'])->find_one();
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->change_customer($c, $p);
|
(new $p['device'])->change_customer($c, $p);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$b->status = 'off';
|
$b->status = 'off';
|
||||||
$b->expiration = date('Y-m-d');
|
$b->expiration = date('Y-m-d');
|
||||||
$b->time = date('H:i:s');
|
$b->time = date('H:i:s');
|
||||||
@ -242,7 +244,8 @@ switch ($action) {
|
|||||||
if ($p) {
|
if ($p) {
|
||||||
$routers[] = $b['routers'];
|
$routers[] = $b['routers'];
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->add_customer($c, $p);
|
(new $p['device'])->add_customer($c, $p);
|
||||||
} else {
|
} else {
|
||||||
@ -250,6 +253,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
r2(U . 'customers/view/' . $id_customer, 's', 'Sync success to ' . implode(", ", $routers));
|
r2(U . 'customers/view/' . $id_customer, 's', 'Sync success to ' . implode(", ", $routers));
|
||||||
}
|
}
|
||||||
r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan');
|
r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan');
|
||||||
@ -328,15 +332,17 @@ switch ($action) {
|
|||||||
$c = ORM::for_table('tbl_user_recharges')->where('username', $d['username'])->find_one();
|
$c = ORM::for_table('tbl_user_recharges')->where('username', $d['username'])->find_one();
|
||||||
if ($c) {
|
if ($c) {
|
||||||
$p = ORM::for_table('tbl_plans')->find_one($c['plan_id']);
|
$p = ORM::for_table('tbl_plans')->find_one($c['plan_id']);
|
||||||
if($p){
|
if ($p) {
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->remove_customer($d, $p);
|
(new $p['device'])->remove_customer($d, $p);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
$c->delete();
|
$c->delete();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@ -569,7 +575,8 @@ switch ($action) {
|
|||||||
$c->save();
|
$c->save();
|
||||||
$p = ORM::for_table('tbl_plans')->find_one($c['plan_id']);
|
$p = ORM::for_table('tbl_plans')->find_one($c['plan_id']);
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->remove_customer($d, $p);
|
(new $p['device'])->remove_customer($d, $p);
|
||||||
(new $p['device'])->add_customer($d, $p);
|
(new $p['device'])->add_customer($d, $p);
|
||||||
@ -578,6 +585,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
r2(U . 'customers/view/' . $id, 's', 'User Updated Successfully');
|
r2(U . 'customers/view/' . $id, 's', 'User Updated Successfully');
|
||||||
} else {
|
} else {
|
||||||
r2(U . 'customers/edit/' . $id, 'e', $msg);
|
r2(U . 'customers/edit/' . $id, 'e', $msg);
|
||||||
|
@ -156,12 +156,14 @@ if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
|
|||||||
if ($tur['status'] != 'on') {
|
if ($tur['status'] != 'on') {
|
||||||
$p = ORM::for_table('tbl_plans')->findOne($tur['plan_id']);
|
$p = ORM::for_table('tbl_plans')->findOne($tur['plan_id']);
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->add_customer($user, $p);
|
(new $p['device'])->add_customer($user, $p);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// make customer cannot extend again
|
// make customer cannot extend again
|
||||||
$days = $config['extend_days'];
|
$days = $config['extend_days'];
|
||||||
@ -188,12 +190,14 @@ if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
|
|||||||
if ($bill) {
|
if ($bill) {
|
||||||
$p = ORM::for_table('tbl_plans')->where('id', $bill['plan_id'])->find_one();
|
$p = ORM::for_table('tbl_plans')->where('id', $bill['plan_id'])->find_one();
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->remove_customer($user, $p);
|
(new $p['device'])->remove_customer($user, $p);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$bill->status = 'off';
|
$bill->status = 'off';
|
||||||
$bill->expiration = date('Y-m-d');
|
$bill->expiration = date('Y-m-d');
|
||||||
$bill->time = date('H:i:s');
|
$bill->time = date('H:i:s');
|
||||||
@ -212,7 +216,8 @@ if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
|
|||||||
$bill = ORM::for_table('tbl_user_recharges')->where('id', $_GET['id'])->where('username', $user['username'])->findOne();
|
$bill = ORM::for_table('tbl_user_recharges')->where('id', $_GET['id'])->where('username', $user['username'])->findOne();
|
||||||
$p = ORM::for_table('tbl_plans')->where('id', $bill['plan_id'])->find_one();
|
$p = ORM::for_table('tbl_plans')->where('id', $bill['plan_id'])->find_one();
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
if ($_GET['mikrotik'] == 'login') {
|
if ($_GET['mikrotik'] == 'login') {
|
||||||
(new $p['device'])->connect_customer($user, $_SESSION['nux-ip'], $_SESSION['nux-mac'], $bill['routers']);
|
(new $p['device'])->connect_customer($user, $_SESSION['nux-ip'], $_SESSION['nux-mac'], $bill['routers']);
|
||||||
@ -224,12 +229,13 @@ if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
|
|||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ui->assign('unpaid', ORM::for_table('tbl_payment_gateway')
|
$ui->assign('unpaid', ORM::for_table('tbl_payment_gateway')
|
||||||
->where('username', $user['username'])
|
->where('username', $user['username'])
|
||||||
->where('status', 1)
|
->where('status', 1)
|
||||||
->find_one());
|
->find_one());
|
||||||
$ui->assign('code', alphanumeric(_get('code'),"-"));
|
$ui->assign('code', alphanumeric(_get('code'), "-"));
|
||||||
run_hook('view_customer_dashboard'); #HOOK
|
run_hook('view_customer_dashboard'); #HOOK
|
||||||
$ui->display('user-dashboard.tpl');
|
$ui->display('user-dashboard.tpl');
|
||||||
|
@ -97,15 +97,18 @@ switch ($do) {
|
|||||||
try {
|
try {
|
||||||
$p = ORM::for_table('tbl_plans')->where('id', $v1['id_plan'])->find_one();
|
$p = ORM::for_table('tbl_plans')->where('id', $v1['id_plan'])->find_one();
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->connect_customer($user, $_SESSION['nux-ip'], $_SESSION['nux-mac'], $v1['routers']);
|
(new $p['device'])->connect_customer($user, $_SESSION['nux-ip'], $_SESSION['nux-mac'], $v1['routers']);
|
||||||
} else {
|
|
||||||
if (!empty($config['voucher_redirect'])) {
|
if (!empty($config['voucher_redirect'])) {
|
||||||
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, now you can login"));
|
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, now you can login"));
|
||||||
} else {
|
} else {
|
||||||
r2(U . "login", 's', Lang::T("Voucher activation success, now you can login"));
|
r2(U . "login", 's', Lang::T("Voucher activation success, now you can login"));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!empty($config['voucher_redirect'])) {
|
if (!empty($config['voucher_redirect'])) {
|
||||||
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, you are connected to internet"));
|
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, you are connected to internet"));
|
||||||
@ -141,15 +144,18 @@ switch ($do) {
|
|||||||
try {
|
try {
|
||||||
$p = ORM::for_table('tbl_plans')->where('id', $v1['id_plan'])->find_one();
|
$p = ORM::for_table('tbl_plans')->where('id', $v1['id_plan'])->find_one();
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->connect_customer($user, $_SESSION['nux-ip'], $_SESSION['nux-mac'], $v1['routers']);
|
(new $p['device'])->connect_customer($user, $_SESSION['nux-ip'], $_SESSION['nux-mac'], $v1['routers']);
|
||||||
} else {
|
|
||||||
if (!empty($config['voucher_redirect'])) {
|
if (!empty($config['voucher_redirect'])) {
|
||||||
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, now you can login"));
|
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, now you can login"));
|
||||||
} else {
|
} else {
|
||||||
r2(U . "login", 's', Lang::T("Voucher activation success, now you can login"));
|
r2(U . "login", 's', Lang::T("Voucher activation success, now you can login"));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!empty($config['voucher_redirect'])) {
|
if (!empty($config['voucher_redirect'])) {
|
||||||
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, you are connected to internet"));
|
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, you are connected to internet"));
|
||||||
@ -182,7 +188,7 @@ switch ($do) {
|
|||||||
default:
|
default:
|
||||||
run_hook('customer_view_login'); #HOOK
|
run_hook('customer_view_login'); #HOOK
|
||||||
if ($config['disable_registration'] == 'yes') {
|
if ($config['disable_registration'] == 'yes') {
|
||||||
$ui->assign('code', alphanumeric(_get('code'),"-"));
|
$ui->assign('code', alphanumeric(_get('code'), "-"));
|
||||||
$ui->display('user-login-noreg.tpl');
|
$ui->display('user-login-noreg.tpl');
|
||||||
} else {
|
} else {
|
||||||
$ui->display('user-login.tpl');
|
$ui->display('user-login.tpl');
|
||||||
|
@ -42,21 +42,23 @@ switch ($action) {
|
|||||||
$router = '';
|
$router = '';
|
||||||
foreach ($turs as $tur) {
|
foreach ($turs as $tur) {
|
||||||
$p = ORM::for_table('tbl_plans')->findOne($tur['plan_id']);
|
$p = ORM::for_table('tbl_plans')->findOne($tur['plan_id']);
|
||||||
if($p){
|
if ($p) {
|
||||||
$c = ORM::for_table('tbl_customers')->findOne($tur['customer_id']);
|
$c = ORM::for_table('tbl_customers')->findOne($tur['customer_id']);
|
||||||
if($c){
|
if ($c) {
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->add_customer($c, $p);
|
(new $p['device'])->add_customer($c, $p);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$log .= "DONE : $tur[username], $ptur[namebp], $tur[type], $tur[routers]<br>";
|
$log .= "DONE : $tur[username], $ptur[namebp], $tur[type], $tur[routers]<br>";
|
||||||
}else{
|
} else {
|
||||||
$log .= "Customer NOT FOUND : $tur[username], $tur[namebp], $tur[type], $tur[routers]<br>";
|
$log .= "Customer NOT FOUND : $tur[username], $tur[namebp], $tur[type], $tur[routers]<br>";
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$log .= "PLAN NOT FOUND : $tur[username], $tur[namebp], $tur[type], $tur[routers]<br>";
|
$log .= "PLAN NOT FOUND : $tur[username], $tur[namebp], $tur[type], $tur[routers]<br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,7 +73,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
$usings = explode(',', $config['payment_usings']);
|
$usings = explode(',', $config['payment_usings']);
|
||||||
$usings = array_filter(array_unique($usings));
|
$usings = array_filter(array_unique($usings));
|
||||||
if(count($usings)==0){
|
if (count($usings) == 0) {
|
||||||
$usings[] = Lang::T('Cash');
|
$usings[] = Lang::T('Cash');
|
||||||
}
|
}
|
||||||
$ui->assign('usings', $usings);
|
$ui->assign('usings', $usings);
|
||||||
@ -117,7 +119,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
$usings = explode(',', $config['payment_usings']);
|
$usings = explode(',', $config['payment_usings']);
|
||||||
$usings = array_filter(array_unique($usings));
|
$usings = array_filter(array_unique($usings));
|
||||||
if(count($usings)==0){
|
if (count($usings) == 0) {
|
||||||
$usings[] = Lang::T('Cash');
|
$usings[] = Lang::T('Cash');
|
||||||
}
|
}
|
||||||
$ui->assign('usings', $usings);
|
$ui->assign('usings', $usings);
|
||||||
@ -267,12 +269,15 @@ switch ($action) {
|
|||||||
if ($d) {
|
if ($d) {
|
||||||
run_hook('delete_customer_active_plan'); #HOOK
|
run_hook('delete_customer_active_plan'); #HOOK
|
||||||
$p = ORM::for_table('tbl_plans')->find_one($d['plan_id']);
|
$p = ORM::for_table('tbl_plans')->find_one($d['plan_id']);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
$dvc = Package::getDevice($p);
|
||||||
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->remove_customer($c, $p);
|
(new $p['device'])->remove_customer($c, $p);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$d->delete();
|
$d->delete();
|
||||||
_log('[' . $admin['username'] . ']: ' . 'Delete Plan for Customer ' . $c['username'] . ' [' . $in['plan_name'] . '][' . Lang::moneyFormat($in['price']) . ']', $admin['user_type'], $admin['id']);
|
_log('[' . $admin['username'] . ']: ' . 'Delete Plan for Customer ' . $c['username'] . ' [' . $in['plan_name'] . '][' . Lang::moneyFormat($in['price']) . ']', $admin['user_type'], $admin['id']);
|
||||||
r2(U . 'plan/list', 's', Lang::T('Data Deleted Successfully'));
|
r2(U . 'plan/list', 's', Lang::T('Data Deleted Successfully'));
|
||||||
@ -316,21 +321,25 @@ switch ($action) {
|
|||||||
//remove from old plan
|
//remove from old plan
|
||||||
$p = ORM::for_table('tbl_plans')->find_one($oldPlanID);
|
$p = ORM::for_table('tbl_plans')->find_one($oldPlanID);
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->remove_customer($customer, $p);
|
(new $p['device'])->remove_customer($customer, $p);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//add new plan
|
//add new plan
|
||||||
$dvc = Package::getDevice($newPlan);
|
$dvc = Package::getDevice($newPlan);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $newPlan['device'])->add_customer($customer, $newPlan);
|
(new $newPlan['device'])->add_customer($customer, $newPlan);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$d->save();
|
$d->save();
|
||||||
_log('[' . $admin['username'] . ']: ' . 'Edit Plan for Customer ' . $d['username'] . ' to [' . $d['namebp'] . '][' . Lang::moneyFormat($p['price']) . ']', $admin['user_type'], $admin['id']);
|
_log('[' . $admin['username'] . ']: ' . 'Edit Plan for Customer ' . $d['username'] . ' to [' . $d['namebp'] . '][' . Lang::moneyFormat($p['price']) . ']', $admin['user_type'], $admin['id']);
|
||||||
r2(U . 'plan/list', 's', Lang::T('Data Updated Successfully'));
|
r2(U . 'plan/list', 's', Lang::T('Data Updated Successfully'));
|
||||||
@ -580,13 +589,12 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
run_hook('create_voucher'); #HOOK
|
run_hook('create_voucher'); #HOOK
|
||||||
$vouchers = [];
|
$vouchers = [];
|
||||||
if($voucher_format == 'numbers'){
|
if ($voucher_format == 'numbers') {
|
||||||
if (strlen($lengthcode)<6) {
|
if (strlen($lengthcode) < 6) {
|
||||||
$msg .= 'The Length Code must be a more than 6 for numbers' . '<br>';
|
$msg .= 'The Length Code must be a more than 6 for numbers' . '<br>';
|
||||||
}
|
}
|
||||||
$vouchers = generateUniqueNumericVouchers($numbervoucher, $lengthcode);
|
$vouchers = generateUniqueNumericVouchers($numbervoucher, $lengthcode);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for ($i = 0; $i < $numbervoucher; $i++) {
|
for ($i = 0; $i < $numbervoucher; $i++) {
|
||||||
$code = strtoupper(substr(md5(time() . rand(10000, 99999)), 0, $lengthcode));
|
$code = strtoupper(substr(md5(time() . rand(10000, 99999)), 0, $lengthcode));
|
||||||
if ($voucher_format == 'low') {
|
if ($voucher_format == 'low') {
|
||||||
@ -595,11 +603,10 @@ switch ($action) {
|
|||||||
$code = Lang::randomUpLowCase($code);
|
$code = Lang::randomUpLowCase($code);
|
||||||
}
|
}
|
||||||
$vouchers[] = $code;
|
$vouchers[] = $code;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($vouchers as $code){
|
foreach ($vouchers as $code) {
|
||||||
$d = ORM::for_table('tbl_voucher')->create();
|
$d = ORM::for_table('tbl_voucher')->create();
|
||||||
$d->type = $type;
|
$d->type = $type;
|
||||||
$d->routers = $server;
|
$d->routers = $server;
|
||||||
@ -758,7 +765,7 @@ switch ($action) {
|
|||||||
$c = ORM::for_table('tbl_customers')->where('id', $user)->find_one();
|
$c = ORM::for_table('tbl_customers')->where('id', $user)->find_one();
|
||||||
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
|
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
|
||||||
Package::createInvoice($in);
|
Package::createInvoice($in);
|
||||||
if(!empty($stoken)){
|
if (!empty($stoken)) {
|
||||||
App::setToken($stoken, $in['id']);
|
App::setToken($stoken, $in['id']);
|
||||||
}
|
}
|
||||||
$ui->display('invoice.tpl');
|
$ui->display('invoice.tpl');
|
||||||
@ -793,15 +800,17 @@ switch ($action) {
|
|||||||
$c = ORM::for_table('tbl_customers')->findOne($tur['customer_id']);
|
$c = ORM::for_table('tbl_customers')->findOne($tur['customer_id']);
|
||||||
$p = ORM::for_table('tbl_plans')->find_one($d['plan_id']);
|
$p = ORM::for_table('tbl_plans')->find_one($d['plan_id']);
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->add_customer($c, $p);
|
(new $p['device'])->add_customer($c, $p);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
_log("$admin[fullname] extend Customer $tur[customer_id] $tur[username] for $days days", $admin['user_type'], $admin['id']);
|
_log("$admin[fullname] extend Customer $tur[customer_id] $tur[username] for $days days", $admin['user_type'], $admin['id']);
|
||||||
r2(U . 'plan', 's', "Extend until $expiration");
|
r2(U . 'plan', 's', "Extend until $expiration");
|
||||||
}else{
|
} else {
|
||||||
r2(U . 'plan', 's', "Customer is not expired yet");
|
r2(U . 'plan', 's', "Customer is not expired yet");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -24,13 +24,15 @@ switch ($action) {
|
|||||||
$router = '';
|
$router = '';
|
||||||
foreach ($plans as $plan) {
|
foreach ($plans as $plan) {
|
||||||
$dvc = Package::getDevice($plan);
|
$dvc = Package::getDevice($plan);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->add_plan($plan);
|
(new $p['device'])->add_plan($plan);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
r2(U . 'services/hotspot', 's', $log);
|
r2(U . 'services/hotspot', 's', $log);
|
||||||
} else if ($routes['2'] == 'pppoe') {
|
} else if ($routes['2'] == 'pppoe') {
|
||||||
$plans = ORM::for_table('tbl_bandwidth')->left_outer_join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'PPPOE')->where('tbl_plans.enabled', '1')->find_many();
|
$plans = ORM::for_table('tbl_bandwidth')->left_outer_join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'PPPOE')->where('tbl_plans.enabled', '1')->find_many();
|
||||||
@ -38,13 +40,15 @@ switch ($action) {
|
|||||||
$router = '';
|
$router = '';
|
||||||
foreach ($plans as $plan) {
|
foreach ($plans as $plan) {
|
||||||
$dvc = Package::getDevice($plan);
|
$dvc = Package::getDevice($plan);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->add_plan($plan);
|
(new $p['device'])->add_plan($plan);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
r2(U . 'services/pppoe', 's', $log);
|
r2(U . 'services/pppoe', 's', $log);
|
||||||
}
|
}
|
||||||
r2(U . 'services/hotspot', 'w', 'Unknown command');
|
r2(U . 'services/hotspot', 'w', 'Unknown command');
|
||||||
@ -128,12 +132,14 @@ switch ($action) {
|
|||||||
if ($d) {
|
if ($d) {
|
||||||
run_hook('delete_plan'); #HOOK
|
run_hook('delete_plan'); #HOOK
|
||||||
$dvc = Package::getDevice($d);
|
$dvc = Package::getDevice($d);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->remove_plan($d);
|
(new $p['device'])->remove_plan($d);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$d->delete();
|
$d->delete();
|
||||||
|
|
||||||
r2(U . 'services/hotspot', 's', Lang::T('Data Deleted Successfully'));
|
r2(U . 'services/hotspot', 's', Lang::T('Data Deleted Successfully'));
|
||||||
@ -210,24 +216,25 @@ switch ($action) {
|
|||||||
$d->enabled = $enabled;
|
$d->enabled = $enabled;
|
||||||
$d->prepaid = $prepaid;
|
$d->prepaid = $prepaid;
|
||||||
$d->device = $device;
|
$d->device = $device;
|
||||||
if($prepaid == 'no'){
|
if ($prepaid == 'no') {
|
||||||
if($expired_date>28 && $expired_date < 1){
|
if ($expired_date > 28 && $expired_date < 1) {
|
||||||
$expired_date = 20;
|
$expired_date = 20;
|
||||||
}
|
}
|
||||||
$d->expired_date = $expired_date;
|
$d->expired_date = $expired_date;
|
||||||
}else{
|
} else {
|
||||||
$d->expired_date = 0;
|
$d->expired_date = 0;
|
||||||
}
|
}
|
||||||
$d->save();
|
$d->save();
|
||||||
|
|
||||||
$dvc = Package::getDevice($d);
|
$dvc = Package::getDevice($d);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->add_plan($d);
|
(new $p['device'])->add_plan($d);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
r2(U . 'services/edit/' . $d->id(), 's', Lang::T('Data Created Successfully'));
|
r2(U . 'services/edit/' . $d->id(), 's', Lang::T('Data Created Successfully'));
|
||||||
} else {
|
} else {
|
||||||
r2(U . 'services/add', 'e', $msg);
|
r2(U . 'services/add', 'e', $msg);
|
||||||
@ -311,24 +318,25 @@ switch ($action) {
|
|||||||
$d->enabled = $enabled;
|
$d->enabled = $enabled;
|
||||||
$d->prepaid = $prepaid;
|
$d->prepaid = $prepaid;
|
||||||
$d->device = $device;
|
$d->device = $device;
|
||||||
if($prepaid == 'no'){
|
if ($prepaid == 'no') {
|
||||||
if($expired_date>28 && $expired_date < 1){
|
if ($expired_date > 28 && $expired_date < 1) {
|
||||||
$expired_date = 20;
|
$expired_date = 20;
|
||||||
}
|
}
|
||||||
$d->expired_date = $expired_date;
|
$d->expired_date = $expired_date;
|
||||||
}else{
|
} else {
|
||||||
$d->expired_date = 0;
|
$d->expired_date = 0;
|
||||||
}
|
}
|
||||||
$d->save();
|
$d->save();
|
||||||
|
|
||||||
$dvc = Package::getDevice($d);
|
$dvc = Package::getDevice($d);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $d['device'])->update_plan($old, $d);
|
(new $d['device'])->update_plan($old, $d);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
r2(U . 'services/hotspot', 's', Lang::T('Data Updated Successfully'));
|
r2(U . 'services/hotspot', 's', Lang::T('Data Updated Successfully'));
|
||||||
} else {
|
} else {
|
||||||
r2(U . 'services/edit/' . $id, 'e', $msg);
|
r2(U . 'services/edit/' . $id, 'e', $msg);
|
||||||
@ -426,12 +434,14 @@ switch ($action) {
|
|||||||
run_hook('delete_ppoe'); #HOOK
|
run_hook('delete_ppoe'); #HOOK
|
||||||
|
|
||||||
$dvc = Package::getDevice($d);
|
$dvc = Package::getDevice($d);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->remove_plan($d);
|
(new $p['device'])->remove_plan($d);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$d->delete();
|
$d->delete();
|
||||||
|
|
||||||
r2(U . 'services/pppoe', 's', Lang::T('Data Deleted Successfully'));
|
r2(U . 'services/pppoe', 's', Lang::T('Data Deleted Successfully'));
|
||||||
@ -510,12 +520,12 @@ switch ($action) {
|
|||||||
$d->is_radius = 0;
|
$d->is_radius = 0;
|
||||||
$d->routers = $routers;
|
$d->routers = $routers;
|
||||||
}
|
}
|
||||||
if($prepaid == 'no'){
|
if ($prepaid == 'no') {
|
||||||
if($expired_date>28 && $expired_date < 1){
|
if ($expired_date > 28 && $expired_date < 1) {
|
||||||
$expired_date = 20;
|
$expired_date = 20;
|
||||||
}
|
}
|
||||||
$d->expired_date = $expired_date;
|
$d->expired_date = $expired_date;
|
||||||
}else{
|
} else {
|
||||||
$d->expired_date = 0;
|
$d->expired_date = 0;
|
||||||
}
|
}
|
||||||
$d->enabled = $enabled;
|
$d->enabled = $enabled;
|
||||||
@ -524,13 +534,14 @@ switch ($action) {
|
|||||||
$d->save();
|
$d->save();
|
||||||
|
|
||||||
$dvc = Package::getDevice($d);
|
$dvc = Package::getDevice($d);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->add_plan($d);
|
(new $p['device'])->add_plan($d);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
r2(U . 'services/pppoe', 's', Lang::T('Data Created Successfully'));
|
r2(U . 'services/pppoe', 's', Lang::T('Data Created Successfully'));
|
||||||
} else {
|
} else {
|
||||||
r2(U . 'services/pppoe-add', 'e', $msg);
|
r2(U . 'services/pppoe-add', 'e', $msg);
|
||||||
@ -603,24 +614,25 @@ switch ($action) {
|
|||||||
$d->enabled = $enabled;
|
$d->enabled = $enabled;
|
||||||
$d->prepaid = $prepaid;
|
$d->prepaid = $prepaid;
|
||||||
$d->device = $device;
|
$d->device = $device;
|
||||||
if($prepaid == 'no'){
|
if ($prepaid == 'no') {
|
||||||
if($expired_date>28 && $expired_date < 1){
|
if ($expired_date > 28 && $expired_date < 1) {
|
||||||
$expired_date = 20;
|
$expired_date = 20;
|
||||||
}
|
}
|
||||||
$d->expired_date = $expired_date;
|
$d->expired_date = $expired_date;
|
||||||
}else{
|
} else {
|
||||||
$d->expired_date = 0;
|
$d->expired_date = 0;
|
||||||
}
|
}
|
||||||
$d->save();
|
$d->save();
|
||||||
|
|
||||||
$dvc = Package::getDevice($d);
|
$dvc = Package::getDevice($d);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $d['device'])->update_plan($old, $d);
|
(new $d['device'])->update_plan($old, $d);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
r2(U . 'services/pppoe', 's', Lang::T('Data Updated Successfully'));
|
r2(U . 'services/pppoe', 's', Lang::T('Data Updated Successfully'));
|
||||||
} else {
|
} else {
|
||||||
r2(U . 'services/pppoe-edit/' . $id, 'e', $msg);
|
r2(U . 'services/pppoe-edit/' . $id, 'e', $msg);
|
||||||
|
@ -33,13 +33,15 @@ foreach ($d as $ds) {
|
|||||||
$c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one();
|
$c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one();
|
||||||
$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();
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if (file_exists($dvc) && $_app_stage != 'demo') {
|
if($_app_stage != 'demo'){
|
||||||
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
(new $p['device'])->remove_customer($c, $p);
|
(new $p['device'])->remove_customer($c, $p);
|
||||||
} else {
|
} else {
|
||||||
echo "Cron error Devices $p[device] not found, cannot disconnect $c[username]";
|
echo "Cron error Devices $p[device] not found, cannot disconnect $c[username]";
|
||||||
Message::sendTelegram("Cron error Devices $p[device] not found, cannot disconnect $c[username]");
|
Message::sendTelegram("Cron error Devices $p[device] not found, cannot disconnect $c[username]");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
echo Message::sendPackageNotification($c, $u['namebp'], $p['price'], $textExpired, $config['user_notification_expired']) . "\n";
|
echo Message::sendPackageNotification($c, $u['namebp'], $p['price'], $textExpired, $config['user_notification_expired']) . "\n";
|
||||||
//update database user dengan status off
|
//update database user dengan status off
|
||||||
$u->status = 'off';
|
$u->status = 'off';
|
||||||
|
@ -644,5 +644,6 @@
|
|||||||
"Category": "Category",
|
"Category": "Category",
|
||||||
"later": "later",
|
"later": "later",
|
||||||
"Package_Details": "Package Details",
|
"Package_Details": "Package Details",
|
||||||
"Summary": "Summary"
|
"Summary": "Summary",
|
||||||
|
"Devices_Not_Found": "Devices Not Found"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user