From c740820731db388ab88a9750113f1cea14093701 Mon Sep 17 00:00:00 2001
From: iBNu Maksum
Date: Thu, 31 Oct 2024 13:15:36 +0700
Subject: [PATCH] Delete extend_expiry settings
---
system/autoload/Package.php | 44 ++++++++++++++++++-------------------
system/devices/Radius.php | 13 +++++------
system/lan/indonesia.json | 5 ++++-
ui/ui/app-miscellaneous.tpl | 13 -----------
4 files changed, 31 insertions(+), 44 deletions(-)
diff --git a/system/autoload/Package.php b/system/autoload/Package.php
index 5b4add48..a1e85c23 100644
--- a/system/autoload/Package.php
+++ b/system/autoload/Package.php
@@ -172,30 +172,28 @@ class Package
if ($b) {
$lastExpired = Lang::dateAndTimeFormat($b['expiration'], $b['time']);
$isChangePlan = false;
- if ($config['extend_expiry'] != 'no') {
- if ($b['namebp'] == $p['name_plan'] && $b['status'] == 'on') {
- // if it same internet plan, expired will extend
- 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-$day_exp", 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'];
- } else if ($p['validity_unit'] == 'Hrs') {
- $datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' hours')));
- $date_exp = $datetime[0];
- $time = $datetime[1];
- } else if ($p['validity_unit'] == 'Mins') {
- $datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' minutes')));
- $date_exp = $datetime[0];
- $time = $datetime[1];
- }
- } else {
- $isChangePlan = true;
+ if ($b['namebp'] == $p['name_plan'] && $b['status'] == 'on') {
+ // if it same internet plan, expired will extend
+ 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-$day_exp", 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'];
+ } else if ($p['validity_unit'] == 'Hrs') {
+ $datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' hours')));
+ $date_exp = $datetime[0];
+ $time = $datetime[1];
+ } else if ($p['validity_unit'] == 'Mins') {
+ $datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' minutes')));
+ $date_exp = $datetime[0];
+ $time = $datetime[1];
}
+ } else {
+ $isChangePlan = true;
}
//if ($b['status'] == 'on') {
diff --git a/system/devices/Radius.php b/system/devices/Radius.php
index 634ba2da..2ee9afe0 100644
--- a/system/devices/Radius.php
+++ b/system/devices/Radius.php
@@ -341,12 +341,11 @@ class Radius
// expired user
if ($expired != '') {
//extend session time only if the plan are the same
- if ($plan['plan_id'] == $p['plan_id'] && $config['extend_expiry'] != 'no') {
- // session timeout [it reset everyday, am still making my research] we can use it for something like 1H/Day - since it reset daily, and Max-All-Session clear everything
- //$this->upsertCustomer($customer['username'], 'Session-Timeout', 3600); // 3600 = 1 hour
- $this->upsertCustomer($customer['username'], 'Max-All-Session', strtotime($expired) - time());
- $this->upsertCustomer($customer['username'], 'Expiration', date('d M Y H:i:s', strtotime($expired)));
- }
+ // session timeout [it reset everyday, am still making my research] we can use it for something like 1H/Day - since it reset daily, and Max-All-Session clear everything
+ //$this->upsertCustomer($customer['username'], 'Session-Timeout', 3600); // 3600 = 1 hour
+ $this->upsertCustomer($customer['username'], 'Max-All-Session', strtotime($expired) - time());
+ $this->upsertCustomer($customer['username'], 'Expiration', date('d M Y H:i:s', strtotime($expired)));
+
// Mikrotik Spesific
$this->upsertCustomer(
$customer['username'],
@@ -372,7 +371,7 @@ class Radius
$this->upsertCustomerAttr($customer['username'], 'Framed-IP-Address', '0.0.0.0', ':=');
$this->upsertCustomerAttr($customer['username'], 'Framed-IP-Netmask', '255.255.255.0', ':=');
}
- }
+ }
return true;
diff --git a/system/lan/indonesia.json b/system/lan/indonesia.json
index 8df693d4..a1aa10e9 100644
--- a/system/lan/indonesia.json
+++ b/system/lan/indonesia.json
@@ -762,5 +762,8 @@
"just_now": "baru saja",
"Face_Detection": "Deteksi Wajah",
"Password_should_be_minimum_6_characters": "Kata sandi minimal harus 6 karakter",
- "Username_should_be_between_3_to_45_characters": "Nama pengguna harus terdiri dari 3 hingga 45 karakter"
+ "Username_should_be_between_3_to_45_characters": "Nama pengguna harus terdiri dari 3 hingga 45 karakter",
+ "Single_session_Admin": "Sesi Tunggal Admin",
+ "Admin_can_only_have_single_session_login__it_will_logout_another_session": "Admin hanya dapat memiliki login satu sesi, maka akan keluar dari sesi berikutnya",
+ "For_Registration_and_Update_Phone_Number": "Untuk Registrasi dan Update Nomor Telepon"
}
\ No newline at end of file
diff --git a/ui/ui/app-miscellaneous.tpl b/ui/ui/app-miscellaneous.tpl
index 826fcd8f..66cf88fd 100644
--- a/ui/ui/app-miscellaneous.tpl
+++ b/ui/ui/app-miscellaneous.tpl
@@ -130,19 +130,6 @@
{Lang::T('OTP is required when user want to change Email Address')}
-