From d5cba4b3c1bae33c254663011c16e51ec1b317e4 Mon Sep 17 00:00:00 2001
From: iBNu Maksum
Date: Fri, 11 Oct 2024 11:37:45 +0700
Subject: [PATCH] add option for check is customer online
---
system/controllers/autoload.php | 56 ++++++++++++++++++---------------
system/lan/indonesia.json | 5 ++-
ui/ui/app-settings.tpl | 16 ++++++++++
3 files changed, 50 insertions(+), 27 deletions(-)
diff --git a/system/controllers/autoload.php b/system/controllers/autoload.php
index 92f7688c..0dbab54c 100644
--- a/system/controllers/autoload.php
+++ b/system/controllers/autoload.php
@@ -85,20 +85,22 @@ switch ($action) {
$ui->display('autoload.tpl');
break;
case 'customer_is_active':
- $c = ORM::for_table('tbl_customers')->where('username', $routes['2'])->find_one();
- $p = ORM::for_table('tbl_plans')->find_one($routes['3']);
- $dvc = Package::getDevice($p);
- if ($_app_stage != 'demo') {
- if (file_exists($dvc)) {
- require_once $dvc;
- try {
- //don't wait more than 5 seconds for response from device, otherwise we get timeout error.
- ini_set('default_socket_timeout', 5);
- if ((new $p['device'])->online_customer($c, $p['routers'])) {
- echo ' ';
+ if ($config['check_customer_online'] == 'yes') {
+ $c = ORM::for_table('tbl_customers')->where('username', $routes['2'])->find_one();
+ $p = ORM::for_table('tbl_plans')->find_one($routes['3']);
+ $dvc = Package::getDevice($p);
+ if ($_app_stage != 'demo') {
+ if (file_exists($dvc)) {
+ require_once $dvc;
+ try {
+ //don't wait more than 5 seconds for response from device, otherwise we get timeout error.
+ ini_set('default_socket_timeout', 5);
+ if ((new $p['device'])->online_customer($c, $p['routers'])) {
+ echo ' ';
+ }
+ } catch (Exception $e) {
+ echo ' ';
}
- } catch (Exception $e) {
- echo ' ';
}
}
}
@@ -110,20 +112,22 @@ switch ($action) {
$c = ORM::for_table('tbl_customers')->find_one($routes['2']);
foreach ($ds as $d) {
if ($d['status'] == 'on') {
- $p = ORM::for_table('tbl_plans')->find_one($d['plan_id']);
- $dvc = Package::getDevice($p);
- $status = "";
- if ($_app_stage != 'demo') {
- if (file_exists($dvc)) {
- require_once $dvc;
- try {
- //don't wait more than 5 seconds for response from device, otherwise we get timeout error.
- ini_set('default_socket_timeout', 5);
- if ((new $p['device'])->online_customer($c, $p['routers'])) {
- $status = ' ';
+ if ($config['check_customer_online'] == 'yes') {
+ $p = ORM::for_table('tbl_plans')->find_one($d['plan_id']);
+ $dvc = Package::getDevice($p);
+ $status = "";
+ if ($_app_stage != 'demo') {
+ if (file_exists($dvc)) {
+ require_once $dvc;
+ try {
+ //don't wait more than 5 seconds for response from device, otherwise we get timeout error.
+ ini_set('default_socket_timeout', 5);
+ if ((new $p['device'])->online_customer($c, $p['routers'])) {
+ $status = ' ';
+ }
+ } catch (Exception $e) {
+ $status = ' ';
}
- } catch (Exception $e) {
- $status = ' ';
}
}
}
diff --git a/system/lan/indonesia.json b/system/lan/indonesia.json
index 85c6a5c4..abcbb3b1 100644
--- a/system/lan/indonesia.json
+++ b/system/lan/indonesia.json
@@ -693,5 +693,8 @@
"This_will_allow_you_to_download_plugin_from_private_paid_repository": "Ini akan memungkinkan Anda mengunduh plugin dari repositori pribadi\/berbayar",
"Expired_Cronjob_Every_5_Minutes": "Cronjob Kedaluwarsa Setiap 5 Menit",
"Expired_Cronjob_Every_1_Hour": "Cronjob Kedaluwarsa Setiap 1 Jam",
- "Reminder_Cronjob_Every_7_AM": "Pengingat Cronjob Setiap Jam 7 Pagi"
+ "Reminder_Cronjob_Every_7_AM": "Pengingat Cronjob Setiap Jam 7 Pagi",
+ "Check_if_Customer_Online": "Periksa apakah Pelanggan Online",
+ "Active_Customers": "Pelanggan Aktif",
+ "This_will_show_is_Customer_currently_is_online_or_not": "Ini akan menunjukkan apakah Pelanggan sedang online atau tidak"
}
\ No newline at end of file
diff --git a/ui/ui/app-settings.tpl b/ui/ui/app-settings.tpl
index bb09077e..b1526c60 100644
--- a/ui/ui/app-settings.tpl
+++ b/ui/ui/app-settings.tpl
@@ -740,6 +740,22 @@
phpnuxbill-login-hotspot
+