From eb31f11fd682f99bc08416dd636712a7d4e98220 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Sun, 23 Jun 2024 11:42:19 +0700 Subject: [PATCH 1/3] Bandwidth name max 255 char --- system/controllers/bandwidth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/controllers/bandwidth.php b/system/controllers/bandwidth.php index 2d490614..f7a71933 100644 --- a/system/controllers/bandwidth.php +++ b/system/controllers/bandwidth.php @@ -93,8 +93,8 @@ switch ($action) { }; } $msg = ''; - if (Validator::Length($name, 16, 4) == false) { - $msg .= 'Name should be between 5 to 15 characters' . '
'; + if (Validator::Length($name, 255, 4) == false) { + $msg .= 'Name should be between 5 to 255 characters' . '
'; } if ($rate_down_unit == 'Kbps') { From 4323e2b87993615cd59e4cb624821ac7d1188599 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Sun, 23 Jun 2024 11:42:46 +0700 Subject: [PATCH 2/3] bandwidth name max char 255 --- system/controllers/bandwidth.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system/controllers/bandwidth.php b/system/controllers/bandwidth.php index f7a71933..ca7fe0ef 100644 --- a/system/controllers/bandwidth.php +++ b/system/controllers/bandwidth.php @@ -93,8 +93,8 @@ switch ($action) { }; } $msg = ''; - if (Validator::Length($name, 255, 4) == false) { - $msg .= 'Name should be between 5 to 255 characters' . '
'; + if (Validator::Length($name, 256, 0) == false) { + $msg .= 'Name should be between 1 to 255 characters' . '
'; } if ($rate_down_unit == 'Kbps') { @@ -152,8 +152,8 @@ switch ($action) { }; } $msg = ''; - if (Validator::Length($name, 16, 4) == false) { - $msg .= 'Name should be between 5 to 15 characters' . '
'; + if (Validator::Length($name, 256, 0) == false) { + $msg .= 'Name should be between 1 to 255 characters' . '
'; } $id = _post('id'); From 98e3304f178ae997f1b4f6797b7364bbd895d6a0 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Sun, 23 Jun 2024 12:01:08 +0700 Subject: [PATCH 3/3] fix variable when move customer to expired plan --- system/autoload/Package.php | 6 ++++++ system/devices/MikrotikHotspot.php | 8 ++++---- system/devices/MikrotikPppoe.php | 4 ++-- system/devices/Radius.php | 4 ++-- system/lan/indonesia.json | 7 ++++++- ui/ui/plan.tpl | 6 +++++- 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/system/autoload/Package.php b/system/autoload/Package.php index 755f1458..2948f8c9 100644 --- a/system/autoload/Package.php +++ b/system/autoload/Package.php @@ -546,6 +546,12 @@ class Package public static function getDevice($plan) { global $DEVICE_PATH; + if($plan === false){ + return "none"; + } + if(!isset($plan['device'])){ + return "none"; + } if (!empty($plan['device'])) { return $DEVICE_PATH . DIRECTORY_SEPARATOR . $plan['device'] . '.php'; } diff --git a/system/devices/MikrotikHotspot.php b/system/devices/MikrotikHotspot.php index 170a24f7..63fe2d5b 100644 --- a/system/devices/MikrotikHotspot.php +++ b/system/devices/MikrotikHotspot.php @@ -27,8 +27,8 @@ class MikrotikHotspot $mikrotik = $this->info($plan['routers']); $client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); if (!empty($plan['plan_expired'])) { - $p = ORM::for_table("tbl_plans")->select("name_plan")->find_one($plan['plan_expired']); - $this->setHotspotUserPackage($client, $customer['username'], $p['name_plan']); + $p = ORM::for_table("tbl_plans")->find_one($plan['plan_expired']); + $this->add_customer($customer, $p); } else { $this->removeHotspotUser($client, $customer['username']); } @@ -280,7 +280,7 @@ class MikrotikHotspot $client->sendSync($setRequest); } - function setHotspotUserPackage($client, $user, $plan_name) + function setHotspotUserPackage($client, $username, $plan_name) { global $_app_stage; if ($_app_stage == 'demo') { @@ -288,7 +288,7 @@ class MikrotikHotspot } $printRequest = new RouterOS\Request('/ip/hotspot/user/print'); $printRequest->setArgument('.proplist', '.id'); - $printRequest->setQuery(RouterOS\Query::where('name', $user)); + $printRequest->setQuery(RouterOS\Query::where('name', $username)); $id = $client->sendSync($printRequest)->getProperty('.id'); $setRequest = new RouterOS\Request('/ip/hotspot/user/set'); diff --git a/system/devices/MikrotikPppoe.php b/system/devices/MikrotikPppoe.php index 46afa880..b9817a7d 100644 --- a/system/devices/MikrotikPppoe.php +++ b/system/devices/MikrotikPppoe.php @@ -27,8 +27,8 @@ class MikrotikPppoe $mikrotik = $this->info($plan['routers']); $client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); if (!empty($plan['plan_expired'])) { - $p = ORM::for_table("tbl_plans")->select("name_plan")->find_one($plan['plan_expired']); - $this->setPpoeUserPlan($client, $customer['username'], $p['plan_expired']); + $p = ORM::for_table("tbl_plans")->find_one($plan['plan_expired']); + $this->add_customer($customer, $p); } else { $this->removePpoeUser($client, $customer['username']); } diff --git a/system/devices/Radius.php b/system/devices/Radius.php index 5c4fb2f1..080d242e 100644 --- a/system/devices/Radius.php +++ b/system/devices/Radius.php @@ -18,9 +18,9 @@ class Radius { function remove_customer($customer, $plan) { - if (empty($plan['plan_expired'])) { + if (!empty($plan['plan_expired'])) { $p = ORM::for_table("tbl_plans")->find_one($plan['plan_expired']); - $this->customerAddPlan($customer, $plan); + $this->customerAddPlan($customer, $p); } else { $this->customerDeactivate($customer['username'], true); } diff --git a/system/lan/indonesia.json b/system/lan/indonesia.json index 1a1e1cf5..aabce314 100644 --- a/system/lan/indonesia.json +++ b/system/lan/indonesia.json @@ -522,5 +522,10 @@ "Ascending": "Naik", "Descending": "Menurun", "Query": "Query", - "Add": "Menambahkan" + "Add": "Menambahkan", + "Logout_Successful": "Logout Berhasil", + "warning": "peringatan", + "Created___Expired": "Dibuat \/ Kedaluwarsa", + "Login___Activate_Voucher": "Masuk \/ Aktifkan Voucher", + "Voucher_activation_success__now_you_can_login": "Aktivasi voucher berhasil, sekarang Anda dapat login" } \ No newline at end of file diff --git a/ui/ui/plan.tpl b/ui/ui/plan.tpl index cd9fc723..3c63e550 100644 --- a/ui/ui/plan.tpl +++ b/ui/ui/plan.tpl @@ -86,7 +86,11 @@ {foreach $d as $ds} {$ds['username']} - {$ds['namebp']} + {if $ds['type'] == 'Hotspot'} + {$ds['namebp']} + {else} + {$ds['namebp']} + {/if} {$ds['type']} {Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])} {Lang::dateAndTimeFormat($ds['expiration'],$ds['time'])}