From f03cb5d87e69bb2efc885b5c5f5f3026b24c06f6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 9 Mar 2009 08:47:38 +0000 Subject: [PATCH] Even more variables renamed and login procedure prepared for filter --- inc/extensions/ext-rallye.php | 4 +- inc/filters.php | 6 +- inc/functions.php | 8 +- inc/libs/admins_functions.php | 20 ++--- inc/libs/bonus_functions.php | 8 +- inc/libs/doubler_functions.php | 6 +- inc/libs/html_mail_functions.php | 37 ++++----- inc/libs/newsletter_functions.php | 10 +-- inc/libs/rallye_functions.php | 22 ++--- inc/libs/refback_functions.php | 6 +- inc/libs/surfbar_functions.php | 34 ++++---- inc/libs/user_functions.php | 83 ++++++++++--------- inc/load_extensions.php | 8 +- inc/loader/load_cache-admin.php | 4 +- inc/mails/beg_mails.php | 6 +- inc/mails/birthday_mails.php | 6 +- inc/mails/bonus_mails.php | 6 +- inc/modules/admin/admin-inc.php | 4 +- inc/modules/admin/overview-inc.php | 8 +- inc/modules/admin/what-edit_user.php | 6 +- inc/modules/admin/what-email_details.php | 6 +- inc/modules/admin/what-list_notifications.php | 4 +- inc/modules/admin/what-updates.php | 4 +- inc/modules/chk_login.php | 6 +- inc/modules/guest/what-active.php | 6 +- inc/modules/guest/what-login.php | 2 +- inc/modules/member/what-order.php | 24 +++--- inc/modules/member/what-points.php | 12 +-- inc/modules/member/what-transfer.php | 6 +- inc/modules/order.php | 4 +- inc/monthly/monthly_bonus.php | 20 ++--- inc/mysql-manager.php | 16 ++-- inc/pool/pool-user.php | 6 +- 33 files changed, 205 insertions(+), 203 deletions(-) diff --git a/inc/extensions/ext-rallye.php b/inc/extensions/ext-rallye.php index f11e1654a0..95890d4f40 100644 --- a/inc/extensions/ext-rallye.php +++ b/inc/extensions/ext-rallye.php @@ -331,14 +331,14 @@ default: // Do stuff when extension is loaded // 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 diff --git a/inc/filters.php b/inc/filters.php index 6ec29093ff..d0c4398d6e 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -68,11 +68,11 @@ function INIT_FILTER_SYSTEM () { // 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__); diff --git a/inc/functions.php b/inc/functions.php index 1dc08094e8..a515308c03 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2172,7 +2172,7 @@ function genScrambleString ($len) { // normally be stored in cookies function ADD_URL_DATA ($URL) { // Init add - $ADD = ""; + $add = ""; // Determine URL binder $BIND = "?"; @@ -2182,15 +2182,15 @@ function ADD_URL_DATA ($URL) { // 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 diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index eed4dec958..cb34ef32ef 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -173,13 +173,13 @@ function ADMINS_CHANGE_ADMIN_ACCOUNT($POST) { // 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(); @@ -195,7 +195,7 @@ function ADMINS_CHANGE_ADMIN_ACCOUNT($POST) { 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); @@ -209,7 +209,7 @@ function ADMINS_CHANGE_ADMIN_ACCOUNT($POST) { 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' @@ -224,7 +224,7 @@ WHERE id=%s LIMIT 1", } 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", @@ -398,14 +398,14 @@ function ADMINS_LIST_ADMIN_ACCOUNTS() { } // 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; } // diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php index 8b4e6c3a93..20b488369a 100644 --- a/inc/libs/bonus_functions.php +++ b/inc/libs/bonus_functions.php @@ -213,8 +213,8 @@ function BONUS_POINTS_HANDLER ($MODE) { 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 @@ -223,8 +223,8 @@ function BONUS_POINTS_HANDLER ($MODE) { 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 { diff --git a/inc/libs/doubler_functions.php b/inc/libs/doubler_functions.php index b74fc45874..a6b0d51594 100644 --- a/inc/libs/doubler_functions.php +++ b/inc/libs/doubler_functions.php @@ -46,10 +46,10 @@ if (!defined('__SECURITY')) { // @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 { @@ -72,7 +72,7 @@ function DOUBLER_GENERATE_TABLE ($uid="0", $done='N', $ref='N', $sort="ASC") { // 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__); diff --git a/inc/libs/html_mail_functions.php b/inc/libs/html_mail_functions.php index 7f607f7e2f..d7273b0627 100644 --- a/inc/libs/html_mail_functions.php +++ b/inc/libs/html_mail_functions.php @@ -97,25 +97,22 @@ function HTML_INSERT_URLS ($text) { // ... 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)); @@ -123,18 +120,16 @@ function HTML_INSERT_URLS ($text) { // 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); } @@ -145,25 +140,25 @@ function HTML_INSERT_URLS ($text) { // 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
-s and finally compile possible own HTML tags out... return COMPILE_CODE(str_replace("\n", "
\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); } } + // ?> diff --git a/inc/libs/newsletter_functions.php b/inc/libs/newsletter_functions.php index ee7663e7aa..ba15c4c4c2 100644 --- a/inc/libs/newsletter_functions.php +++ b/inc/libs/newsletter_functions.php @@ -153,23 +153,23 @@ function NL_INSERT_URLS ($text) { } // -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"); } } } diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index 8587a35e58..5f83e14adb 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -254,15 +254,15 @@ LIMIT 1", array(bigintval($content['userid']), getConfig('ref_payout')), __FUNCT // 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; @@ -335,7 +335,7 @@ function RALLYE_EXPIRE_RALLYES ($result) { $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 @@ -351,11 +351,11 @@ LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__); // 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; @@ -594,20 +594,20 @@ function RALLYE_LIST_WINNERS ($rallye, $default=0) { } // Add row - $ADD = ""; + $add = ""; $OUT .= " -   ".($idx+1).". - "; +   ".($idx+1).". + "; if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= ""; $OUT .= $DATA['uid'][$idx]; if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= ""; $OUT .= " - "; + "; if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= ""; $OUT .= $DATA['ref'][$idx]; if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= ""; $OUT .= " - "; + "; if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= ""; $OUT .= $DATA['infos'][$idx]; if (($DATA['uid'][$idx] == $default) && ($default > 0)) $OUT .= ""; diff --git a/inc/libs/refback_functions.php b/inc/libs/refback_functions.php index 426dabc124..6aa46577df 100644 --- a/inc/libs/refback_functions.php +++ b/inc/libs/refback_functions.php @@ -270,16 +270,16 @@ function UPDATE_REFBACK_TABLE ($uid) { function GET_USER_REFS ($uid, $level) { //* DEBUG: */ print "----------------------- ".__FUNCTION__." - ENTRY ------------------------