- 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);