From 848dcb5caf0ec7582712eb07879e871ad46339c1 Mon Sep 17 00:00:00 2001 From: iBNu Maksum Date: Tue, 27 Feb 2024 07:12:02 +0700 Subject: [PATCH 01/40] fix variable Admin.php --- system/autoload/Admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/autoload/Admin.php b/system/autoload/Admin.php index ddfa89f6..cab30813 100644 --- a/system/autoload/Admin.php +++ b/system/autoload/Admin.php @@ -51,7 +51,7 @@ class Admin if ($id) { return ORM::for_table('tbl_users')->find_one($id); } else { - return []; + return null; } } } From 1ec8049068469b0d2505cd594404e17ec6a20055 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 27 Feb 2024 10:31:56 +0700 Subject: [PATCH 02/40] fix path --- init.php | 6 +++--- system/controllers/customers.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/init.php b/init.php index 1d83c172..5c050497 100644 --- a/init.php +++ b/init.php @@ -76,10 +76,10 @@ if ($_app_stage != 'Live') { define('U', APP_URL . '/index.php?_route='); // notification message -if (file_exists($root_path . $UPLOAD_PATH . DIRECTORY_SEPARATOR . "notifications.json")) { - $_notifmsg = json_decode(file_get_contents($root_path . $UPLOAD_PATH . DIRECTORY_SEPARATOR . 'notifications.json'), true); +if (file_exists($UPLOAD_PATH . DIRECTORY_SEPARATOR . "notifications.json")) { + $_notifmsg = json_decode(file_get_contents($UPLOAD_PATH . DIRECTORY_SEPARATOR . 'notifications.json'), true); } -$_notifmsg_default = json_decode(file_get_contents($root_path . $UPLOAD_PATH . DIRECTORY_SEPARATOR . 'notifications.default.json'), true); +$_notifmsg_default = json_decode(file_get_contents($UPLOAD_PATH . DIRECTORY_SEPARATOR . 'notifications.default.json'), true); //register all plugin foreach (glob(File::pathFixer($PLUGIN_PATH . DIRECTORY_SEPARATOR . '*.php')) as $filename) { diff --git a/system/controllers/customers.php b/system/controllers/customers.php index 430dc8ef..90371224 100644 --- a/system/controllers/customers.php +++ b/system/controllers/customers.php @@ -274,7 +274,7 @@ switch ($action) { } catch (Throwable $e) { } try { - $c->delete(); + if($c) $c->delete(); } catch (Exception $e) { } catch (Throwable $e) { } From b938db9e5d7ccf5a9176fe9dbf2d1e35ecd449f1 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 27 Feb 2024 10:37:41 +0700 Subject: [PATCH 03/40] redirect after login --- system/controllers/admin.php | 4 ++++ system/controllers/default.php | 9 +++++++-- system/controllers/login.php | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/system/controllers/admin.php b/system/controllers/admin.php index 76338042..76bd7400 100644 --- a/system/controllers/admin.php +++ b/system/controllers/admin.php @@ -5,6 +5,10 @@ * by https://t.me/ibnux **/ +if(Admin::getID()){ + r2(U.'dashboard'); +} + if (isset($routes['1'])) { $do = $routes['1']; } else { diff --git a/system/controllers/default.php b/system/controllers/default.php index 0694c7a6..d32f8ce4 100644 --- a/system/controllers/default.php +++ b/system/controllers/default.php @@ -4,5 +4,10 @@ * by https://t.me/ibnux **/ - -r2(APP_URL.'/index.php?_route=dashboard'); +if(Admin::getID()){ + r2(U.'dashboard'); +}if(User::getID()){ + r2(U.'home'); +}else{ + r2(U.'login'); +} diff --git a/system/controllers/login.php b/system/controllers/login.php index 6148591c..15b5eaf0 100644 --- a/system/controllers/login.php +++ b/system/controllers/login.php @@ -5,6 +5,10 @@ * by https://t.me/ibnux **/ +if(User::getID()){ + r2(U.'home'); +} + if (isset($routes['1'])) { $do = $routes['1']; } else { From 747a67b691c288ed7c4d549726c341f08ea1068b Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 27 Feb 2024 10:39:21 +0700 Subject: [PATCH 04/40] 2024.2.27 --- CHANGELOG.md | 5 +++++ version.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 292c3c9f..d7e3c66b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ # CHANGELOG +## 2024.2.27 + +- fix path notification +- redirect to dashboard if already login + ## 2024.2.26 - Clean Unused JS and CSS diff --git a/version.json b/version.json index 641d79b1..6b93e793 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "2024.2.26" + "version": "2024.2.27" } \ No newline at end of file From 61edfb932a118a1bc0c4e6e96adb50b9214a9d92 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 27 Feb 2024 12:00:49 +0700 Subject: [PATCH 05/40] fix wrong logic != to == --- ui/ui/user-dashboard.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/ui/user-dashboard.tpl b/ui/ui/user-dashboard.tpl index bf9f2d8e..84301b91 100644 --- a/ui/ui/user-dashboard.tpl +++ b/ui/ui/user-dashboard.tpl @@ -111,7 +111,7 @@

{$_bill['routers']}

- {if $_bill['type'] != 'Hotspot'} + {if $_bill['type'] == 'Hotspot'} {if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if} {else} {if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if} From c8004f1a27a51481b0eed57eec8ca1419a6061fd Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 27 Feb 2024 13:10:06 +0700 Subject: [PATCH 06/40] fix update file --- update.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/update.php b/update.php index ff716ac6..b5eb0e06 100644 --- a/update.php +++ b/update.php @@ -77,6 +77,9 @@ if (empty($step)) { // remove downloaded zip if (file_exists($file)) unlink($file); } else if ($step == 3) { + deleteFolder('system/autoload/'); + deleteFolder('system/vendor/'); + deleteFolder('ui/ui/'); copyFolder($folder, pathFixer('./')); deleteFolder('install/'); deleteFolder($folder); From 41dd0d86e7e44c8c57f8955a26014b06b15aea22 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 27 Feb 2024 13:12:25 +0700 Subject: [PATCH 07/40] Fix Recharge --- system/autoload/Package.php | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/system/autoload/Package.php b/system/autoload/Package.php index e8fe32a7..c0eb1f5f 100644 --- a/system/autoload/Package.php +++ b/system/autoload/Package.php @@ -48,8 +48,8 @@ class Package $t->routers = $router_name; $t->type = "Balance"; if ($admin) { - $t->admin_id = $admin['id']; - }else{ + $t->admin_id = ($admin['id']) ? $admin['id'] : '0'; + } else { $t->admin_id = '0'; } $t->save(); @@ -152,8 +152,8 @@ class Package $b->routers = $router_name; $b->type = "Hotspot"; if ($admin) { - $b->admin_id = $admin['id']; - }else{ + $b->admin_id = ($admin['id']) ? $admin['id'] : '0'; + } else { $b->admin_id = '0'; } $b->save(); @@ -172,8 +172,8 @@ class Package $t->routers = $router_name; $t->type = "Hotspot"; if ($admin) { - $t->admin_id = $admin['id']; - }else{ + $t->admin_id = ($admin['id']) ? $admin['id'] : '0'; + } else { $t->admin_id = '0'; } $t->save(); @@ -201,9 +201,9 @@ class Package $d->routers = $router_name; $d->type = "Hotspot"; if ($admin) { - $b->admin_id = $admin['id']; - }else{ - $b->admin_id = '0'; + $d->admin_id = ($admin['id']) ? $admin['id'] : '0'; + } else { + $d->admin_id = '0'; } $d->save(); @@ -221,8 +221,8 @@ class Package $t->routers = $router_name; $t->type = "Hotspot"; if ($admin) { - $t->admin_id = $admin['id']; - }else{ + $t->admin_id = ($admin['id']) ? $admin['id'] : '0'; + } else { $t->admin_id = '0'; } $t->save(); @@ -276,8 +276,8 @@ class Package $b->routers = $router_name; $b->type = "PPPOE"; if ($admin) { - $b->admin_id = $admin['id']; - }else{ + $b->admin_id = ($admin['id']) ? $admin['id'] : '0'; + } else { $b->admin_id = '0'; } $b->save(); @@ -296,8 +296,8 @@ class Package $t->routers = $router_name; $t->type = "PPPOE"; if ($admin) { - $t->admin_id = $admin['id']; - }else{ + $t->admin_id = ($admin['id']) ? $admin['id'] : '0'; + } else { $t->admin_id = '0'; } $t->save(); @@ -325,8 +325,8 @@ class Package $d->routers = $router_name; $d->type = "PPPOE"; if ($admin) { - $d->admin_id = $admin['id']; - }else{ + $d->admin_id = ($admin['id']) ? $admin['id'] : '0'; + } else { $d->admin_id = '0'; } $d->save(); @@ -344,8 +344,8 @@ class Package $t->method = "$gateway - $channel"; $t->routers = $router_name; if ($admin) { - $t->admin_id = $admin['id']; - }else{ + $t->admin_id = ($admin['id']) ? $admin['id'] : '0'; + } else { $t->admin_id = '0'; } $t->type = "PPPOE"; @@ -511,6 +511,6 @@ class Package $invoice .= Lang::pad("", '=') . "\n"; $invoice .= Lang::pad($config['note'], ' ', 2) . "\n"; $ui->assign('whatsapp', urlencode("```$invoice```")); - $ui->assign('in',$in); + $ui->assign('in', $in); } } From 82e67f0b83b3582d1a15d35cada1a2c01d21321a Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 27 Feb 2024 13:12:53 +0700 Subject: [PATCH 08/40] fix Recharge --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index 6b93e793..b8373514 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "2024.2.27" + "version": "2024.2.27.1" } \ No newline at end of file From 2660f5d2d0a89af905694d94c0264e7315ecdf11 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 27 Feb 2024 14:22:17 +0700 Subject: [PATCH 09/40] Dashboard 2 Column --- ui/ui/dashboard.tpl | 85 +++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/ui/ui/dashboard.tpl b/ui/ui/dashboard.tpl index d31649c4..3e909a45 100644 --- a/ui/ui/dashboard.tpl +++ b/ui/ui/dashboard.tpl @@ -60,49 +60,52 @@
- -{if $_c['hide_mrc'] != 'yes'} -
-
- - -

{Lang::T('Monthly Registered Customers')}

- -
- - - -
-
-
- -
-
-{/if} - - -{if $_c['hide_tms'] != 'yes'} -
-
- - -

{Lang::T('Total Monthly Sales')}

- -
- - - -
-
-
- -
-
-{/if}
+ + + {if $_c['hide_mrc'] != 'yes'} +
+
+ + +

{Lang::T('Monthly Registered Customers')}

+ +
+ + + +
+
+
+ +
+
+ {/if} + + + {if $_c['hide_tms'] != 'yes'} +
+
+ + +

{Lang::T('Total Monthly Sales')}

+ +
+ + + +
+
+
+ +
+
+ {/if} {if $_c['disable_voucher'] != 'yes' && $stocks['unused']>0 || $stocks['used']>0} {if $_c['hide_vs'] != 'yes'}
From 08153e6ec1684375b772cc8c355e07ac812b9df9 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Wed, 28 Feb 2024 11:31:31 +0700 Subject: [PATCH 10/40] Fix Buy Plan with Balance --- system/controllers/order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/controllers/order.php b/system/controllers/order.php index 75304c8b..03003430 100644 --- a/system/controllers/order.php +++ b/system/controllers/order.php @@ -142,7 +142,7 @@ switch ($action) { $ui->display('user-orderView.tpl'); break; case 'pay': - if ($_c['enable_balance'] != 'yes' && $config['allow_balance_transfer'] != 'yes') { + if ($_c['enable_balance'] != 'yes') { r2(U . "order/package", 'e', Lang::T("Balance not enabled")); } $plan = ORM::for_table('tbl_plans')->where('enabled', '1')->find_one($routes['3']); From a0b9e85f38d11de6ab72f6fd9eb0dd02b96f6945 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Wed, 28 Feb 2024 11:31:36 +0700 Subject: [PATCH 11/40] Add Expired date for reminder --- CHANGELOG.md | 5 +++++ system/autoload/Message.php | 4 ++++ ui/ui/app-notifications.tpl | 25 +++++++++++++++++-------- version.json | 2 +- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7e3c66b..df88411e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ # CHANGELOG +## 2024.2.28 + +- Fix Buy Plan with Balance +- Add Expired date for reminder + ## 2024.2.27 - fix path notification diff --git a/system/autoload/Message.php b/system/autoload/Message.php index 256129de..a8005898 100644 --- a/system/autoload/Message.php +++ b/system/autoload/Message.php @@ -68,9 +68,13 @@ class Message public static function sendPackageNotification($phone, $name, $package, $price, $message, $via) { + global $u; $msg = str_replace('[[name]]', $name, $message); $msg = str_replace('[[package]]', $package, $msg); $msg = str_replace('[[price]]', $price, $msg); + if($u){ + $msg = str_replace('[[expired_date]]', Lang::dateAndTimeFormat($u['expiration'], $u['time']), $msg); + } if ( !empty($phone) && strlen($phone) > 5 && !empty($message) && in_array($via, ['sms', 'wa']) diff --git a/ui/ui/app-notifications.tpl b/ui/ui/app-notifications.tpl index 2691593f..30220a31 100644 --- a/ui/ui/app-notifications.tpl +++ b/ui/ui/app-notifications.tpl @@ -15,13 +15,14 @@
-

- [[name]] will be replaced with Customer Name. [[package]] will be replaced with Package name. [[price]] will be replaced with Package price. + [[name]] will be replaced with Customer Name. + [[package]] will be replaced with Package name. + [[price]] will be replaced with Package price.

@@ -33,7 +34,10 @@ rows="3">{Lang::htmlspecialchars($_json['reminder_7_day'])}

- [[name]] will be replaced with Customer Name. [[package]] will be replaced with Package name. [[price]] will be replaced with Package price. + [[name]] will be replaced with Customer Name. + [[package]] will be replaced with Package name. + [[price]] will be replaced with Package price. + [[expired_date]] will be replaced with Expiration date.

@@ -45,7 +49,10 @@ rows="3">{Lang::htmlspecialchars($_json['reminder_3_day'])}

- [[name]] will be replaced with Customer Name. [[package]] will be replaced with Package name. [[price]] will be replaced with Package price. + [[name]] will be replaced with Customer Name. + [[package]] will be replaced with Package name. + [[price]] will be replaced with Package price. + [[expired_date]] will be replaced with Expiration date.

@@ -57,7 +64,10 @@ rows="3">{Lang::htmlspecialchars($_json['reminder_1_day'])}

- [[name]] will be replaced with Customer Name. [[package]] will be replaced with Package name. [[price]] will be replaced with Package price. + [[name]] will be replaced with Customer Name. + [[package]] will be replaced with Package name. + [[price]] will be replaced with Package price. + [[expired_date]] will be replaced with Expiration date.

@@ -149,8 +159,7 @@
- +
diff --git a/version.json b/version.json index b8373514..60dd994c 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "2024.2.27.1" + "version": "2024.2.28" } \ No newline at end of file From dfeee540cf6942f08d2a748e794b8b6147cde35e Mon Sep 17 00:00:00 2001 From: iBNu Maksum Date: Wed, 28 Feb 2024 18:19:17 +0700 Subject: [PATCH 12/40] Fix variable $_c --- init.php | 1 + 1 file changed, 1 insertion(+) diff --git a/init.php b/init.php index 5c050497..76ba7d75 100644 --- a/init.php +++ b/init.php @@ -96,6 +96,7 @@ $result = ORM::for_table('tbl_appconfig')->find_many(); foreach ($result as $value) { $config[$value['setting']] = $value['value']; } +$_c = $config; if (empty($http_proxy) && !empty($config['http_proxy'])) { $http_proxy = $config['http_proxy']; if (empty($http_proxyauth) && !empty($config['http_proxyauth'])) { From 24370964737bf8c71f081a8c9bb8234ef4a7e1b0 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Thu, 29 Feb 2024 09:25:26 +0700 Subject: [PATCH 13/40] $_c to $config in php file --- system/controllers/order.php | 4 ++-- system/controllers/settings.php | 4 ++-- system/cron.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/system/controllers/order.php b/system/controllers/order.php index 03003430..cee6b454 100644 --- a/system/controllers/order.php +++ b/system/controllers/order.php @@ -142,7 +142,7 @@ switch ($action) { $ui->display('user-orderView.tpl'); break; case 'pay': - if ($_c['enable_balance'] != 'yes') { + if ($config['enable_balance'] != 'yes') { r2(U . "order/package", 'e', Lang::T("Balance not enabled")); } $plan = ORM::for_table('tbl_plans')->where('enabled', '1')->find_one($routes['3']); @@ -176,7 +176,7 @@ switch ($action) { } break; case 'send': - if ($_c['enable_balance'] != 'yes') { + if ($config['enable_balance'] != 'yes') { r2(U . "order/package", 'e', Lang::T("Balance not enabled")); } $ui->assign('_title', Lang::T('Buy for friend')); diff --git a/system/controllers/settings.php b/system/controllers/settings.php index 13804c1e..a2f33fdd 100644 --- a/system/controllers/settings.php +++ b/system/controllers/settings.php @@ -36,9 +36,9 @@ switch ($action) { $logo = $UPLOAD_PATH . DIRECTORY_SEPARATOR . 'logo.default.png'; } $ui->assign('logo', $logo); - if ($_c['radius_enable'] && empty($_c['radius_client'])) { + if ($config['radius_enable'] && empty($config['radius_client'])) { try { - $_c['radius_client'] = Radius::getClient(); + $config['radius_client'] = Radius::getClient(); $ui->assign('_c', $_c); } catch (Exception $e) { //ignore diff --git a/system/cron.php b/system/cron.php index de95b87f..7616187c 100644 --- a/system/cron.php +++ b/system/cron.php @@ -24,7 +24,7 @@ echo "Found " . count($d) . " user(s)\n"; run_hook('cronjob'); #HOOK foreach ($d as $ds) { - if ($ds['type'] == 'Hotspot') { + if ($ds['type'] == 'Hotspot') { # HOTSPOT $date_now = strtotime(date("Y-m-d H:i:s")); $expiration = strtotime($ds['expiration'] . ' ' . $ds['time']); echo $ds['expiration'] . " : " . (($isCli) ? $ds['username'] : Lang::maskText($ds['username'])); @@ -82,7 +82,7 @@ foreach ($d as $ds) { } } else echo " : ACTIVE \r\n"; - } else { + } else { # PPPOE $date_now = strtotime(date("Y-m-d H:i:s")); $expiration = strtotime($ds['expiration'] . ' ' . $ds['time']); echo $ds['expiration'] . " : " . (($isCli) ? $ds['username'] : Lang::maskText($ds['username'])); From 28f4624e8d54d2f409552ee7267d4c7c52ddc64a Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Thu, 29 Feb 2024 11:37:54 +0700 Subject: [PATCH 14/40] change Customer menu --- system/controllers/customers.php | 3 ++ ui/ui/customers-edit.tpl | 73 ++++++++++++++++---------------- ui/ui/sections/header.tpl | 17 ++------ 3 files changed, 43 insertions(+), 50 deletions(-) diff --git a/system/controllers/customers.php b/system/controllers/customers.php index 90371224..0dbc1c5e 100644 --- a/system/controllers/customers.php +++ b/system/controllers/customers.php @@ -12,6 +12,9 @@ $ui->assign('_system_menu', 'customers'); $action = $routes['1']; $ui->assign('_admin', $admin); +if(empty($action)){ + $action = 'list'; +} switch ($action) { case 'list': diff --git a/ui/ui/customers-edit.tpl b/ui/ui/customers-edit.tpl index d54a0c25..46a71202 100644 --- a/ui/ui/customers-edit.tpl +++ b/ui/ui/customers-edit.tpl @@ -13,10 +13,10 @@
{if $_c['country_code_phone']!= ''} - + + + {else} - + {/if}
{if $_c['country_code_phone']!= ''} - + + + {else} - + {/if} @@ -91,25 +91,24 @@
{if $customFields} - {foreach $customFields as $customField} -
- -
- -
- Delete -
- {/foreach} + {foreach $customFields as $customField} +
+ +
+ +
+ Delete +
+ {/foreach} {/if}
- +
@@ -129,16 +128,16 @@
{literal} - + {/literal} {include file="sections/footer.tpl"} \ No newline at end of file diff --git a/ui/ui/sections/header.tpl b/ui/ui/sections/header.tpl index fc1ca388..066d5d37 100644 --- a/ui/ui/sections/header.tpl +++ b/ui/ui/sections/header.tpl @@ -130,20 +130,11 @@ {$_MENU_AFTER_DASHBOARD} {if !in_array($_admin['user_type'],['Report'])} -
  • - - {Lang::T('Customer')} - - - +
  • + + + {Lang::T('Customer')} -
  • {$_MENU_AFTER_CUSTOMERS}
  • From bae079f71c1987d36490bcbf1c4f18f6fde74168 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Thu, 29 Feb 2024 13:32:46 +0700 Subject: [PATCH 15/40] Fix Hook Functionality --- CHANGELOG.md | 5 +++++ system/autoload/Hookers.php | 1 + version.json | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df88411e..a87cff46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ # CHANGELOG +## 2024.2.29 + +- Fix Hook Functionality +- Change Customer Menu + ## 2024.2.28 - Fix Buy Plan with Balance diff --git a/system/autoload/Hookers.php b/system/autoload/Hookers.php index 16d665c4..f15d0a96 100644 --- a/system/autoload/Hookers.php +++ b/system/autoload/Hookers.php @@ -38,6 +38,7 @@ function register_menu($name, $admin, $function, $position, $icon = '', $label = $hook_registered = array(); function register_hook($action, $function){ + global $hook_registered; $hook_registered[] = [ 'action' => $action, 'function' => $function diff --git a/version.json b/version.json index 60dd994c..222ba5ac 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "2024.2.28" + "version": "2024.2.29" } \ No newline at end of file From 699289662b7dfd72185e68d33328c7b6e390ef2e Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Fri, 1 Mar 2024 09:37:13 +0700 Subject: [PATCH 16/40] Fix Upload URL --- system/controllers/export.php | 11 +++++++---- system/controllers/settings.php | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/system/controllers/export.php b/system/controllers/export.php index 3fff53fc..6508fa74 100644 --- a/system/controllers/export.php +++ b/system/controllers/export.php @@ -62,10 +62,11 @@ switch ($action) { $title = ' Reports [' . $mdate . ']'; $title = str_replace('-', ' ', $title); + $UPLOAD_URL_PATH = str_replace($root_path, '', $UPLOAD_PATH); if (file_exists($UPLOAD_PATH . '/logo.png')) { - $logo = $UPLOAD_PATH . '/logo.png'; + $logo = $UPLOAD_URL_PATH . '/logo.png'; } else { - $logo = $UPLOAD_PATH . '/logo.default.png'; + $logo = $UPLOAD_URL_PATH . '/logo.default.png'; } if ($x) { @@ -234,10 +235,12 @@ EOF; $title = ' Reports [' . $mdate . ']'; $title = str_replace('-', ' ', $title); + + $UPLOAD_URL_PATH = str_replace($root_path, '', $UPLOAD_PATH); if (file_exists($UPLOAD_PATH . '/logo.png')) { - $logo = $UPLOAD_PATH . '/logo.png'; + $logo = $UPLOAD_URL_PATH . '/logo.png'; } else { - $logo = $UPLOAD_PATH . '/logo.default.png'; + $logo = $UPLOAD_URL_PATH . '/logo.default.png'; } if ($x) { diff --git a/system/controllers/settings.php b/system/controllers/settings.php index a2f33fdd..40e476d9 100644 --- a/system/controllers/settings.php +++ b/system/controllers/settings.php @@ -30,10 +30,12 @@ switch ($action) { r2(U . "settings/app", 's', 'Test Telegram has been send
    Result: ' . $result); } + $UPLOAD_URL_PATH = str_replace($root_path,'', $UPLOAD_PATH); + if (file_exists($UPLOAD_PATH . DIRECTORY_SEPARATOR . 'logo.png')) { - $logo = $UPLOAD_PATH . DIRECTORY_SEPARATOR . 'logo.png?' . time(); + $logo = $UPLOAD_URL_PATH . DIRECTORY_SEPARATOR . 'logo.png?' . time(); } else { - $logo = $UPLOAD_PATH . DIRECTORY_SEPARATOR . 'logo.default.png'; + $logo = $UPLOAD_URL_PATH . DIRECTORY_SEPARATOR . 'logo.default.png'; } $ui->assign('logo', $logo); if ($config['radius_enable'] && empty($config['radius_client'])) { From de3312055a918ce9507c20bf048317e8663a1119 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Fri, 1 Mar 2024 09:57:59 +0700 Subject: [PATCH 17/40] add hook when recharge --- init.php | 4 +++- system/autoload/Package.php | 5 ++++- ui/ui/alert.tpl | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/init.php b/init.php index 76ba7d75..2779888f 100644 --- a/init.php +++ b/init.php @@ -238,7 +238,7 @@ function r2($to, $ntype = 'e', $msg = '') exit; } -function _alert($text, $type = 'success', $url = "home") +function _alert($text, $type = 'success', $url = "home", $time = 3) { global $ui; if (!isset($ui)) return; @@ -251,8 +251,10 @@ function _alert($text, $type = 'success', $url = "home") } $ui->assign('text', $text); $ui->assign('type', $type); + $ui->assign('time', $time); $ui->assign('url', $url); $ui->display('alert.tpl'); + die(); } diff --git a/system/autoload/Package.php b/system/autoload/Package.php index c0eb1f5f..94e5aa6a 100644 --- a/system/autoload/Package.php +++ b/system/autoload/Package.php @@ -94,6 +94,9 @@ class Package ->where('Type', $p['type']) ->find_one(); + run_hook("recharge_user"); + + $mikrotik = Mikrotik::info($router_name); if ($p['validity_unit'] == 'Months') { $date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' month')); @@ -357,8 +360,8 @@ class Package "\nChannel: " . $channel . "\nPrice: " . Lang::moneyFormat($p['price'])); } - Message::sendInvoice($c, $t); + run_hook("recharge_user_finish"); return true; } diff --git a/ui/ui/alert.tpl b/ui/ui/alert.tpl index b44f4aff..d322108f 100644 --- a/ui/ui/alert.tpl +++ b/ui/ui/alert.tpl @@ -9,7 +9,7 @@ - + @@ -20,7 +20,7 @@ {$text}
  • + {/literal} diff --git a/ui/ui/customers-edit.tpl b/ui/ui/customers-edit.tpl index 46a71202..219fdf42 100644 --- a/ui/ui/customers-edit.tpl +++ b/ui/ui/customers-edit.tpl @@ -1,16 +1,15 @@ {include file="sections/header.tpl"} -
    -
    -
    -
    {Lang::T('Edit Contact')}
    -
    - -
    + +
    +
    +
    +
    {Lang::T('Edit Contact')}
    +
    - -
    + +
    {if $_c['country_code_phone']!= ''} + @@ -25,21 +24,21 @@
    - -
    + +
    - -
    + +
    - -
    + +
    {if $_c['country_code_phone']!= ''} + @@ -53,8 +52,8 @@
    - -
    + +
    @@ -62,8 +61,8 @@
    - -
    + +
    @@ -73,14 +72,14 @@
    - -
    + +
    - -
    + +
    +
    +
    +
    +
    +
    +
    {Lang::T('Attributes')}
    +
    {if $customFields} {foreach $customFields as $customField}
    -
    +
    {/foreach} {/if} - -
    - -
    - -
    + +
    - -
    -
    - - Or {Lang::T('Cancel')} -
    -
    - + +
    +
    -
    -
    +
    + +
    {Lang::T('Cancel')} +
    + {literal}