forked from kevinowino869/mitrobill
@ -172,7 +172,7 @@ class Radius
|
||||
if ($p) {
|
||||
// if exists
|
||||
Radius::delAtribute(Radius::getTableCustomer(), 'Max-All-Session', 'username', $customer['username']);
|
||||
Radius::delAtribute(Radius::getTableCustomer(), 'Max-Data', 'username', $customer['username']);
|
||||
Radius::delAtribute(Radius::getTableCustomer(), 'Max-Volume', 'username', $customer['username']);
|
||||
$p->groupname = "plan_" . $plan['id'];
|
||||
$p->save();
|
||||
} else {
|
||||
@ -194,9 +194,9 @@ class Radius
|
||||
$datalimit = $plan['data_limit'] . "000000000";
|
||||
else
|
||||
$datalimit = $plan['data_limit'] . "000000";
|
||||
//Radius::upsertCustomer($customer['username'], 'Max-Volume', $datalimit);
|
||||
Radius::upsertCustomer($customer['username'], 'Max-Volume', $datalimit);
|
||||
// Mikrotik Spesific
|
||||
Radius::upsertCustomer($customer['username'], 'Max-Data', $datalimit);
|
||||
//Radius::upsertCustomer($customer['username'], 'Max-Data', $datalimit);
|
||||
} else if ($plan['limit_type'] == "Both_Limit") {
|
||||
if ($plan['time_unit'] == 'Hrs')
|
||||
$timelimit = $plan['time_limit'] * 60 * 60;
|
||||
@ -206,10 +206,10 @@ class Radius
|
||||
$datalimit = $plan['data_limit'] . "000000000";
|
||||
else
|
||||
$datalimit = $plan['data_limit'] . "000000";
|
||||
//Radius::upsertCustomer($customer['username'], 'Max-Volume', $datalimit);
|
||||
Radius::upsertCustomer($customer['username'], 'Max-Volume', $datalimit);
|
||||
Radius::upsertCustomer($customer['username'], 'Max-All-Session', $timelimit);
|
||||
// Mikrotik Spesific
|
||||
Radius::upsertCustomer($customer['username'], 'Max-Data', $datalimit);
|
||||
//Radius::upsertCustomer($customer['username'], 'Max-Data', $datalimit);
|
||||
|
||||
|
||||
|
||||
@ -218,9 +218,9 @@ class Radius
|
||||
|
||||
|
||||
} else {
|
||||
//Radius::delAtribute(Radius::getTableCustomer(), 'Max-Volume', 'username', $customer['username']);
|
||||
Radius::delAtribute(Radius::getTableCustomer(), 'Max-Volume', 'username', $customer['username']);
|
||||
Radius::delAtribute(Radius::getTableCustomer(), 'Max-All-Session', 'username', $customer['username']);
|
||||
Radius::delAtribute(Radius::getTableCustomer(), 'Max-Data', 'username', $customer['username']);
|
||||
//Radius::delAtribute(Radius::getTableCustomer(), 'Max-Data', 'username', $customer['username']);
|
||||
}
|
||||
|
||||
Radius::disconnectCustomer($customer['username']);
|
||||
@ -229,8 +229,8 @@ class Radius
|
||||
|
||||
// expired user
|
||||
if ($expired != null) {
|
||||
//Radius::upsertCustomer($customer['username'], 'Max-All-Session', strtotime($expired) - time());
|
||||
Radius::upsertCustomer($customer['username'], 'expiration', date('d M Y H:i:s', strtotime($expired)));
|
||||
Radius::upsertCustomer($customer['username'], 'Max-All-Session', strtotime($expired) - time());
|
||||
//Radius::upsertCustomer($customer['username'], 'expiration', date('d M Y H:i:s', strtotime($expired)));
|
||||
// Mikrotik Spesific
|
||||
Radius::upsertCustomer(
|
||||
$customer['username'],
|
||||
@ -238,8 +238,8 @@ class Radius
|
||||
date('Y-m-d', strtotime($expired)) . 'T' . date('H:i:s', strtotime($expired)) . Timezone::getTimeOffset($config['timezone'])
|
||||
);
|
||||
} else {
|
||||
//Radius::delAtribute(Radius::getTableCustomer(), 'Max-All-Session', 'username', $customer['username']);
|
||||
Radius::delAtribute(Radius::getTableCustomer(), 'expiration', 'username', $customer['username']);
|
||||
Radius::delAtribute(Radius::getTableCustomer(), 'Max-All-Session', 'username', $customer['username']);
|
||||
//Radius::delAtribute(Radius::getTableCustomer(), 'expiration', 'username', $customer['username']);
|
||||
}
|
||||
|
||||
if ($plan['type'] == 'PPPOE') {
|
||||
|
@ -392,6 +392,11 @@ switch ($action) {
|
||||
//post Customers Attributes
|
||||
$custom_field_names = (array) $_POST['custom_field_name'];
|
||||
$custom_field_values = (array) $_POST['custom_field_value'];
|
||||
//additional information
|
||||
$city = _post('city');
|
||||
$district = _post('district');
|
||||
$state = _post('state');
|
||||
$zip = _post('zip');
|
||||
|
||||
run_hook('add_customer'); #HOOK
|
||||
$msg = '';
|
||||
@ -423,6 +428,10 @@ switch ($action) {
|
||||
$d->phonenumber = Lang::phoneFormat($phonenumber);
|
||||
$d->service_type = $service_type;
|
||||
$d->coordinates = $coordinates;
|
||||
$d->city = $city;
|
||||
$d->district = $district;
|
||||
$d->state = $state;
|
||||
$d->zip = $zip;
|
||||
$d->save();
|
||||
|
||||
// Retrieve the customer ID of the newly created customer
|
||||
@ -461,6 +470,11 @@ switch ($action) {
|
||||
$service_type = _post('service_type');
|
||||
$coordinates = _post('coordinates');
|
||||
$status = _post('status');
|
||||
//additional information
|
||||
$city = _post('city');
|
||||
$district = _post('district');
|
||||
$state = _post('state');
|
||||
$zip = _post('zip');
|
||||
run_hook('edit_customer'); #HOOK
|
||||
$msg = '';
|
||||
if (Validator::Length($username, 35, 2) == false) {
|
||||
@ -523,6 +537,10 @@ switch ($action) {
|
||||
$d->phonenumber = $phonenumber;
|
||||
$d->service_type = $service_type;
|
||||
$d->coordinates = $coordinates;
|
||||
$d->city = $city;
|
||||
$d->district = $district;
|
||||
$d->state = $state;
|
||||
$d->zip = $zip;
|
||||
$d->save();
|
||||
|
||||
|
||||
|
@ -5,6 +5,11 @@
|
||||
* by https://t.me/ibnux
|
||||
**/
|
||||
|
||||
$maintenance_mode = $config['maintenance_mode'];
|
||||
if ($maintenance_mode == true){
|
||||
displayMaintenanceMessage();
|
||||
}
|
||||
|
||||
if (User::getID()) {
|
||||
r2(U . 'home');
|
||||
}
|
||||
|
@ -732,12 +732,12 @@ switch ($action) {
|
||||
$suc = 0;
|
||||
$fal = 0;
|
||||
$json = json_decode(file_get_contents($_FILES['json']['tmp_name']), true);
|
||||
try{
|
||||
try {
|
||||
ORM::raw_execute("SET FOREIGN_KEY_CHECKS=0;");
|
||||
} catch (Throwable $e) {
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
try{
|
||||
try {
|
||||
ORM::raw_execute("SET GLOBAL FOREIGN_KEY_CHECKS=0;");
|
||||
} catch (Throwable $e) {
|
||||
} catch (Exception $e) {
|
||||
@ -745,7 +745,7 @@ switch ($action) {
|
||||
foreach ($json as $table => $records) {
|
||||
ORM::raw_execute("TRUNCATE $table;");
|
||||
foreach ($records as $rec) {
|
||||
try{
|
||||
try {
|
||||
$t = ORM::for_table($table)->create();
|
||||
foreach ($rec as $k => $v) {
|
||||
if ($k != 'id') {
|
||||
@ -764,12 +764,12 @@ switch ($action) {
|
||||
}
|
||||
}
|
||||
}
|
||||
try{
|
||||
try {
|
||||
ORM::raw_execute("SET FOREIGN_KEY_CHECKS=1;");
|
||||
} catch (Throwable $e) {
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
try{
|
||||
try {
|
||||
ORM::raw_execute("SET GLOBAL FOREIGN_KEY_CHECKS=1;");
|
||||
} catch (Throwable $e) {
|
||||
} catch (Exception $e) {
|
||||
@ -798,6 +798,40 @@ switch ($action) {
|
||||
r2(U . 'settings/language', 's', Lang::T('Translation saved Successfully'));
|
||||
break;
|
||||
|
||||
case 'maintenance':
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
|
||||
exit;
|
||||
}
|
||||
if (_post('save') == 'save') {
|
||||
$status = isset($_POST['maintenance_mode']) ? 1 : 0; // Checkbox returns 1 if checked, otherwise 0
|
||||
$date = isset($_POST['maintenance_date']) ? $_POST['maintenance_date'] : null;
|
||||
|
||||
$settings = [
|
||||
'maintenance_mode' => $status,
|
||||
'maintenance_date' => $date
|
||||
];
|
||||
|
||||
foreach ($settings as $key => $value) {
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', $key)->find_one();
|
||||
if ($d) {
|
||||
$d->value = $value;
|
||||
$d->save();
|
||||
} else {
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = $key;
|
||||
$d->value = $value;
|
||||
$d->save();
|
||||
}
|
||||
}
|
||||
|
||||
r2(U . "settings/maintenance", 's', Lang::T('Settings Saved Successfully'));
|
||||
}
|
||||
$ui->assign('_c', $config);
|
||||
$ui->assign('_title', Lang::T('Maintenance Mode Settings'));
|
||||
$ui->display('maintenance-mode.tpl');
|
||||
break;
|
||||
|
||||
default:
|
||||
$ui->display('a404.tpl');
|
||||
}
|
||||
|
@ -99,5 +99,8 @@
|
||||
],
|
||||
"2024.5.18" : [
|
||||
"ALTER TABLE `tbl_customers` CHANGE `status` `status` ENUM('Active','Banned','Disabled','Inactive','Limited','Suspended') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'Active';"
|
||||
],
|
||||
"2024.5.20" : [
|
||||
"ALTER TABLE `tbl_customers` ADD `city` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci AFTER `address`, ADD `district` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci AFTER `city`, ADD `state` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci AFTER `district`, ADD `zip` VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci AFTER `state`;"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user