diff --git a/init.php b/init.php index fd3399d3..17ba79cd 100644 --- a/init.php +++ b/init.php @@ -219,6 +219,23 @@ function sendWhatsapp($phone, $txt) Message::sendWhatsapp($phone, $txt); } +function _alert($text, $type = 'success', $url = "home") +{ + global $ui; + if(!isset($ui)) return; + if(strlen($url)>4){ + if(substr($url,0,4)!="http"){ + $url = U.$url; + } + }else{ + $url = U.$url; + } + $ui->assign('text', $text); + $ui->assign('type', $type); + $ui->assign('url', $url); + $ui->display('alert.tpl'); +} + if(!isset($api_secret)){ $api_secret = $db_password; diff --git a/system/boot.php b/system/boot.php index 99bf6a3d..eb533208 100644 --- a/system/boot.php +++ b/system/boot.php @@ -101,7 +101,6 @@ if (isset($_SESSION['notify'])) { unset($_SESSION['ntype']); } - // Routing Engine $req = _get('_route'); $routes = explode('/', $req); diff --git a/system/controllers/admin.php b/system/controllers/admin.php index 02a1d8de..76338042 100644 --- a/system/controllers/admin.php +++ b/system/controllers/admin.php @@ -26,19 +26,16 @@ 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']); - r2(U . 'dashboard'); + _alert(Lang::T('Login Successful'),'success', "dashboard"); } else { - _msglog('e', Lang::T('Invalid Username or Password')); _log($username . ' ' . Lang::T('Failed Login'), $d['user_type']); - r2(U . 'admin'); + _alert(Lang::T('Invalid Username or Password'),'danger', "admin"); } } else { - _msglog('e', Lang::T('Invalid Username or Password')); - r2(U . 'admin'); + _alert(Lang::T('Invalid Username or Password'),'danger', "admin"); } } else { - _msglog('e', Lang::T('Invalid Username or Password')); - r2(U . 'admin'); + _alert(Lang::T('Invalid Username or Password'),'danger', "admin"); } break; diff --git a/system/controllers/login.php b/system/controllers/login.php index 3f3dd1ef..6148591c 100644 --- a/system/controllers/login.php +++ b/system/controllers/login.php @@ -26,7 +26,7 @@ switch ($do) { $d->last_login = date('Y-m-d H:i:s'); $d->save(); _log($username . ' ' . Lang::T('Login Successful'), 'User', $d['id']); - r2(U . 'home'); + _alert(Lang::T('Login Successful'),'success', "home"); } else { _msglog('e', Lang::T('Invalid Username or Password')); _log($username . ' ' . Lang::T('Failed Login'), 'User'); @@ -64,6 +64,7 @@ switch ($do) { r2(U . 'login', 'e', Lang::T('Voucher activation failed')); } } else { + _alert(Lang::T('Login Successful'),'success', "dashboard"); r2(U . 'login', 'e', Lang::T('Voucher activation failed') . '.'); } } diff --git a/system/controllers/logout.php b/system/controllers/logout.php index af08d930..3db002ba 100644 --- a/system/controllers/logout.php +++ b/system/controllers/logout.php @@ -9,4 +9,4 @@ if (session_status() == PHP_SESSION_NONE) session_start(); Admin::removeCookie(); User::removeCookie(); session_destroy(); -header('location: index.php'); \ No newline at end of file +_alert(Lang::T('Logout Successful'),'warning', "login"); \ No newline at end of file diff --git a/system/lan/english.json b/system/lan/english.json index f881ea1f..bf4c5750 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -450,5 +450,9 @@ "Report_Viewer": "Report Viewer", "Super_Administrator": "Super Administrator", "Send_To": "Send To", - "Resend": "Resend" + "Resend": "Resend", + "Alert": "Alert", + "success": "success", + "Click_Here": "Click Here", + "danger": "danger" } \ No newline at end of file diff --git a/ui/ui/alert.tpl b/ui/ui/alert.tpl new file mode 100644 index 00000000..b44f4aff --- /dev/null +++ b/ui/ui/alert.tpl @@ -0,0 +1,47 @@ + + + + + + + {ucwords(Lang::T($type))} - {$_c['CompanyName']} + + + + + + + + +
+
+
{ucwords(Lang::T($type))}
+
+ {$text} +
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/ui/ui/register-otp.tpl b/ui/ui/register-otp.tpl index f6de8816..30d06118 100644 --- a/ui/ui/register-otp.tpl +++ b/ui/ui/register-otp.tpl @@ -4,15 +4,15 @@ - {$_title} - {Lang::T('Register')} + {Lang::T('Register')} - {$_c['CompanyName']} - - + + diff --git a/ui/ui/register-rotp.tpl b/ui/ui/register-rotp.tpl index 2aa197db..d989cbb9 100644 --- a/ui/ui/register-rotp.tpl +++ b/ui/ui/register-rotp.tpl @@ -4,15 +4,15 @@ - {$_title} - {Lang::T('Register')} + {Lang::T('Register')} - {$_c['CompanyName']} - - + + diff --git a/ui/ui/register.tpl b/ui/ui/register.tpl index 9a309c6c..413f44ca 100644 --- a/ui/ui/register.tpl +++ b/ui/ui/register.tpl @@ -4,15 +4,15 @@ - {$_title} - {Lang::T('Register')} + {Lang::T('Register')} - {$_c['CompanyName']} - - + + diff --git a/ui/ui/user-login-noreg.tpl b/ui/ui/user-login-noreg.tpl index 42849f96..0a3c7bdd 100644 --- a/ui/ui/user-login-noreg.tpl +++ b/ui/ui/user-login-noreg.tpl @@ -4,12 +4,12 @@ - {$_title} - {Lang::T('Login')} + {Lang::T('Login')} - {$_c['CompanyName']} - + diff --git a/ui/ui/user-login.tpl b/ui/ui/user-login.tpl index 66205274..2340f517 100644 --- a/ui/ui/user-login.tpl +++ b/ui/ui/user-login.tpl @@ -4,13 +4,11 @@ - {$_title} - {Lang::T('Login')} + {Lang::T('Login')} - {$_c['CompanyName']} - -