+ // Do we have 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($passCookie)) && (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;
+ }
+
+ if (!empty($valPass)) {
+ // Check if password is valid
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '(' . $valPass . '==' . $passCookie . ')='.intval($valPass == $passCookie));
+ $GLOBALS[__FUNCTION__][$adminId] = (($GLOBALS['admin_hash'] == $passCookie) || ((strlen($GLOBALS['admin_hash']) == 32) && ($GLOBALS['admin_hash'] == md5($passCookie))) || (($GLOBALS['admin_hash'] == '*FAILED*') && (!isExtensionActive('cache'))));
+ } // END - if
+ } // END - if
+
+ // Return result of comparision
+ return $GLOBALS[__FUNCTION__][$adminId];
+}
+
+// Generates a list of "max receiveable emails per day"
+function addMaxReceiveList ($mode, $default = '', $return = false) {
+ $OUT = '';
+ $result = false;
+
+ switch ($mode) {
+ case 'guest':
+ // Guests (in the registration form) are not allowed to select 0 mails per day.
+ $result = SQL_QUERY('SELECT `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `value` > 0 ORDER BY `value` ASC',
+ __FUNCTION__, __LINE__);
+ break;
+
+ case 'member':
+ // Members are allowed to set to zero mails per day (we will change this soon!)
+ $result = SQL_QUERY('SELECT `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` ORDER BY `value` ASC',
+ __FUNCTION__, __LINE__);
+ break;
+
+ default: // Invalid!
+ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Invalid mode %s detected.", $mode));
+ break;
+ }
+
+ // Some entries are found?
+ if (!SQL_HASZERONUMS($result)) {
+ $OUT = '';
+ while ($content = SQL_FETCHARRAY($result)) {
+ $OUT .= ' <option value="' . $content['value'] . '"';
+ if (postRequestParameter('max_mails') == $content['value']) $OUT .= ' selected="selected"';
+ $OUT .= '>' . $content['value'] . ' {--PER_DAY--}';
+ if (!empty($content['comment'])) $OUT .= '(' . $content['comment'] . ')';
+ $OUT .= '</option>';
+ }
+
+ // Load template
+ $OUT = loadTemplate(($mode . '_receive_table'), true, $OUT);
+ } else {
+ // Maybe the admin has to setup some maximum values?
+ debug_report_bug(__FUNCTION__, __LINE__, 'Nothing is being done here?');
+ }
+