forked from kevinowino869/mitrobill
Found lazy way to create api
This commit is contained in:
@ -30,6 +30,13 @@ switch ($do) {
|
||||
$d->last_login = date('Y-m-d H:i:s');
|
||||
$d->save();
|
||||
_log($username . ' ' . Lang::T('Login Successful'), $d['user_type'], $d['id']);
|
||||
if ($isApi) {
|
||||
if ($token) {
|
||||
showResult(true, Lang::T('Login Successful'), ['token' => "a.".$token]);
|
||||
} else {
|
||||
showResult(false, Lang::T('Invalid Username or Password'));
|
||||
}
|
||||
}
|
||||
_alert(Lang::T('Login Successful'),'success', "dashboard");
|
||||
} else {
|
||||
_log($username . ' ' . Lang::T('Failed Login'), $d['user_type']);
|
||||
|
@ -59,9 +59,6 @@ switch ($action) {
|
||||
}
|
||||
$log .= "DONE : $plan[username], $plan[namebp], $plan[type], $plan[routers]<br>";
|
||||
}
|
||||
if ($isApi) {
|
||||
showResult(true, $log);
|
||||
}
|
||||
r2(U . 'plan/list', 's', $log);
|
||||
case 'list':
|
||||
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/plan.js"></script>');
|
||||
@ -75,9 +72,6 @@ switch ($action) {
|
||||
$d = Paginator::findMany($query);
|
||||
}
|
||||
run_hook('view_list_billing'); #HOOK
|
||||
if ($isApi) {
|
||||
showResult(true, $action, $d, ['search' => $search]);
|
||||
}
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('search', $search);
|
||||
$ui->display('plan.tpl');
|
||||
|
@ -336,12 +336,6 @@ switch ($action) {
|
||||
$admins[$adm['id']] = $adm['fullname'];
|
||||
}
|
||||
}
|
||||
if ($isApi) {
|
||||
showResult(true, $action, [
|
||||
'admins' => $d,
|
||||
'roots' => $admins
|
||||
], ['search' => $search]);
|
||||
}
|
||||
$ui->assign('admins', $admins);
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('search', $search);
|
||||
@ -380,15 +374,6 @@ switch ($action) {
|
||||
if ($d['user_type'] == 'Sales') {
|
||||
$ui->assign('agent', ORM::for_table('tbl_users')->where('id', $d['root'])->find_array()[0]);
|
||||
}
|
||||
if ($isApi) {
|
||||
unset($d['password']);
|
||||
$agent = $ui->get('agent');
|
||||
if ($agent) unset($agent['password']);
|
||||
showResult(true, $action, [
|
||||
'admin' => $d,
|
||||
'agent' => $agent
|
||||
], ['search' => $search]);
|
||||
}
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('_title', $d['username']);
|
||||
$ui->display('users-view.tpl');
|
||||
|
Reference in New Issue
Block a user