Fix if user Active in dashboard customer and order
This commit is contained in:
parent
3201df263f
commit
ec7dee5c8a
@ -15,13 +15,13 @@ class Radius
|
|||||||
public static function getClient()
|
public static function getClient()
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
if(empty($config['radius_client'])){
|
if (empty($config['radius_client'])) {
|
||||||
if(function_exists("shell_exec")){
|
if (function_exists("shell_exec")) {
|
||||||
shell_exec('which radclient');
|
shell_exec('which radclient');
|
||||||
}else{
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$config['radius_client'];
|
$config['radius_client'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,13 +91,13 @@ class Radius
|
|||||||
public static function planUpSert($plan_id, $rate, $pool = null)
|
public static function planUpSert($plan_id, $rate, $pool = null)
|
||||||
{
|
{
|
||||||
$rates = explode('/', $rate);
|
$rates = explode('/', $rate);
|
||||||
##burst fixed
|
##burst fixed
|
||||||
if (strpos($rate, ' ')) {
|
if (strpos($rate, ' ')) {
|
||||||
$ratos = $rates[0].'/'.$rates[1].' '.$rates[2].'/'.$rates[3].'/'.$rates[4].'/'.$rates[5].'/'.$rates[6];
|
$ratos = $rates[0] . '/' . $rates[1] . ' ' . $rates[2] . '/' . $rates[3] . '/' . $rates[4] . '/' . $rates[5] . '/' . $rates[6];
|
||||||
} else {
|
} else {
|
||||||
$ratos = $rates[0].'/'.$rates[1];
|
$ratos = $rates[0] . '/' . $rates[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
Radius::upsertPackage($plan_id, 'Ascend-Data-Rate', $rates[1], ':=');
|
Radius::upsertPackage($plan_id, 'Ascend-Data-Rate', $rates[1], ':=');
|
||||||
Radius::upsertPackage($plan_id, 'Ascend-Xmit-Rate', $rates[0], ':=');
|
Radius::upsertPackage($plan_id, 'Ascend-Xmit-Rate', $rates[0], ':=');
|
||||||
Radius::upsertPackage($plan_id, 'Mikrotik-Rate-Limit', $ratos, ':=');
|
Radius::upsertPackage($plan_id, 'Mikrotik-Rate-Limit', $ratos, ':=');
|
||||||
@ -171,7 +171,7 @@ class Radius
|
|||||||
$p = Radius::getTableUserPackage()->where_equal('username', $customer['username'])->findOne();
|
$p = Radius::getTableUserPackage()->where_equal('username', $customer['username'])->findOne();
|
||||||
if ($p) {
|
if ($p) {
|
||||||
// if exists
|
// if exists
|
||||||
Radius::delAtribute(Radius::getTableCustomer(), 'Max-All-Session', 'username', $customer['username']);
|
Radius::delAtribute(Radius::getTableCustomer(), 'Max-All-Session', 'username', $customer['username']);
|
||||||
Radius::delAtribute(Radius::getTableCustomer(), 'Max-Volume', 'username', $customer['username']);
|
Radius::delAtribute(Radius::getTableCustomer(), 'Max-Volume', 'username', $customer['username']);
|
||||||
$p->groupname = "plan_" . $plan['id'];
|
$p->groupname = "plan_" . $plan['id'];
|
||||||
$p->save();
|
$p->save();
|
||||||
@ -210,23 +210,21 @@ class Radius
|
|||||||
Radius::upsertCustomer($customer['username'], 'Max-All-Session', $timelimit);
|
Radius::upsertCustomer($customer['username'], 'Max-All-Session', $timelimit);
|
||||||
// Mikrotik Spesific
|
// Mikrotik Spesific
|
||||||
//Radius::upsertCustomer($customer['username'], 'Max-Data', $datalimit);
|
//Radius::upsertCustomer($customer['username'], 'Max-Data', $datalimit);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} 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-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']);
|
Radius::disconnectCustomer($customer['username']);
|
||||||
Radius::getTableAcct()->where_equal('username', $customer['username'])->delete_many();
|
Radius::getTableAcct()->where_equal('username', $customer['username'])->delete_many();
|
||||||
|
|
||||||
|
|
||||||
// expired user
|
// expired user
|
||||||
if ($expired != null) {
|
if ($expired != null) {
|
||||||
Radius::upsertCustomer($customer['username'], 'Max-All-Session', strtotime($expired) - time());
|
Radius::upsertCustomer($customer['username'], 'Max-All-Session', strtotime($expired) - time());
|
||||||
@ -245,8 +243,8 @@ class Radius
|
|||||||
if ($plan['type'] == 'PPPOE') {
|
if ($plan['type'] == 'PPPOE') {
|
||||||
Radius::upsertCustomerAttr($customer['username'], 'Framed-Pool', $plan['pool'], ':=');
|
Radius::upsertCustomerAttr($customer['username'], 'Framed-Pool', $plan['pool'], ':=');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -326,10 +324,10 @@ class Radius
|
|||||||
if ($_app_stage == 'demo') {
|
if ($_app_stage == 'demo') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Fix loop to all Nas but still detecting Hotspot Multylogin from other Nas
|
* Fix loop to all Nas but still detecting Hotspot Multylogin from other Nas
|
||||||
*/
|
*/
|
||||||
$act = ORM::for_table('radacct')->where_raw("acctstoptime IS NULL")->where('username', $username)->find_one();
|
$act = ORM::for_table('radacct')->where_raw("acctstoptime IS NULL")->where('username', $username)->find_one();
|
||||||
$nas = Radius::getTableNas()->where('nasname', $act['nasipaddress'])->find_many();
|
$nas = Radius::getTableNas()->where('nasname', $act['nasipaddress'])->find_many();
|
||||||
$count = count($nas) * 15;
|
$count = count($nas) * 15;
|
||||||
set_time_limit($count);
|
set_time_limit($count);
|
||||||
|
@ -161,8 +161,8 @@ class User
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
if ($config['maintenance_mode'] == true) {
|
if ($config['maintenance_mode'] == true) {
|
||||||
displayMaintenanceMessage();
|
displayMaintenanceMessage();
|
||||||
// r2(U . 'logout', 'd', '');
|
// r2(U . 'logout', 'd', '');
|
||||||
}
|
}
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
$id = User::getID();
|
$id = User::getID();
|
||||||
|
@ -18,7 +18,7 @@ if (isset($_GET['renewal'])) {
|
|||||||
|
|
||||||
if (_post('send') == 'balance') {
|
if (_post('send') == 'balance') {
|
||||||
if ($config['enable_balance'] == 'yes' && $config['allow_balance_transfer'] == 'yes') {
|
if ($config['enable_balance'] == 'yes' && $config['allow_balance_transfer'] == 'yes') {
|
||||||
if ($user['status'] == 'Active') {
|
if ($user['status'] != 'Active') {
|
||||||
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
|
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
|
||||||
}
|
}
|
||||||
$target = ORM::for_table('tbl_customers')->where('username', _post('username'))->find_one();
|
$target = ORM::for_table('tbl_customers')->where('username', _post('username'))->find_one();
|
||||||
@ -80,7 +80,7 @@ if (_post('send') == 'balance') {
|
|||||||
r2(U . 'home', 'd', Lang::T('Failed, balance is not available'));
|
r2(U . 'home', 'd', Lang::T('Failed, balance is not available'));
|
||||||
}
|
}
|
||||||
} else if (_post('send') == 'plan') {
|
} else if (_post('send') == 'plan') {
|
||||||
if ($user['status'] == 'Active') {
|
if ($user['status'] != 'Active') {
|
||||||
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
|
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
|
||||||
}
|
}
|
||||||
$actives = ORM::for_table('tbl_user_recharges')
|
$actives = ORM::for_table('tbl_user_recharges')
|
||||||
@ -98,7 +98,7 @@ if (_post('send') == 'balance') {
|
|||||||
$ui->assign('_bills', User::_billing());
|
$ui->assign('_bills', User::_billing());
|
||||||
|
|
||||||
if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
|
if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
|
||||||
if ($user['status'] == 'Active') {
|
if ($user['status'] != 'Active') {
|
||||||
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
|
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
|
||||||
}
|
}
|
||||||
if (!empty(App::getTokenValue(_get('stoken')))) {
|
if (!empty(App::getTokenValue(_get('stoken')))) {
|
||||||
@ -128,7 +128,7 @@ if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!empty(_get('extend'))) {
|
} else if (!empty(_get('extend'))) {
|
||||||
if ($user['status'] == 'Active') {
|
if ($user['status'] != 'Active') {
|
||||||
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
|
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
|
||||||
}
|
}
|
||||||
if (!$config['extend_expired']) {
|
if (!$config['extend_expired']) {
|
||||||
|
@ -148,6 +148,9 @@ switch ($action) {
|
|||||||
r2(U . "voucher/invoice/");
|
r2(U . "voucher/invoice/");
|
||||||
die();
|
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']);
|
$plan = ORM::for_table('tbl_plans')->where('enabled', '1')->find_one($routes['3']);
|
||||||
if (empty($plan)) {
|
if (empty($plan)) {
|
||||||
r2(U . "order/package", 'e', Lang::T("Plan Not found"));
|
r2(U . "order/package", 'e', Lang::T("Plan Not found"));
|
||||||
@ -202,6 +205,9 @@ switch ($action) {
|
|||||||
if ($config['enable_balance'] != 'yes') {
|
if ($config['enable_balance'] != 'yes') {
|
||||||
r2(U . "order/package", 'e', Lang::T("Balance not enabled"));
|
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('_title', Lang::T('Buy for friend'));
|
||||||
$ui->assign('_system_menu', 'package');
|
$ui->assign('_system_menu', 'package');
|
||||||
$plan = ORM::for_table('tbl_plans')->find_one($routes['3']);
|
$plan = ORM::for_table('tbl_plans')->find_one($routes['3']);
|
||||||
@ -372,6 +378,9 @@ switch ($action) {
|
|||||||
} else if (!empty($gateway)) {
|
} else if (!empty($gateway)) {
|
||||||
$_SESSION['gateway'] = $gateway;
|
$_SESSION['gateway'] = $gateway;
|
||||||
}
|
}
|
||||||
|
if ($user['status'] != 'Active') {
|
||||||
|
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
|
||||||
|
}
|
||||||
if (empty($gateway)) {
|
if (empty($gateway)) {
|
||||||
r2(U . 'order/gateway/' . $routes[2] . '/' . $routes[3], 'w', Lang::T("Please select Payment Gateway"));
|
r2(U . 'order/gateway/' . $routes[2] . '/' . $routes[3], 'w', Lang::T("Please select Payment Gateway"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user