From 1515a44ae5370889e41fc3b48a7c7830dfa79ff7 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 1 Aug 2023 14:59:47 +0700 Subject: [PATCH 01/10] fix vendors.js path --- ui/ui/register-otp.tpl | 2 +- ui/ui/register-rotp.tpl | 2 +- ui/ui/register.tpl | 2 +- ui/ui/user-login.tpl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/ui/register-otp.tpl b/ui/ui/register-otp.tpl index 49896d18..bd48de86 100644 --- a/ui/ui/register-otp.tpl +++ b/ui/ui/register-otp.tpl @@ -117,7 +117,7 @@ {/if} - + \ No newline at end of file diff --git a/ui/ui/register-rotp.tpl b/ui/ui/register-rotp.tpl index a9a99e6c..87b80247 100644 --- a/ui/ui/register-rotp.tpl +++ b/ui/ui/register-rotp.tpl @@ -93,7 +93,7 @@ {/if} - + \ No newline at end of file diff --git a/ui/ui/register.tpl b/ui/ui/register.tpl index 849c1c01..9b071830 100644 --- a/ui/ui/register.tpl +++ b/ui/ui/register.tpl @@ -115,7 +115,7 @@ {/if} - + \ No newline at end of file diff --git a/ui/ui/user-login.tpl b/ui/ui/user-login.tpl index b6cca036..40640367 100644 --- a/ui/ui/user-login.tpl +++ b/ui/ui/user-login.tpl @@ -74,7 +74,7 @@ - + \ No newline at end of file From 1f4bd28045069f66a7aab538646443ceef76c3db Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 1 Aug 2023 15:00:17 +0700 Subject: [PATCH 02/10] Add Custom UI Folder to customize UI --- .gitignore | 5 ++++- system/boot.php | 33 ++++++++++++++++----------------- ui/ui_custom/README.md | 5 +++++ ui/ui_custom/index.html | 0 4 files changed, 25 insertions(+), 18 deletions(-) create mode 100644 ui/ui_custom/README.md create mode 100644 ui/ui_custom/index.html diff --git a/.gitignore b/.gitignore index bfd3e7e3..5a2ce6e7 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,7 @@ system/paymentgateway/** !system/paymentgateway/index.html !system/plugin/ui/ system/plugin/ui/* -!system/plugin/ui/index.html \ No newline at end of file +!system/plugin/ui/index.html +ui/ui_custom/** +!ui/ui_custom/index.html +!ui/ui_custom/README.md \ No newline at end of file diff --git a/system/boot.php b/system/boot.php index 6f98ab7a..c2e0c637 100644 --- a/system/boot.php +++ b/system/boot.php @@ -55,7 +55,7 @@ ORM::configure('username', $db_user); ORM::configure('password', $db_password); ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); ORM::configure('return_result_sets', true); -if($_app_stage != 'Live'){ +if ($_app_stage != 'Live') { ORM::configure('logging', true); } @@ -67,7 +67,7 @@ foreach ($result as $value) { date_default_timezone_set($config['timezone']); $_c = $config; -if($config['radius_mode']){ +if ($config['radius_mode']) { ORM::configure("mysql:host=$radius_host;dbname=$radius_name", null, 'radius'); ORM::configure('username', $radius_user, 'radius'); ORM::configure('password', $radius_password, 'radius'); @@ -84,7 +84,7 @@ function _notify($msg, $type = 'e') $lan_file = 'system/lan/' . $config['language'] . '/common.lan.php'; require($lan_file); $ui = new Smarty(); -$ui->setTemplateDir('ui/ui/'); +$ui->setTemplateDir(['custom' => 'ui/ui_custom/', 'default' => 'ui/ui/']); $ui->addTemplateDir('system/paymentgateway/ui/', 'pg'); $ui->addTemplateDir('system/plugin/ui/', 'plugin'); $ui->setCompileDir('ui/compiled/'); @@ -130,8 +130,7 @@ include "autoload/Hookers.php"; //register all plugin -foreach (glob("system/plugin/*.php") as $filename) -{ +foreach (glob("system/plugin/*.php") as $filename) { include $filename; } @@ -290,25 +289,25 @@ if (file_exists($sys_render)) { // "function" => $function $ui->assign('_system_menu', $routes[0]); foreach ($menu_registered as $menu) { - if($menu['admin'] && _admin(false)) { - $menus[$menu['position']] .= ''; - if(!empty($menu['icon'])){ - $menus[$menu['position']] .= ''; + if ($menu['admin'] && _admin(false)) { + $menus[$menu['position']] .= ''; + if (!empty($menu['icon'])) { + $menus[$menu['position']] .= ''; } - $menus[$menu['position']] .= ''.$menu['name'].''; - }else if(!$menu['admin'] && _auth(false)) { - $menus[$menu['position']] .= ''; - if(!empty($menu['icon'])){ - $menus[$menu['position']] .= ''; + $menus[$menu['position']] .= '' . $menu['name'] . ''; + } else if (!$menu['admin'] && _auth(false)) { + $menus[$menu['position']] .= ''; + if (!empty($menu['icon'])) { + $menus[$menu['position']] .= ''; } - $menus[$menu['position']] .= ''.$menu['name'].''; + $menus[$menu['position']] .= '' . $menu['name'] . ''; } } foreach ($menus as $k => $v) { - $ui->assign('_MENU_'.$k, $v); + $ui->assign('_MENU_' . $k, $v); } unset($menus, $menu_registered); include($sys_render); } else { - r2(U.'dashboard', 'e', 'not found'); + r2(U . 'dashboard', 'e', 'not found'); } diff --git a/ui/ui_custom/README.md b/ui/ui_custom/README.md new file mode 100644 index 00000000..e83eb163 --- /dev/null +++ b/ui/ui_custom/README.md @@ -0,0 +1,5 @@ +# CUSTOM DESIGN + +If you want to change the UI, copy the file from UI, to here, and edit as you need, so it will not be overwrite when updating + +Jika mau mengubah tampilan UI, salin filenya dari folder UI kesini, lalu ubah sesuai keinginan, sehingga tidak akan ditimpa saat ada update \ No newline at end of file diff --git a/ui/ui_custom/index.html b/ui/ui_custom/index.html new file mode 100644 index 00000000..e69de29b From e0eed484e92a7f2c0dd107f6c889ba579b32d830 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 1 Aug 2023 15:50:01 +0700 Subject: [PATCH 03/10] Remove Echo Debug --- system/autoload/File.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/system/autoload/File.php b/system/autoload/File.php index d704f240..60d256bb 100644 --- a/system/autoload/File.php +++ b/system/autoload/File.php @@ -5,21 +5,17 @@ class File public static function copyFolder($from, $to, $exclude = []) { - echo "copyFolder($from, $to);
"; $files = scandir($from); print_r($files); foreach ($files as $file) { if (is_file($from . $file) && !in_array($file, $exclude)) { if (file_exists($to . $file)) unlink($to . $file); rename($from . $file, $to . $file); - echo "rename($from$file, $to$file);
"; } else if (is_dir($from . $file) && !in_array($file, ['.', '..'])) { if (!file_exists($to . $file)) { - echo "mkdir($to$file);;
"; mkdir($to . $file); } - echo "File::copyFolder($from$file, $to$file);
"; - File::copyFolder($from . $file . DIRECTORY_SEPARATOR, $to . $file . DIRECTORY_SEPARATOR); + File::copyFolder($from . $file . DIRECTORY_SEPARATOR, $to . $file . DIRECTORY_SEPARATOR, $exclude); } } } @@ -29,15 +25,12 @@ class File $files = scandir($path); foreach ($files as $file) { if (is_file($path . $file)) { - echo "unlink($path$file);
"; unlink($path . $file); } else if (is_dir($path . $file) && !in_array($file, ['.', '..'])) { File::deleteFolder($path . $file . DIRECTORY_SEPARATOR); - echo "rmdir($path$file);
"; rmdir($path . $file); } } - echo "rmdir($path);
"; rmdir($path); } From 5059c4dd3b122714b6ebe82810f01b08a3215947 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 1 Aug 2023 15:50:28 +0700 Subject: [PATCH 04/10] Update Software Script --- update.php | 221 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 update.php diff --git a/update.php b/update.php new file mode 100644 index 00000000..a8b23dee --- /dev/null +++ b/update.php @@ -0,0 +1,221 @@ +open($file); + $zip->extractTo(pathFixer('system/cache/')); + $zip->close(); + if (file_exists($folder)){ + $step++; + }else{ + $msg = "Failed to extract update file"; + $msgType = "danger"; + $continue = false; + } + // remove downloaded zip + if (file_exists($file)) unlink($file); +}else if ($step == 3) { + copyFolder($folder, pathFixer('./')); + deleteFolder('install/'); + deleteFolder($folder); + if (!file_exists($folder.pathFixer('/system/'))){ + $step++; + }else{ + $msg = "Failed to install update file."; + $msgType = "danger"; + $continue = false; + } +} + +function pathFixer($path) +{ + return str_replace("/", DIRECTORY_SEPARATOR, $path); +} + +function r2($to, $ntype = 'e', $msg = '') +{ + if ($msg == '') { + header("location: $to"); + exit; + } + $_SESSION['ntype'] = $ntype; + $_SESSION['notify'] = $msg; + header("location: $to"); + exit; +} + +function copyFolder($from, $to, $exclude = []) +{ + $files = scandir($from); + print_r($files); + foreach ($files as $file) { + if (is_file($from . $file) && !in_array($file, $exclude)) { + if (file_exists($to . $file)) unlink($to . $file); + rename($from . $file, $to . $file); + } else if (is_dir($from . $file) && !in_array($file, ['.', '..'])) { + if (!file_exists($to . $file)) { + mkdir($to . $file); + } + copyFolder($from . $file . DIRECTORY_SEPARATOR, $to . $file . DIRECTORY_SEPARATOR); + } + } +} +function deleteFolder($path) +{ + $files = scandir($path); + foreach ($files as $file) { + if (is_file($path . $file)) { + unlink($path . $file); + } else if (is_dir($path . $file) && !in_array($file, ['.', '..'])) { + File::deleteFolder($path . $file . DIRECTORY_SEPARATOR); + rmdir($path . $file); + } + } + rmdir($path); +} + +?> + + + + + + + PHPNuxBill Updater + + + + + + + + + + + + + + + + + + +
+
+

+ Update PHP NuxBill +

+
+ +
+
+
+
+ + + + +
+
Step 1
+
+ Downloading update
+ Please wait.... +
+
+ +
+
Step 2
+
+ extracting
+ Please wait.... +
+
+ +
+
Step 3
+
+ Installing
+ Please wait.... +
+
+ +
+
+
+
+ PHPNuxBill by iBNuX +
+
+ + + \ No newline at end of file From 72146a3afae312c6aa6122f4334c195a05b96c26 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 1 Aug 2023 15:54:24 +0700 Subject: [PATCH 05/10] update finished dialog --- update.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/update.php b/update.php index a8b23dee..601387d2 100644 --- a/update.php +++ b/update.php @@ -82,6 +82,9 @@ if(empty($step)){ $msgType = "danger"; $continue = false; } +}else { + $version = json_decode(file_get_contents('version.json'), true)['version']; + $continue = false; } function pathFixer($path) @@ -208,6 +211,14 @@ function deleteFolder($path) Please wait.... + +
+
Update Finished
+
+ PHPNuxBill has been updated to Version +
+
+ From 25a6491932d6b3cbce2a42eea8caeb76dde1a89a Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 1 Aug 2023 15:58:33 +0700 Subject: [PATCH 06/10] update Community Page --- ui/ui/community.tpl | 60 ++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/ui/ui/community.tpl b/ui/ui/community.tpl index 3174f784..736a99ee 100644 --- a/ui/ui/community.tpl +++ b/ui/ui/community.tpl @@ -8,10 +8,13 @@
Get help from community
@@ -58,10 +61,12 @@ @@ -107,14 +112,21 @@

Chat with me

-
Paid Support?
donation confirmation?
Or ask any Donation Alternative
+
$50 Paid Support
donation confirmation?
Or ask any Donation Alternative
+ +
+
+

Free WhatsApp Gateway and Telegram Bot creater

+
+
+ There is a Telegram bot wizard in here +
+
@@ -129,20 +141,12 @@ - -
-
-

Free WhatsApp Gateway and Telegram Bot creater

-
-
- There is a Telegram bot wizard in here -
-
From 1111ea986e9974bccb068676e0fc9b2f0ce5328b Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 1 Aug 2023 16:01:21 +0700 Subject: [PATCH 07/10] update Version --- CHANGELOG.md | 6 ++++++ ui/ui/community.tpl | 2 +- version.json | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4aac06d8..e65825bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ # CHANGELOG +## 2023.8.1 + +- Add Update file script, one click updating PHPNuxBill +- Add Custom UI folder, to custome your own template +- Delete debug text +- Fix Vendor JS ## 2023.7.28 - Fix link buy Voucher diff --git a/ui/ui/community.tpl b/ui/ui/community.tpl index 736a99ee..d4e730fe 100644 --- a/ui/ui/community.tpl +++ b/ui/ui/community.tpl @@ -142,7 +142,7 @@