Merge branch 'Development' of https://github.com/Focuslinkstech/phpnuxbill into Development

This commit is contained in:
Focuslinkstech
2024-05-17 09:52:20 +01:00
parent cd34a68cf3
commit 67a4d7f534
20 changed files with 2929 additions and 2618 deletions

View File

@ -184,13 +184,18 @@ switch ($action) {
$zero = 1;
$gateway = 'Recharge Zero';
}
$usings = explode(',', $config['payment_usings']);
$usings = array_filter(array_unique($usings));
if(count($usings)==0){
$usings[] = Lang::T('Cash');
}
$ui->assign('usings', $usings);
$ui->assign('bills', $bills);
$ui->assign('add_cost', $add_cost);
$ui->assign('cust', $cust);
$ui->assign('gateway', $gateway);
$ui->assign('channel', $channel);
$ui->assign('server', $b['routers']);
$ui->assign('using', 'cash');
$ui->assign('plan', $plan);
$ui->display('recharge-confirm.tpl');
} else {

View File

@ -9,6 +9,17 @@ _admin();
$ui->assign('_title', Lang::T('Dashboard'));
$ui->assign('_admin', $admin);
if(isset($_GET['refresh'])){
$files = scandir($CACHE_PATH);
foreach ($files as $file) {
$ext = pathinfo($file, PATHINFO_EXTENSION);
if (is_file($CACHE_PATH . DIRECTORY_SEPARATOR . $file) && $ext == 'temp') {
unlink($CACHE_PATH . DIRECTORY_SEPARATOR . $file);
}
}
r2(U . 'dashboard', 's', 'Data Refreshed');
}
$fdate = date('Y-m-01');
$tdate = date('Y-m-t');
//first day of month

View File

@ -68,6 +68,12 @@ switch ($action) {
if (isset($routes['2']) && !empty($routes['2'])) {
$ui->assign('cust', ORM::for_table('tbl_customers')->find_one($routes['2']));
}
$usings = explode(',', $config['payment_usings']);
$usings = array_filter(array_unique($usings));
if(count($usings)==0){
$usings[] = Lang::T('Cash');
}
$ui->assign('usings', $usings);
run_hook('view_recharge'); #HOOK
$ui->display('recharge.tpl');
break;
@ -108,6 +114,12 @@ switch ($action) {
$zero = 1;
$gateway = 'Recharge Zero';
}
$usings = explode(',', $config['payment_usings']);
$usings = array_filter(array_unique($usings));
if(count($usings)==0){
$usings[] = Lang::T('Cash');
}
$ui->assign('usings', $usings);
$ui->assign('bills', $bills);
$ui->assign('add_cost', $add_cost);
$ui->assign('cust', $cust);
@ -146,7 +158,7 @@ switch ($action) {
}
if ($msg == '') {
$gateway = 'Recharge';
$gateway = ucwords($using);
$channel = $admin['fullname'];
$cust = User::_info($id_customer);
list($bills, $add_cost) = User::getBills($id_customer);

View File

@ -38,7 +38,7 @@ switch ($action) {
} else {
$radup = '000000';
}
$radiusRate = $plan['rate_up'] . $radup . '/' . $plan['rate_down'] . $raddown . '/' . $b['burst'];
$radiusRate = $plan['rate_up'] . $radup . '/' . $plan['rate_down'] . $raddown . '/' . $plan['burst'];
Radius::planUpSert($plan['id'], $radiusRate);
$log .= "DONE : Radius $plan[name_plan], $plan[shared_users], $radiusRate<br>";
} else {
@ -83,7 +83,7 @@ switch ($action) {
} else {
$radup = '000000';
}
$radiusRate = $plan['rate_up'] . $radup . '/' . $plan['rate_down'] . $raddown . '/' . $b['burst'];
$radiusRate = $plan['rate_up'] . $radup . '/' . $plan['rate_down'] . $raddown . '/' . $plan['burst'];
Radius::planUpSert($plan['id'], $radiusRate, $plan['pool']);
$log .= "DONE : RADIUS $plan[name_plan], $plan[pool], $rate<br>";
} else {

View File

@ -732,22 +732,48 @@ switch ($action) {
$suc = 0;
$fal = 0;
$json = json_decode(file_get_contents($_FILES['json']['tmp_name']), true);
try{
ORM::raw_execute("SET FOREIGN_KEY_CHECKS=0;");
} catch (Throwable $e) {
} catch (Exception $e) {
}
try{
ORM::raw_execute("SET GLOBAL FOREIGN_KEY_CHECKS=0;");
} catch (Throwable $e) {
} catch (Exception $e) {
}
foreach ($json as $table => $records) {
ORM::raw_execute("TRUNCATE $table;");
foreach ($records as $rec) {
$t = ORM::for_table($table)->create();
foreach ($rec as $k => $v) {
if ($k != 'id') {
$t->set($k, $v);
try{
$t = ORM::for_table($table)->create();
foreach ($rec as $k => $v) {
if ($k != 'id') {
$t->set($k, $v);
}
}
}
if ($t->save()) {
$suc++;
} else {
if ($t->save()) {
$suc++;
} else {
$fal++;
}
} catch (Throwable $e) {
$fal++;
} catch (Exception $e) {
$fal++;
}
}
}
try{
ORM::raw_execute("SET FOREIGN_KEY_CHECKS=1;");
} catch (Throwable $e) {
} catch (Exception $e) {
}
try{
ORM::raw_execute("SET GLOBAL FOREIGN_KEY_CHECKS=1;");
} catch (Throwable $e) {
} catch (Exception $e) {
}
if (file_exists($_FILES['json']['tmp_name'])) unlink($_FILES['json']['tmp_name']);
r2(U . "settings/dbstatus", 's', "Restored $suc success $fal failed");
} else {