forked from kevinowino869/mitrobill
Merge branch 'Development' of https://github.com/Focuslinkstech/phpnuxbill into Development
This commit is contained in:
@ -34,6 +34,10 @@ class Package
|
||||
$c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
|
||||
$p = ORM::for_table('tbl_plans')->where('id', $plan_id)->find_one();
|
||||
|
||||
if($c['status'] != 'Active'){
|
||||
_alert(Lang::T('This account status').' : '.Lang::T($c['status']),'danger', "");
|
||||
}
|
||||
|
||||
$add_cost = 0;
|
||||
$bills = [];
|
||||
// Zero cost recharge
|
||||
|
@ -163,7 +163,9 @@ class User
|
||||
$id = User::getID();
|
||||
}
|
||||
$d = ORM::for_table('tbl_customers')->find_one($id);
|
||||
|
||||
if ($d['status'] != 'Banned') {
|
||||
_alert(Lang::T('This account status') . ' : ' . Lang::T($d['status']), 'danger', "logout");
|
||||
}
|
||||
if (empty($d['username'])) {
|
||||
r2(U . 'logout', 'd', '');
|
||||
}
|
||||
|
@ -459,6 +459,7 @@ switch ($action) {
|
||||
$phonenumber = Lang::phoneFormat(_post('phonenumber'));
|
||||
$service_type = _post('service_type');
|
||||
$coordinates = _post('coordinates');
|
||||
$status = _post('status');
|
||||
run_hook('edit_customer'); #HOOK
|
||||
$msg = '';
|
||||
if (Validator::Length($username, 35, 2) == false) {
|
||||
@ -517,6 +518,7 @@ switch ($action) {
|
||||
$d->email = $email;
|
||||
$d->account_type = $account_type;
|
||||
$d->address = $address;
|
||||
$d->status = $status;
|
||||
$d->phonenumber = $phonenumber;
|
||||
$d->service_type = $service_type;
|
||||
$d->coordinates = $coordinates;
|
||||
@ -606,19 +608,33 @@ switch ($action) {
|
||||
default:
|
||||
run_hook('list_customers'); #HOOK
|
||||
$search = _post('search');
|
||||
$order = _post('order', 'username');
|
||||
$orderby = _post('orderby', 'asc');
|
||||
$order_pos = [
|
||||
'username' => 0,
|
||||
'created_at' => 8,
|
||||
'balance' => 3
|
||||
];
|
||||
|
||||
if ($search != '') {
|
||||
$query = ORM::for_table('tbl_customers')
|
||||
->whereRaw("username LIKE '%$search%' OR fullname LIKE '%$search%' OR address LIKE '%$search%' ".
|
||||
"OR phonenumber LIKE '%$search%' OR email LIKE '%$search%' ")
|
||||
->order_by_asc('username');
|
||||
$d = $query->findMany();
|
||||
"OR phonenumber LIKE '%$search%' OR email LIKE '%$search%' ");
|
||||
} else {
|
||||
$query = ORM::for_table('tbl_customers')->order_by_asc('username');
|
||||
$query = ORM::for_table('tbl_customers');
|
||||
}
|
||||
if($orderby=='asc'){
|
||||
$query->order_by_asc($order);
|
||||
}else{
|
||||
$query->order_by_desc($order);
|
||||
}
|
||||
$d = $query->findMany();
|
||||
$ui->assign('xheader', '<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/jquery.dataTables.min.css">');
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('search', $search);
|
||||
$ui->assign('order', $order);
|
||||
$ui->assign('order_pos', $order_pos[$order]);
|
||||
$ui->assign('orderby', $orderby);
|
||||
$ui->display('customers.tpl');
|
||||
break;
|
||||
}
|
||||
|
@ -18,6 +18,9 @@ if (isset($_GET['renewal'])) {
|
||||
|
||||
if (_post('send') == 'balance') {
|
||||
if ($config['enable_balance'] == 'yes' && $config['allow_balance_transfer'] == 'yes') {
|
||||
if ($user['status'] != 'Active') {
|
||||
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
|
||||
}
|
||||
$target = ORM::for_table('tbl_customers')->where('username', _post('username'))->find_one();
|
||||
if (!$target) {
|
||||
r2(U . 'home', 'd', Lang::T('Username not found'));
|
||||
@ -77,6 +80,9 @@ if (_post('send') == 'balance') {
|
||||
r2(U . 'home', 'd', Lang::T('Failed, balance is not available'));
|
||||
}
|
||||
} else if (_post('send') == 'plan') {
|
||||
if ($user['status'] != 'Active') {
|
||||
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
|
||||
}
|
||||
$actives = ORM::for_table('tbl_user_recharges')
|
||||
->where('username', _post('username'))
|
||||
->find_many();
|
||||
@ -92,6 +98,9 @@ if (_post('send') == 'balance') {
|
||||
$ui->assign('_bills', User::_billing());
|
||||
|
||||
if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
|
||||
if ($user['status'] != 'Active') {
|
||||
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
|
||||
}
|
||||
if (!empty(App::getTokenValue(_get('stoken')))) {
|
||||
r2(U . "voucher/invoice/");
|
||||
die();
|
||||
@ -119,7 +128,10 @@ if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
|
||||
}
|
||||
}
|
||||
} else if (!empty(_get('extend'))) {
|
||||
if(!$config['extend_expired']){
|
||||
if ($user['status'] != 'Active') {
|
||||
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
|
||||
}
|
||||
if (!$config['extend_expired']) {
|
||||
r2(U . 'home', 'e', "cannot extend");
|
||||
}
|
||||
if (!empty(App::getTokenValue(_get('stoken')))) {
|
||||
@ -130,7 +142,7 @@ if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
|
||||
if ($tur) {
|
||||
$m = date("m");
|
||||
$path = $CACHE_PATH . DIRECTORY_SEPARATOR . "extends" . DIRECTORY_SEPARATOR;
|
||||
if(!file_exists($path)){
|
||||
if (!file_exists($path)) {
|
||||
mkdir($path);
|
||||
}
|
||||
$path .= $user['id'] . ".txt";
|
||||
@ -148,7 +160,7 @@ if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
|
||||
$router = $tur['routers'];
|
||||
}
|
||||
$p = ORM::for_table('tbl_plans')->findOne($tur['plan_id']);
|
||||
if(!$p){
|
||||
if (!$p) {
|
||||
r2(U . 'home', '3', "Plan Not Found");
|
||||
}
|
||||
if ($tur['routers'] == 'radius') {
|
||||
@ -171,12 +183,12 @@ if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
|
||||
App::setToken(_get('stoken'), $id);
|
||||
file_put_contents($path, $m);
|
||||
_log("Customer $tur[customer_id] $tur[username] extend for $days days", "Customer", $user['id']);
|
||||
Message::sendTelegram("#u$user[username] #extend #".$p['type']." \n" . $p['name_plan'] .
|
||||
"\nLocation: " . $p['routers'] .
|
||||
"\nCustomer: " . $user['fullname'] .
|
||||
"\nNew Expired: " . Lang::dateAndTimeFormat($expiration, $tur['time']));
|
||||
Message::sendTelegram("#u$user[username] #extend #" . $p['type'] . " \n" . $p['name_plan'] .
|
||||
"\nLocation: " . $p['routers'] .
|
||||
"\nCustomer: " . $user['fullname'] .
|
||||
"\nNew Expired: " . Lang::dateAndTimeFormat($expiration, $tur['time']));
|
||||
r2(U . 'home', 's', "Extend until $expiration");
|
||||
}else{
|
||||
} else {
|
||||
r2(U . 'home', 'e', "Plan is not expired");
|
||||
}
|
||||
} else {
|
||||
|
@ -5,8 +5,8 @@
|
||||
* by https://t.me/ibnux
|
||||
**/
|
||||
|
||||
if(User::getID()){
|
||||
r2(U.'home');
|
||||
if (User::getID()) {
|
||||
r2(U . 'home');
|
||||
}
|
||||
|
||||
if (isset($routes['1'])) {
|
||||
@ -24,13 +24,16 @@ switch ($do) {
|
||||
$d = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
|
||||
if ($d) {
|
||||
$d_pass = $d['password'];
|
||||
if ($d['status'] != 'Banned') {
|
||||
_alert(Lang::T('This account status') . ' : ' . Lang::T($d['status']), 'danger', "");
|
||||
}
|
||||
if (Password::_uverify($password, $d_pass) == true) {
|
||||
$_SESSION['uid'] = $d['id'];
|
||||
User::setCookie($d['id']);
|
||||
$d->last_login = date('Y-m-d H:i:s');
|
||||
$d->save();
|
||||
_log($username . ' ' . Lang::T('Login Successful'), 'User', $d['id']);
|
||||
_alert(Lang::T('Login Successful'),'success', "home");
|
||||
_alert(Lang::T('Login Successful'), 'success', "home");
|
||||
} else {
|
||||
_msglog('e', Lang::T('Invalid Username or Password'));
|
||||
_log($username . ' ' . Lang::T('Failed Login'), 'User');
|
||||
@ -68,7 +71,7 @@ switch ($do) {
|
||||
r2(U . 'login', 'e', Lang::T('Voucher activation failed'));
|
||||
}
|
||||
} else {
|
||||
_alert(Lang::T('Login Successful'),'success', "dashboard");
|
||||
_alert(Lang::T('Login Successful'), 'success', "dashboard");
|
||||
r2(U . 'login', 'e', Lang::T('Voucher activation failed') . '.');
|
||||
}
|
||||
}
|
||||
|
@ -148,6 +148,9 @@ switch ($action) {
|
||||
r2(U . "voucher/invoice/");
|
||||
die();
|
||||
}
|
||||
if($user['status'] != 'Active'){
|
||||
_alert(Lang::T('This account status').' : '.Lang::T($user['status']),'danger', "");
|
||||
}
|
||||
$plan = ORM::for_table('tbl_plans')->where('enabled', '1')->find_one($routes['3']);
|
||||
if (empty($plan)) {
|
||||
r2(U . "order/package", 'e', Lang::T("Plan Not found"));
|
||||
@ -181,6 +184,9 @@ switch ($action) {
|
||||
if ($config['enable_balance'] != 'yes') {
|
||||
r2(U . "order/package", 'e', Lang::T("Balance not enabled"));
|
||||
}
|
||||
if($user['status'] != 'Active'){
|
||||
_alert(Lang::T('This account status').' : '.Lang::T($user['status']),'danger', "");
|
||||
}
|
||||
$ui->assign('_title', Lang::T('Buy for friend'));
|
||||
$ui->assign('_system_menu', 'package');
|
||||
$plan = ORM::for_table('tbl_plans')->find_one($routes['3']);
|
||||
@ -322,6 +328,9 @@ switch ($action) {
|
||||
} else if (!empty($gateway)) {
|
||||
$_SESSION['gateway'] = $gateway;
|
||||
}
|
||||
if($user['status'] != 'Active'){
|
||||
_alert(Lang::T('This account status').' : '.Lang::T($user['status']),'danger', "");
|
||||
}
|
||||
if (empty($gateway)) {
|
||||
r2(U . 'order/gateway/' . $routes[2] . '/' . $routes[3], 'w', Lang::T("Please select Payment Gateway"));
|
||||
}
|
||||
|
@ -581,5 +581,13 @@
|
||||
"Created___Expired": "Created \/ Expired",
|
||||
"Bank_Transfer": "Bank Transfer",
|
||||
"Recharge_Using": "Recharge Using",
|
||||
"ago": "ago"
|
||||
"ago": "ago",
|
||||
"Disabled": "Disabled",
|
||||
"Banned": "Banned",
|
||||
"Customer_cannot_login_again": "Customer cannot login again",
|
||||
"Customer_can_login_but_cannot_buy_internet_plan__Admin_cannot_recharge_customer": "Customer can login but cannot buy internet plan, Admin cannot recharge customer",
|
||||
"Don_t_forget_to_deactivate_all_active_plan_too": "Don't forget to deactivate all active plan too",
|
||||
"Ascending": "Ascending",
|
||||
"Descending": "Descending",
|
||||
"Created_Date": "Created Date"
|
||||
}
|
@ -93,5 +93,8 @@
|
||||
],
|
||||
"2024.4.5" : [
|
||||
"ALTER TABLE `tbl_payment_gateway` ADD `trx_invoice` VARCHAR(25) NOT NULL DEFAULT '' COMMENT 'from tbl_transactions' AFTER `paid_date`;"
|
||||
],
|
||||
"2024.5.17" : [
|
||||
"ALTER TABLE `tbl_customers` ADD `status` ENUM('Active','Banned','Disabled') NOT NULL DEFAULT 'Active' AFTER `auto_renewal`;"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user