X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fwrapper-functions.php;h=26187489f3450b0c4264429c305456d912a4af33;hb=231773d6ed6d253c72db2b0b22e1472ecccbd8ff;hp=b76f513d39a06a91a60111ec4535c8be4051ab0b;hpb=f2736bc6457140146890877d992be862a78b259f;p=mailer.git diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index b76f513d39..26187489f3 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -443,15 +443,15 @@ function isNicknameUsed ($userid) { $isUsed = false; // Is the cache there - if (isset($GLOBALS['cache_probe_nicknames'][$userid])) { + if (isset($GLOBALS['is_nickname_used'][$userid])) { // Then use it - $isUsed = $GLOBALS['cache_probe_nicknames'][$userid]; + $isUsed = $GLOBALS['is_nickname_used'][$userid]; } else { // Determine it $isUsed = ((isExtensionActive('nickname')) && (('' . round($userid) . '') != $userid)); // And write it to the cache - $GLOBALS['cache_probe_nicknames'][$userid] = $isUsed; + $GLOBALS['is_nickname_used'][$userid] = $isUsed; } // Return the result @@ -708,5 +708,56 @@ function setAdminHash ($admin, $hash) { $GLOBALS['cache_array']['admin']['password'][$admin] = $hash; } +// Init user data array +function initUserData () { + // User id should not be zero + if (getCurrentUserId() == 0) debug_report_bug('User id is zero.'); + + // Init the user + $GLOBALS['user_data'][getCurrentUserId()]['status'] = 'GUEST'; +} + +// Getter for user data +function getUserData ($column) { + // User id should not be zero + if (getCurrentUserId() == 0) debug_report_bug('User id is zero.'); + + // Return the value + return $GLOBALS['user_data'][getCurrentUserId()][$column]; +} + +// Geter for whole user data array +function getUserDataArray () { + // User id should not be zero + if (getCurrentUserId() == 0) debug_report_bug('User id is zero.'); + + // Get the whole array + return $GLOBALS['user_data'][getCurrentUserId()]; +} + +// Checks if the user data is valid, this may indicate that the user has logged +// in, but you should use isMember() if you want to find that out. +function isUserDataValid () { + // User id should not be zero + if (getCurrentUserId() == 0) debug_report_bug('User id is zero.'); + + // Is the array there and filled? + return ((isset($GLOBALS['user_data'][getCurrentUserId()])) && (count($GLOBALS['user_data'][getCurrentUserId()]) > 1)); +} + +// Setter for current userid +function setCurrentUserId ($userid) { + $GLOBALS['current_userid'] = bigintval($userid); +} + +// Getter for current userid +function getCurrentUserId () { + // Return zero if not set + if (!isset($GLOBALS['current_userid'])) return 0; + + // Return the userid + return $GLOBALS['current_userid']; +} + // [EOF] ?>