// Do stuff only when not in CSS mode
if (($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1") && ($GLOBALS['cache_mode'] != "init")) {
// Get total member count
- $TOTAL = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true);
+ $total = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true);
// Add more data on higher versions
$ADD1 = ""; $ADD2 = ""; $OR = "";
if (GET_EXT_VERSION("rallye") >= "0.2.0") {
$ADD1 = ", min_users, min_prices";
$ADD2 = ", d.min_users, d.min_prices";
- $OR = " OR (d.min_users <= ".$TOTAL." AND d.min_users > 0)";
+ $OR = " OR (d.min_users <= ".$total." AND d.min_users > 0)";
} // END - if
// Check for new started but not notified rallyes
// Load all saved filers if sql_patches is updated
if (GET_EXT_VERSION("sql_patches") >= "0.5.9") {
// Init add
- $ADD = "";
- if (GET_EXT_VERSION("sql_patches") >= "0.6.0") $ADD = ", `filter_counter`";
+ $add = "";
+ if (GET_EXT_VERSION("sql_patches") >= "0.6.0") $add = ", `filter_counter`";
// Load all active filers
- $result = SQL_QUERY("SELECT `filter_name`,`filter_function`,`filter_active`".$ADD."
+ $result = SQL_QUERY("SELECT `filter_name`,`filter_function`,`filter_active`".$add."
FROM `{!_MYSQL_PREFIX!}_filters`
ORDER BY `filter_id` ASC", __FUNCTION__, __LINE__);
// normally be stored in cookies
function ADD_URL_DATA ($URL) {
// Init add
- $ADD = "";
+ $add = "";
// Determine URL binder
$BIND = "?";
// Cookies are not accepted
if ((REQUEST_ISSET_GET(('refid'))) && (strpos($URL, "refid=") == 0)) {
// Cookie found in URL
- $ADD .= $BIND."refid=".bigintval(REQUEST_GET('refid'));
+ $add .= $BIND."refid=".bigintval(REQUEST_GET('refid'));
} elseif ((GET_EXT_VERSION("sql_patches") != '') && (getConfig('def_refid') > 0)) {
// Not found! So let's set default here
- $ADD .= $BIND."refid=".getConfig('def_refid');
+ $add .= $BIND."refid=".getConfig('def_refid');
}
} // END - if
// Add all together and return it
- return $URL . $ADD;
+ return $URL . $add;
}
// Generate an PGP-like encrypted hash of given hash for e.g. cookies
// When both passwords match update admin account
if ($POST['pass1'][$id] == $POST['pass2'][$id]) {
// Save only when both passwords are the same (also when they are empty)
- $ADD = ""; $cache_update = "1";
+ $add = ""; $cache_update = "1";
// Generate hash
$hash = generateHash($POST['pass1'][$id]);
// Save password when set
- if (!empty($POST['pass1'][$id])) $ADD = sprintf(", password='%s'", SQL_ESCAPE($hash));
+ if (!empty($POST['pass1'][$id])) $add = sprintf(", password='%s'", SQL_ESCAPE($hash));
// Get admin's ID
$aid = GET_CURRENT_ADMIN_ID();
set_session('admin_login', $login);
// Update password cookie as well?
- if (!empty($ADD)) set_session('admin_md5', $hash);
+ if (!empty($add)) set_session('admin_md5', $hash);
} elseif (generateHash($POST['pass1'][$id], $salt) != get_session('admin_md5')) {
// Update password cookie
set_session('admin_md5', $hash);
if ($default == "allow") {
// Allow changing default ACL
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins` SET
-login='%s'".$ADD.",
+login='%s'".$add.",
email='%s',
default_acl='%s',
la_mode='%s'
} else {
// Do not allow it here
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins` SET
-login='%s'".$ADD.",
+login='%s'".$add.",
email='%s',
la_mode='%s'
WHERE id=%s LIMIT 1",
}
// Filter for adding extra data to the query
-function FILTER_ADD_EXTRA_SQL_DATA ($ADD = "") {
+function FILTER_ADD_EXTRA_SQL_DATA ($add = "") {
// Is the admins extension updated? (should be!)
- if (GET_EXT_VERSION("admins") >= "0.3") $ADD .= ", default_acl AS def_acl";
- if (GET_EXT_VERSION("admins") >= "0.6.7") $ADD .= ", la_mode";
- if (GET_EXT_VERSION("admins") >= "0.7.2") $ADD .= ", login_failures, UNIX_TIMESTAMP(last_failure) AS last_failure";
+ if (GET_EXT_VERSION("admins") >= "0.3") $add .= ", default_acl AS def_acl";
+ if (GET_EXT_VERSION("admins") >= "0.6.7") $add .= ", la_mode";
+ if (GET_EXT_VERSION("admins") >= "0.7.2") $add .= ", login_failures, UNIX_TIMESTAMP(last_failure) AS last_failure";
// Return it
- return $ADD;
+ return $add;
}
//
case "JACKPOT": // ... jackpot
if ((SUB_JACKPOT($points) == -1) && (getConfig('bonus_uid') > 0)) {
// Check points amount first...
- $TOTAL = GET_TOTAL_DATA(getConfig('bonus_uid'), "user_points", "points") - GET_TOTAL_DATA(getConfig('bonus_uid'), "user_data", "used_points");
- if ($TOTAL >= $points) {
+ $total = GET_TOTAL_DATA(getConfig('bonus_uid'), "user_points", "points") - GET_TOTAL_DATA(getConfig('bonus_uid'), "user_data", "used_points");
+ if ($total >= $points) {
// Subtract points from userid's account
SUB_POINTS("bonus_payout_jackpot", getConfig('bonus_uid'), $points);
} // END - if
case "UID": // ... userid's account
// Check his amount first
- $TOTAL = GET_TOTAL_DATA(getConfig('bonus_uid'), "user_points", "points") - GET_TOTAL_DATA(getConfig('bonus_uid'), "user_data", "used_points");
- if ($TOTAL >= $points) {
+ $total = GET_TOTAL_DATA(getConfig('bonus_uid'), "user_points", "points") - GET_TOTAL_DATA(getConfig('bonus_uid'), "user_data", "used_points");
+ if ($total >= $points) {
// Subtract points from userid's account
SUB_POINTS("bonus_payout_uid", getConfig('bonus_uid'), $points);
} else {
// @TODO Lame description
function DOUBLER_GENERATE_TABLE ($uid="0", $done='N', $ref='N', $sort="ASC") {
if (empty($cnt)) $cnt = 0;
- $ADD = ""; $DT_MODE = 0;
+ $add = ""; $DT_MODE = 0;
if ($uid > 0) {
// Load entries only from a single user
- $ADD = " AND userid='".bigintval($uid)."'";
+ $add = " AND userid='".bigintval($uid)."'";
$MODE = "member"; $COLS = "4"; $DT_MODE = "2";
$NOT_FOUND = getMessage('DOUBLER_MEMBER_NO_ENTRIES_FOUND');
} else {
// List entries
$result = SQL_QUERY("SELECT userid, refid, points, timemark
FROM `{!_MYSQL_PREFIX!}_doubler`
-WHERE completed='".$done."' AND is_ref='".$ref."'".$ADD."
+WHERE completed='".$done."' AND is_ref='".$ref."'".$add."
ORDER BY timemark ".$sort."
LIMIT ".$limit, __FUNCTION__, __LINE__);
// ... what will the email address be out the @... ;-)
$PARTS = array();
- while (ereg("@", $test))
- {
+ while (ereg("@", $test)) {
$pos = strpos($test, "@");
$test2 = substr($test, 0, $pos);
// First check backwards
$idx = $pos - 1;
- while ($idx > 0)
- {
+ while ($idx > 0) {
$check = substr($test2, $idx, 1);
- if (!in_array($check, $GLOBALS['valid_email_chars']))
- {
+ if (!in_array($check, $GLOBALS['valid_email_chars'])) {
// Char found so we end here
break;
}
$idx--;
}
- if ($idx > 0)
- {
+
+ if ($idx > 0) {
// Starting mark is found
$check2 = substr($test, 0, ($idx + 1));
$test = substr($test, ($idx + 1));
// And now go forward...
$idx = 0;
- while ($idx < strlen($test))
- {
+ while ($idx < strlen($test)) {
$check = substr($test, $idx, 1);
- if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != "@"))
- {
+ if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != "@")) {
// Char found so end here again
break;
}
$idx++;
}
- if ($idx > 0)
- {
+
+ if ($idx > 0) {
// Maybe this is the email address?
$check = substr($test, 0, $idx);
}
// Remove email from testing string (see above why...)
$test = substr($test, strlen($check));
}
+
// Now put all parts together
$text = ""; $PARTS[] = $test;
- foreach ($PARTS as $part)
- {
+ foreach ($PARTS as $part) {
$text .= $part;
}
// Replace new-lines agains <br />-s and finally compile possible own HTML tags out...
return COMPILE_CODE(str_replace("\n", "<br />\n", $text));
}
+
//
-function SEND_HTML_EMAIL($TO, $SUBJECT, $message, $FROM)
-{
- if (EXT_IS_ACTIVE("html_mail"))
- {
+function SEND_HTML_EMAIL($to, $subject, $message, $FROM) {
+ if (EXT_IS_ACTIVE("html_mail")) {
// Send mail away as HTML
$FROM = "Content-Type: text/html\n".$FROM;
- SEND_EMAIL($TO, $SUBJECT, $message, 'N', $FROM);
+ SEND_EMAIL($to, $subject, $message, 'N', $FROM);
}
}
+
//
?>
}
//
-function SEND_NEWSLETTER ($TO, $SUBJECT, $message, $MODE) {
+function SEND_NEWSLETTER ($to, $subject, $message, $MODE) {
// Send mail away as HTML
if (REQUEST_POST('auto_urls') == "Y") {
// Automatically insert URLs into newsletter
if ((EXT_IS_ACTIVE("html")) && ($MODE == "html")) {
// Send HTML mail
- SEND_EMAIL($TO, $SUBJECT, HTML_INSERT_URLS($message), "Y");
+ SEND_EMAIL($to, $subject, HTML_INSERT_URLS($message), "Y");
} else {
// Send normal mail
- SEND_EMAIL($TO, $SUBJECT, NL_INSERT_URLS($message), "N");
+ SEND_EMAIL($to, $subject, NL_INSERT_URLS($message), "N");
}
} else {
// Regular send-out
if ((EXT_IS_ACTIVE("html")) && ($MODE == "html")) {
- SEND_EMAIL($TO, $SUBJECT, $message, "Y");
+ SEND_EMAIL($to, $subject, $message, "Y");
} else {
- SEND_EMAIL($TO, $SUBJECT, $message, "N");
+ SEND_EMAIL($to, $subject, $message, "N");
}
}
}
// Run this function only when a new member has confirmed his email address!
function RALLYE_AUTOADD_USER ($uid) {
global $DATA;
- $ADD = "";
+ $add = "";
// Updated extension?
if (GET_EXT_VERSION("rallye") >= "0.2.0") {
- $ADD .= ", min_users, min_prices";
+ $add .= ", min_users, min_prices";
} // END - if
// Check for an auto-add rallye
- $result = SQL_QUERY("SELECT id, title, start_time, end_time, send_notify".$ADD." FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE is_active='Y' AND notified='Y' AND auto_add_new_user='Y' AND expired='N' LIMIT 1", __FUNCTION__, __LINE__);
+ $result = SQL_QUERY("SELECT id, title, start_time, end_time, send_notify".$add." FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE is_active='Y' AND notified='Y' AND auto_add_new_user='Y' AND expired='N' LIMIT 1", __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Init variables
$min_users = 0; $min_prices = 0;
$DATA['now_t'] = MAKE_DATETIME(time(), "1");
// Just count...
- $TOTAL = 0;
+ $total = 0;
foreach($prices['uid'] as $key => $uid) {
// Check status
// active = 1: account is still confirmed
// Allow valid and active users with at least one ref to get points
if (($uid > 0) && ($prices['ref'][$key] > 0) && ($active == 1) && ($prices['cpoints'][$key] > 0)) {
- $TOTAL++;
+ $total++;
} // END - if
} // END - foreach
- if (($TOTAL < $min_prices) || ($TOTAL == 0)) {
+ if (($total < $min_prices) || ($total == 0)) {
// Do not end this rallye!
unset($DATA);
return;
}
// Add row
- $ADD = "";
+ $add = "";
$OUT .= "<tr>
- <td class=\"switch_sw".$SW." bottom2".$ADD."\"> ".($idx+1).".</td>
- <td align=\"center\" class=\"switch_sw".$SW." bottom2".$ADD."\">";
+ <td class=\"switch_sw".$SW." bottom2".$add."\"> ".($idx+1).".</td>
+ <td align=\"center\" class=\"switch_sw".$SW." bottom2".$add."\">";
if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= "<strong>";
$OUT .= $DATA['uid'][$idx];
if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= "</strong>";
$OUT .= "</td>
- <td align=\"center\" class=\"switch_sw".$SW." bottom2".$ADD."\">";
+ <td align=\"center\" class=\"switch_sw".$SW." bottom2".$add."\">";
if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= "<strong>";
$OUT .= $DATA['ref'][$idx];
if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= "</strong>";
$OUT .= "</td>
- <td align=\"center\" class=\"switch_sw".$SW." bottom2".$ADD."\">";
+ <td align=\"center\" class=\"switch_sw".$SW." bottom2".$add."\">";
if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= "<strong>";
$OUT .= $DATA['infos'][$idx];
if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= "</strong>";
function GET_USER_REFS ($uid, $level) {
//* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
// Default is no refs and no nickname
- $ADD = "";
+ $add = "";
$refs = array();
// Do we have nickname extension installed?
if (EXT_IS_ACTIVE("nickname")) {
- $ADD = ", d.nickname";
+ $add = ", d.nickname";
} // END - if
// Get refs from database
- $result = SQL_QUERY_ESC("SELECT r.id, r.refid, r.refback, r.points, d.status".$ADD."
+ $result = SQL_QUERY_ESC("SELECT r.id, r.refid, r.refback, r.points, d.status".$add."
FROM `{!_MYSQL_PREFIX!}_user_refs` AS r
LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d
ON r.refid=d.userid
}
// Default is all URLs
- $ADD = "";
+ $add = "";
// Is the status set?
if (is_array($status)) {
// Only URLs with these status
- $ADD = sprintf(" AND status IN('%s')", implode("','", $status));
+ $add = sprintf(" AND status IN('%s')", implode("','", $status));
} elseif (!empty($status)) {
// Only URLs with this status
- $ADD = sprintf(" AND `status`='%s'", $status);
+ $add = sprintf(" AND `status`='%s'", $status);
} elseif (is_array($exclude)) {
// Exclude URLs with these status
- $ADD = sprintf(" AND status NOT IN('%s')", implode("','", $exclude));
+ $add = sprintf(" AND status NOT IN('%s')", implode("','", $exclude));
} elseif (!empty($exclude)) {
// Exclude URLs with this status
- $ADD = sprintf(" AND status != '%s'", $exclude);
+ $add = sprintf(" AND status != '%s'", $exclude);
}
// Get amount from database
$result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt
FROM `{!_MYSQL_PREFIX!}_surfbar_urls`
-WHERE userid=%s".$ADD."
+WHERE userid=%s".$add."
LIMIT %s",
array($uid, getConfig('surfbar_max_order')), __FUNCTION__, __LINE__
);
// Updates the statistics of current URL/userid
function SURFBAR_UPDATE_INSERT_STATS_RECORD () {
// Init add
- $ADD = "";
+ $add = "";
// Get allowed views
$allowed = SURFBAR_GET_VIEWS_ALLOWED();
// Do we have a limit?
if ($allowed > 0) {
// Then count views_max down!
- $ADD .= ",views_max=views_max-1";
+ $add .= ",views_max=views_max-1";
} // END - if
// Update URL stats
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET views_total=views_total+1".$ADD." WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET views_total=views_total+1".$add." WHERE id=%s LIMIT 1",
array(SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
// Update the stats entry
return $USE;
}
// "Getter" for maximum random number
-function SURFBAR_GET_MAX_RANDOM ($UIDs, $ADD) {
+function SURFBAR_GET_MAX_RANDOM ($UIDs, $add) {
// Count max availabe entries
$result = SQL_QUERY("SELECT sbu.id AS cnt
FROM `{!_MYSQL_PREFIX!}_surfbar_urls` AS sbu
ON sbu.id=sbs.url_id
LEFT JOIN `{!_MYSQL_PREFIX!}_surfbar_locks` AS l
ON sbu.id=l.url_id
-WHERE sbu.userid NOT IN (".implode(",", $UIDs).") AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0)) AND sbu.`status`='ACTIVE'".$ADD."
+WHERE sbu.userid NOT IN (".implode(",", $UIDs).") AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0)) AND sbu.`status`='ACTIVE'".$add."
GROUP BY sbu.id", __FUNCTION__, __LINE__);
// Log last query
$USE = SURFBAR_GET_LOCK_IDS();
// Shall we add some URL ids to ignore?
- $ADD = "";
+ $add = "";
if (count($USE) > 0) {
// Ignore some!
- $ADD = " AND sbu.id NOT IN (";
+ $add = " AND sbu.id NOT IN (";
foreach ($USE as $url_id => $lid) {
// Add URL id
- $ADD .= $url_id.",";
+ $add .= $url_id.",";
} // END - foreach
// Add closing bracket
- $ADD = substr($ADD, 0, -1) . ")";
+ $add = substr($add, 0, -1) . ")";
} // END - if
// Determine depleted user account
$UIDs = SURFBAR_DETERMINE_DEPLETED_USERIDS();
// Get maximum randomness factor
- $maxRand = SURFBAR_GET_MAX_RANDOM($UIDs['uid'], $ADD);
+ $maxRand = SURFBAR_GET_MAX_RANDOM($UIDs['uid'], $add);
// If more than one URL can be called generate the random number!
if ($maxRand > 1) {
ON sbu.id=sbs.url_id
LEFT JOIN `{!_MYSQL_PREFIX!}_surfbar_locks` AS l
ON sbu.id=l.url_id
-WHERE sbu.userid NOT IN (".implode(",", $UIDs['uid']).") AND sbu.`status`='ACTIVE' AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0))".$ADD."
+WHERE sbu.userid NOT IN (".implode(",", $UIDs['uid']).") AND sbu.`status`='ACTIVE' AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0))".$add."
GROUP BY sbu.id
ORDER BY l.last_surfed ASC, sbu.id ASC
LIMIT %s,1",
// Add links for selecting some users
function alpha ($sortby, $colspan, $return=false) {
if (!REQUEST_ISSET_GET(('offset'))) REQUEST_SET_GET('offset', 0);
- $ADD = "&page=".REQUEST_GET(('page'))."&offset=".REQUEST_GET(('offset'));
- if (REQUEST_ISSET_GET(('mode'))) $ADD .= "&mode=".REQUEST_GET(('mode'));
+ $add = "&page=".REQUEST_GET(('page'))."&offset=".REQUEST_GET(('offset'));
+ if (REQUEST_ISSET_GET(('mode'))) $add .= "&mode=".REQUEST_GET(('mode'));
/* Creates the list of letters and makes them a link. */
$alphabet = array(getMessage('_ALL2'),"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",getMessage('_OTHERS'));
// Output link to letter
$OUT .= "<a href=\"{!URL!}/modules.php?module=admin&what=".$GLOBALS['what'];
if (REQUEST_ISSET_GET(('mode'))) $OUT .= "&mode=".REQUEST_GET(('mode'));
- $OUT .= "&letter=".$ltr."&sortby=".$sortby.$ADD."\">".$ltr."</a>";
+ $OUT .= "&letter=".$ltr."&sortby=".$sortby.$add."\">".$ltr."</a>";
}
if ((($counter / getConfig('user_alpha')) == round($counter / getConfig('user_alpha'))) && ($counter > 0)) {
if (!REQUEST_ISSET_GET(('page'))) REQUEST_SET_GET('page' , 0);
// Add page and offset
- $ADD = "&page=".REQUEST_GET(('page'))."&offset=".REQUEST_GET(('offset'));
+ $add = "&page=".REQUEST_GET(('page'))."&offset=".REQUEST_GET(('offset'));
// Add status or mode
- if (REQUEST_ISSET_GET(('status'))) $ADD .= "&mode=".REQUEST_GET(('status'));
- elseif (REQUEST_ISSET_GET(('mode'))) $ADD .= "&mode=".REQUEST_GET(('mode'));
+ if (REQUEST_ISSET_GET(('status'))) $add .= "&mode=".REQUEST_GET(('status'));
+ elseif (REQUEST_ISSET_GET(('mode'))) $add .= "&mode=".REQUEST_GET(('mode'));
// Makes order by links..
if ($letter == "front") $letter = getMessage('_ALL2');
if ($sortby == $sort) {
$OUT .= "<strong>".$title."</strong> | ";
} else {
- $OUT .= "<a href=\"{!URL!}/modules.php?module=admin&what=list_user&letter=".$letter."&sortby=".$sort.$ADD."\">".$title."</a> | ";
+ $OUT .= "<a href=\"{!URL!}/modules.php?module=admin&what=list_user&letter=".$letter."&sortby=".$sort.$add."\">".$title."</a> | ";
}
} // END - foreach
// Do the user login
function USER_DO_LOGIN ($uid, $passwd) {
+ // Init variables
+ $dmy = "";
+
// Add last_login if available
- $lastOnline = "";
+ $lastOnline = "";
if (GET_EXT_VERSION("sql_patches") >= "0.2.8") {
$lastOnline = ", last_login";
} // END - if
+ // Init array
+ $content = array(
+ 'password' => "",
+ 'userid' => "",
+ 'last_online' => 0,
+ 'last_login' => 0,
+ 'hash' => ""
+ );
+
// Check login data
- $password = ""; $uid2 = ""; $dmy = ""; $online = 0; $login = 0;
if ((EXT_IS_ACTIVE("nickname")) && (NICKNAME_PROBE_ON_USERID($uid))) {
// Nickname entered
$result = SQL_QUERY_ESC("SELECT userid, password, last_online".$lastOnline." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' AND `status`='CONFIRMED' LIMIT 1",
array($uid), __FUNCTION__, __LINE__);
- list($uid2, $password, $online, $login) = SQL_FETCHROW($result);
- if (!empty($uid2)) $uid = bigintval($uid2);
} else {
// Direct userid entered
$result = SQL_QUERY_ESC("SELECT userid, password, last_online".$lastOnline." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
- array($uid, $hash), __FUNCTION__, __LINE__);
- list($uid2, $password, $online, $login) = SQL_FETCHROW($result);
+ array($uid, $content['hash']), __FUNCTION__, __LINE__);
}
+ // Load entry
+ $content = SQL_FETCHARRAY($result);
+ if (!empty($content['userid'])) $uid = bigintval($content['userid']);
+
// Is there an entry?
- if ((SQL_NUMROWS($result) == 1) && ((($probe_nickname) && (!empty($uid2))) || ($uid2 == $uid))) {
+ if ((SQL_NUMROWS($result) == 1) && ((($probe_nickname) && (!empty($content['userid']))) || ($content['userid'] == $uid))) {
// Free result
SQL_FREERESULT($result);
- // By default the hash is empty
- $hash = "";
-
// Check for old MD5 passwords
- if ((strlen($password) == 32) && (md5($passwd) == $password)) {
+ if ((strlen($content['password']) == 32) && (md5($passwd) == $content['password'])) {
// Just set the hash to the password from DB... :)
- $hash = $password;
+ $content['hash'] = $content['password'];
} else {
// Hash password with improved way for comparsion
- $hash = generateHash($passwd, substr($password, 0, -40));
+ $content['hash'] = generateHash($passwd, substr($content['password'], 0, -40));
}
- if ($hash == $password) {
+ // Does the password match the hash?
+ if ($content['hash'] == $content['password']) {
// New hashed password found so let's generate a new one
- $hash = generateHash($passwd);
+ $content['hash'] = generateHash($passwd);
// ... and update database
+ // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content);
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET password='%s' WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
- array($hash, $uid), __FUNCTION__, __LINE__);
+ array($content['hash'], $uid), __FUNCTION__, __LINE__);
// No login bonus by default
- // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', array('login' => $login, 'online' => $online));
- $BONUS = false;
+ $GLOBALS['bonus_payed'] = false;
// Probe for last online timemark
- $probe = time() - $online;
- if (!empty($login)) $probe = time() - $login;
+ $probe = time() - $content['last_online'];
+ if (!empty($content['last_login'])) $probe = time() - $content['last_login'];
if ((GET_EXT_VERSION("bonus") >= "0.2.2") && ($probe >= getConfig('login_timeout'))) {
// Add login bonus to user's account
- $ADD = sprintf(", login_bonus=login_bonus+%s",
+ $add = sprintf(", login_bonus=login_bonus+%s",
(float)getConfig('login_bonus')
);
- $BONUS = true;
+ $GLOBALS['bonus_payed'] = true;
// Subtract login bonus from userid's account or jackpot
if ((GET_EXT_VERSION("bonus") >= "0.3.5") && (getConfig('bonus_mode') != "ADD")) BONUS_POINTS_HANDLER('login_bonus');
} // END - if
- // Init variables
- $login = false;
-
// Calculate new hash with the secret key and master salt together
- $hash = generatePassString($hash);
+ $content['hash'] = generatePassString($content['hash']);
// Update global array
- // @TODO Make this filter working: $URL = runFilterChain('do_login', array('uid' => $uid, 'hash' => $hash, 'addon' => $ADDON));
+ // @TODO Make this filter working: $URL = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
setUserId($uid);
// Try to set session data (which shall normally always work!)
- if ((set_session('userid', $uid )) && (set_session('u_hash', $hash))) {
+ if ((set_session('userid', $uid )) && (set_session('u_hash', $content['hash']))) {
// Update database records
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET total_logins=total_logins+1".$ADD." WHERE userid=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET total_logins=total_logins+1".$add." WHERE userid=%s LIMIT 1",
array($uid), __FUNCTION__, __LINE__);
if (SQL_AFFECTEDROWS() == 1) {
// Procedure to checking for login data
- if (($BONUS) && (EXT_IS_ACTIVE("bonus"))) {
+ if (($GLOBALS['bonus_payed']) && (EXT_IS_ACTIVE("bonus"))) {
// Bonus added (just displaying!)
$URL = "modules.php?module=chk_login&mode=bonus";
} else {
// Wrong password!
$URL = "modules.php?module=index&what=login&login=".getCode('WRONG_PASS');
}
- } elseif ((($probe_nickname) && (!empty($uid2))) || ($uid2 == $uid)) {
+ } elseif ((($probe_nickname) && (!empty($content['userid']))) || ($content['userid'] == $uid)) {
// Other account status?
// @TODO Can this query be merged with above query?
$result = SQL_QUERY_ESC("SELECT status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
// Init variables
EXT_INIT_CSS_FILES();
-$ADD = "";
+$add = "";
// Init cache instance and array
$GLOBALS['cache_instance'] = null;
// If current user is not admin load only activated extensions. But load
// them all if we are going to init the cache files. The admin shall use
// every available extension for testing purposes.
- if ((!IS_ADMIN()) && ($GLOBALS['cache_mode'] != "init")) $ADD = " WHERE ext_active='Y'";
+ if ((!IS_ADMIN()) && ($GLOBALS['cache_mode'] != "init")) $add = " WHERE ext_active='Y'";
if (GET_EXT_VERSION("sql_patches") >= "0.0.6") {
// Query with CSS file from DB
$res_ext_crt = SQL_QUERY("SELECT id AS ext_id, ext_name, ext_has_css AS ext_css, ext_active, ext_version
-FROM `{!_MYSQL_PREFIX!}_extensions`".$ADD."
+FROM `{!_MYSQL_PREFIX!}_extensions`".$add."
ORDER BY ext_name", __FILE__, __LINE__);
} else {
// Old obsolete query string
$res_ext_crt = SQL_QUERY("SELECT id AS ext_id, ext_name, ext_name, ext_active, ext_version
-FROM `{!_MYSQL_PREFIX!}_extensions`".$ADD."
+FROM `{!_MYSQL_PREFIX!}_extensions`".$add."
ORDER BY ext_name", __FILE__, __LINE__);
}
}
$GLOBALS['cache_instance']->storeExtensionVersion("admins");
// Load every data from DB to cache file
- $ADD = runFilterChain('sql_admin_extra_data');
+ $add = runFilterChain('sql_admin_extra_data');
// Query the database about this
- $result_admins = SQL_QUERY("SELECT id AS aid, login, password, email".$ADD."
+ $result_admins = SQL_QUERY("SELECT id AS aid, login, password, email".$add."
FROM `{!_MYSQL_PREFIX!}_admins`
ORDER BY login", __FILE__, __LINE__);
while ($dummy = SQL_FETCHARRAY($result_admins)) {
$sentBonusMails = ((getConfig('beg_notify_bonus') > 0) && ($MODE == "en") && (EXT_IS_ACTIVE("bonus")));
// Generate subject line
- $SUBJECT = constant('BEG_RALLYE_'.strtoupper($MODE).'_NOTIFY');
+ $subject = constant('BEG_RALLYE_'.strtoupper($MODE).'_NOTIFY');
// Load message body for bonus mails
$message = LOAD_EMAIL_TEMPLATE("beg_en_notify_body", "", "{PER}uid{PER}");
} else {
// Send normal notification mail to the members
$message = LOAD_EMAIL_TEMPLATE("beg_".$MODE."_notify", array(), $content['userid']);
- SEND_EMAIL($content['email'], $SUBJECT, $message);
+ SEND_EMAIL($content['email'], $subject, $message);
}
} // END - while
$URL = "modules.php?module=index&what=login";
// Insert mail
- ADD_BONUS_MAIL_TO_QUEUE($SUBJECT, $message, $RECEIVER, getConfig('beg_notify_bonus'), getConfig('beg_notify_wait'), $URL, 0, "normal", SQL_NUMROWS($result_main));
+ ADD_BONUS_MAIL_TO_QUEUE($subject, $message, $RECEIVER, getConfig('beg_notify_bonus'), getConfig('beg_notify_wait'), $URL, 0, "normal", SQL_NUMROWS($result_main));
} // END - if
} // END - if
$YEAR = date('Y', time());
// Shall I include only active members?
-$ADD = "%s"; $VALUE = "";
+$add = "%s"; $VALUE = "";
if ((getConfig('birthday_active')) && (EXT_IS_ACTIVE("autopurge")) && (getConfig('autopurge_inactive') == "Y") && (getConfig('ap_inactive_since') > 0)) {
- $ADD = " AND last_online >= (UNIX_TIMESTAP() - %s)";
+ $add = " AND last_online >= (UNIX_TIMESTAP() - %s)";
$VALUE = getConfig('ap_inactive_since');
}
// Only confirmed members shall receive birthday mails...
$result_birthday = SQL_QUERY_ESC("SELECT userid, email, birth_year
FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND birth_day=%s AND birth_month=%s AND birthday_sent < (UNIX_TIMESTAMP() - ".(getConfig('one_day') * 364).")".$ADD."
+WHERE `status`='CONFIRMED' AND birth_day=%s AND birth_month=%s AND birthday_sent < (UNIX_TIMESTAMP() - ".(getConfig('one_day') * 364).")".$add."
ORDER BY userid",
array($DAY, $MONTH, $VALUE), __FILE__, __LINE__);
$sentBonusMails = ((getConfig('bonus_notify_points') > 0) && ($MODE == "en") && (EXT_IS_ACTIVE("bonus")));
// Generate subject line
- $SUBJECT = constant('BONUS_RALLYE_'.strtoupper($MODE).'_NOTIFY');
+ $subject = constant('BONUS_RALLYE_'.strtoupper($MODE).'_NOTIFY');
// Load message body for bonus mails
$message = LOAD_EMAIL_TEMPLATE("bonus_en_notify_body", "", "{PER}uid{PER}");
} else {
// Send normal notification mail to the members
$message = LOAD_EMAIL_TEMPLATE("bonus_".$MODE."_notify", array(), $content['userid']);
- SEND_EMAIL($content['email'], $SUBJECT, $message);
+ SEND_EMAIL($content['email'], $subject, $message);
}
} // END - while
$URL = "modules.php?module=index&what=login";
// Insert mail
- ADD_BONUS_MAIL_TO_QUEUE($SUBJECT, $message, $RECEIVER, getConfig('bonus_notify_points'), getConfig('bonus_notify_wait'), $URL, 0, "normal", SQL_NUMROWS($result_main));
+ ADD_BONUS_MAIL_TO_QUEUE($subject, $message, $RECEIVER, getConfig('bonus_notify_points'), getConfig('bonus_notify_wait'), $URL, 0, "normal", SQL_NUMROWS($result_main));
} // END - if
} // END - if
} // END - if
} elseif (!EXT_IS_ACTIVE("cache")) {
// Add extra data via filter now
- $ADD = runFilterChain('sql_admin_extra_data');
+ $add = runFilterChain('sql_admin_extra_data');
// Get password from DB
- $result = SQL_QUERY_ESC("SELECT password".$ADD." FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT password".$add." FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
array($aid), __FUNCTION__, __LINE__);
// Entry found?
array(GET_CURRENT_ADMIN_ID(), bigintval($tid)), __FILE__, __LINE__);
} // END - if
- $ADD = "";
+ $add = "";
if ($type == "SUPPORT_MEMBER") {
$mode = substr($text, 0, strpos($text, ":"));
$text = substr($text, strpos($text, ":") + 1);
- $ADD = "<li>{--ADMIN_TASK_SUPPORT_MODE--}: <strong>".$mode."</strong></li>";
+ $add = "<li>{--ADMIN_TASK_SUPPORT_MODE--}: <strong>".$mode."</strong></li>";
} // END - if
if ($uid > 0) {
if (SQL_NUMROWS($result_user) == 1) {
list($gender, $sname, $fname, $email) = SQL_FETCHROW($result_user);
SQL_FREERESULT($result_user);
- $ADD = "<li>{--ADMIN_MEMBER_UID--}: <strong>".ADMIN_USER_PROFILE_LINK($uid)." (<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".TRANSLATE_GENDER($gender)." ".$sname." ".$fname."</a>)</strong></li>";
+ $add = "<li>{--ADMIN_MEMBER_UID--}: <strong>".ADMIN_USER_PROFILE_LINK($uid)." (<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".TRANSLATE_GENDER($gender)." ".$sname." ".$fname."</a>)</strong></li>";
} // END - if
} // END - if
$content = array(
'sw' => $SW,
'subj' => $subj,
- 'add' => $ADD,
+ 'add' => $add,
'text' => $text,
'created' => MAKE_DATETIME($created, "1"),
'extension' => $ext_name
elseif (REQUEST_ISSET_POST('edit'))
{
// Ok, change the account...
- $PASS = false; $ADD = "";
+ $PASS = false; $add = "";
if ((!REQUEST_ISSET_POST(('pass1'))) && (!REQUEST_ISSET_POST(('pass2'))))
{
// Don't change the password
{
// Change the password
$PASS = true;
- $ADD = ", password='".generateHash(REQUEST_POST('pass1'))."'";
+ $add = ", password='".generateHash(REQUEST_POST('pass1'))."'";
}
if ($PASS)
{
zip=%s,
city='%s',
email='%s'
-".$ADD."
+".$add."
WHERE userid=%s LIMIT 1",
array(
substr(REQUEST_POST('gender'), 0, 1),
// Add limitation to SQL string
if (!REQUEST_ISSET_GET(('mid'))) {
// Create limitation line
- $ADD = " LIMIT ".(bigintval(REQUEST_GET('offset')) * bigintval(REQUEST_GET('page')) - bigintval(REQUEST_GET('offset'))).", ".bigintval(REQUEST_GET('offset'));
+ $add = " LIMIT ".(bigintval(REQUEST_GET('offset')) * bigintval(REQUEST_GET('page')) - bigintval(REQUEST_GET('offset'))).", ".bigintval(REQUEST_GET('offset'));
// For normal mails
- $sql .= $ADD;
+ $sql .= $add;
// For bonus mails
- if (!empty($SQL2)) $SQL2 .= $ADD;
+ if (!empty($SQL2)) $SQL2 .= $add;
} // END - if
// Run SQL query for normal mails
}
// Create limitation line
-$ADD = " LIMIT ".(bigintval(REQUEST_GET('offset')) * bigintval(REQUEST_GET('page')) - bigintval(REQUEST_GET('offset'))).", ".bigintval(REQUEST_GET('offset'));
+$add = " LIMIT ".(bigintval(REQUEST_GET('offset')) * bigintval(REQUEST_GET('page')) - bigintval(REQUEST_GET('offset'))).", ".bigintval(REQUEST_GET('offset'));
// Add limitation
-if (!empty($SQL2)) $SQL2 .= $ADD;
+if (!empty($SQL2)) $SQL2 .= $add;
if ((EXT_IS_ACTIVE("bonus")) && (SQL_NUMROWS($result_max) > 0) && (!empty($SQL2))) {
// Run SQL query for notification mails
if (($response[3] != "[EOF]") && ($ONLINE['version'] == constant('FULL_VERSION'))) {
// We have found new patches (newer than FULL_VERSION)
- $max = str_replace("\n", "", $response[count($response) - 2]); $TOTAL_SIZE = 0;
+ $max = str_replace("\n", "", $response[count($response) - 2]); $totalSize = 0;
// Maximum of available pacthes extracted (above). Now we can get all informations
for ($idx = 0; $idx < $max; $idx++) {
}
// Add patch's size to total
- $TOTAL_SIZE += $PATCHES['fsize'][$idx];
+ $totalSize += $PATCHES['fsize'][$idx];
}
}
if (isUserIdSet() && (isSessionVariableSet('u_hash'))) {
// Login failures are supported since 0.4.7
// Do we have 0.4.7 of sql_patches or later?
- $ADD = "";
+ $add = "";
if (GET_EXT_VERSION("sql_patches") >= "0.6.1") {
// Load them here
- $ADD = ", login_failures, UNIX_TIMESTAMP(last_failure) AS last_failure";
+ $add = ", login_failures, UNIX_TIMESTAMP(last_failure) AS last_failure";
} // END - if
// Get theme from profile
- $result = SQL_QUERY_ESC("SELECT curr_theme".$ADD." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT curr_theme".$add." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
array(getUserId()), __FILE__, __LINE__);
// Load data
ADD_DESCR("guest", __FILE__);
// Extra field to include is by default uid
-$ADD = "userid";
+$add = "userid";
// If nickname is installed the extra field is the nickname of the user
-if (EXT_IS_ACTIVE("nickname")) $ADD = "nickname";
+if (EXT_IS_ACTIVE("nickname")) $add = "nickname";
// Check for members who were active only this day
-$result = SQL_QUERY_ESC("SELECT userid, ".$ADD.", last_online
+$result = SQL_QUERY_ESC("SELECT userid, ".$add.", last_online
FROM `{!_MYSQL_PREFIX!}_user_data`
WHERE last_online >= %s AND `status`='CONFIRMED'
ORDER BY last_online DESC LIMIT %s",
$uid = false;
$hash = "";
$URL = "";
-$ADD = "";
+$add = "";
// Already logged in?
if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) {
if (getConfig('order_max_full') == "MAX") $ALLOWED = $MAXI;
// Now check his points amount
-$TOTAL = GET_TOTAL_DATA(getUserId(), "user_points", "points") - GET_TOTAL_DATA(getUserId(), "user_data", "used_points");;
+$total = GET_TOTAL_DATA(getUserId(), "user_points", "points") - GET_TOTAL_DATA(getUserId(), "user_data", "used_points");;
if (($HOLIDAY == "Y") && (GET_EXT_VERSION("holiday") >= "0.1.3")) {
// Holiday is active!
// Still no error?
if (empty($URL)) {
// Check if category and number of receivers is okay
- $ADD = "";
+ $add = "";
if ((getConfig('order_multi_page') == "Y") && (REQUEST_ISSET_POST(('zip')))) {
// Choose recipients by ZIP code
- $ADD = " AND d.zip LIKE '".bigintval(REQUEST_POST('zip'))."{PER}'";
+ $add = " AND d.zip LIKE '".bigintval(REQUEST_POST('zip'))."{PER}'";
} // END - if
// Check for userids
$result = SQL_QUERY_ESC("SELECT DISTINCT c.userid FROM `{!_MYSQL_PREFIX!}_user_cats` AS c
LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d
ON c.userid=d.userid
-WHERE c.cat_id=%s AND c.userid != '%s' AND d.`status`='CONFIRMED' AND d.receive_mails > 0".$ADD."
+WHERE c.cat_id=%s AND c.userid != '%s' AND d.`status`='CONFIRMED' AND d.receive_mails > 0".$add."
ORDER BY d.%s %s",
array(
bigintval(REQUEST_POST('cat')),
if (!REQUEST_ISSET_POST(('zip'))) REQUEST_SET_POST('zip', "0");
// Check if he has enougth points for this order and selected more than 0 receivers
- if (($USED > 0) && ($USED <= $TOTAL) && ($MAX_SEND > 0)) {
+ if (($USED > 0) && ($USED <= $total) && ($MAX_SEND > 0)) {
// Gettings points is okay, so we can add $USED later from
$TIME = time();
if (($id == "0") || ($type != "TEMP")) {
// Display order form
$result_cats = SQL_QUERY("SELECT id, cat FROM `{!_MYSQL_PREFIX!}_cats`".$whereStatement." ORDER BY `sort`", __FILE__, __LINE__);
if (SQL_NUMROWS($result_cats) > 0) {
- if ($TOTAL > 0) {
+ if ($total > 0) {
// Initialize array...
$CATS = array(
'id' => array(),
SQL_FREERESULT($result);
// Output user's points
- $TOTAL = TRANSLATE_COMMA($TOTAL);
+ $total = TRANSLATE_COMMA($total);
// Check how many mail orders he has placed today and how many he's allowed to send
switch (getConfig('order_max_full'))
}
// Load final template
- LOAD_TEMPLATE("member_order_points", false, $TOTAL);
+ LOAD_TEMPLATE("member_order_points", false, $total);
// Reset variables
$OLD_ORDER = false; $subject = ""; $text = ""; $target = "";
LOAD_TEMPLATE("member_order_page2");
} else {
// Remember maybe entered ZIP code in constant
- $ADD = "";
+ $add = "";
if (EXT_IS_ACTIVE("html_mail")) {
// Add some content when html extension is active
- if ((getConfig('order_multi_page') == "Y") || (IS_ADMIN())) $ADD = "<tr><td colspan=\"2\" class=\"seperator bottom2\" height=\"5\"> </td></tr>\n";
+ if ((getConfig('order_multi_page') == "Y") || (IS_ADMIN())) $add = "<tr><td colspan=\"2\" class=\"seperator bottom2\" height=\"5\"> </td></tr>\n";
define('MEMBER_HTML_EXTENSION', LOAD_TEMPLATE("member_order-html_intro", true));
} else {
// No HTML extension installed
if (REQUEST_POST('zip') > 0) {
$content = array(
'zip' => bigintval(REQUEST_POST('zip')),
- 'add' => $ADD
+ 'add' => $add
);
} else {
$content = array(
'zip' => "",
- 'add' => $ADD
+ 'add' => $add
);
}
define('MEMBER_ZIP_CONTENT', LOAD_TEMPLATE("member_order-zip1", true, $content));
// Only user >= v0.1.2: Fetch confirmed mails counter
if (GET_EXT_VERSION("user") >= "0.1.2") {
- $ADD = "";
+ $add = "";
if (GET_EXT_VERSION("user") >= "0.1.4") {
- $ADD = ", emails_sent, emails_received";
+ $add = ", emails_sent, emails_received";
}
- $result = SQL_QUERY_ESC("SELECT mails_confirmed".$ADD." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT mails_confirmed".$add." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
list($CONFIRMED, $SENT, $RECEIVED) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Display login bonus and turbo-click bonus
if ((GET_EXT_VERSION("bonus") >= "0.2.2") && (EXT_IS_ACTIVE("bonus")) && (getConfig('bonus_active') == "Y")) {
- $ADD = ", 0, 0, 0";
- if (GET_EXT_VERSION("bonus") >= "0.4.4") $ADD = ", bonus_ref, bonus_order, bonus_stats";
+ $add = ", 0, 0, 0";
+ if (GET_EXT_VERSION("bonus") >= "0.4.4") $add = ", bonus_ref, bonus_order, bonus_stats";
// Load data
- $result = SQL_QUERY_ESC("SELECT login_bonus, turbo_bonus".$ADD." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT login_bonus, turbo_bonus".$add." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
array(getUserId()), __FILE__, __LINE__);
// We don't add this points now. This will be done after each month
$valid_recipient = (REQUEST_POST('to_uid') > 0);
// Check for nickname extension and set additional data
- $nick = false; $ADD = ", userid";
+ $nick = false; $add = ", userid";
if (EXT_IS_ACTIVE("nickname")) {
- $ADD = ", nickname";
+ $add = ", nickname";
$nick = true;
}
// Re-check receivers and own personal data
- $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email".$ADD." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid IN ('%s','%s') AND `status`='CONFIRMED' ORDER BY userid LIMIT 2",
+ $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email".$add." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid IN ('%s','%s') AND `status`='CONFIRMED' ORDER BY userid LIMIT 2",
array(getUserId(), bigintval(REQUEST_POST('to_uid'))), __FILE__, __LINE__);
$valid_data = (SQL_NUMROWS($result) == 2);
$USED = $DATA[7] * GET_PAY_POINTS($DATA[3]);
// Update used points
- $ADD = "";
- if (getConfig('order_max_full') == "ORDER") $ADD = ", mail_orders=mail_orders+1";
+ $add = "";
+ if (getConfig('order_max_full') == "ORDER") $add = ", mail_orders=mail_orders+1";
SUB_POINTS("order", getUserId(), $USED);
// Prepare content
} // END - if
// Add more bonus points here
- $ADD = "";
- if (getConfig('bonus_click_yn') == "Y") $ADD .= " + turbo_bonus";
- if (getConfig('bonus_login_yn') == "Y") $ADD .= " + login_bonus";
- if (getConfig('bonus_order_yn') == "Y") $ADD .= " + bonus_order";
- if (getConfig('bonus_stats_yn') == "Y") $ADD .= " + bonus_stats";
- if (getConfig('bonus_ref_yn') == "Y") $ADD .= " + bonus_ref";
+ $add = "";
+ if (getConfig('bonus_click_yn') == "Y") $add .= " + turbo_bonus";
+ if (getConfig('bonus_login_yn') == "Y") $add .= " + login_bonus";
+ if (getConfig('bonus_order_yn') == "Y") $add .= " + bonus_order";
+ if (getConfig('bonus_stats_yn') == "Y") $add .= " + bonus_stats";
+ if (getConfig('bonus_ref_yn') == "Y") $add .= " + bonus_ref";
// Shall we add some entries?
- if (!empty($ADD)) {
- $whereStatement1 .= " AND (0".$ADD.") > 0";
+ if (!empty($add)) {
+ $whereStatement1 .= " AND (0".$add.") > 0";
} // END - if
// Run SQL string to check for accounts
- $result_main = SQL_QUERY_ESC("SELECT userid, email, gender, surname, family, (0".$ADD.") AS points
+ $result_main = SQL_QUERY_ESC("SELECT userid, email, gender, surname, family, (0".$add.") AS points
FROM `{!_MYSQL_PREFIX!}_user_data`
-".$whereStatement1."".$ADD."
+".$whereStatement1."".$add."
ORDER BY points DESC, userid
LIMIT %s",
array($whereStatement2), __FILE__, __LINE__);
$ret = false;
// Look in all menus or only unlocked
- $ADD = "";
- if ((!IS_ADMIN()) && ($MODE != "admin")) $ADD = " AND `locked`='N'";
+ $add = "";
+ if ((!IS_ADMIN()) && ($MODE != "admin")) $add = " AND `locked`='N'";
//* DEBUG: */ echo __LINE__.":".$MODE."/".$act."/".$wht."*<br />\n";
if (($MODE != "admin") && ($UPDATE === true)) {
// Update guest or member menu
- $sql = SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_%s_menu` SET counter=counter+1 WHERE `action`='%s' AND `what`='%s'".$ADD." LIMIT 1",
+ $sql = SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_%s_menu` SET counter=counter+1 WHERE `action`='%s' AND `what`='%s'".$add." LIMIT 1",
array($MODE, $act, $wht), __FUNCTION__, __LINE__, false);
} elseif (($wht != "overview") && (!empty($wht))) {
// Other actions
- $sql = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND `what`='%s'".$ADD." ORDER BY action DESC LIMIT 1",
+ $sql = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND `what`='%s'".$add." ORDER BY action DESC LIMIT 1",
array($MODE, $act, $wht), __FUNCTION__, __LINE__, false);
} else {
// Admin login overview
- $sql = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND (what='' OR `what` IS NULL)".$ADD." ORDER BY action DESC LIMIT 1",
+ $sql = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND (what='' OR `what` IS NULL)".$add." ORDER BY action DESC LIMIT 1",
array($MODE, $act), __FUNCTION__, __LINE__, false);
}
function GET_USER_REF_POINTS ($uid, $level) {
//* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
// Default is no refs and no nickname
- $ADD = "";
+ $add = "";
$refs = array();
// Do we have nickname extension installed?
if (EXT_IS_ACTIVE("nickname")) {
- $ADD = ", ud.nickname";
+ $add = ", ud.nickname";
} // END - if
// Get refs from database
- $result = SQL_QUERY_ESC("SELECT ur.id, ur.refid, ud.status, ud.last_online, ud.mails_confirmed, ud.emails_received".$ADD."
+ $result = SQL_QUERY_ESC("SELECT ur.id, ur.refid, ud.status, ud.last_online, ud.mails_confirmed, ud.emails_received".$add."
FROM `{!_MYSQL_PREFIX!}_user_refs` AS ur
LEFT JOIN `{!_MYSQL_PREFIX!}_user_points` AS up
ON ur.refid=up.userid AND ur.level=0
// Do we have send maximum mails?
elseif (($GLOBALS['pool_cnt'] >= getConfig('max_send')) || ($cnt2 >= getConfig('max_send'))) {
// There are some mails left to send for next round, so we reset the status back to NEW (=still not fully delivered)
- $ADD = "";
- if ($GLOBALS['pool_cnt'] <= $DATA[8]) $ADD = ", target_send=target_send-".$GLOBALS['pool_cnt'];
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='NEW', receivers='%s'".$ADD." WHERE id=%s LIMIT 1",
+ $add = "";
+ if ($GLOBALS['pool_cnt'] <= $DATA[8]) $add = ", target_send=target_send-".$GLOBALS['pool_cnt'];
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='NEW', receivers='%s'".$add." WHERE id=%s LIMIT 1",
array(implode(";", $dummy), bigintval($DATA[0])), __FILE__, __LINE__);
//* DEBUG: */ echo"*EXIT/L:".__LINE__."*<br />";