upgrade first session to flightphp
This commit is contained in:
@@ -12,51 +12,51 @@
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
//OK
|
||||
declare(strict_types=1);
|
||||
|
||||
if (!function_exists('user_level')) {
|
||||
function user_level($level = 9) {
|
||||
if ($_SESSION['__WEB_USER']['Level'] <= $level) return true;
|
||||
if (Flight::session()->get('__WEB_USER', ['Level'=>9]) <= $level) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('user_level_not')) {
|
||||
function user_level_not($level = 9) {
|
||||
if ($_SESSION['__WEB_USER']['Level'] !== $level) return true;
|
||||
if (Flight::session()->get('__WEB_USER', ['Level'=>9]) !== $level) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('user_logged')) {
|
||||
function user_logged() {
|
||||
if (isset($_SESSION['__WEB_USER'])) return true;
|
||||
return false;
|
||||
return !empty(Flight::session()->get('__WEB_USER'));
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('user_id')) {
|
||||
function user_id($idigit = 0) {
|
||||
if ($idigit > 0) return isi_nol($_SESSION['__WEB_USER']['UserID'], $idigit);
|
||||
return $_SESSION['__WEB_USER']['UserID'];
|
||||
if ($idigit > 0) return isi_nol((int)Flight::session()->get('__WEB_USER', ['UserID'=>0])['UserID'], $idigit);
|
||||
return (int)Flight::session()->get('__WEB_USER', ['UserID'=>0])['UserID'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('user_user')) {
|
||||
function user_user() {
|
||||
return $_SESSION['__WEB_USER']['Username'];
|
||||
return (string)Flight::session()->get('__WEB_USER', ['Username'=>''])['Username'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('user_unix')) {
|
||||
function user_unix() {
|
||||
return $_SESSION['__WEB_USER']['UNIX'];
|
||||
return (string)Flight::session()->get('__WEB_USER', ['UNIX'=>'0'])['UNIX'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('user_nama')) {
|
||||
function user_nama() {
|
||||
return $_SESSION['__WEB_USER']['Nama'];
|
||||
return (string)Flight::session()->get('__WEB_USER', ['Nama'=>''])['Nama'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user