upgrade all with dice compatible
This commit is contained in:
+18
-17
@@ -8,55 +8,56 @@
|
||||
Created Date : January 27th, 2008.
|
||||
Last Modified : January 21st, 2024.
|
||||
|
||||
(c) 2008 - 2024, 3FONIA Software; WWW.3FONIA.COM.
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
//OK
|
||||
declare(strict_types=1);
|
||||
|
||||
use \flight\Session;
|
||||
|
||||
if (!function_exists('user_level')) {
|
||||
function user_level($level = 9) {
|
||||
if (Flight::session()->get('__WEB_USER', ['Level'=>9]) <= $level) return true;
|
||||
function user_level(Session $session, int $level = 9): bool {
|
||||
if ($session->get('__WEB_USER', ['Level'=>9]) <= $level) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('user_level_not')) {
|
||||
function user_level_not($level = 9) {
|
||||
if (Flight::session()->get('__WEB_USER', ['Level'=>9]) !== $level) return true;
|
||||
function user_level_not(Session $session, int $level = 9): bool {
|
||||
if ($session->get('__WEB_USER', ['Level'=>9]) !== $level) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('user_logged')) {
|
||||
function user_logged() {
|
||||
return !empty(Flight::session()->get('__WEB_USER'));
|
||||
function user_logged(Session $session): bool {
|
||||
return !empty($session->get('__WEB_USER'));
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('user_id')) {
|
||||
function user_id($idigit = 0) {
|
||||
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'];
|
||||
function user_id(Session $session, int $digit = 0): string|int {
|
||||
if ($digit > 0) return isi_nol($session->get('__WEB_USER', ['UserID'=>0])['UserID'], $digit);
|
||||
return (int)$session->get('__WEB_USER', ['UserID'=>0])['UserID'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('user_user')) {
|
||||
function user_user() {
|
||||
return (string)Flight::session()->get('__WEB_USER', ['Username'=>''])['Username'];
|
||||
function user_user(Session $session): string {
|
||||
return (string)$session->get('__WEB_USER', ['Username'=>''])['Username'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('user_unix')) {
|
||||
function user_unix() {
|
||||
return (string)Flight::session()->get('__WEB_USER', ['UNIX'=>'0'])['UNIX'];
|
||||
function user_unix(Session $session): string {
|
||||
return (string)$session->get('__WEB_USER', ['UNIX'=>'0'])['UNIX'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('user_nama')) {
|
||||
function user_nama() {
|
||||
return (string)Flight::session()->get('__WEB_USER', ['Nama'=>''])['Nama'];
|
||||
function user_nama(Session $session): string {
|
||||
return (string)$session->get('__WEB_USER', ['Nama'=>''])['Nama'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user