diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4902a7b8..4a0fa479 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,14 @@
# CHANGELOG
+## 2024.2.21
+
+- Fix SQL Installer
+- remove multiple space in language
+- Change Phone Number require OTP by @Focuslinkstech
+- Change burst Form
+- Delete Table Responsive, first Column Freeze
+
## 2024.2.20
- Fix list admin
diff --git a/system/autoload/Lang.php b/system/autoload/Lang.php
index f2becec3..385bb06a 100644
--- a/system/autoload/Lang.php
+++ b/system/autoload/Lang.php
@@ -12,6 +12,7 @@ class Lang
{
global $_L, $lan_file, $config;
$_L = $_SESSION['Lang'];
+ $key = preg_replace('/\s+/', ' ', $key);
if (!empty($_L[$key])) {
return $_L[$key];
}
diff --git a/system/controllers/accounts.php b/system/controllers/accounts.php
index b383fab2..423134b3 100644
--- a/system/controllers/accounts.php
+++ b/system/controllers/accounts.php
@@ -42,17 +42,17 @@ switch ($action) {
$c = ORM::for_table('tbl_user_recharges')->where('username', $user['username'])->find_one();
if ($c) {
$p = ORM::for_table('tbl_plans')->where('id', $c['plan_id'])->find_one();
- if($p['is_radius']){
- if($c['type'] == 'Hotspot' || ($c['type'] == 'PPPOE' && empty($d['pppoe_password']))){
+ if ($p['is_radius']) {
+ if ($c['type'] == 'Hotspot' || ($c['type'] == 'PPPOE' && empty($d['pppoe_password']))) {
Radius::customerUpsert($d, $p);
}
- }else{
+ } else {
$mikrotik = Mikrotik::info($c['routers']);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
if ($c['type'] == 'Hotspot') {
- Mikrotik::setHotspotUser($client, $c['username'], $npass);
- Mikrotik::removeHotspotActiveUser($client, $user['username']);
- } else if(empty($d['pppoe_password'])){
+ Mikrotik::setHotspotUser($client, $c['username'], $npass);
+ Mikrotik::removeHotspotActiveUser($client, $user['username']);
+ } else if (empty($d['pppoe_password'])) {
// only change when pppoe_password empty
Mikrotik::setPpoeUser($client, $c['username'], $npass);
Mikrotik::removePpoeActive($client, $user['username']);
@@ -122,6 +122,98 @@ switch ($action) {
}
break;
+ case 'phone-update':
+
+ $d = ORM::for_table('tbl_customers')->find_one($user['id']);
+ if ($d) {
+ //run_hook('customer_view_edit_profile'); #HOOK
+ $ui->assign('d', $d);
+ $ui->display('user-phone-update.tpl');
+ } else {
+ r2(U . 'home', 'e', Lang::T('Account Not Found'));
+ }
+ break;
+
+ case 'phone-update-otp':
+ $phone = _post('phone');
+ $username = $user['username'];
+ $otpPath = 'system/cache/sms/';
+
+ if (empty($config['sms_url'])) {
+ r2(U . 'accounts/phone-update', 'e', Lang::T('SMS server not Available, Please try again later'));
+ }
+
+ if (!empty($config['sms_url'])) {
+ if (!empty($phone)) {
+ $d = ORM::for_table('tbl_customers')->where('username', $username)->where('phonenumber', $phone)->find_one();
+ if ($d) {
+ r2(U . 'accounts/phone-update', 'e', Lang::T('You cannot use your current phone number'));
+ }
+ if (!file_exists($otpPath)) {
+ mkdir($otpPath);
+ touch($otpPath . 'index.html');
+ }
+ $otpFile = $otpPath . sha1($username . $db_password) . ".txt";
+ $phoneFile = $otpPath . sha1($username . $db_password) . "_phone.txt";
+
+ // expired 10 minutes
+ if (file_exists($otpFile) && time() - filemtime($otpFile) < 1200) {
+ r2(U . 'accounts/phone-update', 'e', Lang::T('Please wait ' . (1200 - (time() - filemtime($otpFile))) . ' seconds before sending another SMS'));
+ } else {
+ $otp = rand(100000, 999999);
+ file_put_contents($otpFile, $otp);
+ file_put_contents($phoneFile, $phone);
+ Message::sendSMS($phone, $config['CompanyName'] . "\n Your Verification code is: $otp");
+ r2(U . 'accounts/phone-update', 'e', Lang::T('Verification code has been sent to your phone'));
+ }
+ }
+ }
+
+ break;
+
+ case 'phone-update-post':
+ $phone = _post('phone');
+ $otp_code = _post('otp');
+ $username = $user['username'];
+ $otpPath = 'system/cache/sms/';
+
+ if (!empty($config['sms_url'])) {
+ $otpFile = $otpPath . sha1($username . $db_password) . ".txt";
+ $phoneFile = $otpPath . sha1($username . $db_password) . "_phone.txt";
+ // expired 10 minutes
+ if (file_exists($otpFile) && time() - filemtime($otpFile) > 1200) {
+ unlink($otpFile);
+ unlink($phoneFile);
+ r2(U . 'accounts/phone-update', 'e', 'Verification code expired');
+ } else if (file_exists($otpFile)) {
+ $code = file_get_contents($otpFile);
+ if ($code != $otp_code) {
+ r2(U . 'accounts/phone-update', 'e', 'Wrong Verification code');
+ exit();
+ } elseif (file_exists($phoneFile)) {
+ $savedPhone = file_get_contents($phoneFile);
+ if ($savedPhone !== $phone) {
+ r2(U . 'accounts/phone-update', 'e', 'The phone number does not match the one that requested the OTP');
+ exit();
+ } else {
+ unlink($otpFile);
+ unlink($phoneFile);
+ }
+ } else {
+ r2(U . 'accounts/phone-update', 'e', 'No Verification code');
+ }
+ }
+ }
+
+ $d = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
+ if ($d) {
+ $d->phonenumber = Lang::phoneFormat($phone);
+ $d->save();
+ }
+ r2(U . 'accounts/profile', 's', 'Phone number updated successfully');
+
+ break;
+
default:
$ui->display('a404.tpl');
}
diff --git a/system/controllers/bandwidth.php b/system/controllers/bandwidth.php
index 15791b5f..45d68b21 100644
--- a/system/controllers/bandwidth.php
+++ b/system/controllers/bandwidth.php
@@ -44,6 +44,7 @@ switch ($action) {
run_hook('view_edit_bandwith'); #HOOK
$d = ORM::for_table('tbl_bandwidth')->find_one($id);
if($d){
+ $ui->assign('burst',explode(" ", $d['burst']));
$ui->assign('d',$d);
$ui->display('bandwidth-edit.tpl');
}else{
@@ -67,8 +68,19 @@ switch ($action) {
$rate_down_unit = _post('rate_down_unit');
$rate_up = _post('rate_up');
$rate_up_unit = _post('rate_up_unit');
- $burst = _post('burst');
run_hook('add_bandwidth'); #HOOK
+ $isBurst = true;
+ $burst = "";
+ if(isset($_POST['burst'])){
+ foreach($_POST['burst'] as $b){
+ if(empty($b)){
+ $isBurst = false;
+ }
+ }
+ if($isBurst){
+ $burst = implode(' ', $_POST['burst']);
+ };
+ }
$msg = '';
if(Validator::Length($name,16,4) == false){
$msg .= 'Name should be between 5 to 15 characters'. ' ';
@@ -104,8 +116,19 @@ switch ($action) {
$rate_down_unit = _post('rate_down_unit');
$rate_up = _post('rate_up');
$rate_up_unit = _post('rate_up_unit');
- $burst = _post('burst');
- run_hook('edit_bandwidth'); #HOOK
+ run_hook('edit_bandwidth'); #HOOK
+ $isBurst = true;
+ $burst = "";
+ if(isset($_POST['burst'])){
+ foreach($_POST['burst'] as $b){
+ if(empty($b)){
+ $isBurst = false;
+ }
+ }
+ if($isBurst){
+ $burst = implode(' ', $_POST['burst']);
+ };
+ }
$msg = '';
if(Validator::Length($name,16,4) == false){
$msg .= 'Name should be between 5 to 15 characters'. ' ';
diff --git a/system/lan/english.json b/system/lan/english.json
index e254e969..37550777 100644
--- a/system/lan/english.json
+++ b/system/lan/english.json
@@ -427,5 +427,19 @@
"Code": "Code",
"Send_To_Customer": "Send To Customer",
"Prev": "Prev",
- "Voucher_Not_Found": "Voucher Not Found"
+ "Voucher_Not_Found": "Voucher Not Found",
+ "Miscellaneous": "Miscellaneous",
+ "OTP_Required": "OTP Required",
+ "Change": "Change",
+ "Change_Phone_Number": "Change Phone Number",
+ "Current_Number": "Current Number",
+ "New_Number": "New Number",
+ "Input_your_phone_number": "Input your phone number",
+ "OTP": "OTP",
+ "Enter_OTP_that_was_sent_to_your_phone": "Enter OTP that was sent to your phone",
+ "Update": "Update",
+ "OTP_is_required_when_user_want_to_change_phone_number": "OTP is required when user want to change phone number",
+ "Rate": "Rate",
+ "Burst": "Burst",
+ "Editing_Bandwidth_will_not_automatically_update_the_plan__you_need_to_edit_the_plan_then_save_again": "Editing Bandwidth will not automatically update the plan, you need to edit the plan then save again"
}
\ No newline at end of file
diff --git a/ui/ui/app-settings.tpl b/ui/ui/app-settings.tpl
index d618469d..7023f864 100644
--- a/ui/ui/app-settings.tpl
+++ b/ui/ui/app-settings.tpl
@@ -74,11 +74,11 @@
Theme
- Default
+ Default
{foreach $themes as $theme}
-
- {Lang::ucWords($theme)}
+
+ {Lang::ucWords($theme)}
{/foreach}
@@ -103,21 +103,21 @@
@@ -132,9 +132,9 @@
{Lang::T('Disable Voucher')}
- No
+ No
- Yes
+ Yes
@@ -144,12 +144,12 @@
{Lang::T('Voucher Format')}
- UPPERCASE
+ UPPERCASE
-
+
lowercase
-
+
RaNdoM
@@ -157,31 +157,33 @@
UPPERCASE lowercase RaNdoM
{if $_c['disable_voucher'] != 'yes'}
-
@@ -366,9 +368,9 @@
None
- Whatsapp
- SMS
@@ -381,9 +383,9 @@
None
- Whatsapp
- SMS
@@ -452,6 +454,28 @@
+
+
+
+
+ {Lang::T('Miscellaneous')}
+
+
{*
- {Lang::T('Save Changes')}
+ {Lang::T('Save
+ Changes')}
@@ -511,14 +535,14 @@ add dst-host=*.{$_domain}
function testWa() {
var target = prompt("Phone number\nSave First before Test", "");
if (target != null) {
- window.location.href = '{$_url}settings/app&testWa='+target;
+ window.location.href = '{$_url}settings/app&testWa=' + target;
}
}
function testSms() {
var target = prompt("Phone number\nSave First before Test", "");
if (target != null) {
- window.location.href = '{$_url}settings/app&testSms='+target;
+ window.location.href = '{$_url}settings/app&testSms=' + target;
}
}
diff --git a/ui/ui/bandwidth-add.tpl b/ui/ui/bandwidth-add.tpl
index f7c6ae96..c2d411d6 100644
--- a/ui/ui/bandwidth-add.tpl
+++ b/ui/ui/bandwidth-add.tpl
@@ -40,7 +40,31 @@
+
+
+
+
diff --git a/ui/ui/bandwidth-edit.tpl b/ui/ui/bandwidth-edit.tpl
index c8f986c3..a6810dc9 100644
--- a/ui/ui/bandwidth-edit.tpl
+++ b/ui/ui/bandwidth-edit.tpl
@@ -43,11 +43,39 @@
-
+
+
+
+
+
diff --git a/ui/ui/bandwidth.tpl b/ui/ui/bandwidth.tpl
index 86c1edd4..d8e45e1f 100644
--- a/ui/ui/bandwidth.tpl
+++ b/ui/ui/bandwidth.tpl
@@ -24,12 +24,12 @@
-
+
{Lang::T('Bandwidth Name')}
- {Lang::T('Rate Download')}
- {Lang::T('Rate Upload')}
+ {Lang::T('Rate')}
+ {Lang::T('Burst')}
{Lang::T('Manage')}
@@ -37,8 +37,8 @@
{foreach $d as $ds}
{$ds['name_bw']}
- {$ds['rate_down']} {$ds['rate_down_unit']}
- {$ds['rate_up']} {$ds['rate_up_unit']}
+ {$ds['rate_down']} {$ds['rate_down_unit']} / {$ds['rate_up']} {$ds['rate_up_unit']}
+ {$ds['burst']}
{Lang::T('Edit')}
diff --git a/ui/ui/customers.tpl b/ui/ui/customers.tpl
index 32812082..da48cbdb 100644
--- a/ui/ui/customers.tpl
+++ b/ui/ui/customers.tpl
@@ -32,7 +32,7 @@
class="ion ion-android-add"> {Lang::T('Add New Contact')}
-
+
diff --git a/ui/ui/dashboard.tpl b/ui/ui/dashboard.tpl
index b1ba26c9..d58bfd6c 100644
--- a/ui/ui/dashboard.tpl
+++ b/ui/ui/dashboard.tpl
@@ -108,7 +108,7 @@
Vouchers Stock
-
+
{Lang::T('Plan Name')}
@@ -139,20 +139,17 @@
{Lang::T('User Expired, Today')}
-
+
- Id
{Lang::T('Username')}
{Lang::T('Created On')}
{Lang::T('Expires On')}
- {$no = 1}
{foreach $expire as $expired}
- {$no++}
{$expired['username']}
{Lang::dateAndTimeFormat($expired['recharged_on'],$expired['recharged_time'])}
diff --git a/ui/ui/hotspot.tpl b/ui/ui/hotspot.tpl
index 51fae5b1..1026fe3d 100644
--- a/ui/ui/hotspot.tpl
+++ b/ui/ui/hotspot.tpl
@@ -45,13 +45,14 @@
{Lang::T('Routers')}
{Lang::T('Expired IP Pool')}
{Lang::T('Manage')}
+ ID
{foreach $d as $ds}
- {$ds['name_plan']}
+ {$ds['name_plan']}
{$ds['typebp']}
{$ds['name_bw']}
{Lang::moneyFormat($ds['price'])}
@@ -75,6 +76,7 @@
onclick="return confirm('{Lang::T('Delete')}?')"
class="btn btn-danger btn-xs">
+ {$ds['id']}
{/foreach}
diff --git a/ui/ui/pool.tpl b/ui/ui/pool.tpl
index da90b528..598b56be 100644
--- a/ui/ui/pool.tpl
+++ b/ui/ui/pool.tpl
@@ -36,18 +36,16 @@
- #
{Lang::T('Name Pool')}
{Lang::T('Range IP')}
{Lang::T('Routers')}
{Lang::T('Manage')}
+ ID
- {$no = 1}
{foreach $d as $ds}
- {$no++}
{$ds['pool_name']}
{$ds['range_ip']}
{$ds['routers']}
@@ -57,6 +55,7 @@
onclick="return confirm('{Lang::T('Delete')}?')"
class="btn btn-danger btn-xs">
+ {$ds['id']}
{/foreach}
diff --git a/ui/ui/pppoe.tpl b/ui/ui/pppoe.tpl
index 12399793..fa943491 100644
--- a/ui/ui/pppoe.tpl
+++ b/ui/ui/pppoe.tpl
@@ -43,6 +43,7 @@
{Lang::T('Expired IP Pool')}
{Lang::T('Routers')}
{Lang::T('Manage')}
+ ID
@@ -70,6 +71,7 @@
onclick="return confirm('{Lang::T('Delete')}?')" id="{$ds['id']}"
class="btn btn-danger btn-xs">
+ {$ds['id']}
{/foreach}
diff --git a/ui/ui/radius-nas.tpl b/ui/ui/radius-nas.tpl
index d7c2b4b5..8e103246 100644
--- a/ui/ui/radius-nas.tpl
+++ b/ui/ui/radius-nas.tpl
@@ -31,7 +31,6 @@
- ID
Name
IP
Type
@@ -40,12 +39,12 @@
Community
Routers
{Lang::T('Manage')}
+ ID
{foreach $nas as $ds}
- {$ds['id']}
{$ds['shortname']}
{$ds['nasname']}
{$ds['type']}
@@ -59,6 +58,7 @@
onclick="return confirm('{Lang::T('Delete')}?')"
class="btn btn-danger btn-xs">
+ {$ds['id']}
{/foreach}
diff --git a/ui/ui/routers.tpl b/ui/ui/routers.tpl
index f34d820c..1c605554 100644
--- a/ui/ui/routers.tpl
+++ b/ui/ui/routers.tpl
@@ -31,19 +31,18 @@
- ID
{Lang::T('Router Name')}
{Lang::T('IP Address')}
{Lang::T('Username')}
{Lang::T('Description')}
{Lang::T('Status')}
{Lang::T('Manage')}
+ ID
{foreach $d as $ds}
- {$ds['id']}
{$ds['name']}
{$ds['ip_address']}
{$ds['username']}
@@ -56,6 +55,7 @@
onclick="return confirm('{Lang::T('Delete')}?')"
class="btn btn-danger btn-xs">
+ {$ds['id']}
{/foreach}
diff --git a/ui/ui/sections/header.tpl b/ui/ui/sections/header.tpl
index 8ae2e739..f4400c86 100644
--- a/ui/ui/sections/header.tpl
+++ b/ui/ui/sections/header.tpl
@@ -41,19 +41,11 @@
}
}
- @media only screen and (max-width: 40em) {
- thead th:not(:first-child) {
- display: none;
- }
-
- td,
- th {
- display: block;
- }
-
- td[data-th]:before {
- content: attr(data-th);
- }
+ th:first-child,
+ td:first-child {
+ position: sticky;
+ left: 0px;
+ background-color: #f9f9f9;
}
diff --git a/ui/ui/user-activation-list.tpl b/ui/ui/user-activation-list.tpl
index 035d9afe..448d2361 100644
--- a/ui/ui/user-activation-list.tpl
+++ b/ui/ui/user-activation-list.tpl
@@ -7,7 +7,7 @@
{Lang::T('List Activated Voucher')}
-
+
{Lang::T('Username')}
diff --git a/ui/ui/user-orderHistory.tpl b/ui/ui/user-orderHistory.tpl
index c143cdae..78c87593 100644
--- a/ui/ui/user-orderHistory.tpl
+++ b/ui/ui/user-orderHistory.tpl
@@ -7,7 +7,7 @@
{Lang::T('Order History')}
-
+
{Lang::T('Plan Name')}
diff --git a/ui/ui/user-phone-update.tpl b/ui/ui/user-phone-update.tpl
new file mode 100644
index 00000000..866f2637
--- /dev/null
+++ b/ui/ui/user-phone-update.tpl
@@ -0,0 +1,80 @@
+{include file="sections/user-header.tpl"}
+
+
+
+
+{include file="sections/user-footer.tpl"}
\ No newline at end of file
diff --git a/ui/ui/user-profile.tpl b/ui/ui/user-profile.tpl
index 3f5911a6..c6b5d17c 100644
--- a/ui/ui/user-profile.tpl
+++ b/ui/ui/user-profile.tpl
@@ -34,17 +34,35 @@
-