* login.
*/
function isAdmin () {
+ // Is there cache?
+ if (isset($GLOBALS[__FUNCTION__])) {
+ // Return it
+ return $GLOBALS[__FUNCTION__];
+ } // END - if
+
// No admin in installation phase!
if ((isInstallationPhase()) || (!isAdminRegistered())) {
+ $GLOBALS[__FUNCTION__] = FALSE;
return FALSE;
} // END - if
//* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Current adminId is zero. isSessionVariableSet(admin_id)=' . intval(isSessionVariableSet('admin_id')) . ',isSessionVariableSet(admin_md5)=' . intval(isSessionVariableSet('admin_md5')));
// Abort here now
+ $GLOBALS[__FUNCTION__] = FALSE;
return FALSE;
} // END - if
- // Is there cache?
- if (!isset($GLOBALS[__FUNCTION__][$adminId])) {
- // Init it with failed
- $GLOBALS[__FUNCTION__][$adminId] = FALSE;
-
- // Search in array for entry
- if (isset($GLOBALS['admin_hash'])) {
- // Use cached string
- $valPass = $GLOBALS['admin_hash'];
- } elseif ((!empty($passwordFromCookie)) && (isAdminHashSet($adminId) === TRUE) && (!empty($adminId))) {
- // Login data is valid or not?
- $valPass = encodeHashForCookie(getAdminHash($adminId));
-
- // Cache it away
- $GLOBALS['admin_hash'] = $valPass;
-
- // Count cache hits
- incrementStatsEntry('cache_hits');
- } elseif ((!empty($adminId)) && ((!isExtensionActive('cache')) || (isAdminHashSet($adminId) === FALSE))) {
- // Get admin hash and hash it
- $valPass = encodeHashForCookie(getAdminHash($adminId));
-
- // Cache it away
- $GLOBALS['admin_hash'] = $valPass;
- }
+ // Init it with failed
+ $GLOBALS[__FUNCTION__] = FALSE;
- if (!empty($valPass)) {
- // Check if password is valid
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '(' . $valPass . '==' . $passwordFromCookie . ')='.intval($valPass == $passwordFromCookie));
- $GLOBALS[__FUNCTION__][$adminId] = ($GLOBALS['admin_hash'] == $passwordFromCookie);
- } // END - if
+ // Search in array for entry
+ if (isset($GLOBALS['admin_hash'])) {
+ // Use cached string
+ $valPass = $GLOBALS['admin_hash'];
+ } elseif ((!empty($passwordFromCookie)) && (isAdminHashSet($adminId) === TRUE) && (!empty($adminId))) {
+ // Login data is valid or not?
+ $valPass = encodeHashForCookie(getAdminHash($adminId));
+
+ // Cache it away
+ $GLOBALS['admin_hash'] = $valPass;
+
+ // Count cache hits
+ incrementStatsEntry('cache_hits');
+ } elseif ((!empty($adminId)) && ((!isExtensionActive('cache')) || (isAdminHashSet($adminId) === FALSE))) {
+ // Get admin hash and hash it
+ $valPass = encodeHashForCookie(getAdminHash($adminId));
+
+ // Cache it away
+ $GLOBALS['admin_hash'] = $valPass;
+ }
+
+ // $valPass shall not be empty. If so, the admin has not found.
+ if (!empty($valPass)) {
+ // Check if password is valid
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '(' . $valPass . '==' . $passwordFromCookie . ')='.intval($valPass == $passwordFromCookie));
+ $GLOBALS[__FUNCTION__] = ($GLOBALS['admin_hash'] == $passwordFromCookie);
} // END - if
// Return result of comparision
- return $GLOBALS[__FUNCTION__][$adminId];
+ return $GLOBALS[__FUNCTION__];
}
// Generates a list of "max receiveable emails per day"