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

@ -127,7 +127,7 @@ class Lang
if (!$full)
$string = array_slice($string, 0, 1);
return $string ? implode(', ', $string) . ' ago' : 'just now';
return $string ? implode(', ', $string) .' '. Lang::T('ago') : Lang::T('just now');
}
public static function nl2br($text)

View File

@ -175,7 +175,7 @@ class Package
};
$time = date("23:59:00");
} else if ($p['validity_unit'] == 'Days') {
$datetime = date("Y-m-d H:i:s", strtotime('+' . $p['validity'] . ' day'));
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime('+' . $p['validity'] . ' day')));
$date_exp = $datetime[0];
$time = $datetime[1];
} else if ($p['validity_unit'] == 'Hrs') {

View File

@ -92,7 +92,7 @@ class Radius
{
$rates = explode('/', $rate);
##burst fixed
if (str_contains($rate, ' ')) {
if (strpos($rate, ' ')) {
$ratos = $rates[0].'/'.$rates[1].' '.$rates[2].'/'.$rates[3].'/'.$rates[4].'/'.$rates[5].'/'.$rates[6];
} else {
$ratos = $rates[0].'/'.$rates[1];

View File

@ -74,7 +74,7 @@ class User
list($cost, $rem) = explode(":", $v);
// :0 installment is done
if ($rem != 0) {
User::setAttribute($k, "$cost:".($rem - 1), $id);
User::setAttribute($k, "$cost:" . ($rem - 1), $id);
}
}
}
@ -177,21 +177,13 @@ class User
}
$d = ORM::for_table('tbl_user_recharges')
->select('tbl_user_recharges.id', 'id')
->select('customer_id')
->select('username')
->select('plan_id')
->select('namebp')
->select('recharged_on')
->select('recharged_time')
->select('expiration')
->select('time')
->select('status')
->select('method')
->select('plan_type')
->select('tbl_user_recharges.routers', 'routers')
->select('tbl_user_recharges.type', 'type')
->select('admin_id')
->select('prepaid')
->selects([
'customer_id', 'username', 'plan_id', 'namebp', 'recharged_on', 'recharged_time', 'expiration', 'time',
'status', 'method', 'plan_type',
['tbl_user_recharges.routers', 'routers'],
['tbl_user_recharges.type', 'type'],
'admin_id', 'prepaid'
])
->where('customer_id', $id)
->join('tbl_plans', array('tbl_plans.id', '=', 'tbl_user_recharges.plan_id'))
->find_many();

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 {

View File

@ -577,5 +577,9 @@
"Extend_Days": "Extend Days",
"Confirmation_Message": "Confirmation Message",
"You_are_already_logged_in": "You are already logged in",
"Extend": "Extend"
"Extend": "Extend",
"Created___Expired": "Created \/ Expired",
"Bank_Transfer": "Bank Transfer",
"Recharge_Using": "Recharge Using",
"ago": "ago"
}

File diff suppressed because it is too large Load Diff