diff --git a/CHANGELOG.md b/CHANGELOG.md
index 292c3c9f..01307208 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,38 @@
# CHANGELOG
+## 2024.3.6
+
+- change attributes view
+
+## 2024.3.4
+
+- add [[username]] for reminder
+- fix agent show when editing
+- fix password admin when sending notification
+- add file exists for pages
+
+## 2024.3.3
+
+- Change loading button by @Focuslinkstech
+- Add Customer Announcements by @Gerandonk
+- Add PPPOE Period Validity by @Gerandonk
+
+## 2024.2.29
+
+- Fix Hook Functionality
+- Change Customer Menu
+
+## 2024.2.28
+
+- Fix Buy Plan with Balance
+- Add Expired date for reminder
+
+## 2024.2.27
+
+- fix path notification
+- redirect to dashboard if already login
+
## 2024.2.26
- Clean Unused JS and CSS
diff --git a/init.php b/init.php
index 1d83c172..2779888f 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) {
@@ -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'])) {
@@ -237,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;
@@ -250,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/install/phpnuxbill.sql b/install/phpnuxbill.sql
index 5f4bd014..1e5ea998 100644
--- a/install/phpnuxbill.sql
+++ b/install/phpnuxbill.sql
@@ -91,7 +91,7 @@ CREATE TABLE `tbl_plans` (
`data_limit` int(10) UNSIGNED DEFAULT NULL,
`data_unit` enum('MB','GB') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`validity` int(10) NOT NULL,
- `validity_unit` enum('Mins','Hrs','Days','Months') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+ `validity_unit` enum('Mins','Hrs','Days','Months','Period') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`shared_users` int(10) DEFAULT NULL,
`routers` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`is_radius` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1 is radius',
diff --git a/pages_template/Announcement.html b/pages_template/Announcement.html
index 3f0a6c99..4eec3810 100644
--- a/pages_template/Announcement.html
+++ b/pages_template/Announcement.html
@@ -1 +1,3 @@
-Pengumuman!!
Besok libur
Announcement!!
Tomorrow holiday
\ No newline at end of file
+Pengumuman!!
Besok libur
Announcement!!
Tomorrow holiday
+
+This Announcement is for Login Page.
\ No newline at end of file
diff --git a/pages_template/Announcement_Customer.html b/pages_template/Announcement_Customer.html
new file mode 100644
index 00000000..4eaa8063
--- /dev/null
+++ b/pages_template/Announcement_Customer.html
@@ -0,0 +1,8 @@
+Pengumuman Pelanggan!!
+Besok libur
+
+Customer Announcement!!
+Tomorrow holiday
+
+
+This Announcement is for Customer Dashboard
\ No newline at end of file
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;
}
}
}
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/system/autoload/Message.php b/system/autoload/Message.php
index 256129de..0823ce51 100644
--- a/system/autoload/Message.php
+++ b/system/autoload/Message.php
@@ -60,25 +60,30 @@ class Message
global $config;
run_hook('send_whatsapp'); #HOOK
if (!empty($config['wa_url'])) {
- $waurl = str_replace('[number]', urlencode($phone), $config['wa_url']);
+ $waurl = str_replace('[number]', urlencode(Lang::phoneFormat($phone)), $config['wa_url']);
$waurl = str_replace('[text]', urlencode($txt), $waurl);
return Http::getData($waurl);
}
}
- public static function sendPackageNotification($phone, $name, $package, $price, $message, $via)
+ public static function sendPackageNotification($customer, $package, $price, $message, $via)
{
- $msg = str_replace('[[name]]', $name, $message);
+ global $u;
+ $msg = str_replace('[[name]]', $customer['fullname'], $message);
+ $msg = str_replace('[[username]]', $customer['username'], $msg);
$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($customer['phonenumber']) && strlen($customer['phonenumber']) > 5
&& !empty($message) && in_array($via, ['sms', 'wa'])
) {
if ($via == 'sms') {
- Message::sendSMS($phone, $msg);
+ Message::sendSMS($customer['phonenumber'], $msg);
} else if ($via == 'wa') {
- Message::sendWhatsapp($phone, $msg);
+ Message::sendWhatsapp($customer['phonenumber'], $msg);
}
}
return "$via: $msg";
diff --git a/system/autoload/Package.php b/system/autoload/Package.php
index b1ed8423..454ade31 100644
--- a/system/autoload/Package.php
+++ b/system/autoload/Package.php
@@ -19,7 +19,7 @@ class Package
*/
public static function rechargeUser($id_customer, $router_name, $plan_id, $gateway, $channel)
{
- global $config, $admin;
+ global $config, $admin, $c, $p, $b, $t, $d;
$date_now = date("Y-m-d H:i:s");
$date_only = date("Y-m-d");
$time_only = date("H:i:s");
@@ -31,6 +31,16 @@ class Package
$c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $plan_id)->where('enabled', '1')->find_one();
+ if ($p['validity_unit'] == 'Period') {
+ $f = ORM::for_table('tbl_customers_fields')->where('field_name', 'Expired Date')->where('customer_id', $c['id'])->find_one();
+ if (!$f) {
+ $f = ORM::for_table('tbl_customers_fields')->create();
+ $f->customer_id = $c['id'];
+ $f->field_name = 'Expired Date';
+ $f->field_value = 20;
+ $f->save();
+ }
+ }
if ($router_name == 'balance') {
// insert table transactions
@@ -48,8 +58,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();
@@ -94,9 +104,24 @@ 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'));
+ } else if ($p['validity_unit'] == 'Period') {
+ $date_tmp = date("Y-m-{$f['field_value']}", strtotime('+' . $p['validity'] . ' month'));
+ $dt1 = new DateTime("$date_only");
+ $dt2 = new DateTime("$date_tmp");
+ $diff = $dt2->diff($dt1);
+ $sum = $diff->format("%a"); // => 453
+ if ($sum >= 35) {
+ $date_exp = date("Y-m-{$f['field_value']}", strtotime('+0 month'));
+ } else {
+ $date_exp = date("Y-m-{$f['field_value']}", strtotime('+' . $p['validity'] . ' month'));
+ };
+ $time = date("23:59:00");
} else if ($p['validity_unit'] == 'Days') {
$date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' day'));
} else if ($p['validity_unit'] == 'Hrs') {
@@ -116,6 +141,9 @@ class Package
if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
$time = $b['time'];
+ } else if ($p['validity_unit'] == 'Period') {
+ $date_exp = date("Y-m-{$f['field_value']}", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
+ $time = date("23:59:00");
} else if ($p['validity_unit'] == 'Days') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
$time = $b['time'];
@@ -152,8 +180,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,11 +200,32 @@ 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();
+
+ // insert to fields
+ $fl = ORM::for_table('tbl_customers_fields')->where('field_name', 'Invoice')->where('customer_id', $c['id'])->find_one();
+ if (!$fl) {
+ $fl = ORM::for_table('tbl_customers_fields')->create();
+ $fl->customer_id = $c['id'];
+ $fl->field_name = 'Invoice';
+ $fl->field_value = $p['price'];
+ $fl->save();
+ } else {
+ $fl->customer_id = $c['id'];
+ $fl->field_value = $p['price'];
+ $fl->save();
+ }
+
+
+ Message::sendTelegram("#u$c[username] $c[fullname] #recharge #Hotspot \n" . $p['name_plan'] .
+ "\nRouter: " . $router_name .
+ "\nGateway: " . $gateway .
+ "\nChannel: " . $channel .
+ "\nPrice: " . Lang::moneyFormat($p['price']));
} else {
if ($p['is_radius']) {
Radius::customerAddPlan($c, $p, "$date_exp $time");
@@ -201,18 +250,29 @@ class Package
$d->routers = $router_name;
$d->type = "Hotspot";
if ($admin) {
- $d->admin_id = $admin['id'];
- }else{
+ $d->admin_id = ($admin['id']) ? $admin['id'] : '0';
+ } else {
$d->admin_id = '0';
}
$d->save();
+ // Calculating Price
+ $sd = new DateTime("$date_only");
+ $ed = new DateTime("$date_exp");
+ $td = $ed->diff($sd);
+ $fd = $td->format("%a");
+ $gi = ($p['price'] / 30) * $fd;
+
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . Package::_raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
- $t->price = $p['price'];
+ if ($gi > $p['price']) {
+ $t->price = $p['price'];
+ } else {
+ $t->price = $gi;
+ }
$t->recharged_on = $date_only;
$t->recharged_time = $time_only;
$t->expiration = $date_exp;
@@ -221,17 +281,36 @@ 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();
+
+ // insert to fields
+ $fl = ORM::for_table('tbl_customers_fields')->where('field_name', 'Invoice')->where('customer_id', $c['id'])->find_one();
+ if (!$fl) {
+ $fl = ORM::for_table('tbl_customers_fields')->create();
+ $fl->customer_id = $c['id'];
+ $fl->field_name = 'Invoice';
+ if ($gi > $p['price']) {
+ $fl->field_value = $p['price'];
+ } else {
+ $fl->field_value = $gi;
+ }
+ $fl->save();
+ } else {
+ $fl->customer_id = $c['id'];
+ $fl->field_value = $p['price'];
+ $fl->save();
+ }
+
+ Message::sendTelegram("#u$c[username] $c[fullname] #buy #Hotspot \n" . $p['name_plan'] .
+ "\nRouter: " . $router_name .
+ "\nGateway: " . $gateway .
+ "\nChannel: " . $channel .
+ "\nPrice: " . Lang::moneyFormat($p['price']));
}
- Message::sendTelegram("#u$c[username] #buy #Hotspot \n" . $p['name_plan'] .
- "\nRouter: " . $router_name .
- "\nGateway: " . $gateway .
- "\nChannel: " . $channel .
- "\nPrice: " . Lang::moneyFormat($p['price']));
} else {
if ($b) {
@@ -240,6 +319,9 @@ class Package
if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
$time = $b['time'];
+ } else if ($p['validity_unit'] == 'Period') {
+ $date_exp = date("Y-m-{$f['field_value']}", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
+ $time = date("23:59:00");
} else if ($p['validity_unit'] == 'Days') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
$time = $b['time'];
@@ -276,8 +358,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,11 +378,32 @@ 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();
+
+ // insert to fields
+ $fl = ORM::for_table('tbl_customers_fields')->where('field_name', 'Invoice')->where('customer_id', $c['id'])->find_one();
+ $gp = $gi;
+ if (!$fl) {
+ $fl = ORM::for_table('tbl_customers_fields')->create();
+ $fl->customer_id = $c['id'];
+ $fl->field_name = 'Invoice';
+ $fl->field_value = $p['price'];
+ $fl->save();
+ } else {
+ $fl->customer_id = $c['id'];
+ $fl->field_value = $p['price'];
+ $fl->save();
+ }
+
+ Message::sendTelegram("#u$c[username] $c[fullname] #recharge #PPPOE \n" . $p['name_plan'] .
+ "\nRouter: " . $router_name .
+ "\nGateway: " . $gateway .
+ "\nChannel: " . $channel .
+ "\nPrice: " . Lang::moneyFormat($p['price']));
} else {
if ($p['is_radius']) {
Radius::customerAddPlan($c, $p, "$date_exp $time");
@@ -325,18 +428,29 @@ 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();
+ // Calculating Price
+ $sd = new DateTime("$date_only");
+ $ed = new DateTime("$date_exp");
+ $td = $ed->diff($sd);
+ $fd = $td->format("%a");
+ $gi = ($p['price'] / 30) * $fd;
+
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . Package::_raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
- $t->price = $p['price'];
+ if ($gi > $p['price']) {
+ $t->price = $p['price'];
+ } else {
+ $t->price = $gi;
+ }
$t->recharged_on = $date_only;
$t->recharged_time = $time_only;
$t->expiration = $date_exp;
@@ -344,20 +458,39 @@ 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";
$t->save();
- }
- Message::sendTelegram("#u$c[username] #buy #PPPOE \n" . $p['name_plan'] .
- "\nRouter: " . $router_name .
- "\nGateway: " . $gateway .
- "\nChannel: " . $channel .
- "\nPrice: " . Lang::moneyFormat($p['price']));
- }
+ // insert to fields
+ $fl = ORM::for_table('tbl_customers_fields')->where('field_name', 'Invoice')->where('customer_id', $c['id'])->find_one();
+ if (!$fl) {
+ $fl = ORM::for_table('tbl_customers_fields')->create();
+ $fl->customer_id = $c['id'];
+ $fl->field_name = 'Invoice';
+ if ($gi > $p['price']) {
+ $fl->field_value = $p['price'];
+ } else {
+ $fl->field_value = $gi;
+ }
+ $fl->save();
+ } else {
+ $fl->customer_id = $c['id'];
+ $fl->field_value = $p['price'];
+ $fl->save();
+ }
+
+ Message::sendTelegram("#u$c[username] $c[fullname] #buy #PPPOE \n" . $p['name_plan'] .
+ "\nRouter: " . $router_name .
+ "\nGateway: " . $gateway .
+ "\nChannel: " . $channel .
+ "\nPrice: " . Lang::moneyFormat($p['price']));
+ }
+ }
+ run_hook("recharge_user_finish");
Message::sendInvoice($c, $t);
return true;
}
@@ -511,6 +644,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);
}
}
diff --git a/system/boot.php b/system/boot.php
index 9dc14843..c766baf5 100644
--- a/system/boot.php
+++ b/system/boot.php
@@ -78,9 +78,9 @@ $ui->assign('_domain', str_replace('www.', '', parse_url(APP_URL, PHP_URL_HOST))
$ui->assign('_url', APP_URL . '/index.php?_route=');
$ui->assign('_path', __DIR__);
$ui->assign('_c', $config);
-$ui->assign('UPLOAD_PATH', $UPLOAD_PATH);
-$ui->assign('CACHE_PATH', $CACHE_PATH);
-$ui->assign('PAGES_PATH', $PAGES_PATH);
+$ui->assign('UPLOAD_PATH', str_replace($root_path, '', $UPLOAD_PATH));
+$ui->assign('CACHE_PATH', str_replace($root_path, '', $CACHE_PATH));
+$ui->assign('PAGES_PATH', str_replace($root_path, '', $PAGES_PATH));
$ui->assign('_system_menu', 'dashboard');
function _msglog($type, $msg)
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/customers.php b/system/controllers/customers.php
index 430dc8ef..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':
@@ -274,7 +277,7 @@ switch ($action) {
} catch (Throwable $e) {
}
try {
- $c->delete();
+ if($c) $c->delete();
} catch (Exception $e) {
} catch (Throwable $e) {
}
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/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/home.php b/system/controllers/home.php
index 15f8ce8d..da7cb2e9 100644
--- a/system/controllers/home.php
+++ b/system/controllers/home.php
@@ -99,9 +99,6 @@ if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
if(!$plan['enabled']){
r2(U . "home", 'e', 'Plan is not exists');
}
- if($plan['allow_purchase'] != 'yes'){
- r2(U . "home", 'e', 'Cannot recharge this plan');
- }
if ($user['balance'] > $plan['price']) {
r2(U . "order/pay/$router[id]/$bill[plan_id]", 'e', 'Order Plan');
} else {
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 {
diff --git a/system/controllers/order.php b/system/controllers/order.php
index 75304c8b..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' && $config['allow_balance_transfer'] != '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..7d20d163 100644
--- a/system/controllers/settings.php
+++ b/system/controllers/settings.php
@@ -30,15 +30,16 @@ 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 ($_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
@@ -495,11 +496,11 @@ switch ($action) {
$date_now = date("Y-m-d H:i:s");
run_hook('add_admin'); #HOOK
if ($msg == '') {
- $password = Password::_crypt($password);
+ $passwordC = Password::_crypt($password);
$d = ORM::for_table('tbl_users')->create();
$d->username = $username;
$d->fullname = $fullname;
- $d->password = $password;
+ $d->password = $passwordC;
$d->user_type = $user_type;
$d->phone = $phone;
$d->email = $email;
diff --git a/system/cron.php b/system/cron.php
index de95b87f..76783eec 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']));
@@ -54,7 +54,7 @@ foreach ($d as $ds) {
}
Mikrotik::removeHotspotActiveUser($client, $c['username']);
}
- echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $price, $textExpired, $config['user_notification_expired'])."\n";
+ echo Message::sendPackageNotification($c, $u['namebp'], $price, $textExpired, $config['user_notification_expired'])."\n";
//update database user dengan status off
$u->status = 'off';
$u->save();
@@ -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']));
@@ -109,7 +109,7 @@ foreach ($d as $ds) {
}
Mikrotik::removePpoeActive($client, $c['username']);
}
- echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $price, $textExpired, $config['user_notification_expired'])."\n";
+ echo Message::sendPackageNotification($c, $u['namebp'], $price, $textExpired, $config['user_notification_expired'])."\n";
$u->status = 'off';
$u->save();
diff --git a/system/cron_reminder.php b/system/cron_reminder.php
index 1b54e86c..aff8182b 100644
--- a/system/cron_reminder.php
+++ b/system/cron_reminder.php
@@ -40,11 +40,11 @@ foreach ($d as $ds) {
$c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one();
$price = Lang::moneyFormat($p['price']);
if ($ds['expiration'] == $day7) {
- echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $p['name_plan'], $price, Lang::getNotifText('reminder_7_day'), $config['user_notification_reminder']) . "\n";
+ echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_7_day'), $config['user_notification_reminder']) . "\n";
} else if ($ds['expiration'] == $day3) {
- echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $p['name_plan'], $price, Lang::getNotifText('reminder_3_day'), $config['user_notification_reminder']) . "\n";
+ echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_3_day'), $config['user_notification_reminder']) . "\n";
} else if ($ds['expiration'] == $day1) {
- echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $p['name_plan'], $price, Lang::getNotifText('reminder_1_day'), $config['user_notification_reminder']) . "\n";
+ echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_1_day'), $config['user_notification_reminder']) . "\n";
}
}
}
diff --git a/system/lan/english.json b/system/lan/english.json
index e4e269d5..dc2cfac8 100644
--- a/system/lan/english.json
+++ b/system/lan/english.json
@@ -456,5 +456,10 @@
"Click_Here": "Click Here",
"danger": "danger",
"Logout_Successful": "Logout Successful",
- "warning": "warning"
+ "warning": "warning",
+ "Users_Announcement": "Users Announcement",
+ "Customer_Announcement": "Customer Announcement",
+ "1_Period___1_Month__Expires_the_20th_of_each_month": "1 Period = 1 Month, Expires the 20th of each month",
+ "Period": "Period",
+ "Add": "Add"
}
\ No newline at end of file
diff --git a/system/updates.json b/system/updates.json
index e5ecdff6..aa67225a 100644
--- a/system/updates.json
+++ b/system/updates.json
@@ -69,5 +69,8 @@
"2024.2.23" : [
"ALTER TABLE `tbl_transactions` ADD `admin_id` INT NOT NULL DEFAULT '1' AFTER `type`;",
"ALTER TABLE `tbl_user_recharges` ADD `admin_id` INT NOT NULL DEFAULT '1' AFTER `type`;"
+ ],
+ "2024.3.3" : [
+ "ALTER TABLE `tbl_plans` CHANGE `validity_unit` `validity_unit` ENUM('Mins','Hrs','Days','Months','Period') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;"
]
}
\ No newline at end of file
diff --git a/ui/ui/admin-login.tpl b/ui/ui/admin-login.tpl
index 493b7061..3ba9e197 100644
--- a/ui/ui/admin-login.tpl
+++ b/ui/ui/admin-login.tpl
@@ -4,19 +4,19 @@
{Lang::T('Enter Admin Area')}
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}