// Destroy cache here
// @TODO Rewrite this to a filter
- if (getOutputMode() == 0) rebuildCacheFile('modules', 'modules');
+ if ((getOutputMode() == 0) || (getOutputMode() == -1)) rebuildCacheFile('modules', 'modules');
// And reload data
unset($GLOBALS['module_status'][$mod]);
} // END - if
//* DEBUG: */ print(__FUNCTION__.':'.$admin.'/'.$passCookie.'<br />');
- // Search in array for entry
- if (isset($GLOBALS['admin_hash'])) {
- // Use cached string
- $valPass = $GLOBALS['admin_hash'];
- } elseif ((!empty($passCookie)) && (isAdminHashSet($admin) === true) && (!empty($admin))) {
- // Login data is valid or not?
- $valPass = generatePassString(getAdminHash($admin));
+ // Do we have cache?
+ if (!isset($GLOBALS['is_admin'][$admin])) {
+ // Init it with failed
+ $GLOBALS['is_admin'][$admin] = false;
+
+ // Search in array for entry
+ if (isset($GLOBALS['admin_hash'])) {
+ // Use cached string
+ $valPass = $GLOBALS['admin_hash'];
+ } elseif ((!empty($passCookie)) && (isAdminHashSet($admin) === true) && (!empty($admin))) {
+ // Login data is valid or not?
+ $valPass = generatePassString(getAdminHash($admin));
+
+ // Cache it away
+ $GLOBALS['admin_hash'] = $valPass;
+
+ // Count cache hits
+ incrementStatsEntry('cache_hits');
+ } elseif ((!empty($admin)) && ((!isExtensionActive('cache'))) || (isAdminHashSet($admin) === false)) {
+ // Search for admin
+ $result = SQL_QUERY_ESC("SELECT HIGH_PRIORITY `password` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `login`='%s' LIMIT 1",
+ array($admin), __FUNCTION__, __LINE__);
- // Cache it away
- $GLOBALS['admin_hash'] = $valPass;
+ // Is he admin?
+ $passDB = '';
+ if (SQL_NUMROWS($result) == 1) {
+ // Admin login was found so let's load password from DB
+ list($passDB) = SQL_FETCHROW($result);
- // Count cache hits
- incrementStatsEntry('cache_hits');
- } elseif ((!empty($admin)) && ((!isExtensionActive('cache'))) || (isAdminHashSet($admin) === false)) {
- // Search for admin
- $result = SQL_QUERY_ESC("SELECT HIGH_PRIORITY `password` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `login`='%s' LIMIT 1",
- array($admin), __FUNCTION__, __LINE__);
+ // Temporary cache it
+ setAdminHash($admin, $passDB);
- // Is he admin?
- $passDB = '';
- if (SQL_NUMROWS($result) == 1) {
- // Admin login was found so let's load password from DB
- list($passDB) = SQL_FETCHROW($result);
+ // Generate password hash
+ $valPass = generatePassString($passDB);
+ } // END - if
- // Temporary cache it
- setAdminHash($admin, $passDB);
+ // Free memory
+ SQL_FREERESULT($result);
+ }
- // Generate password hash
- $valPass = generatePassString($passDB);
+ if (!empty($valPass)) {
+ // Check if password is valid
+ //* DEBUG: */ print(__FUNCTION__ . ':(' . $valPass . '==' . $passCookie . ')='.intval($valPass == $passCookie).'<br />');
+ $GLOBALS['is_admin'][$admin] = (($valPass == $passCookie) || ((strlen($valPass) == 32) && ($valPass == md5($passCookie))) || (($valPass == '*FAILED*') && (!isExtensionActive('cache'))));
} // END - if
-
- // Free memory
- SQL_FREERESULT($result);
- }
-
- if (!empty($valPass)) {
- // Check if password is valid
- //* DEBUG: */ print(__FUNCTION__ . ':(' . $valPass . '==' . $passCookie . ')='.intval($valPass == $passCookie).'<br />');
- $ret = (($valPass == $passCookie) || ((strlen($valPass) == 32) && ($valPass == md5($passCookie))) || (($valPass == '*FAILED*') && (!isExtensionActive('cache'))));
} // END - if
// Return result of comparision
- return $ret;
+ return $GLOBALS['is_admin'][$admin];
}
// Generates a list of "max receiveable emails per day"
return $ret;
}
-// Remove a receiver's ID from $receivers and add a link for him to confirm
+// Remove a receiver's id from $receivers and add a link for him to confirm
function removeReceiver (&$receivers, $key, $userid, $pool_id, $stats_id = '', $bonus = false) {
// Default is not removed
$ret = 'failed';
// Is there already a line for this user available?
if ($stats_id > 0) {
- // Only when we got a real stats ID continue searching for the entry
+ // Only when we got a real stats id continue searching for the entry
$type = 'NORMAL'; $rowName = 'stats_id';
if ($bonus) { $type = 'BONUS'; $rowName = 'bonus_id'; }
* Dynamic referal system, can also send mails!
*
* subject = Subject line, write in lower-case letters and underscore is allowed
- * userid = Referal ID wich should receive...
+ * userid = Referal id wich should receive...
* points = ... xxx points
* sendNotify = shall I send the referal an email or not?
* rid = inc/modules/guest/what-confirm.php need this
// Really simple... ;-)
}
-// Get ID number from administrator's login name
+// Get id number from administrator's login name
function getAdminId ($login) {
// By default no admin is found
$ret = '-1';