From 321ac3a35a9987e936e69364480e80a954ba18de Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Wed, 27 Sep 2023 15:01:48 +0700 Subject: [PATCH] 404 --- system/autoload/Http.php | 12 +++++++++--- system/controllers/accounts.php | 2 +- system/controllers/autoload.php | 2 +- system/controllers/autoload_user.php | 2 +- system/controllers/bandwidth.php | 2 +- system/controllers/export.php | 2 +- system/controllers/prepaid.php | 2 +- system/controllers/radius.php | 3 +++ system/controllers/reports.php | 2 +- system/controllers/services.php | 2 +- system/controllers/settings.php | 2 +- system/controllers/voucher.php | 2 +- system/lan/english/common.lan.php | 1 + system/radius.php | 27 --------------------------- system/updates.json | 4 ++++ ui/ui/sections/header.tpl | 10 ++++++---- 16 files changed, 33 insertions(+), 44 deletions(-) delete mode 100644 system/radius.php diff --git a/system/autoload/Http.php b/system/autoload/Http.php index 2dd21acd..34892cca 100644 --- a/system/autoload/Http.php +++ b/system/autoload/Http.php @@ -18,7 +18,9 @@ class Http curl_setopt($ch, CURLOPT_POST, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15); curl_setopt($ch, CURLOPT_TIMEOUT, 15); - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + if(is_array($headers) && count($headers)>0){ + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + } curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if (!empty($http_proxy)) { curl_setopt($ch, CURLOPT_PROXY, $http_proxy); @@ -55,7 +57,9 @@ class Http } } curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($array_post)); - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + if(is_array($headers) && count($headers)>0){ + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + } if (!empty($basic)) { curl_setopt($ch, CURLOPT_USERPWD, $basic); } @@ -90,7 +94,9 @@ class Http } } curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_post)); - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + if(is_array($headers) && count($headers)>0){ + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + } if (!empty($basic)) { curl_setopt($ch, CURLOPT_USERPWD, $basic); } diff --git a/system/controllers/accounts.php b/system/controllers/accounts.php index 559d7bd2..4aab7c20 100644 --- a/system/controllers/accounts.php +++ b/system/controllers/accounts.php @@ -140,5 +140,5 @@ switch ($action) { break; default: - echo 'action not defined'; + $ui->display('a404.tpl'); } diff --git a/system/controllers/autoload.php b/system/controllers/autoload.php index 70a448ff..b0e49618 100644 --- a/system/controllers/autoload.php +++ b/system/controllers/autoload.php @@ -67,5 +67,5 @@ switch ($action) { die(); break; default: - echo 'action not defined'; + $ui->display('a404.tpl'); } diff --git a/system/controllers/autoload_user.php b/system/controllers/autoload_user.php index 4a02eca6..85b8c10c 100644 --- a/system/controllers/autoload_user.php +++ b/system/controllers/autoload_user.php @@ -30,5 +30,5 @@ switch ($action) { } break; default: - echo 'action not defined'; + $ui->display('404.tpl'); } diff --git a/system/controllers/bandwidth.php b/system/controllers/bandwidth.php index a8c23bdc..38038e3f 100644 --- a/system/controllers/bandwidth.php +++ b/system/controllers/bandwidth.php @@ -135,5 +135,5 @@ switch ($action) { break; default: - echo 'action not defined'; + $ui->display('a404.tpl'); } \ No newline at end of file diff --git a/system/controllers/export.php b/system/controllers/export.php index b7a3a82b..0c4673c7 100644 --- a/system/controllers/export.php +++ b/system/controllers/export.php @@ -348,5 +348,5 @@ EOF; break; default: - echo 'action not defined'; + $ui->display('a404.tpl'); } diff --git a/system/controllers/prepaid.php b/system/controllers/prepaid.php index 3fc4fed8..c4f4714d 100644 --- a/system/controllers/prepaid.php +++ b/system/controllers/prepaid.php @@ -439,5 +439,5 @@ switch ($action) { } break; default: - echo 'action not defined'; + $ui->display('a404.tpl'); } diff --git a/system/controllers/radius.php b/system/controllers/radius.php index d3479fe5..e9016062 100644 --- a/system/controllers/radius.php +++ b/system/controllers/radius.php @@ -25,10 +25,12 @@ switch ($action) { $nas = ORM::for_table('nas', 'radius')->find_many(); $ui->assign('nas', $nas); $ui->display('radius-nas.tpl'); + break; case 'nas-add': $ui->assign('_system_menu', 'network'); $ui->assign('_title', "Network Access Server"); $ui->display('radius-nas-add.tpl'); + break; case 'nas-add-post': $shortname = _post('shortname'); $nasname = _post('nasname'); @@ -79,6 +81,7 @@ switch ($action) { }else{ r2(U . 'radius/nas-add', 'e', $msg); } + break; default: $ui->display('a404.tpl'); } diff --git a/system/controllers/reports.php b/system/controllers/reports.php index 8c426eb7..be89f748 100644 --- a/system/controllers/reports.php +++ b/system/controllers/reports.php @@ -80,5 +80,5 @@ switch ($action) { break; default: - echo 'action not defined'; + $ui->display('a404.tpl'); } \ No newline at end of file diff --git a/system/controllers/services.php b/system/controllers/services.php index cce9e4d8..a83b3d68 100644 --- a/system/controllers/services.php +++ b/system/controllers/services.php @@ -619,5 +619,5 @@ switch ($action) { } break; default: - echo 'action not defined'; + $ui->display('a404.tpl'); } diff --git a/system/controllers/settings.php b/system/controllers/settings.php index bae3cf7f..e6b8713d 100644 --- a/system/controllers/settings.php +++ b/system/controllers/settings.php @@ -716,5 +716,5 @@ switch ($action) { break; default: - echo 'action not defined'; + $ui->display('a404.tpl'); } diff --git a/system/controllers/voucher.php b/system/controllers/voucher.php index 3f2c8993..2e8c61c0 100644 --- a/system/controllers/voucher.php +++ b/system/controllers/voucher.php @@ -54,5 +54,5 @@ switch ($action) { break; default: - $ui->display('404.tpl'); + $ui->display('a404.tpl'); } diff --git a/system/lan/english/common.lan.php b/system/lan/english/common.lan.php index e36701e1..2ea8383d 100644 --- a/system/lan/english/common.lan.php +++ b/system/lan/english/common.lan.php @@ -403,3 +403,4 @@ $_L['Deactivate'] = 'Deactivate'; $_L['Sync'] = 'Sync'; $_L['Failed_to_create_PaymeTrust_transaction'] = 'Failed to create PaymeTrust transaction.'; $_L['Location'] = 'Location'; +$_L['Radius_Plans'] = 'Radius Plans'; diff --git a/system/radius.php b/system/radius.php deleted file mode 100644 index 13073efc..00000000 --- a/system/radius.php +++ /dev/null @@ -1,27 +0,0 @@ -find_many(); -foreach($result as $value){ - $config[$value['setting']]=$value['value']; -} -date_default_timezone_set($config['timezone']); \ No newline at end of file diff --git a/system/updates.json b/system/updates.json index 77023a3d..0f728fe6 100644 --- a/system/updates.json +++ b/system/updates.json @@ -21,5 +21,9 @@ "2023.9.5" : [ "DROP TABLE `tbl_language`;", "ALTER TABLE `tbl_plans` ADD `pool_expired` varchar(40) NOT NULL DEFAULT '' AFTER `pool`;" + ], + "2023.9.27" : [ + "ALTER TABLE `tbl_plans` CHANGE `type` `type` ENUM('Hotspot','PPPOE','Balance','Radius') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;", + "ALTER TABLE `tbl_transactions` CHANGE `type` `type` ENUM('Hotspot','PPPOE','Balance','Radius') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;" ] } \ No newline at end of file diff --git a/ui/ui/sections/header.tpl b/ui/ui/sections/header.tpl index 47e31bb6..30ed74c4 100644 --- a/ui/ui/sections/header.tpl +++ b/ui/ui/sections/header.tpl @@ -163,6 +163,8 @@ href="{$_url}services/hotspot">{$_L['Hotspot_Plans']}
  • {$_L['PPPOE_Plans']}
  • +
  • {Lang::T('Radius Plans')}
  • {$_L['Bandwidth_Plans']}
  • {$_L['Routers']}
  • -
  • Radius NAS
  • +
  • Radius NAS
  • {$_L['Pool']}
  • {$_MENU_NETWORK} @@ -222,9 +224,9 @@
  • {$_L['Announcement']}
  • {$_L['Registration_Info']}
  • + href="{$_url}pages/Registration_Info">{$_L['Registration_Info']}
  • Privacy Policy
  • + href="{$_url}pages/Privacy_Policy">Privacy Policy
  • Terms and Conditions
  • {$_MENU_PAGES}