check if demo or not

This commit is contained in:
Ibnu Maksum
2024-06-12 15:39:43 +07:00
parent 987e21b3ce
commit 6a4ac274d1
13 changed files with 28 additions and 152 deletions

View File

@ -44,7 +44,7 @@ switch ($action) {
// if has active plan, change the password to devices
$p = ORM::for_table('tbl_plans')->where('id', $c['plan_id'])->find_one();
$dvc = Package::getDevice($p);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->remove_customer($c, $p);
} else {

View File

@ -18,7 +18,7 @@ switch ($action) {
$bill = ORM::for_table('tbl_user_recharges')->where('id', $routes['2'])->where('username', $user['username'])->findOne();
if ($bill['type'] == 'Hotspot' && $bill['status'] == 'on') {
$dvc = Package::getDevice($d);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
if ((new $d['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>');

View File

@ -214,7 +214,7 @@ switch ($action) {
if ($p) {
$p = ORM::for_table('tbl_plans')->where('id', $c['plan_id'])->find_one();
$dvc = Package::getDevice($p);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->change_customer($c, $p);
} else {
@ -242,7 +242,7 @@ switch ($action) {
if ($p) {
$routers[] = $b['routers'];
$dvc = Package::getDevice($p);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->add_customer($c, $p);
} else {
@ -330,7 +330,7 @@ switch ($action) {
$p = ORM::for_table('tbl_plans')->find_one($c['plan_id']);
if($p){
$dvc = Package::getDevice($p);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->remove_customer($d, $p);
} else {
@ -569,7 +569,7 @@ switch ($action) {
$c->save();
$p = ORM::for_table('tbl_plans')->find_one($c['plan_id']);
$dvc = Package::getDevice($p);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->remove_customer($d, $p);
(new $p['device'])->add_customer($d, $p);

View File

@ -156,7 +156,7 @@ if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
if ($tur['status'] != 'on') {
$p = ORM::for_table('tbl_plans')->findOne($tur['plan_id']);
$dvc = Package::getDevice($p);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->add_customer($user, $p);
} else {
@ -188,7 +188,7 @@ if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
if ($bill) {
$p = ORM::for_table('tbl_plans')->where('id', $bill['plan_id'])->find_one();
$dvc = Package::getDevice($p);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->remove_customer($user, $p);
} else {
@ -212,7 +212,7 @@ 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();
$p = ORM::for_table('tbl_plans')->where('id', $bill['plan_id'])->find_one();
$dvc = Package::getDevice($p);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
if ($_GET['mikrotik'] == 'login') {
(new $p['device'])->connect_customer($user, $_SESSION['nux-ip'], $_SESSION['nux-mac'], $bill['routers']);

View File

@ -97,7 +97,7 @@ switch ($do) {
try {
$p = ORM::for_table('tbl_plans')->where('id', $v1['id_plan'])->find_one();
$dvc = Package::getDevice($p);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->connect_customer($user, $_SESSION['nux-ip'], $_SESSION['nux-mac'], $v1['routers']);
} else {
@ -141,7 +141,7 @@ switch ($do) {
try {
$p = ORM::for_table('tbl_plans')->where('id', $v1['id_plan'])->find_one();
$dvc = Package::getDevice($p);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->connect_customer($user, $_SESSION['nux-ip'], $_SESSION['nux-mac'], $v1['routers']);
} else {

View File

@ -44,7 +44,7 @@ switch ($action) {
$p = ORM::for_table('tbl_plans')->findOne($plan['plan_id']);
$c = ORM::for_table('tbl_customers')->findOne($plan['customer_id']);
$dvc = Package::getDevice($plan);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->add_customer($c, $p);
} else {
@ -258,7 +258,7 @@ switch ($action) {
if ($d) {
run_hook('delete_customer_active_plan'); #HOOK
$p = ORM::for_table('tbl_plans')->find_one($d['plan_id']);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->remove_customer($c, $p);
} else {
@ -774,7 +774,7 @@ switch ($action) {
$c = ORM::for_table('tbl_customers')->findOne($tur['customer_id']);
$p = ORM::for_table('tbl_plans')->find_one($d['plan_id']);
$dvc = Package::getDevice($p);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->add_customer($c, $p);
} else {

View File

@ -24,7 +24,7 @@ switch ($action) {
$router = '';
foreach ($plans as $plan) {
$dvc = Package::getDevice($plan);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->add_plan($plan);
} else {
@ -38,7 +38,7 @@ switch ($action) {
$router = '';
foreach ($plans as $plan) {
$dvc = Package::getDevice($plan);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->add_plan($plan);
} else {
@ -128,7 +128,7 @@ switch ($action) {
if ($d) {
run_hook('delete_plan'); #HOOK
$dvc = Package::getDevice($d);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->remove_plan($d);
} else {
@ -212,7 +212,7 @@ switch ($action) {
$d->save();
$dvc = Package::getDevice($d);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->add_plan($d);
} else {
@ -304,7 +304,7 @@ switch ($action) {
$d->save();
$dvc = Package::getDevice($d);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $d['device'])->update_plan($old, $d);
} else {
@ -408,7 +408,7 @@ switch ($action) {
run_hook('delete_ppoe'); #HOOK
$dvc = Package::getDevice($d);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->remove_plan($d);
} else {
@ -497,7 +497,7 @@ switch ($action) {
$d->save();
$dvc = Package::getDevice($d);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $p['device'])->add_plan($d);
} else {
@ -578,7 +578,7 @@ switch ($action) {
$d->save();
$dvc = Package::getDevice($d);
if (file_exists($dvc)) {
if (file_exists($dvc) && $_app_stage != 'demo') {
require_once $dvc;
(new $d['device'])->update_plan($old, $d);
} else {