forked from kevinowino869/mitrobill
UserType 'SuperAdmin','Admin','Report','Agent','Sales'
This commit is contained in:
@ -25,11 +25,11 @@ switch ($do) {
|
||||
Admin::setCookie($d['id']);
|
||||
$d->last_login = date('Y-m-d H:i:s');
|
||||
$d->save();
|
||||
_log($username . ' ' . $_L['Login_Successful'], 'Admin', $d['id']);
|
||||
_log($username . ' ' . $_L['Login_Successful'], $d['user_type'], $d['id']);
|
||||
r2(U . 'dashboard');
|
||||
} else {
|
||||
_msglog('e', $_L['Invalid_Username_or_Password']);
|
||||
_log($username . ' ' . $_L['Failed_Login'], 'Admin');
|
||||
_log($username . ' ' . $_L['Failed_Login'], $d['user_type']);
|
||||
r2(U . 'admin');
|
||||
}
|
||||
} else {
|
||||
|
@ -12,7 +12,7 @@ $action = $routes['1'];
|
||||
$admin = Admin::_info();
|
||||
$ui->assign('_admin', $admin);
|
||||
|
||||
if($admin['user_type'] != 'Admin' AND $admin['user_type'] != 'Sales'){
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U."dashboard",'e',$_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ $admin = Admin::_info();
|
||||
$ui->assign('_admin', $admin);
|
||||
$cache = File::pathFixer('system/cache/codecanyon.json');
|
||||
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
if (empty($config['envato_token'])) {
|
||||
|
@ -14,7 +14,7 @@ $admin = Admin::_info();
|
||||
$ui->assign('_admin', $admin);
|
||||
|
||||
|
||||
if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
@ -50,8 +50,8 @@ switch ($action) {
|
||||
|
||||
case 'csv':
|
||||
$cs = ORM::for_table('tbl_customers')
|
||||
->select('tbl_customers.id','id')
|
||||
->select('tbl_customers.username','username')
|
||||
->select('tbl_customers.id', 'id')
|
||||
->select('tbl_customers.username', 'username')
|
||||
->select('fullname')
|
||||
->select('phonenumber')
|
||||
->select('email')
|
||||
@ -59,7 +59,7 @@ switch ($action) {
|
||||
->select('namebp')
|
||||
->select('routers')
|
||||
->select('status')
|
||||
->select('method','Payment')
|
||||
->select('method', 'Payment')
|
||||
->join('tbl_user_recharges', array('tbl_customers.id', '=', 'tbl_user_recharges.customer_id'))
|
||||
->order_by_asc('tbl_customers.id')->find_array();
|
||||
$h = false;
|
||||
@ -77,11 +77,11 @@ switch ($action) {
|
||||
$ks[] = $k;
|
||||
$vs[] = $v;
|
||||
}
|
||||
if(!$h){
|
||||
echo '"'.implode('";"', $ks)."\"\n";
|
||||
if (!$h) {
|
||||
echo '"' . implode('";"', $ks) . "\"\n";
|
||||
$h = true;
|
||||
}
|
||||
echo '"'.implode('";"', $vs)."\"\n";
|
||||
echo '"' . implode('";"', $vs) . "\"\n";
|
||||
}
|
||||
break;
|
||||
case 'add':
|
||||
@ -137,7 +137,7 @@ switch ($action) {
|
||||
$p = ORM::for_table('tbl_plans')->where('id', $b['plan_id'])->where('enabled', '1')->find_one();
|
||||
if ($p) {
|
||||
if ($p['is_radius']) {
|
||||
Radius::customerAddPlan($c, $p, $p['expiration'].' '.$p['time']);
|
||||
Radius::customerAddPlan($c, $p, $p['expiration'] . ' ' . $p['time']);
|
||||
r2(U . 'customers/view/' . $id_customer, 's', 'Success sync customer to Radius');
|
||||
} else {
|
||||
$mikrotik = Mikrotik::info($b['routers']);
|
||||
@ -167,7 +167,7 @@ switch ($action) {
|
||||
$v = $routes['3'];
|
||||
if (empty($v) || $v == 'order') {
|
||||
$v = 'order';
|
||||
$paginator = Paginator::build(ORM::for_table('tbl_payment_gateway'),['username'=>$customer['username']]);
|
||||
$paginator = Paginator::build(ORM::for_table('tbl_payment_gateway'), ['username' => $customer['username']]);
|
||||
$order = ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $customer['username'])
|
||||
->offset($paginator['startpoint'])
|
||||
@ -177,7 +177,7 @@ switch ($action) {
|
||||
$ui->assign('paginator', $paginator);
|
||||
$ui->assign('order', $order);
|
||||
} else if ($v == 'activation') {
|
||||
$paginator = Paginator::build(ORM::for_table('tbl_transactions'),['username'=>$customer['username']]);
|
||||
$paginator = Paginator::build(ORM::for_table('tbl_transactions'), ['username' => $customer['username']]);
|
||||
$activation = ORM::for_table('tbl_transactions')
|
||||
->where('username', $customer['username'])
|
||||
->offset($paginator['startpoint'])
|
||||
@ -369,11 +369,11 @@ switch ($action) {
|
||||
$c->save();
|
||||
$p = ORM::for_table('tbl_plans')->find_one($c['plan_id']);
|
||||
if ($p['is_radius']) {
|
||||
if($userDiff){
|
||||
if ($userDiff) {
|
||||
Radius::customerChangeUsername($oldusername, $username);
|
||||
}
|
||||
Radius::customerAddPlan($d, $p, $p['expiration'].' '.$p['time']);
|
||||
}else{
|
||||
Radius::customerAddPlan($d, $p, $p['expiration'] . ' ' . $p['time']);
|
||||
} else {
|
||||
$mikrotik = Mikrotik::info($c['routers']);
|
||||
if ($c['type'] == 'Hotspot') {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
|
@ -9,7 +9,7 @@ _admin();
|
||||
$ui->assign('_title', $_L['Dashboard']);
|
||||
$admin = Admin::_info();
|
||||
$ui->assign('_admin', $admin);
|
||||
if (!in_array($admin['user_type'], ['Admin', 'Sales'])) {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "home", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ $action = $routes['1'];
|
||||
$admin = Admin::_info();
|
||||
$ui->assign('_admin', $admin);
|
||||
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ $admin = Admin::_info();
|
||||
$ui->assign('_admin', $admin);
|
||||
|
||||
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ $action = $routes['1'];
|
||||
$admin = Admin::_info();
|
||||
$ui->assign('_admin', $admin);
|
||||
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ $action = $routes['1'];
|
||||
$admin = Admin::_info();
|
||||
$ui->assign('_admin', $admin);
|
||||
|
||||
if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin', 'Sales'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ switch ($action) {
|
||||
$ui->assign('in', $in);
|
||||
$ui->assign('date', date("Y-m-d H:i:s"));
|
||||
$ui->display('invoice.tpl');
|
||||
_log('[' . $admin['username'] . ']: ' . 'Recharge ' . $c['username'] . ' [' . $in['plan_name'] . '][' . Lang::moneyFormat($in['price']) . ']', 'Admin', $admin['id']);
|
||||
_log('[' . $admin['username'] . ']: ' . 'Recharge ' . $c['username'] . ' [' . $in['plan_name'] . '][' . Lang::moneyFormat($in['price']) . ']', $admin['user_type'], $admin['id']);
|
||||
} else {
|
||||
r2(U . 'prepaid/recharge', 'e', "Failed to recharge account");
|
||||
}
|
||||
@ -202,7 +202,7 @@ switch ($action) {
|
||||
}
|
||||
}
|
||||
$d->delete();
|
||||
_log('[' . $admin['username'] . ']: ' . 'Delete Plan for Customer ' . $c['username'] . ' [' . $in['plan_name'] . '][' . Lang::moneyFormat($in['price']) . ']', 'Admin', $admin['id']);
|
||||
_log('[' . $admin['username'] . ']: ' . 'Delete Plan for Customer ' . $c['username'] . ' [' . $in['plan_name'] . '][' . Lang::moneyFormat($in['price']) . ']', $admin['user_type'], $admin['id']);
|
||||
r2(U . 'prepaid/list', 's', $_L['Delete_Successfully']);
|
||||
}
|
||||
break;
|
||||
@ -247,7 +247,7 @@ switch ($action) {
|
||||
if($d['status'] == 'on'){
|
||||
Package::changeTo($username, $id_plan, $id);
|
||||
}
|
||||
_log('[' . $admin['username'] . ']: ' . 'Edit Plan for Customer ' . $d['username'] . ' to [' . $d['namebp'] . '][' . Lang::moneyFormat($p['price']) . ']', 'Admin', $admin['id']);
|
||||
_log('[' . $admin['username'] . ']: ' . 'Edit Plan for Customer ' . $d['username'] . ' to [' . $d['namebp'] . '][' . Lang::moneyFormat($p['price']) . ']', $admin['user_type'], $admin['id']);
|
||||
r2(U . 'prepaid/list', 's', $_L['Updated_Successfully']);
|
||||
} else {
|
||||
r2(U . 'prepaid/edit/' . $id, 'e', $msg);
|
||||
|
@ -12,7 +12,7 @@ $admin = Admin::_info();
|
||||
$ui->assign('_admin', $admin);
|
||||
|
||||
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ $action = $routes['1'];
|
||||
$admin = Admin::_info();
|
||||
$ui->assign('_admin', $admin);
|
||||
|
||||
if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin', 'Sales'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ use PEAR2\Net\RouterOS;
|
||||
|
||||
require_once 'system/autoload/PEAR2/Autoload.php';
|
||||
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ $action = $routes['1'];
|
||||
$admin = Admin::_info();
|
||||
$ui->assign('_admin', $admin);
|
||||
|
||||
if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ $ui->assign('_admin', $admin);
|
||||
|
||||
switch ($action) {
|
||||
case 'app':
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'localisation':
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
$folders = [];
|
||||
@ -89,7 +89,7 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'users':
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'users-add':
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
run_hook('view_add_admin'); #HOOK
|
||||
@ -119,7 +119,7 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'users-edit':
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'users-delete':
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ switch ($action) {
|
||||
|
||||
$d->save();
|
||||
|
||||
_log('[' . $admin['username'] . ']: ' . $_L['account_created_successfully'], 'Admin', $admin['id']);
|
||||
_log('[' . $admin['username'] . ']: ' . $_L['account_created_successfully'], $admin['user_type'], $admin['id']);
|
||||
r2(U . 'settings/users', 's', $_L['account_created_successfully']);
|
||||
} else {
|
||||
r2(U . 'settings/users-add', 'e', $msg);
|
||||
@ -249,7 +249,7 @@ switch ($action) {
|
||||
|
||||
$d->save();
|
||||
|
||||
_log('[' . $admin['username'] . ']: ' . $_L['User_Updated_Successfully'], 'Admin', $admin['id']);
|
||||
_log('[' . $admin['username'] . ']: ' . $_L['User_Updated_Successfully'], $admin['user_type'], $admin['id']);
|
||||
r2(U . 'settings/users', 's', 'User Updated Successfully');
|
||||
} else {
|
||||
r2(U . 'settings/users-edit/' . $id, 'e', $msg);
|
||||
@ -316,7 +316,7 @@ switch ($action) {
|
||||
}
|
||||
}
|
||||
|
||||
_log('[' . $admin['username'] . ']: ' . $_L['Settings_Saved_Successfully'], 'Admin', $admin['id']);
|
||||
_log('[' . $admin['username'] . ']: ' . $_L['Settings_Saved_Successfully'], $admin['user_type'], $admin['id']);
|
||||
|
||||
r2(U . 'settings/app', 's', $_L['Settings_Saved_Successfully']);
|
||||
}
|
||||
@ -404,13 +404,13 @@ switch ($action) {
|
||||
$d->value = $lan;
|
||||
$d->save();
|
||||
|
||||
_log('[' . $admin['username'] . ']: ' . $_L['Settings_Saved_Successfully'], 'Admin', $admin['id']);
|
||||
_log('[' . $admin['username'] . ']: ' . $_L['Settings_Saved_Successfully'], $admin['user_type'], $admin['id']);
|
||||
r2(U . 'settings/localisation', 's', $_L['Settings_Saved_Successfully']);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'change-password':
|
||||
if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
run_hook('view_change_password'); #HOOK
|
||||
@ -439,7 +439,7 @@ switch ($action) {
|
||||
$d->save();
|
||||
|
||||
_msglog('s', $_L['Password_Changed_Successfully']);
|
||||
_log('[' . $admin['username'] . ']: Password changed successfully', 'Admin', $admin['id']);
|
||||
_log('[' . $admin['username'] . ']: Password changed successfully', $admin['user_type'], $admin['id']);
|
||||
|
||||
r2(U . 'admin');
|
||||
} else {
|
||||
@ -454,7 +454,7 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'notifications':
|
||||
if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
run_hook('view_notifications'); #HOOK
|
||||
@ -471,7 +471,7 @@ switch ($action) {
|
||||
r2(U . 'settings/notifications', 's', $_L['Settings_Saved_Successfully']);
|
||||
break;
|
||||
case 'dbstatus':
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
@ -489,7 +489,7 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'dbbackup':
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
$tables = $_POST['tables'];
|
||||
@ -509,7 +509,7 @@ switch ($action) {
|
||||
echo json_encode($array);
|
||||
break;
|
||||
case 'dbrestore':
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
if (file_exists($_FILES['json']['tmp_name'])) {
|
||||
@ -539,7 +539,7 @@ switch ($action) {
|
||||
}
|
||||
break;
|
||||
case 'language':
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
run_hook('view_add_language'); #HOOK
|
||||
|
Reference in New Issue
Block a user