* svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
// Destroy cache here
// @TODO Rewrite this to a filter
- if ((getOutputMode() == '0') || (getOutputMode() == -1)) rebuildCacheFile('modules', 'modules');
+ if ((getOutputMode() == '0') || (getOutputMode() == -1)) rebuildCache('modules', 'modules');
// And reload data
unset($GLOBALS['module_status'][$module]);
}
} elseif (($ret == 'cache_miss') && (getOutputMode() == '0')) {
// Rebuild the cache files
- rebuildCacheFile('modules', 'modules');
+ rebuildCache('modules', 'modules');
} elseif ($found === false) {
// Problem with module detected
logDebugMessage(__FUNCTION__, __LINE__, sprintf("Problem in module %s detected. ret=%s, locked=%s, hidden=%s, mem=%s, admin=%s, output_mode=%s",
if (isAdmin()) $ADD = '';
$dummy = substr($search, 0, -4);
- $ADD .= " AND `action`='".getModeAction($accessLevel, $dummy)."'";
+ $ADD .= " AND `action`='".getActionFromModuleWhat($accessLevel, $dummy)."'";
} elseif (($accessLevel == 'sponsor') || ($accessLevel == 'engine')) {
// Sponsor / engine menu
$type = 'what';
// is the cache entry there?
if (isset($GLOBALS['is_member'])) {
// Then return it
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'CACHED! (' . intval($GLOBALS['is_member']) . ')');
return $GLOBALS['is_member'];
- } elseif (getMemberId() == '0') {
+ } elseif ((!isSessionVariableSet('userid')) || (!isSessionVariableSet('u_hash'))) {
// No member
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'No member set in cookie/session.');
return false;
} else {
- // Transfer userid=>current
- setCurrentUserid(getMemberId());
+ // Get it secured from session
+ setMemberId(getSession('userid'));
+ setCurrentUserId(getMemberId());
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . getSession('userid') . ' used from cookie/session.');
}
- // Init global user data array
+ // Init user data array
initUserData();
// Fix "deleted" cookies first
// Cookies are set with values, but are they valid?
if (fetchUserData(getMemberId()) === true) {
// Validate password by created the difference of it and the secret key
- $valPass = generatePassString(getUserData('password'));
+ $valPass = encodeHashForCookie(getUserData('password'));
// Transfer last module and online time
$GLOBALS['last_online']['module'] = getUserData('last_module');
$ret = true;
} else {
// Maybe got locked etc.
- logDebugMessage(__FUNCTION__, __LINE__, 'status=' . getUserData('status'));
+ //* DEBUG */ logDebugMessage(__FUNCTION__, __LINE__, 'status=' . getUserData('status') . ',' . $valPass . '(' . strlen($valPass) . ')/' . getSession('u_hash') . '(' . strlen(getSession('u_hash')) . ')/' . getUserData('password') . '(' . strlen(getUserData('password')) . ')');
destroyMemberSession();
}
} else {
// Cookie data is invalid!
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cookie data invalid or user not found.');
destroyMemberSession();
}
} else {
// Cookie data is invalid!
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cookie data not complete.');
destroyMemberSession();
}
$GLOBALS['is_member'] = $ret;
// Return status
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret=' . intval($ret));
return $ret;
}
}
// This patched function will reduce many SELECT queries for the specified or current admin login
-function isAdmin ($admin = '') {
+function isAdmin ($adminLogin = '') {
// Init variables
- $ret = false; $passCookie = ''; $valPass = '';
- //* DEBUG: */ print(__FUNCTION__.':'.$admin.'<br />');
+ $ret = false;
+ $passCookie = '';
+ $valPass = '';
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $adminLogin.'<br />');
// If admin login is not given take current from cookies...
- if ((empty($admin)) && (isSessionVariableSet('admin_login')) && (isSessionVariableSet('admin_md5'))) {
+ if ((empty($adminLogin)) && (isSessionVariableSet('admin_login')) && (isSessionVariableSet('admin_md5'))) {
// Get admin login and password from session/cookies
- $admin = getSession('admin_login');
+ $adminLogin = getSession('admin_login');
$passCookie = getSession('admin_md5');
} // END - if
- //* DEBUG: */ print(__FUNCTION__.':'.$admin.'/'.$passCookie.'<br />');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $adminLogin.'/'.$passCookie.'<br />');
// Do we have cache?
- if (!isset($GLOBALS['is_admin'][$admin])) {
+ if (!isset($GLOBALS['is_admin'][$adminLogin])) {
// Init it with failed
- $GLOBALS['is_admin'][$admin] = false;
+ $GLOBALS['is_admin'][$adminLogin] = 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))) {
+ } elseif ((!empty($passCookie)) && (isAdminHashSet($adminLogin) === true) && (!empty($adminLogin))) {
// Login data is valid or not?
- $valPass = generatePassString(getAdminHash($admin));
+ $valPass = encodeHashForCookie(getAdminHash($adminLogin));
// Cache it away
$GLOBALS['admin_hash'] = $valPass;
// Count cache hits
incrementStatsEntry('cache_hits');
- } elseif ((!empty($admin)) && ((!isExtensionActive('cache'))) || (isAdminHashSet($admin) === false)) {
+ } elseif ((!empty($adminLogin)) && ((!isExtensionActive('cache')) || (isAdminHashSet($adminLogin) === false))) {
// Get admin hash and hash it
- $valPass = generatePassString(getAdminHash($admin));
+ $valPass = encodeHashForCookie(getAdminHash($adminLogin));
+
+ // Cache it away
+ $GLOBALS['admin_hash'] = $valPass;
}
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'))));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '(' . $valPass . '==' . $passCookie . ')='.intval($valPass == $passCookie));
+ $GLOBALS['is_admin'][$adminLogin] = (($valPass == $passCookie) || ((strlen($valPass) == 32) && ($valPass == md5($passCookie))) || (($valPass == '*FAILED*') && (!isExtensionActive('cache'))));
} // END - if
} // END - if
// Return result of comparision
- return $GLOBALS['is_admin'][$admin];
+ return $GLOBALS['is_admin'][$adminLogin];
}
// Generates a list of "max receiveable emails per day"
$OUT = '';
while ($content = SQL_FETCHARRAY($result)) {
$OUT .= ' <option value="' . $content['value'] . '"';
- if (postRequestElement('max_mails') == $content['value']) $OUT .= ' selected="selected"';
+ if (postRequestParameter('max_mails') == $content['value']) $OUT .= ' selected="selected"';
$OUT .= '>' . $content['value'] . ' {--PER_DAY--}';
if (!empty($content['comment'])) $OUT .= '(' . $content['comment'] . ')';
$OUT .= '</option>';
}
// Get action value from mode (admin/guest/member) and what-value
-function getModeAction ($mode, $what) {
+function getActionFromModuleWhat ($module, $what) {
// Init status
$data['action'] = '';
- //* DEBUG: */ print(__LINE__.'='.$mode.'/'.$what.'/'.getAction()."=<br />");
+ //* DEBUG: */ print(__LINE__.'='.$module.'/'.$what.'/'.getAction()."=<br />");
if (!isExtensionInstalledAndNewer('sql_patches', '0.0.5')) {
// sql_patches is missing so choose depending on mode
if (isWhatSet()) {
// Use setted what
$what = getWhat();
- } elseif ($mode == 'admin') {
+ } elseif ($module == 'admin') {
// Admin area
$what = 'overview';
} else {
// Everywhere else
$what = 'welcome';
}
- } elseif ((empty($what)) && ($mode != 'admin')) {
+ } elseif ((empty($what)) && ($module != 'admin')) {
// Use configured 'home'
$what = getConfig('index_home');
} // END - if
- if ($mode == 'admin') {
+ if ($module == 'admin') {
// Action value for admin area
- if (isGetRequestElementSet('action')) {
+ if (isGetRequestParameterSet('action')) {
// Use from request!
- return getRequestElement('action');
+ return getRequestParameter('action');
} elseif (isActionSet()) {
// Get it directly from URL
return getAction();
// Get it directly from URL
return getAction();
}
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ret=".$data['action'].'<br />');
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>): ret=' . $data['action'] . '<br />');
// Does the module have a menu?
- if (ifModuleHasMenu($mode)) {
+ if (ifModuleHasMenu($module)) {
// Rewriting modules to menu
- $mode = mapModuleToTable($mode);
+ $module = mapModuleToTable($module);
// Guest and member menu is 'main' as the default
if (empty($data['action'])) $data['action'] = 'main';
// Load from database
$result = SQL_QUERY_ESC("SELECT `action` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `what`='%s' LIMIT 1",
- array($mode, $what), __FUNCTION__, __LINE__);
+ array($module, $what), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load action value and pray that this one is the right you want... ;-)
$data = SQL_FETCHARRAY($result);
// Free memory
SQL_FREERESULT($result);
- } elseif ((!isExtensionInstalled('sql_patches')) && (($mode != 'admin') && ($mode != 'unknown'))) {
+ } elseif ((!isExtensionInstalled('sql_patches')) && ($module != 'admin') && ($module != 'unknown')) {
// No sql_patches installed, but maybe we need to register an admin?
if (isAdminRegistered()) {
// Redirect to admin area
// Count up referal depth
if (!isset($GLOBALS['ref_level'])) {
// Initialialize referal system
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): Referal system initialized!<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>): Referal system initialized!<br />");
$GLOBALS['ref_level'] = '0';
} else {
// Increase referal level
$GLOBALS['ref_level']++;
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): Referal level increased. DEPTH={$GLOBALS['ref_level']}<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>): Referal level increased. DEPTH={$GLOBALS['ref_level']}<br />");
}
// Default is 'normal' points
if ($locked === true) $data = 'locked_points';
// Check user account
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},points={$points}<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid},points={$points}<br />");
if (fetchUserData($userid)) {
// This is the user and his ref
$GLOBALS['cache_array']['add_userid'][getUserData('refid')] = $userid;
// Get percents
$per = getReferalLevelPercents($GLOBALS['ref_level']);
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},points={$points},depth={$GLOBALS['ref_level']},per={$per},mode={$add_mode}<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid},points={$points},depth={$GLOBALS['ref_level']},per={$per},mode={$add_mode}<br />");
// Some percents found?
if ($per > 0) {
// Calculate new points
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},points={$points},per={$per},depth={$GLOBALS['ref_level']}<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid},points={$points},per={$per},depth={$GLOBALS['ref_level']}<br />");
$ref_points = $points * $per / 100;
// Pay refback here if level > 0 and in ref-mode
if ((isExtensionActive('refback')) && ($GLOBALS['ref_level'] > 0) && ($per < 100) && ($add_mode == "ref") && (isset($GLOBALS['cache_array']['add_userid'][$userid]))) {
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},data={$GLOBALS['cache_array']['add_userid'][$userid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - BEFORE!<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid},data={$GLOBALS['cache_array']['add_userid'][$userid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - BEFORE!<br />");
$ref_points = addRefbackPoints($GLOBALS['cache_array']['add_userid'][$userid], $userid, $points, $ref_points);
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},data={$GLOBALS['cache_array']['add_userid'][$userid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - AFTER!<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid},data={$GLOBALS['cache_array']['add_userid'][$userid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - AFTER!<br />");
} // END - if
// Update points...
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET `%s`=`%s`+%s WHERE `userid`=%s AND `ref_depth`='%s' LIMIT 1",
array($data, $data, $ref_points, bigintval($userid), bigintval($GLOBALS['ref_level'])), __FUNCTION__, __LINE__);
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):data={$data},ref_points={$ref_points},userid={$userid},depth={$GLOBALS['ref_level']},mode={$add_mode} - UPDATE! (".SQL_AFFECTEDROWS().")<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):data={$data},ref_points={$ref_points},userid={$userid},depth={$GLOBALS['ref_level']},mode={$add_mode} - UPDATE! (".SQL_AFFECTEDROWS().")<br />");
// No entry updated?
if (SQL_AFFECTEDROWS() < 1) {
// First ref in this level! :-)
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_points` (`userid`,`ref_depth`,`%s`) VALUES (%s,'%s',%s)",
array($data, bigintval($userid), bigintval($GLOBALS['ref_level']), $ref_points), __FUNCTION__, __LINE__);
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):data={$data},ref_points={$ref_points},userid={$userid},depth={$GLOBALS['ref_level']},mode={$add_mode} - INSERTED! (".SQL_AFFECTEDROWS().")<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):data={$data},ref_points={$ref_points},userid={$userid},depth={$GLOBALS['ref_level']},mode={$add_mode} - INSERTED! (".SQL_AFFECTEDROWS().")<br />");
} // END - if
// Points updated, maybe I shall send him an email?
// Send email
sendEmail($userid, getMessage('THANX_REFERAL_ONE_SUBJECT'), $message);
- } elseif (($sendNotify) && (getUserData('refid') == '0') && ($locked === false) && ($add_mode == 'direct')) {
+ } elseif (($sendNotify === true) && (getUserData('refid') == '0') && ($locked === false) && ($add_mode == 'direct')) {
// Prepare content
$content = array(
'text' => getMessage('REASON_DIRECT_PAYMENT'),
// And sent it away
sendEmail($userid, getMessage('SUBJECT_DIRECT_PAYMENT'), $message);
- if (!isGetRequestElementSet('mid')) loadTemplate('admin_settings_saved', false, getMessage('ADMIN_POINTS_ADDED'));
+ if (!isGetRequestParameterSet('mid')) loadTemplate('admin_settings_saved', false, getMessage('ADMIN_POINTS_ADDED'));
}
// Maybe there's another ref?
if ((getUserData('refid') > 0) && ($points > 0) && (getUserData('refid') != $userid) && ($add_mode == 'ref')) {
// Then let's credit him here...
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},ref=".getUserData('refid').",points={$points} - ADVANCE!<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid},ref=".getUserData('refid').",points={$points} - ADVANCE!<br />");
addPointsThroughReferalSystem(sprintf("%s_ref:%s", $subject, $GLOBALS['ref_level']), getUserData('refid'), $points, $sendNotify, getUserData('refid'), $locked);
} // END - if
} // END - if
function updateReferalCounter ($userid) {
// Make it sure referal level zero (member him-/herself) is at least selected
if (empty($GLOBALS['cache_array']['ref_level'][$userid])) $GLOBALS['cache_array']['ref_level'][$userid] = 1;
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},level={$GLOBALS['cache_array']['ref_level'][$userid]}<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid},level={$GLOBALS['cache_array']['ref_level'][$userid]}<br />");
// Update counter
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET `counter`=`counter`+1 WHERE `userid`=%s AND `level`='%s' LIMIT 1",
array(bigintval($userid), $GLOBALS['cache_array']['ref_level'][$userid]), __FUNCTION__, __LINE__);
// When no entry was updated then we have to create it here
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):updated=".SQL_AFFECTEDROWS().'<br />');
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):updated=".SQL_AFFECTEDROWS().'<br />');
if (SQL_AFFECTEDROWS() < 1) {
// First count!
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_refsystem` (`userid`, `level`, `counter`) VALUES (%s,%s,1)",
array(bigintval($userid), $GLOBALS['cache_array']['ref_level'][$userid]), __FUNCTION__, __LINE__);
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid}<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid}<br />");
} // END - if
// Init referal id
$ref = getUserData('refid');
} // END - if
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):userid={$userid},ref={$ref}<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):userid={$userid},ref={$ref}<br />");
// When he has a referal...
if (($ref > 0) && ($ref != $userid)) {
// Move to next referal level and count his counter one up!
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - ADVANCE!<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):ref={$ref} - ADVANCE!<br />");
$GLOBALS['cache_array']['ref_level'][$userid]++;
updateReferalCounter($ref);
} elseif ((($ref == $userid) || ($ref == '0')) && (isExtensionInstalledAndNewer('cache', '0.1.2'))) {
// Remove cache here
- //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - CACHE!<br />");
- rebuildCacheFile('refsystem', 'refsystem');
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):ref={$ref} - CACHE!<br />");
+ rebuildCache('refsystem', 'refsystem');
}
// "Walk" back here
}
// Get id number from administrator's login name
-function getAdminId ($login) {
+function getAdminId ($adminLogin) {
// By default no admin is found
$data['id'] = '-1';
// Check cache
- if (isset($GLOBALS['cache_array']['admin']['admin_id'][$login])) {
+ if (isset($GLOBALS['cache_array']['admin']['admin_id'][$adminLogin])) {
// Use it if found to save SQL queries
- $data['id'] = $GLOBALS['cache_array']['admin']['admin_id'][$login];
+ $data['id'] = $GLOBALS['cache_array']['admin']['admin_id'][$adminLogin];
// Update cache hits
incrementStatsEntry('cache_hits');
} elseif (!isExtensionActive('cache')) {
// Load from database
$result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `login`='%s' LIMIT 1",
- array($login), __FUNCTION__, __LINE__);
+ array($adminLogin), __FUNCTION__, __LINE__);
// Do we have an entry?
if (SQL_NUMROWS($result) == 1) {
$adminId = getAdminId($adminLogin);
// Remember in cache securely
- $GLOBALS['current_admin_id'] = bigintval($adminId);
+ setCurrentAdminId(bigintval($adminId));
} // END - if
// Return it
return $GLOBALS['current_admin_id'];
}
+// Setter for current admin id
+function setCurrentAdminId ($currentAdminId) {
+ // Set it secured
+ $GLOBALS['current_admin_id'] = bigintval($currentAdminId);
+}
+
// Get password hash from administrator's login name
-function getAdminHash ($admin) {
+function getAdminHash ($adminLogin) {
// By default an invalid hash is returned
$data['password'] = '-1';
- if (isAdminHashSet($admin)) {
+ if (isAdminHashSet($adminLogin)) {
// Check cache
- $data['password'] = $GLOBALS['cache_array']['admin']['password'][$admin];
+ $data['password'] = $GLOBALS['cache_array']['admin']['password'][$adminLogin];
// Update cache hits
incrementStatsEntry('cache_hits');
} elseif (!isExtensionActive('cache')) {
// Load from database
$result = SQL_QUERY_ESC("SELECT `password` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `login`='%s' LIMIT 1",
- array($admin), __FUNCTION__, __LINE__);
+ array($adminLogin), __FUNCTION__, __LINE__);
// Do we have an entry?
if (SQL_NUMROWS($result) == 1) {
$data = SQL_FETCHARRAY($result);
// Set cache
- setAdminHash($admin, $data['password']);
+ setAdminHash($adminLogin, $data['password']);
} // END - if
// Free result
}
// Generates an option list from various parameters
-function generateOptionList ($table, $id, $name, $default='', $special='', $where='') {
+function generateOptionList ($table, $id, $name, $default='', $special='', $where='', $disabled=array()) {
$ret = '';
if ($table == '/ARRAY/') {
// Selection from array
// Both are arrays
foreach ($id as $idx => $value) {
$ret .= '<option value="' . $value . '"';
- if ($default == $value) $ret .= ' selected="selected"';
+ if ($default == $value) {
+ // Selected by default
+ $ret .= ' selected="selected"';
+ } elseif (isset($disabled[$value])) {
+ // Disabled!
+ $ret .= ' disabled="disabled"';
+ }
$ret .= '>' . $name[$idx] . '</option>';
} // END - foreach
} else {
while (list($value, $title, $add) = SQL_FETCHROW($result)) {
if (empty($special)) $add = '';
$ret .= '<option value="' . $value . '"';
- if ($default == $value) $ret .= ' selected="selected"';
+ if ($default == $value) {
+ // Selected by default
+ $ret .= ' selected="selected"';
+ } elseif (isset($disabled[$value])) {
+ // Disabled!
+ $ret .= ' disabled="disabled"';
+ }
if (!empty($add)) $add = ' ('.$add.')';
$ret .= '>' . $title . $add . '</option>';
} // END - while
updateConfiguration('activate_xchange' ,0);
// Rebuild cache
- rebuildCacheFile('modules', 'modules');
+ rebuildCache('modules', 'modules');
} // END - if
}
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1", array(bigintval($userid)), __FUNCTION__, __LINE__);
}
-// Generates meta description for given module and 'what' value
-function generateMetaDescriptionCode ($module, $what) {
- // Exclude admin and member's area
- if (($module != 'admin') && ($module != 'login')) {
- // Construct dynamic description
- $DESCR = '{?MAIN_TITLE?} '.trim(getConfig('title_middle')) . ' ' . getTitleFromMenu('guest', $what);
-
- // Output it directly
- outputHtml('<meta name="description" content="' . $DESCR . '" />');
- } // END - if
-
- // Remove depth
- unset($GLOBALS['ref_level']);
-}
-
// Gets the matching what name from module
function getWhatFromModule ($modCheck) {
// Is the request element set?
- if (isGetRequestElementSet('what')) {
+ if (isGetRequestParameterSet('what')) {
// Then return this!
- return getRequestElement('what');
+ return getRequestParameter('what');
} // END - if
// Default is empty