From 31dda69d3d2109a574e067303273ebd8acf13081 Mon Sep 17 00:00:00 2001
From: iBNu Maksum
Date: Fri, 31 Jan 2025 16:54:22 +0700
Subject: [PATCH] get ready for Pretty URL
---
README.md | 2 +-
init.php | 2 +-
system/autoload/Text.php | 2 +-
system/controllers/bandwidth.php | 2 +-
system/controllers/plan.php | 2 +-
system/controllers/pool.php | 4 +-
system/controllers/routers.php | 2 +-
system/controllers/services.php | 6 +-
system/controllers/settings.php | 1 +
system/lan/english.json | 8 ++-
ui/ui/app-settings.tpl | 25 +++++++--
ui/ui/customer/header.tpl | 30 +++++-----
ui/ui/sections/header.tpl | 94 ++++++++++++++++----------------
update.php | 1 +
14 files changed, 102 insertions(+), 79 deletions(-)
diff --git a/README.md b/README.md
index 1c7c5827..b3cd7294 100644
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@ Most current web servers with PHP & MySQL installed will be capable of running P
Minimum Requirements
- Linux or Windows OS
-- Minimum PHP Version 7.4
+- Minimum PHP Version 8.2
- Both PDO & MySQLi Support
- PHP-GD2 Image Library
- PHP-CURL
diff --git a/init.php b/init.php
index b6530a46..3059f859 100644
--- a/init.php
+++ b/init.php
@@ -266,7 +266,7 @@ function showResult($success, $message = '', $result = [], $meta = [])
*/
function getUrl($url)
{
- Text::url($url);
+ return Text::url($url);
}
function generateUniqueNumericVouchers($totalVouchers, $length = 8)
diff --git a/system/autoload/Text.php b/system/autoload/Text.php
index 573690b7..e11cfef9 100644
--- a/system/autoload/Text.php
+++ b/system/autoload/Text.php
@@ -113,7 +113,7 @@ class Text
public static function url(...$data){
global $config;
$url = implode("", $data);
- if ($config['url_canonical'] != 'Yes') {
+ if ($config['url_canonical'] == 'yes') {
$u = str_replace('?_route=', '', U);
$pos = strpos($url, '&');
if ($pos === false) {
diff --git a/system/controllers/bandwidth.php b/system/controllers/bandwidth.php
index a482550c..e566a2f5 100644
--- a/system/controllers/bandwidth.php
+++ b/system/controllers/bandwidth.php
@@ -18,7 +18,7 @@ if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
switch ($action) {
case 'list':
- $ui->assign('xfooter', '');
+ $ui->assign('xfooter', '');
run_hook('view_list_bandwidth'); #HOOK
$name = _post('name');
if ($name != '') {
diff --git a/system/controllers/plan.php b/system/controllers/plan.php
index fbfaae81..f2dbba2a 100644
--- a/system/controllers/plan.php
+++ b/system/controllers/plan.php
@@ -1061,7 +1061,7 @@ switch ($action) {
}
break;
default:
- $ui->assign('xfooter', '');
+ $ui->assign('xfooter', '');
$ui->assign('_title', Lang::T('Customer'));
$search = _post('search');
$status = _req('status');
diff --git a/system/controllers/pool.php b/system/controllers/pool.php
index aec8c1bc..14c44d7d 100644
--- a/system/controllers/pool.php
+++ b/system/controllers/pool.php
@@ -20,7 +20,7 @@ require_once $DEVICE_PATH . DIRECTORY_SEPARATOR . 'MikrotikPppoe' . '.php';
switch ($action) {
case 'list':
- $ui->assign('xfooter', '');
+ $ui->assign('xfooter', '');
$name = _post('name');
if ($name != '') {
@@ -149,7 +149,7 @@ switch ($action) {
}
case 'port':
- $ui->assign('xfooter', '');
+ $ui->assign('xfooter', '');
$name = _post('name');
if ($name != '') {
diff --git a/system/controllers/routers.php b/system/controllers/routers.php
index 4d121c52..ef3e1c8e 100644
--- a/system/controllers/routers.php
+++ b/system/controllers/routers.php
@@ -204,7 +204,7 @@ switch ($action) {
break;
default:
- $ui->assign('xfooter', '');
+ $ui->assign('xfooter', '');
$name = _post('name');
$name = _post('name');
diff --git a/system/controllers/services.php b/system/controllers/services.php
index 8f054457..a61a7ce2 100644
--- a/system/controllers/services.php
+++ b/system/controllers/services.php
@@ -53,7 +53,7 @@ switch ($action) {
}
r2(getUrl('services/hotspot'), 'w', 'Unknown command');
case 'hotspot':
- $ui->assign('xfooter', '');
+ $ui->assign('xfooter', '');
$name = _req('name');
$type1 = _req('type1');
$type2 = _req('type2');
@@ -428,7 +428,7 @@ switch ($action) {
case 'pppoe':
$ui->assign('_title', Lang::T('PPPOE Plans'));
- $ui->assign('xfooter', '');
+ $ui->assign('xfooter', '');
$name = _post('name');
$name = _req('name');
@@ -921,7 +921,7 @@ switch ($action) {
break;
case 'vpn':
$ui->assign('_title', Lang::T('VPN Plans'));
- $ui->assign('xfooter', '');
+ $ui->assign('xfooter', '');
$name = _post('name');
$name = _req('name');
diff --git a/system/controllers/settings.php b/system/controllers/settings.php
index 57725b40..69d790fa 100644
--- a/system/controllers/settings.php
+++ b/system/controllers/settings.php
@@ -173,6 +173,7 @@ switch ($action) {
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
}
$csrf_token = _post('csrf_token');
+
if (!Csrf::check($csrf_token)) {
r2(getUrl('settings/app'), 'e', Lang::T('Invalid or Expired CSRF Token') . ".");
}
diff --git a/system/lan/english.json b/system/lan/english.json
index da4f7cc9..93263e55 100644
--- a/system/lan/english.json
+++ b/system/lan/english.json
@@ -956,5 +956,11 @@
"in_minutes__leave_0_to_disable_this_feature_": "in minutes, leave 0 to disable this feature.",
"Check_if_Router_Online_": "Check if Router Online?",
"To_check_whether_the_Router_is_online_or_not__please_visit_the_following_page": "To check whether the Router is online or not, please visit the following page",
- "Cek_Now": "Cek Now"
+ "Cek_Now": "Cek Now",
+ "Pretty_URL": "Pretty URL",
+ "rename__htaccess_firewall_to__htaccess": "rename .htaccess_firewall to .htaccess",
+ "Show_chart": "Show chart",
+ "Max_30_days": "Max 30 days",
+ "Information": "Information",
+ "Export_and_Print_will_show_all_data_without_pagination": "Export and Print will show all data without pagination"
}
\ No newline at end of file
diff --git a/ui/ui/app-settings.tpl b/ui/ui/app-settings.tpl
index 59f8146e..c990038b 100644
--- a/ui/ui/app-settings.tpl
+++ b/ui/ui/app-settings.tpl
@@ -104,15 +104,30 @@
{Lang::T('This used for admin to select payment in recharge, using comma for every new options')}
-
+