]> git.mxchange.org Git - mailer.git/commitdiff
'userid' rewritten to functions
authorRoland Häder <roland@mxchange.org>
Fri, 6 Mar 2009 22:24:46 +0000 (22:24 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 6 Mar 2009 22:24:46 +0000 (22:24 +0000)
44 files changed:
inc/databases.php
inc/filters.php
inc/functions.php
inc/libs/online_functions.php
inc/libs/primera_functions.php
inc/libs/refback_functions.php
inc/libs/surfbar_functions.php
inc/libs/user_functions.php
inc/libs/wernis_functions.php
inc/modules/chk_login.php
inc/modules/frametester.php
inc/modules/guest/what-login.php
inc/modules/guest/what-rallyes.php
inc/modules/member/what-beg.php
inc/modules/member/what-categories.php
inc/modules/member/what-doubler.php
inc/modules/member/what-holiday.php
inc/modules/member/what-html_mail.php
inc/modules/member/what-mydata.php
inc/modules/member/what-newsletter.php
inc/modules/member/what-nickname.php
inc/modules/member/what-order.php
inc/modules/member/what-payout.php
inc/modules/member/what-points.php
inc/modules/member/what-primera.php
inc/modules/member/what-rallyes.php
inc/modules/member/what-refback.php
inc/modules/member/what-reflinks.php
inc/modules/member/what-reflist.php
inc/modules/member/what-stats.php
inc/modules/member/what-support.php
inc/modules/member/what-themes.php
inc/modules/member/what-transfer.php
inc/modules/member/what-unconfirmed.php
inc/modules/member/what-welcome.php
inc/modules/member/what-wernis.php
inc/modules/order.php
inc/monthly/monthly_newsletter.php
inc/mysql-connect.php
inc/mysql-manager.php
inc/session-functions.php
inc/session.php
modules.php
surfbar.php

index 240174765f7914424da400fd2dd001c07b254128..33de9ab78ad047d081202fd51036c6f4d6cc556a 100644 (file)
@@ -90,7 +90,7 @@ $GLOBALS['replacer'] = array(
        'userid'  => "%uid%",           // User-ID
        'surname' => "%vorname%",       // Surname
        'family'  => "%nachname%",      // Family name
-       'gender'  => "%anrede%",        // Gender
+       'gender'  => "%anrede%",                // Gender
 );
 
 // One day
@@ -114,6 +114,9 @@ define('_ADD', (constant('_PRIME') * constant('_PRIME') / (pi() * getConfig('cod
 // Random number for e.g. the "cache-buster" used in OpenX script
 define('CACHE_BUSTER', mt_rand(1000000, 9999999));
 
+// CFG: DEBUG-SQL (if enabled and DEBUG_MODE is enabled all SQL queries will be logged to debug.log)
+define('DEBUG_SQL', false);
+
 // Extra title is empty by default
 $EXTRA_TITLE = "";
 
index 74d7c43e5df2d416a693964723b7291f9ffa0be3..901cf93a2f4f8adc69e800ca853f2aa7560dae5a 100644 (file)
@@ -457,11 +457,11 @@ function FILTER_UPDATE_LOGIN_DATA () {
        if (!IS_MEMBER()) return false;
 
        // Secure user ID
-       $GLOBALS['userid'] = bigintval(get_session('userid'));
+       setUserId(get_session('userid'));
 
        // Load last module and last online time
        $result = SQL_QUERY_ESC("SELECT last_module, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-               array($GLOBALS['userid']), __FUNCTION__, __LINE__);
+               array(getUserId()), __FUNCTION__, __LINE__);
 
        // Entry found?
        if (SQL_NUMROWS($result) == 1) {
@@ -485,7 +485,7 @@ function FILTER_UPDATE_LOGIN_DATA () {
 
                // Update last module / online time
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET last_module='%s', last_online=UNIX_TIMESTAMP(), REMOTE_ADDR='%s' WHERE userid=%s LIMIT 1",
-                       array($GLOBALS['what'], GET_REMOTE_ADDR(), $GLOBALS['userid']), __FUNCTION__, __LINE__);
+                       array($GLOBALS['what'], GET_REMOTE_ADDR(), getUserId()), __FUNCTION__, __LINE__);
        }  else {
                // Destroy session, we cannot update!
                destroy_user_session();
index 4545846423668f31b61935d1a004fa80c1cf823c..5cbf2877c8667a11e2f8af886f1d91e3f74f4207 100644 (file)
@@ -245,7 +245,7 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
        if ($template == "member_support_form") {
                // Support request of a member
                $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-                       array($GLOBALS['userid']), __FUNCTION__, __LINE__);
+                       array(getUserId()), __FUNCTION__, __LINE__);
 
                // Is content an array?
                if (is_array($content)) {
@@ -1257,7 +1257,7 @@ function generateRandomCodde ($length, $code, $uid, $DATA="") {
 
        // Add more additional data
        if (isSessionVariableSet('u_hash'))                     $data .= ":".get_session('u_hash');
-       if (isset($GLOBALS['userid']))                          $data .= ":".$GLOBALS['userid'];
+       if (isUserIdSet())                                                      $data .= ":".getUserId();
        if (isSessionVariableSet('mxchange_theme'))             $data .= ":".get_session('mxchange_theme');
        if (isSessionVariableSet('mx_lang'))                    $data .= ":".GET_LANGUAGE();
        if (isset($GLOBALS['refid']))                                   $data .= ":".$GLOBALS['refid'];
@@ -3521,6 +3521,31 @@ function shutdown () {
        exit;
 }
 
+// Setter for userid
+function setUserId ($userid) {
+       $GLOBALS['userid'] = bigintval($userid);
+}
+
+// Getter for userid or returns zero
+function getUserId () {
+       // Default userid
+       $userid = 0;
+
+       // Is the userid set?
+       if (isUserIdSet()) {
+               // Then use it
+               $userid = $GLOBALS['userid'];
+       } // END - if
+
+       // Return it
+       return $userid;
+}
+
+// Checks ether the userid is set
+function isUserIdSet () {
+       return (isset($GLOBALS['userid']));
+}
+
 //////////////////////////////////////////////////
 // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
 //////////////////////////////////////////////////
index ae13a3a68d237477eeeeb3ff837904976c106dcf..da9d2fab2e10fcf31afef4054b86ac915f41ce82 100644 (file)
@@ -57,9 +57,9 @@ function FILTER_UPDATE_ONLINE_LIST () {
        $uid = 0; $rid = 0; $MEM = "N"; $ADMIN = "N";
 
        // Valid userid?
-       if ((!empty($GLOBALS['userid'])) && ($GLOBALS['userid'] > 0) && (IS_MEMBER())) {
+       if ((isUserIdSet()) && (getUserId() > 0) && (IS_MEMBER())) {
                // Is valid user
-               $uid = bigintval($GLOBALS['userid']);
+               $uid = getUserId();
                $MEM = "Y";
        } // END - if
 
index 04228a1cfe247eadfe50c9d2bb02916c4a895b98..0ca43bcfecf08d0937f1c4b793186238612b8f4b 100644 (file)
@@ -268,7 +268,7 @@ function PRIMERA_EXECUTE_PAYOUT ($primusNick, $userMd5, $amount) {
        $api = new PrimeraApi(getConfig('primera_api_name'), getConfig('primera_api_md5'));
 
        // Prepare purpose
-       $eval = "\$purpose = \"".COMPILE_CODE(sprintf(getMessage('PRIMERA_API_PURPOSE_PAYOUT'), $GLOBALS['userid']))."\";";
+       $eval = "\$purpose = \"".COMPILE_CODE(sprintf(getMessage('PRIMERA_API_PURPOSE_PAYOUT'), getUserId()))."\";";
        eval($eval);
 
        // Pay the Primera
index 2f85181857eb50affc0089a129dce69f0a84f467..2a3fe253f2bbd2ea42091598e8b37bbc2706452b 100644 (file)
@@ -315,7 +315,7 @@ function GET_USER_REF_ENTRY ($id) {
 
        // Get entry from database
        $result = SQL_QUERY_ESC("SELECT id, refid, refback, level FROM `{!_MYSQL_PREFIX!}_user_refs` WHERE id=%s AND userid=%s LIMIT 1",
-               array($id, $GLOBALS['userid']), __FUNCTION__, __LINE__);
+               array($id, getUserId()), __FUNCTION__, __LINE__);
 
        // Is there an entry?
        if (SQL_NUMROWS($result) == 1) {
@@ -367,7 +367,7 @@ function REFBACK_CHANGE_MEMBER_PERCENTS ($id, $percents) {
 
        // Update entry
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_refs` SET refback='%s' WHERE id=%s AND userid=%s LIMIT 1",
-               array($percents, $id, $GLOBALS['userid']), __FUNCTION__, __LINE__);
+               array($percents, $id, getUserId()), __FUNCTION__, __LINE__);
 
        // Entry updated?
        if (SQL_AFFECTEDROWS() < 1) {
@@ -384,13 +384,13 @@ function REFBACK_CHANGE_MEMBER_PERCENTS ($id, $percents) {
        );
 
        // Load member email template
-       $mail = LOAD_EMAIL_TEMPLATE("member_refback", $content, $GLOBALS['userid']);
+       $mail = LOAD_EMAIL_TEMPLATE("member_refback", $content, getUserId());
 
        // Send email to user
        SEND_EMAIL($dummy['refid'], getMessage('MEMBER_REFBACK_SUBJECT'), $mail);
 
        // Send admin notification
-       SEND_ADMIN_NOTIFICATION(getMessage('ADMIN_REFBACK_SUBJECT'), "admin_refback", $content, $GLOBALS['userid']);
+       SEND_ADMIN_NOTIFICATION(getMessage('ADMIN_REFBACK_SUBJECT'), "admin_refback", $content, getUserId());
 
        // All fine!
        $status['ok'] = true;
index 16c42e90dfa689e20dc1bd96e933a2a657db556f..59f05041cc449baa836f133164bf592fc285a955 100644 (file)
@@ -158,10 +158,10 @@ function SURFBAR_MEMBER_ADD_URL ($url, $limit) {
        } elseif (!VALIDATE_URL($url)) {
                // URL invalid
                return false;
-       } elseif (SURFBAR_LOOKUP_BY_URL($url, $GLOBALS['userid'])) {
+       } elseif (SURFBAR_LOOKUP_BY_URL($url, getUserId())) {
                // URL already found in surfbar!
                return false;
-       } elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS($GLOBALS['userid'])) {
+       } elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS(getUserId())) {
                // No more allowed!
                return false;
        } elseif ("".($limit + 0)."" != "".$limit."") {
@@ -170,7 +170,7 @@ function SURFBAR_MEMBER_ADD_URL ($url, $limit) {
        }
 
        // Register the new URL
-       return SURFBAR_REGISTER_URL($url, $GLOBALS['userid'], "PENDING", "reg", array('limit' => $limit));
+       return SURFBAR_REGISTER_URL($url, getUserId(), "PENDING", "reg", array('limit' => $limit));
 }
 // Create list of actions depending on status for the user
 function SURFBAR_MEMBER_ACTIONS ($urlId, $status) {
@@ -809,7 +809,7 @@ INNER JOIN `{!_MYSQL_PREFIX!}_surfbar_urls` AS u
 ON u.id=l.url_id
 WHERE l.userid=%s AND (UNIX_TIMESTAMP() - ".SURFBAR_GET_SURF_LOCK().") < UNIX_TIMESTAMP(l.last_surfed) AND (((UNIX_TIMESTAMP(l.last_surfed) - u.fixed_reload) < 0 AND u.fixed_reload > 0) OR u.fixed_reload = 0)
 LIMIT 1",
-               array($GLOBALS['userid']), __FUNCTION__, __LINE__
+               array(getUserId()), __FUNCTION__, __LINE__
        );
 
        // Fetch row
@@ -871,7 +871,7 @@ function SURFBAR_GET_TOTAL_USER_URLS ($uid=0, $status="",$exclude="") {
        // Is the user 0 and user is logged in?
        if (($uid == 0) && (IS_MEMBER())) {
                // Then use this userid
-               $uid = $GLOBALS['userid'];
+               $uid = getUserId();
        } elseif ($uid == 0) {
                // Error!
                return (getConfig('surfbar_max_order') + 1);
@@ -938,7 +938,7 @@ function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") {
                }
 
                // ... and now the validation code
-               $valCode = generateRandomCodde($length, sha1(SURFBAR_GET_SALT().":".$urlId), $GLOBALS['userid']);
+               $valCode = generateRandomCodde($length, sha1(SURFBAR_GET_SALT().":".$urlId), getUserId());
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "valCode={$valCode}", false);
        } // END - while
 
@@ -971,11 +971,11 @@ function SURFBAR_LOCKDOWN_ID ($urlId) {
        ///* DEBUG: */ return;
        // Just add it to the database
        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_surfbar_locks` (userid, url_id) VALUES (%s, %s)",
-               array($GLOBALS['userid'], bigintval($urlId)), __FUNCTION__, __LINE__);
+               array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__);
 
        // Remove the salt from database
        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_surfbar_salts` WHERE url_id=%s AND userid=%s LIMIT 1",
-               array(bigintval($urlId), $GLOBALS['userid']), __FUNCTION__, __LINE__);
+               array(bigintval($urlId), getUserId()), __FUNCTION__, __LINE__);
 }
 // Pay points to the user and remove it from the sender if userid is given else it is a "sponsored surf"
 function SURFBAR_PAY_POINTS () {
@@ -986,8 +986,8 @@ function SURFBAR_PAY_POINTS () {
        } // END - if
 
        // Book it to the user
-       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "uid=".$GLOBALS['userid'].",reward=".SURFBAR_GET_REWARD()."", false);
-       ADD_POINTS_REFSYSTEM(sprintf("surfbar_%s", getConfig('surfbar_pay_model')), $GLOBALS['userid'], SURFBAR_GET_DATA('reward'));
+       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "uid=".getUserId().",reward=".SURFBAR_GET_REWARD()."", false);
+       ADD_POINTS_REFSYSTEM(sprintf("surfbar_%s", getConfig('surfbar_pay_model')), getUserId(), SURFBAR_GET_DATA('reward'));
 }
 // Updates the statistics of current URL/userid
 function SURFBAR_UPDATE_INSERT_STATS_RECORD () {
@@ -1009,13 +1009,13 @@ function SURFBAR_UPDATE_INSERT_STATS_RECORD () {
 
        // Update the stats entry
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_stats` SET count=count+1 WHERE userid=%s AND url_id=%s LIMIT 1",
-               array($GLOBALS['userid'], SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
+               array(getUserId(), SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
 
        // Was that update okay?
        if (SQL_AFFECTEDROWS() < 1) {
                // No, then insert entry
                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_surfbar_stats` (userid,url_id,count) VALUES (%s,%s,1)",
-                       array($GLOBALS['userid'], SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
+                       array(getUserId(), SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
        } // END - if
 
        // Update total/daily/weekly/monthly counter
@@ -1034,16 +1034,16 @@ function SURFBAR_UPDATE_SALT_STATS () {
 
        // Simply store the salt from cache away in database...
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_salts` SET last_salt='%s' WHERE url_id=%s AND userid=%s LIMIT 1",
-               array(SURFBAR_GET_SALT(), SURFBAR_GET_ID(), $GLOBALS['userid']), __FUNCTION__, __LINE__);
+               array(SURFBAR_GET_SALT(), SURFBAR_GET_ID(), getUserId()), __FUNCTION__, __LINE__);
 
        // Debug message
-       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "salt=".SURFBAR_GET_SALT().",id=".SURFBAR_GET_ID().",uid=".$GLOBALS['userid']."", false);
+       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "salt=".SURFBAR_GET_SALT().",id=".SURFBAR_GET_ID().",uid=".getUserId()."", false);
 
        // Was that okay?
        if (SQL_AFFECTEDROWS() < 1) {
                // Insert missing entry!
                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_surfbar_salts` (url_id,userid,last_salt) VALUES (%s, %s, '%s')",
-                       array(SURFBAR_GET_ID(), $GLOBALS['userid'], SURFBAR_GET_SALT()), __FUNCTION__, __LINE__);
+                       array(SURFBAR_GET_ID(), getUserId(), SURFBAR_GET_SALT()), __FUNCTION__, __LINE__);
        } // END - if
 
        // Debug message
@@ -1061,7 +1061,7 @@ FROM `{!_MYSQL_PREFIX!}_surfbar_locks`
 WHERE userid=%s AND url_id=%s AND (UNIX_TIMESTAMP() - ".SURFBAR_GET_SURF_LOCK().") < UNIX_TIMESTAMP(last_surfed)
 ORDER BY last_surfed ASC
 LIMIT 1",
-               array($GLOBALS['userid'], bigintval($urlId)), __FUNCTION__, __LINE__
+               array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__
        );
 
        // Fetch counter
@@ -1086,9 +1086,9 @@ function SURFBAR_DETERMINE_DEPLETED_USERIDS ($limit=0) {
        // Do we have a current user id?
        if ((IS_MEMBER()) && ($limit == 0)) {
                // Then add this as well
-               $UIDs['uid'][$GLOBALS['userid']]      = $GLOBALS['userid'];
-               $UIDs['points'][$GLOBALS['userid']]   = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
-               $UIDs['notified'][$GLOBALS['userid']] = 0;
+               $UIDs['uid'][getUserId()]      = getUserId();
+               $UIDs['points'][getUserId()]   = GET_TOTAL_DATA(getUserId(), "user_points", "points") - GET_TOTAL_DATA(getUserId(), "user_data", "used_points");
+               $UIDs['notified'][getUserId()] = 0;
 
                // Get all userid except logged in one
                $result = SQL_QUERY_ESC("SELECT u.userid, UNIX_TIMESTAMP(d.surfbar_low_notified) AS notified
@@ -1098,7 +1098,7 @@ ON u.userid=d.userid
 WHERE u.userid NOT IN (%s,0) AND u.`status`='ACTIVE'
 GROUP BY u.userid
 ORDER BY u.userid ASC",
-                       array($GLOBALS['userid']), __FUNCTION__, __LINE__);
+                       array(getUserId()), __FUNCTION__, __LINE__);
        } else {
                // Get all userid
                $result = SQL_QUERY("SELECT u.userid, UNIX_TIMESTAMP(d.surfbar_low_notified) AS notified
@@ -1130,7 +1130,7 @@ ORDER BY u.userid ASC", __FUNCTION__, __LINE__);
        SQL_FREERESULT($result);
 
        // Debug message
-       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "UIDs::count=".count($UIDs)." (with own userid=".$GLOBALS['userid'].")", false);
+       //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "UIDs::count=".count($UIDs)." (with own userid=".getUserId().")", false);
 
        // Return result
        return $UIDs;
@@ -1320,7 +1320,7 @@ FROM
 WHERE
        userid=%s
 ORDER BY
-       id ASC", array($GLOBALS['userid']),
+       id ASC", array(getUserId()),
                __FUNCTION__, __LINE__);
 
        // Load all entries
@@ -1393,7 +1393,7 @@ function SURFBAR_GET_USER_URLS () {
 FROM `{!_MYSQL_PREFIX!}_surfbar_urls` AS u
 WHERE u.userid=%s AND u.status != 'DELETED'
 ORDER BY u.id ASC",
-               array($GLOBALS['userid']), __FUNCTION__, __LINE__);
+               array(getUserId()), __FUNCTION__, __LINE__);
 
        // Are there entries?
        if (SQL_NUMROWS($result) > 0) {
@@ -1508,7 +1508,7 @@ LEFT JOIN `{!_MYSQL_PREFIX!}_surfbar_locks` AS l
 ON sbu.id=l.url_id
 WHERE sbu.userid != %s AND sbu.`status`='ACTIVE' AND sbu.id=%s AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0))
 LIMIT 1",
-                       array($GLOBALS['userid'], bigintval($urlId)), __FUNCTION__, __LINE__
+                       array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__
                );
        }
 
index 95200502da5d21970edc5bd03620e751d44b7208..d5db1536f0b17bf9e3249ed5120891ca7ebd3573 100644 (file)
@@ -333,7 +333,7 @@ function USER_DO_LOGIN ($uid, $passwd) {
 
                        // Update global array
                        // @TODO Make this filter working: $URL = runFilterChain('do_login', array('uid' => $uid, 'hash' => $hash, 'addon' => $ADDON));
-                       $GLOBALS['userid'] = $uid;
+                       setUserId($uid);
 
                        // Try to set session data (which shall normally always work!)
                        if ((set_session('userid', $uid )) && (set_session('u_hash', $hash))) {
index 7d6f157c3b2f2b9c7efacd260867987fbd1fcd14..6febd51f6f050a9060bc91969a89f6f12bd4a2b1 100644 (file)
@@ -226,7 +226,7 @@ function WERNIS_EXECUTE_WITHDRAW ($wdsId, $userMd5, $amount) {
        $result = false;
 
        // Prepare the purpose
-       $eval = "\$purpose = \"".COMPILE_CODE(sprintf(WERNIS_API_PURPOSE_WITHDRAW, $GLOBALS['userid']))."\";";
+       $eval = "\$purpose = \"".COMPILE_CODE(sprintf(WERNIS_API_PURPOSE_WITHDRAW, getUserId()))."\";";
        eval($eval);
 
        // Prepare the request data
@@ -267,7 +267,7 @@ function WERNIS_EXECUTE_PAYOUT ($wdsId, $amount) {
        $result = false;
 
        // Prepare the purpose
-       $eval = "\$purpose = \"".COMPILE_CODE(sprintf(getMessage('WERNIS_API_PURPOSE_PAYOUT'), $GLOBALS['userid']))."\";";
+       $eval = "\$purpose = \"".COMPILE_CODE(sprintf(getMessage('WERNIS_API_PURPOSE_PAYOUT'), getUserId()))."\";";
        eval($eval);
 
        // Prepare the request data
@@ -327,7 +327,7 @@ function WERNIS_TRANSFER_STATUS ($status) {
 function WERNIS_LOG_TRANSFER ($wdsId, $amount, $type = 'FAILED', $message = "", $status = "") {
        // Register this wernis movement
        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_wernis` (`userid`, `wernis_account`, `wernis_amount`, `wernis_timestamp`, `wernis_type`, `wernis_api_message`, `wernis_api_status`) VALUES (%d, %d, %d, UNIX_TIMESTAMP(), '%s', '%s', '%s')",
-               array($GLOBALS['userid'], bigintval($wdsId), bigintval($amount), $type, $message, $status), __FUNCTION__, __LINE__);
+               array(getUserId(), bigintval($wdsId), bigintval($amount), $type, $message, $status), __FUNCTION__, __LINE__);
 }
 
 // Take fees and factor
@@ -336,7 +336,7 @@ function WERNIS_TAKE_FEE ($points, $mode) {
        //* DEBUG: */ echo "mode={$mode},points={$points}<br />\n";
        if (!in_array($mode, array('payout', 'withdraw'))) {
                // Log error and abort
-               DEBUG_LOG(__FUNCTION__, __LINE__, "uid={$GLOBALS['userid']},mode={$mode},points={$points}");
+               DEBUG_LOG(__FUNCTION__, __LINE__, "uid={getUserId()},mode={$mode},points={$points}");
                return false;
        } // END - if
 
index 2fe52f798660309a1cf46b857e7bbcbe921f9d1e..a2bce2d724edc4e37c399e4b03db5566581d036a 100644 (file)
@@ -45,7 +45,7 @@ if (!defined('__SECURITY')) {
 // Initial message part
 $MSG = "<strong>{--VALIDATING_LOGIN--}</strong>";
 
-if (!empty($GLOBALS['userid']) && (isSessionVariableSet('u_hash'))) {
+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 = "";
@@ -56,7 +56,7 @@ if (!empty($GLOBALS['userid']) && (isSessionVariableSet('u_hash'))) {
 
        // Get theme from profile
        $result = SQL_QUERY_ESC("SELECT curr_theme".$ADD." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-               array($GLOBALS['userid']), __FILE__, __LINE__);
+               array(getUserId()), __FILE__, __LINE__);
 
        // Load data
        $data = SQL_FETCHARRAY($result);
@@ -74,7 +74,7 @@ if (!empty($GLOBALS['userid']) && (isSessionVariableSet('u_hash'))) {
 SET login_failures=0, last_failure='0000-00-00 00:00:00'
 WHERE userid=%s
 LIMIT 1",
-                       array($GLOBALS['userid']), __FILE__, __LINE__);
+                       array(getUserId()), __FILE__, __LINE__);
 
                // Store it in session
                set_session('mxchange_member_failures', $data['login_failures']);
@@ -90,7 +90,7 @@ SET last_login=UNIX_TIMESTAMP()
 WHERE userid=%s AND last_login < (UNIX_TIMESTAMP() - %s)
 LIMIT 1",
                        array(
-                               $GLOBALS['userid'],
+                               getUserId(),
                                getConfig('login_timeout')
                        ), __FILE__, __LINE__
                );
index 2c3a21c3b45a1f79aaf01bc2026959c316232d74..62c94c0c62808c9f691c03a6b3227210cca26ef4 100644 (file)
@@ -49,7 +49,7 @@ if (REQUEST_ISSET_GET(('order'))) {
        if (IS_MEMBER()) {
                // Ok, test passed... :)
                $result = SQL_QUERY_ESC("SELECT subject, url FROM `{!_MYSQL_PREFIX!}_pool` WHERE id=%s AND sender=%s AND data_type='TEMP' LIMIT 1",
-                array(bigintval(REQUEST_GET('order')), $GLOBALS['userid']), __FILE__, __LINE__);
+                array(bigintval(REQUEST_GET('order')), getUserId()), __FILE__, __LINE__);
 
                // Finally is the entry valid?
                if (SQL_NUMROWS($result) == 1) {
index e8b3dfc6a9206d1c33318f01348ad774892f45ef..2233e0c499e8017bf3b5cf23f5323bde8e205c9f 100644 (file)
@@ -60,9 +60,9 @@ $URL = "";
 $ADD = "";
 
 // Already logged in?
-if ((!empty($GLOBALS['userid'])) && (isSessionVariableSet('u_hash'))) {
+if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) {
        // Maybe, then continue with it
-       $uid = $GLOBALS['userid'];
+       $uid = getUserId();
 } elseif ((REQUEST_ISSET_POST(('id'))) && (REQUEST_ISSET_POST(('password'))) && (IS_FORM_SENT())) {
        // Set userid and crypt password when login data was submitted
        if ((EXT_IS_ACTIVE("nickname")) && (NICKNAME_PROBE_ON_USERID(REQUEST_POST('id')))) {
index 2b9946776e3ef3f4ac5ec1f8c9b2ba8255778bf9..24c935b45651774f39e8e43a9849f04f57cd4360 100644 (file)
@@ -116,7 +116,7 @@ if (SQL_NUMROWS($result) == 1)
                define('__RALLYE_CAN_WIN_THIS', RALLYE_OUR_WINNERS_ARE);
        } else {
                define('__RALLYE_PRICES', RALLYE_ADD_PRICES($id, "html"));
-               define('__RALLYE_TOP_USERS', RALLYE_ADD_TOPUSERS($id, $GLOBALS['userid']));
+               define('__RALLYE_TOP_USERS', RALLYE_ADD_TOPUSERS($id, getUserId()));
                define('__RALLYE_CAN_WIN_THIS', RALLYE_YOU_CAN_WIN);
        }
 
index 745076d1a8d4ad2b74857e2e0587b101a35bef16..262d49c39f9b73a44caf64fb4e1bc35b161ff675 100644 (file)
@@ -50,7 +50,7 @@ if (!defined('__SECURITY')) {
 // Add description as navigation point
 ADD_DESCR("member", __FILE__);
 
-$uid = $GLOBALS['userid'];
+$uid = getUserId();
 if (EXT_IS_ACTIVE("nickname"))
 {
        // Load nickname
@@ -72,7 +72,7 @@ SQL_FREERESULT($result);
 
 // Set User-ID when no nickname was found
 $nickname = true;
-if (empty($uid)) { $uid = $GLOBALS['userid']; $nickname = false; }
+if (empty($uid)) { $uid = getUserId(); $nickname = false; }
 
 // Prepare constants
 define('__BEG_UID'        , $uid);
index 032400dab4e8d9f508baa8cec11b9a41754938da..7db47413f43afe7ac2a0e87c6239b481979b8c48 100644 (file)
@@ -47,7 +47,7 @@ if (!defined('__SECURITY')) {
 // Add description as navigation point
 ADD_DESCR("member", __FILE__);
 
-$UID = $GLOBALS['userid'];
+$UID = getUserId();
 $whereStatement = " WHERE `visible`='Y'";
 if (IS_ADMIN()) $whereStatement = "";
 
index 25515d5a0b186c539fe2695059784fb741a8bbd5..978685023eb7e9aabaf57bcb5da707cd4d795045 100644 (file)
@@ -60,18 +60,18 @@ define('__MAX_VALUE'   , TRANSLATE_COMMA(getConfig('doubler_max')));
 // Transfer referal ID
 if (EXT_IS_ACTIVE("nickname")) {
        // Load nickname from DB
-       $nick = NICKNAME_GET_NICK($GLOBALS['userid']);
+       $nick = NICKNAME_GET_NICK(getUserId());
 
        if (!empty($nick)) {
                // Set nickname
                define('__USERID', $nick);
        } else {
                // Use direct userid
-               define('__USERID', $GLOBALS['userid']);
+               define('__USERID', getUserId());
        }
 } else {
        // Use direct userid
-       define('__USERID', $GLOBALS['userid']);
+       define('__USERID', getUserId());
 }
 
 // Usage counter
@@ -94,13 +94,13 @@ default:
 }
 
 // Generate table with already payed out doubles
-define('__DOUBLER_PAYOUT_HISTORY', DOUBLER_GENERATE_TABLE($GLOBALS['userid'], "Y", "N", "DESC"));
+define('__DOUBLER_PAYOUT_HISTORY', DOUBLER_GENERATE_TABLE(getUserId(), "Y", "N", "DESC"));
 
 // Generate table with next-to-run payouts
-define('__DOUBLER_PAYOUT_NEXT', DOUBLER_GENERATE_TABLE($GLOBALS['userid']));
+define('__DOUBLER_PAYOUT_NEXT', DOUBLER_GENERATE_TABLE(getUserId()));
 
 // Generate table with refferal payouts
-define('__DOUBLER_PAYOUT_REF', DOUBLER_GENERATE_TABLE($GLOBALS['userid'], "N", "Y", "DESC"));
+define('__DOUBLER_PAYOUT_REF', DOUBLER_GENERATE_TABLE(getUserId(), "N", "Y", "DESC"));
 
 // Generate timemark
 define('__TIMEOUT_MARK', CREATE_FANCY_TIME(getConfig('doubler_timeout')));
index 6ba67857b2c136364149c194c1c501f411668bfd..f12b75ecc8f1e275c68d0d5300d77730a0759e2e 100644 (file)
@@ -52,11 +52,11 @@ ADD_DESCR("member", __FILE__);
 
 // Check for running mail orders in pool
 $result1 = SQL_QUERY_ESC("SELECT timestamp FROM `{!_MYSQL_PREFIX!}_pool`
-WHERE sender=%s ORDER BY timestamp DESC LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
+WHERE sender=%s ORDER BY timestamp DESC LIMIT 1", array(getUserId()), __FILE__, __LINE__);
 
 // Check for sent mail orders in stats
 $result2 = SQL_QUERY_ESC("SELECT timestamp_ordered FROM `{!_MYSQL_PREFIX!}_user_stats`
-WHERE userid=%s ORDER BY timestamp_ordered DESC LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
+WHERE userid=%s ORDER BY timestamp_ordered DESC LIMIT 1", array(getUserId()), __FILE__, __LINE__);
 
 if ((SQL_NUMROWS($result1) == 1) || (SQL_NUMROWS($result2) == 1)) {
        // Mail order found!
@@ -102,13 +102,13 @@ if (IS_FORM_SENT())
        } else {
                // Everything went okay so let's store his request and send mails
                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_holidays` (userid, holiday_start, holiday_end, comments) VALUES ('%s','%s','%s','%s')",
-                array($GLOBALS['userid'], $START, $END, REQUEST_POST('comments')), __FILE__, __LINE__);
+                array(getUserId(), $START, $END, REQUEST_POST('comments')), __FILE__, __LINE__);
 
                // Activate holiday system
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
 SET holiday_active='N', holiday_activated=UNIX_TIMESTAMP()
 WHERE userid=%s LIMIT 1",
-                array($GLOBALS['userid']), __FILE__, __LINE__);
+                array(getUserId()), __FILE__, __LINE__);
 
                // Prepare constants
                define('_START_DAY'  , REQUEST_POST('start_day'));
@@ -119,15 +119,15 @@ WHERE userid=%s LIMIT 1",
                define('_END_YEAR'   , REQUEST_POST('end_year'));
 
                // Send mail to member
-               $msg = LOAD_EMAIL_TEMPLATE("member_holiday_request", REQUEST_POST('comments'), $GLOBALS['userid']);
-               SEND_EMAIL($GLOBALS['userid'], getMessage('HOLIDAY_MEMBER_SUBJECT'), $msg);
+               $msg = LOAD_EMAIL_TEMPLATE("member_holiday_request", REQUEST_POST('comments'), getUserId());
+               SEND_EMAIL(getUserId(), getMessage('HOLIDAY_MEMBER_SUBJECT'), $msg);
 
                // Send mail to all admins
-               SEND_ADMIN_NOTIFICATION(getMessage('HOLIDAY_ADMIN_SUBJECT'), "admin_holiday_request", REQUEST_POST('comments'), $GLOBALS['userid']);
+               SEND_ADMIN_NOTIFICATION(getMessage('HOLIDAY_ADMIN_SUBJECT'), "admin_holiday_request", REQUEST_POST('comments'), getUserId());
 
                // Create task
                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (userid, assigned_admin, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','HOLIDAY_REQUEST','{--HOLIDAY_ADMIN_SUBJECT--}','%s', UNIX_TIMESTAMP())",
-                array($GLOBALS['userid'], $msg), __FILE__, __LINE__);
+                array(getUserId(), $msg), __FILE__, __LINE__);
 
                // Display message
                LOAD_TEMPLATE("admin_settings_saved", false, getMessage('HOLIDAY_IS_ACTIVATED_NOW'));
@@ -139,7 +139,7 @@ if (REQUEST_ISSET_POST(('stop')))
 {
        // Okay, end the holiday here...
        $result = SQL_QUERY_ESC("SELECT holiday_active, holiday_activated FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
+WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
        list($active, $locked) = SQL_FETCHROW($result);
        SQL_FREERESULT($result);
 
@@ -147,7 +147,7 @@ WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
        {
                // Load data
                $result = SQL_QUERY_ESC("SELECT holiday_start, holiday_end FROM `{!_MYSQL_PREFIX!}_user_holidays`
-WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
+WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
                if (SQL_NUMROWS($result) == 1)
                {
                        // Data was found
@@ -161,14 +161,14 @@ WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
                        // Deactivate it now
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
 SET holiday_active='N', holiday_activated='0'
-WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
+WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
 
                        // Remove entry
                        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_holidays`
-WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
+WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
 
                        // Send email to admin
-                       SEND_ADMIN_NOTIFICATION(getMessage('HOLIDAY_ADMIN_DEAC_SUBJ'), "admin_holiday_deactivated", array(), $GLOBALS['userid']);
+                       SEND_ADMIN_NOTIFICATION(getMessage('HOLIDAY_ADMIN_DEAC_SUBJ'), "admin_holiday_deactivated", array(), getUserId());
 
                        // Display message to user
                        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('HOLIDAY_MEMBER_DEACTIVATED_NOW'));
@@ -187,7 +187,7 @@ if ((!IS_FORM_SENT()) && (!REQUEST_ISSET_POST(('stop'))))
 {
        // Check if user is in holiday...
        $result = SQL_QUERY_ESC("SELECT holiday_active, holiday_activated FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
+WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
        list($active, $locked) = SQL_FETCHROW($result);
        SQL_FREERESULT($result);
 
@@ -200,7 +200,7 @@ WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
                case "Y": // Display deactivation form
                        // Load starting and ending date
                        $result = SQL_QUERY_ESC("SELECT holiday_start, holiday_end FROM `{!_MYSQL_PREFIX!}_user_holidays`
-WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
+WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result) == 1)
                        {
                                // Data was found
@@ -223,7 +223,7 @@ WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
                                // Remove entry and reload URL
                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
 SET holiday_active='N'
-WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
+WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
                                LOAD_URL("modules.php?module=login&amp;what=holiday");
                                return;
                        }
index c527fbaea0fe8501671045c0aac53d589255e767..447e84c824941b440eba3c742c2078922c88fc78 100644 (file)
@@ -54,12 +54,12 @@ ADD_DESCR("member", __FILE__);
 if (IS_FORM_SENT()) {
        // Save settings
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET html='%s' WHERE userid=%s LIMIT 1",
-               array(REQUEST_POST('html'), $GLOBALS['userid']), __FILE__, __LINE__);
+               array(REQUEST_POST('html'), getUserId()), __FILE__, __LINE__);
        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('MEMBER_SETTINGS_SAVED'));
 } else {
        // Load template for changing settings
        $result = SQL_QUERY_ESC("SELECT html FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-               array($GLOBALS['userid']), __FILE__, __LINE__);
+               array(getUserId()), __FILE__, __LINE__);
        list($mode) = SQL_FETCHROW($result);
        SQL_FREERESULT($result);
 
index 2db92cb197e4b3ce6f37053a92b3327cef46d287..d29449aeb84842fd85c991cc2e47c445551ad4c1 100644 (file)
@@ -50,7 +50,7 @@ if (!defined('__SECURITY')) {
 // Add description as navigation point
 ADD_DESCR("member", __FILE__);
 
-define('UID_VALUE', $GLOBALS['userid']); $URL = "";
+define('UID_VALUE', getUserId()); $URL = "";
 
 // Detect what the member wants to do
 $MODE = "show"; // Show his data
@@ -294,7 +294,7 @@ array(
 
 case "notify": // Switch off notfication
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET notified='N', last_update=UNIX_TIMESTAMP() WHERE userid=%s LIMIT 1",
-               array($GLOBALS['userid']), __FILE__, __LINE__);
+               array(getUserId()), __FILE__, __LINE__);
        $URL = "modules.php?module=login&amp;what=welcome&amp;msg=".urlencode(getMessage('PROFILE_UPDATED'));
        break;
 }
index 6523244b3fb16b6e6f6a92e7bb684691049b6067..9ec4bd6cc6d824a0be4923949755ea2908700ee1 100644 (file)
@@ -52,7 +52,7 @@ ADD_DESCR("member", __FILE__);
 
 // Load status
 $result = SQL_QUERY_ESC("SELECT nl_receive, nl_until, nl_timespan FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-       array($GLOBALS['userid']), __FILE__, __LINE__);
+       array(getUserId()), __FILE__, __LINE__);
 list($status, $until, $span) = SQL_FETCHROW($result);
 SQL_FREERESULT($result);
 
@@ -62,21 +62,21 @@ define('__CHARGE_VALUE', TRANSLATE_COMMA(getConfig('nl_charge')));
 if ((IS_FORM_SENT()) && ($status == "Y") && ($span == "0")) {
        // Save request
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET nl_timespan='".(getConfig('one_day') * 30)."' WHERE userid=%s LIMIT 1",
-               array($GLOBALS['userid']), __FILE__, __LINE__);
+               array(getUserId()), __FILE__, __LINE__);
 
        // Load admin message
-       $admin_msg = LOAD_EMAIL_TEMPLATE("admin_newsletter_request", array(), $GLOBALS['userid']);
+       $admin_msg = LOAD_EMAIL_TEMPLATE("admin_newsletter_request", array(), getUserId());
 
        // Add task
        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (assigned_admin, status, task_type, subject, text, task_created, userid)
-VALUES ('0','NEW','NL_UNSUBSCRIBE','{--ADMIN_NL_SUBJECT--}','".$admin_msg."', UNIX_TIMESTAMP(),'%s')", array($GLOBALS['userid']), __FILE__, __LINE__);
+VALUES ('0','NEW','NL_UNSUBSCRIBE','{--ADMIN_NL_SUBJECT--}','".$admin_msg."', UNIX_TIMESTAMP(),'%s')", array(getUserId()), __FILE__, __LINE__);
 
        // Send mail to member
-       $msg = LOAD_EMAIL_TEMPLATE("member_newsletter_request", array(), $GLOBALS['userid']);
-       SEND_EMAIL($GLOBALS['userid'], getMessage('NL_MEMBER_SUBJECT'), $msg);
+       $msg = LOAD_EMAIL_TEMPLATE("member_newsletter_request", array(), getUserId());
+       SEND_EMAIL(getUserId(), getMessage('NL_MEMBER_SUBJECT'), $msg);
 
        // Send mail to all admins
-       SEND_ADMIN_NOTIFICATION(getMessage('NL_ADMIN_SUBJECT'), "admin_newsletter_request", array(), $GLOBALS['userid']);
+       SEND_ADMIN_NOTIFICATION(getMessage('NL_ADMIN_SUBJECT'), "admin_newsletter_request", array(), getUserId());
 
        // Display message
        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('NL_MEMBER_REQUEST_DONE'));
index ea5105ccf18521542ca5f8d488b052cd3238a310..e606f04eae14008d0c65a3923b7d6c5a39fff439 100644 (file)
@@ -66,25 +66,25 @@ if (IS_FORM_SENT()) {
 if ($VALID) {
        // Look for nickname in database (we only need just one entry so don't worry about the "LIMIT 1" !
        $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' AND userid != '%s' LIMIT 1",
-               array(REQUEST_POST('nickname'), $GLOBALS['userid']), __FILE__, __LINE__);
+               array(REQUEST_POST('nickname'), getUserId()), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 0) {
                // Nickname not in use, so set it now
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET nickname='%s' WHERE userid=%s LIMIT 1",
-                       array(REQUEST_POST('nickname'), $GLOBALS['userid']), __FILE__, __LINE__);
+                       array(REQUEST_POST('nickname'), getUserId()), __FILE__, __LINE__);
                $content = NICKNAME_SAVED;
        } else {
                // Free result
                SQL_FREERESULT($result);
 
                // Nickname already in use!
-               $content = NICKNAME_ALREADY_IN_USE;
+               $content = getMessage('NICKNAME_ALREADY_IN_USE');
        }
 
        // Load template
        LOAD_TEMPLATE("admin_settings_saved", false, $content);
 } else {
        // Load current nickname
-       define('__NICKNAME', NICKNAME_GET_NICK($GLOBALS['userid']));
+       define('__NICKNAME', NICKNAME_GET_NICK(getUserId()));
 
        // Do we have already submit the form?
        if (REQUEST_ISSET_POST(('nickname'))) {
index 1b7b283a805bca9cda0b9f4bebd54ce4d82f1160..c34720d1241adda533bf4cda433d8c3424ce811c 100644 (file)
@@ -64,7 +64,7 @@ if (IS_ADMIN()) $whereStatement = "";
 define('__MIN_VALUE', getConfig('order_min'));
 
 // Count unconfirmed mails
-$links = GET_TOTAL_DATA($GLOBALS['userid'], "user_links", "id", "userid", true);
+$links = GET_TOTAL_DATA(getUserId(), "user_links", "id", "userid", true);
 
 // Does the user has more than 0 mails per day set?
 $HOLIDAY = "userid";
@@ -76,7 +76,7 @@ if (GET_EXT_VERSION("holiday") >= "0.1.3") {
 $result_mmails = SQL_QUERY_ESC("SELECT userid, receive_mails, mail_orders, ".$HOLIDAY."
 FROM `{!_MYSQL_PREFIX!}_user_data`
 WHERE userid=%s AND max_mails > 0 LIMIT 1",
-       array($GLOBALS['userid']), __FILE__, __LINE__);
+       array(getUserId()), __FILE__, __LINE__);
 
 $mmails = SQL_NUMROWS($result_mmails);
 list($DMY, $MAXI, $ORDERS, $HOLIDAY) = SQL_FETCHROW($result_mmails);
@@ -87,7 +87,7 @@ $ALLOWED = $MAXI - $ORDERS;
 if (getConfig('order_max_full') == "MAX") $ALLOWED = $MAXI;
 
 // Now check his points amount
-$TOTAL = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "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!
@@ -99,7 +99,7 @@ if (($HOLIDAY == "Y") && (GET_EXT_VERSION("holiday") >= "0.1.3")) {
        $result = SQL_QUERY_ESC("SELECT id, data_type
 FROM `{!_MYSQL_PREFIX!}_pool`
 WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
-               array($GLOBALS['userid'], REQUEST_POST('url'), getConfig('url_tlock')), __FILE__, __LINE__);
+               array(getUserId(), REQUEST_POST('url'), getConfig('url_tlock')), __FILE__, __LINE__);
 
        $type = "TEMP"; $id = 0;
        if (SQL_NUMROWS($result) == 1) {
@@ -207,7 +207,7 @@ WHERE c.cat_id=%s AND c.userid != '%s' AND d.`status`='CONFIRMED' AND d.receive_
 ORDER BY d.%s %s",
  array(
        bigintval(REQUEST_POST('cat')),
-       $GLOBALS['userid'],
+       getUserId(),
        getConfig('order_select'),
        getConfig('order_mode'),
  ), __FILE__, __LINE__);
@@ -276,7 +276,7 @@ WHERE userid=%s AND holiday_start < UNIX_TIMESTAMP() AND holiday_end > UNIX_TIME
                                                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_pool` (sender, subject, text, receivers, payment_id, data_type, timestamp, url, cat_id, target_send, zip, html_msg)
  VALUES ('%s','%s','%s','%s','%s','TEMP','%s','%s','%s','%s','%s','%s')",
 array(
-       $GLOBALS['userid'],
+       getUserId(),
        REQUEST_POST('subject'),
        REQUEST_POST('text'),
        $RECEIVER,
@@ -293,7 +293,7 @@ array(
                                                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_pool` (sender, subject, text, receivers, payment_id, data_type, timestamp, url, cat_id, target_send, zip)
  VALUES ('%s','%s','%s','%s','%s','TEMP','%s','%s','%s','%s','%s')",
 array(
-       $GLOBALS['userid'],
+       getUserId(),
        REQUEST_POST('subject'),
        REQUEST_POST('text'),
        $RECEIVER,
@@ -365,7 +365,7 @@ array(
                                        // Order is placed as temporary. We need to get it's id for the frametester
                                        $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_pool` WHERE sender=%s AND subject='%s' AND payment_id=%s AND data_type='TEMP' AND timestamp=%s LIMIT 1",
                                        array(
-                                               $GLOBALS['userid'],
+                                               getUserId(),
                                                REQUEST_POST('subject'),
                                                bigintval(REQUEST_POST('type')),
                                                $TIME
@@ -422,7 +422,7 @@ array(
 
                                // Select users in current category
                                $result_uids = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE cat_id=%s AND userid != '%s' ORDER BY userid",
-                                       array(bigintval($content['id']), $GLOBALS['userid']), __FILE__, __LINE__);
+                                       array(bigintval($content['id']), getUserId()), __FILE__, __LINE__);
 
                                $uid_cnt = 0;
                                while (list($ucat) = SQL_FETCHROW($result_uids)) {
@@ -602,7 +602,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
 
                                // Check if we already have an order placed and make it editable
                                $result = SQL_QUERY_ESC("SELECT subject, text, payment_id, timestamp, url, target_send, cat_id, zip FROM `{!_MYSQL_PREFIX!}_pool` WHERE sender=%s AND data_type='TEMP' LIMIT 1",
-                                array($GLOBALS['userid']), __FILE__, __LINE__);
+                                array(getUserId()), __FILE__, __LINE__);
 
                                if (SQL_NUMROWS($result) == 1) {
                                        // Old order found
index ceef0a61047749c0daf8fc419c1e0597a57f6ffc..cee143d869f7b0f9cc751e6434e7996a733f7cbe 100644 (file)
@@ -57,7 +57,7 @@ $TPTS = 0;
 while ($content = SQL_FETCHARRAY($result_depths)) {
        // Load referal points
        $result_points = SQL_QUERY_ESC("SELECT points FROM `{!_MYSQL_PREFIX_user_points!}` WHERE userid=%s AND ref_depth=%d LIMIT 1",
-               array($GLOBALS['userid'], bigintval($content['level'])), __FILE__, __LINE__);
+               array(getUserId(), bigintval($content['level'])), __FILE__, __LINE__);
 
        // Entry found?
        if (SQL_NUMROWS($result_points) == 1) {
@@ -76,7 +76,7 @@ while ($content = SQL_FETCHARRAY($result_depths)) {
 SQL_FREERESULT($result_depths);
 
 // Get used points
-$USED = GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
+$USED = GET_TOTAL_DATA(getUserId(), "user_data", "used_points");
 
 // Translate point into comma
 $TPTS = TRANSLATE_COMMA($TPTS - $USED);
@@ -101,7 +101,7 @@ LEFT JOIN `{!_MYSQL_PREFIX!}_payout_types` AS t
 ON p.payout_id = t.id
 WHERE p.userid = %s
 ORDER BY p.payout_timestamp DESC",
-                array($GLOBALS['userid']), __FILE__, __LINE__);
+                array(getUserId()), __FILE__, __LINE__);
                if (SQL_NUMROWS($result_payouts) > 0) {
                        // List all his requests
                        $OUT = ""; $SW = 2;
@@ -190,7 +190,7 @@ ORDER BY p.payout_timestamp DESC",
                                define('PAYOUT_POINTS_VALUE', $PAYOUT);
 
                                // Subtract points from member's account
-                               SUB_POINTS("payout", $GLOBALS['userid'], $PAYOUT);
+                               SUB_POINTS("payout", getUserId(), $PAYOUT);
 
                                // Add entry to his tranfer history
                                if ($content['allow'] == "Y") {
@@ -198,7 +198,7 @@ ORDER BY p.payout_timestamp DESC",
                                        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_payouts` (userid, payout_total, payout_id, payout_timestamp, status, target_url, link_text, banner_url)
 VALUES (%s,%s,%s, UNIX_TIMESTAMP(), 'NEW','%s','%s','%s')",
  array(
-       $GLOBALS['userid'],
+       getUserId(),
        bigintval(REQUEST_POST('payout')),
        bigintval(REQUEST_GET('payout')),
        REQUEST_POST('turl'),
@@ -207,18 +207,18 @@ VALUES (%s,%s,%s, UNIX_TIMESTAMP(), 'NEW','%s','%s','%s')",
 ), __FILE__, __LINE__);
 
                                        // Load templates
-                                       $msg_mem = LOAD_EMAIL_TEMPLATE("member_payout_request_banner", array(), $GLOBALS['userid']);
+                                       $msg_mem = LOAD_EMAIL_TEMPLATE("member_payout_request_banner", array(), getUserId());
                                        if (GET_EXT_VERSION("admins") >= "0.4.1") {
                                                $adm_tpl = "admin_payout_request_banner";
                                        } else {
-                                               $msg_adm = LOAD_EMAIL_TEMPLATE("admin_payout_request_banner", array(), $GLOBALS['userid']);
+                                               $msg_adm = LOAD_EMAIL_TEMPLATE("admin_payout_request_banner", array(), getUserId());
                                        }
                                } else {
                                        // e-currency payout requested
                                        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_payouts` (userid, payout_total, target_account, target_bank, payout_id, payout_timestamp, status, password)
 VALUES (%s,%s,%s,'%s',%s, UNIX_TIMESTAMP(), 'NEW','%s')",
  array(
-       $GLOBALS['userid'],
+       getUserId(),
        bigintval(REQUEST_POST('payout')),
        bigintval(REQUEST_POST('account')),
        REQUEST_POST('bank'),
@@ -227,8 +227,8 @@ VALUES (%s,%s,%s,'%s',%s, UNIX_TIMESTAMP(), 'NEW','%s')",
 ), __FILE__, __LINE__);
 
                                        // Load templates
-                                       $msg_mem = LOAD_EMAIL_TEMPLATE("member_payout_request", array(), $GLOBALS['userid']);
-                                       $msg_adm = LOAD_EMAIL_TEMPLATE("admin_payout_request", array(), $GLOBALS['userid']);
+                                       $msg_mem = LOAD_EMAIL_TEMPLATE("member_payout_request", array(), getUserId());
+                                       $msg_adm = LOAD_EMAIL_TEMPLATE("admin_payout_request", array(), getUserId());
                                        $admin_tpl = "";
                                        if (GET_EXT_VERSION("admins") >= "0.4.1")
                                        {
@@ -241,14 +241,14 @@ VALUES (%s,%s,%s,'%s',%s, UNIX_TIMESTAMP(), 'NEW','%s')",
 VALUES (0, 'NEW','PAYOUT_REQUEST','[payout:] {--PAYOUT_REQUEST_ADMIN--}','%s', UNIX_TIMESTAMP(), %s)",
  array(
        $msg_adm,
-       $GLOBALS['userid']
+       getUserId()
 ), __FILE__, __LINE__);
 
                                // Send out mails
-                               SEND_EMAIL($GLOBALS['userid'], getMessage('PAYOUT_REQUEST_MEMBER'), $msg_mem);
+                               SEND_EMAIL(getUserId(), getMessage('PAYOUT_REQUEST_MEMBER'), $msg_mem);
 
                                // To admin(s)
-                               SEND_ADMIN_NOTIFICATION(getMessage('PAYOUT_REQUEST_ADMIN'), $admin_tpl, array(), $GLOBALS['userid']);
+                               SEND_ADMIN_NOTIFICATION(getMessage('PAYOUT_REQUEST_ADMIN'), $admin_tpl, array(), getUserId());
 
                                // Load template and output it
                                LOAD_TEMPLATE("admin_settings_saved", false, getMessage('PAYOUT_REQUEST_SENT'));
index 0d1644d5670fd244dd49302808fa75831117d5c8..8ab4efa8127479624e8a0ae83080df0ed8b929fb 100644 (file)
@@ -68,7 +68,7 @@ while ($content = SQL_FETCHARRAY($result_depths)) {
        $REFS = 0;
 
        // Load referal points
-       $result_points = SQL_QUERY_ESC("SELECT points, locked_points FROM `{!_MYSQL_PREFIX!}_user_points` WHERE userid=%s AND ref_depth=%d LIMIT 1", array($GLOBALS['userid'], bigintval($content['level'])), __FILE__, __LINE__);
+       $result_points = SQL_QUERY_ESC("SELECT points, locked_points FROM `{!_MYSQL_PREFIX!}_user_points` WHERE userid=%s AND ref_depth=%d LIMIT 1", array(getUserId(), bigintval($content['level'])), __FILE__, __LINE__);
        if (SQL_NUMROWS($result_points) == 1) {
                list($points, $locked) = SQL_FETCHROW($result_points);
                SQL_FREERESULT($result_points);
@@ -80,7 +80,7 @@ while ($content = SQL_FETCHARRAY($result_depths)) {
 
        // Load referal counts
        $result_refs = SQL_QUERY_ESC("SELECT counter FROM `{!_MYSQL_PREFIX!}_refsystem` WHERE userid=%s AND level='%s' LIMIT 1",
-               array($GLOBALS['userid'], bigintval($content['level'])), __FILE__, __LINE__);
+               array(getUserId(), bigintval($content['level'])), __FILE__, __LINE__);
        if (SQL_NUMROWS($result_refs) == 1) {
                list($REFS) = SQL_FETCHROW($result_refs);
                SQL_FREERESULT($result_refs);
@@ -108,7 +108,7 @@ SQL_FREERESULT($result_depths);
 define('__REF_LEVEL_ROWS', $OUT);
 
 $result = SQL_QUERY_ESC("SELECT used_points, ref_payout FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-       array($GLOBALS['userid']), __FILE__, __LINE__);
+       array(getUserId()), __FILE__, __LINE__);
 list($USED, $PAY) = SQL_FETCHROW($result);
 SQL_FREERESULT($result);
 
@@ -121,7 +121,7 @@ if (GET_EXT_VERSION("user") >= "0.1.2") {
        if (GET_EXT_VERSION("user") >= "0.1.4") {
                $ADD = ", emails_sent, emails_received";
        }
-       $result = SQL_QUERY_ESC("SELECT mails_confirmed".$ADD." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __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);
 
@@ -152,7 +152,7 @@ if ((GET_EXT_VERSION("bonus") >= "0.2.2") && (EXT_IS_ACTIVE("bonus")) && (getCon
 
        // Load data
        $result = SQL_QUERY_ESC("SELECT login_bonus, turbo_bonus".$ADD." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-               array($GLOBALS['userid']), __FILE__, __LINE__);
+               array(getUserId()), __FILE__, __LINE__);
 
        // We don't add this points now. This will be done after each month
        list($login, $turbo, $ref, $order, $stats) = SQL_FETCHROW($result);
index 9e799d681a27eb98bff7025df12ab55871170ab8..a3a346df0688558486379d7972a950ec8183d007 100644 (file)
@@ -69,7 +69,7 @@ if (!REQUEST_ISSET_GET(('mode'))) {
 
        // Get Primus id
        $result = SQL_QUERY_ESC("SELECT primera_userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-               array($GLOBALS['userid']), __FILE__, __LINE__);
+               array(getUserId()), __FILE__, __LINE__);
 
        // Are there some entries?
        if (SQL_NUMROWS($result) == 1) {
@@ -87,7 +87,7 @@ if (!REQUEST_ISSET_GET(('mode'))) {
 
                // And load all rows!
                $result = SQL_QUERY_ESC("SELECT `id`, `primera_account`, `primera_amount`, `primera_timestamp`, `primera_type` FROM `{!_MYSQL_PREFIX!}_user_primera` WHERE `userid` = %s ORDER BY `primera_timestamp` DESC",
-                       array($GLOBALS['userid']), __FILE__, __LINE__);
+                       array(getUserId()), __FILE__, __LINE__);
 
                // Load all rows
                $content['rows'] = ""; $SW = 2;
@@ -116,7 +116,7 @@ if (!REQUEST_ISSET_GET(('mode'))) {
 } // END - if
 if (REQUEST_GET('mode') == "pay") {
        // Get total points and check if the user can request a payout
-       $points = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
+       $points = GET_TOTAL_DATA(getUserId(), "user_points", "points") - GET_TOTAL_DATA(getUserId(), "user_data", "used_points");
 
        // No dots here...
        $points = explode(".", $points);
@@ -139,7 +139,7 @@ if (REQUEST_GET('mode') == "pay") {
        // Get Primera id
        $content['primera_nickname'] = "";
        $result = SQL_QUERY_ESC("SELECT primera_userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-               array($GLOBALS['userid']), __FILE__, __LINE__);
+               array(getUserId()), __FILE__, __LINE__);
 
        // Are there some entries?
        if (SQL_NUMROWS($result) == 1) {
@@ -193,11 +193,11 @@ if ((IS_FORM_SENT()) && (REQUEST_ISSET_GET(('mode')))) {
                                        } // END - if
 
                                        // Remove points from account
-                                       SUB_POINTS("primera_payout", $GLOBALS['userid'], REQUEST_POST('amount'));
+                                       SUB_POINTS("primera_payout", getUserId(), REQUEST_POST('amount'));
 
                                        // Update primera nickname
                                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `primera_userid`=%s WHERE userid=%s LIMIT 1",
-                                               array(REQUEST_POST('primera_nickname'), $GLOBALS['userid']), __FILE__, __LINE__);
+                                               array(REQUEST_POST('primera_nickname'), getUserId()), __FILE__, __LINE__);
 
                                        // All done!
                                        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('PRIMERA_MEMBER_PAYOUT_DONE'));
index 1443c8fc640dc0c3e2fe6262ad42e2de272ed27f..4548b4a3b468f8e47d25d131011666576ed8f0a6 100644 (file)
@@ -106,7 +106,7 @@ if (SQL_NUMROWS($result) == 1) {
                define('__RALLYE_CAN_WIN_THIS', getMessage('RALLYE_OUR_WINNERS_ARE'));
        } else {
                define('__RALLYE_PRICES', RALLYE_ADD_PRICES($id, "html"));
-               define('__RALLYE_TOP_USERS', RALLYE_ADD_TOPUSERS($id, $GLOBALS['userid']));
+               define('__RALLYE_TOP_USERS', RALLYE_ADD_TOPUSERS($id, getUserId()));
                define('__RALLYE_CAN_WIN_THIS', getMessage('RALLYE_YOU_CAN_WIN'));
        }
 
index c034e62298be73ef180483db3324b96cab24c8a1..7eef3ef48f5db9c783aaab36f3ca17f0ab9ea9b2 100644 (file)
@@ -107,7 +107,7 @@ $result = SQL_QUERY_ESC("SELECT r.level, r.percents
 FROM `{!_MYSQL_PREFIX!}_refdepths` AS r
 WHERE r.level > 0
 ORDER BY r.level ASC",
-       array($GLOBALS['userid']), __FILE__, __LINE__);
+       array(getUserId()), __FILE__, __LINE__);
 
 // Are there some entries? (Shall be!)
 if (SQL_NUMROWS($result) > 0) {
@@ -120,7 +120,7 @@ if (SQL_NUMROWS($result) > 0) {
                $SW = 2;
 
                // Check for users ref in this level
-               foreach (GET_USER_REFS($GLOBALS['userid'], $content['level']) as $refRow) {
+               foreach (GET_USER_REFS(getUserId(), $content['level']) as $refRow) {
                        // Not-deleted account is default
                        $deleted = false;
                        if (is_null($refRow['status'])) $deleted = true;
index 92bbfc52f358ccef1faa560cb71d457380c81495..0a4c9620f142a602c0076b8371909880151f56c5 100644 (file)
@@ -49,17 +49,17 @@ ADD_DESCR("member", __FILE__);
 
 // Load current referal clicks
 $result = SQL_QUERY_ESC("SELECT ref_clicks FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-       array($GLOBALS['userid']), __FILE__, __LINE__);
+       array(getUserId()), __FILE__, __LINE__);
 list($c) = SQL_FETCHROW($result);
 SQL_FREERESULT($result);
 
 OUTPUT_HTML("<div class=\"tiny\">{--YOUR_PERSONAL_REFLINK--}:<br />
-<strong><a href=\"{!URL!}/ref.php?refid=".$GLOBALS['userid']."\" target=\"_blank\">{!URL!}/ref.php?ref=".$GLOBALS['userid']."</a></strong><br />
+<strong><a href=\"{!URL!}/ref.php?refid=".getUserId()."\" target=\"_blank\">{!URL!}/ref.php?ref=".getUserId()."</a></strong><br />
 <br />");
 
 if (EXT_IS_ACTIVE("nickname")) {
        // Add nickname link when nickname is entered
-       $nick = NICKNAME_GET_NICK($GLOBALS['userid']);
+       $nick = NICKNAME_GET_NICK(getUserId());
 
        if (!empty($nick)) {
                // Display nickname link
@@ -109,7 +109,7 @@ if (SQL_NUMROWS($result) > 0) {
                        'alt' => $content['alternate'],
                        'cnt' => $content['counter'],
                        'cks' => $content['clicks'],
-                       'uid' => $GLOBALS['userid'],
+                       'uid' => getUserId(),
                        'id'  => $content['id'],
                );
 
@@ -123,7 +123,7 @@ if (SQL_NUMROWS($result) > 0) {
        define('__REFLINKS_ROWS', $OUT);
 
        // Load final template
-       LOAD_TEMPLATE("member_reflinks_table", false, $GLOBALS['userid']);
+       LOAD_TEMPLATE("member_reflinks_table", false, getUserId());
 } else {
        // No refbanner found!
        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('MEMBER_NO_REFBANNER_FOUND'));
index 420c246b58ce1050754c064fd6ebf3a9314cea51..61123327a053dce3781a34cb51ba309890b067bc 100644 (file)
@@ -53,7 +53,7 @@ $result = SQL_QUERY_ESC("SELECT r.level, r.percents
 FROM `{!_MYSQL_PREFIX!}_refdepths` AS r
 WHERE r.level > 0
 ORDER BY r.level ASC",
-       array($GLOBALS['userid']), __FILE__, __LINE__);
+       array(getUserId()), __FILE__, __LINE__);
 
 // Are there some entries? (Shall be!)
 if (SQL_NUMROWS($result) > 0) {
@@ -66,7 +66,7 @@ if (SQL_NUMROWS($result) > 0) {
                $SW = 2;
 
                // Check for users ref in this level
-               foreach (GET_USER_REF_POINTS($GLOBALS['userid'], $content['level']) as $refRow) {
+               foreach (GET_USER_REF_POINTS(getUserId(), $content['level']) as $refRow) {
                        // Add/"translate" more content
                        $refRow['sw']          = $SW;
                        $refRow['points']      = TRANSLATE_COMMA($refRow['points']);
index a5bd35b6e8f2c0c265fd80a9364bc6cf1af72727..84f801050a5b7c880e9a91524c5aa3ed5b183046 100644 (file)
@@ -55,7 +55,7 @@ $result = SQL_QUERY_ESC("SELECT id, cat_id, payment_id, subject, url, timestamp,
 FROM `{!_MYSQL_PREFIX!}_pool`
 WHERE sender=%s AND data_type != 'SEND'
 ORDER BY timestamp DESC",
-       array($GLOBALS['userid']), __FILE__, __LINE__);
+       array(getUserId()), __FILE__, __LINE__);
 
 // Are there mails left in pool?
 if (SQL_NUMROWS($result) > 0) {
@@ -102,7 +102,7 @@ $result = SQL_QUERY_ESC("SELECT id, cat_id, payment_id, subject, url, timestamp_
 FROM `{!_MYSQL_PREFIX!}_user_stats`
 WHERE userid=%s
 ORDER BY timestamp_ordered DESC",
-       array($GLOBALS['userid']), __FILE__, __LINE__);
+       array(getUserId()), __FILE__, __LINE__);
 
 if (SQL_NUMROWS($result) > 0) {
        // Mail orders are in pool so we can display them
index 03c455ccf9b8bc88f169f4c141ca30948e1b1be6..93fd3595e42f11c6d8e091e073ce81aaaa6da1c7 100644 (file)
@@ -58,9 +58,9 @@ if ((!IS_FORM_SENT()) || (!REQUEST_ISSET_POST(('qsummary')))) {
        if (GET_EXT_VERSION("admins") >= "0.4.1") {
                $a_tpl = "admin_support-".REQUEST_POST('qsummary');
        } else {
-               $msg_a = LOAD_EMAIL_TEMPLATE("admin_support-".REQUEST_POST('qsummary'), array('text' => REQUEST_POST('qdetails')), $GLOBALS['userid']);
+               $msg_a = LOAD_EMAIL_TEMPLATE("admin_support-".REQUEST_POST('qsummary'), array('text' => REQUEST_POST('qdetails')), getUserId());
        }
-       $msg_m = LOAD_EMAIL_TEMPLATE("member_support-".REQUEST_POST('qsummary'), array('text' => REQUEST_POST('qdetails')), $GLOBALS['userid']);
+       $msg_m = LOAD_EMAIL_TEMPLATE("member_support-".REQUEST_POST('qsummary'), array('text' => REQUEST_POST('qdetails')), getUserId());
 
        // Select right subject
        switch (REQUEST_POST('qsummary')) {
@@ -81,14 +81,14 @@ if ((!IS_FORM_SENT()) || (!REQUEST_ISSET_POST(('qsummary')))) {
        } // END - switch
 
        // Send mail to admin
-       SEND_ADMIN_NOTIFICATION($subj_a, $a_tpl, array('text' => REQUEST_POST('qdetails')), $GLOBALS['userid']);
+       SEND_ADMIN_NOTIFICATION($subj_a, $a_tpl, array('text' => REQUEST_POST('qdetails')), getUserId());
 
        // Send mail to user
-       SEND_EMAIL($GLOBALS['userid'], $subj_m, $msg_m);
+       SEND_EMAIL(getUserId(), $subj_m, $msg_m);
 
        // Drop a message in the admin's area
        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (userid, assigned_admin, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','SUPPORT_MEMBER','%s','%s', UNIX_TIMESTAMP())",
-               array($GLOBALS['userid'], $subj_a, REQUEST_POST('qsummary').":".array('text' => REQUEST_POST('qdetails'))), __FILE__, __LINE__);
+               array(getUserId(), $subj_a, REQUEST_POST('qsummary').":".array('text' => REQUEST_POST('qdetails'))), __FILE__, __LINE__);
 
        // Form sent
        LOAD_TEMPLATE("member_support_contcted");
index 8da9719dfd77635e023213667d946c7776723763..24d05c0c65b8e56bc365a98a0df2afabfde3d297 100644 (file)
@@ -53,7 +53,7 @@ ADD_DESCR("member", __FILE__);
 if (REQUEST_ISSET_POST(('member_theme'))) {
        // Save theme to member's profile
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET curr_theme='%s' WHERE userid=%s LIMIT 1",
-               array(REQUEST_POST('member_theme'), $GLOBALS['userid']), __FILE__, __LINE__);
+               array(REQUEST_POST('member_theme'), getUserId()), __FILE__, __LINE__);
 
        // Set new theme for guests
        $newTheme = SQL_ESCAPE(REQUEST_POST('member_theme'));
index d13f4f82868d216a6997355bd506d0d9d4b4f9b3..95b17b72f8226ed192cfd5e276c2d2408e67d4f9 100644 (file)
@@ -52,7 +52,7 @@ ADD_DESCR("member", __FILE__);
 
 // Load data
 $result = SQL_QUERY_ESC("SELECT opt_in FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-       array($GLOBALS['userid']), __FILE__, __LINE__);
+       array(getUserId()), __FILE__, __LINE__);
 list($opt_in) = SQL_FETCHROW($result);
 
 // Free memory
@@ -68,7 +68,7 @@ switch ($MODE)
 {
 case "new": // Start new transfer
        // Get total points and subtract the balance amount from it = maximum transferable points
-       $total = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points")  - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
+       $total = GET_TOTAL_DATA(getUserId(), "user_points", "points")  - GET_TOTAL_DATA(getUserId(), "user_data", "used_points");
 
        // Remember maximum value for template
        define('__TRANSFER_MAX_VALUE', round($total - getConfig('transfer_balance') - 0.5));
@@ -77,7 +77,7 @@ case "new": // Start new transfer
                // Add new transfer
                if (getConfig('transfer_code') > 0) {
                        // Check for code
-                       $code = generateRandomCodde(getConfig('transfer_code'), REQUEST_POST('code_chk'), $GLOBALS['userid'], constant('__TRANSFER_MAX_VALUE'));
+                       $code = generateRandomCodde(getConfig('transfer_code'), REQUEST_POST('code_chk'), getUserId(), constant('__TRANSFER_MAX_VALUE'));
                        $valid_code = ($code == REQUEST_POST('code'));
                } else {
                        // Zero length (= disabled) is always valid!
@@ -105,7 +105,7 @@ case "new": // Start new transfer
 
                // 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",
-                       array($GLOBALS['userid'], bigintval(REQUEST_POST('to_uid'))), __FILE__, __LINE__);
+                       array(getUserId(), bigintval(REQUEST_POST('to_uid'))), __FILE__, __LINE__);
                $valid_data = (SQL_NUMROWS($result) == 2);
 
                if ($valid_code && $valid_pass && $valid_amount && $valid_reason && $valid_recipient) {
@@ -114,7 +114,7 @@ case "new": // Start new transfer
                        list($uid2, $gender2, $sname2, $fname2, $email2, $nick2) = SQL_FETCHROW($result);
                        SQL_FREERESULT($result);
                        // @TODO Rewrite all these constants to array elements
-                       if ($uid1 == $GLOBALS['userid']) {
+                       if ($uid1 == getUserId()) {
                                // Data row 1 is sender's data
                                define('__SENDER_GENDER'   , TRANSLATE_GENDER($gender1));
                                define('__SENDER_NICK'     , $nick1);
@@ -151,7 +151,7 @@ case "new": // Start new transfer
                        }
 
                        // Sender's UID is always currently stored in cookie userid...
-                       define('__SENDER_UID'     , $GLOBALS['userid']);
+                       define('__SENDER_UID'     , getUserId());
                        define('__RECIPIENT_UID'  , REQUEST_POST('to_uid'));
 
                        $SENDER = constant('__SENDER_UID');
@@ -171,21 +171,21 @@ case "new": // Start new transfer
                        define('__TRANSFER_EXPIRES', CREATE_FANCY_TIME(getConfig('transfer_age')));
 
                        // Generate tranafer id
-                       define('__TRANS_ID', bigintval(generateRandomCodde("10", mt_rand(0, 99999), $GLOBALS['userid'], REQUEST_POST('reason'))));
+                       define('__TRANS_ID', bigintval(generateRandomCodde("10", mt_rand(0, 99999), getUserId(), REQUEST_POST('reason'))));
 
                        // Add entries to both tables
                        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_transfers_in` (userid, from_uid, points, reason, time_trans, trans_id) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP(),'%s')",
-                               array(bigintval(REQUEST_POST('to_uid')), $GLOBALS['userid'], bigintval(REQUEST_POST('points')), REQUEST_POST('reason'), __TRANS_ID),
+                               array(bigintval(REQUEST_POST('to_uid')), getUserId(), bigintval(REQUEST_POST('points')), REQUEST_POST('reason'), __TRANS_ID),
                                __FILE__, __LINE__);
                        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_transfers_out` (userid, to_uid, points, reason, time_trans, trans_id) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP(),'%s')",
-                               array($GLOBALS['userid'], bigintval(REQUEST_POST('to_uid')), bigintval(REQUEST_POST('points')), REQUEST_POST('reason'), __TRANS_ID),
+                               array(getUserId(), bigintval(REQUEST_POST('to_uid')), bigintval(REQUEST_POST('points')), REQUEST_POST('reason'), __TRANS_ID),
                                __FILE__, __LINE__);
 
                        // Add points to account *directly* ...
                        ADD_POINTS_REFSYSTEM("member_transfer", bigintval(REQUEST_POST('to_uid')), bigintval(REQUEST_POST('points')), false, "0", false, "direct");
 
                        // ... and add it to current user's used points
-                       SUB_POINTS("transfer", $GLOBALS['userid'], REQUEST_POST('points'));
+                       SUB_POINTS("transfer", getUserId(), REQUEST_POST('points'));
 
                        // First send email to recipient
                        $msg = LOAD_EMAIL_TEMPLATE("member_transfer_recipient", "", constant('__RECIPIENT_UID'));
@@ -233,11 +233,11 @@ case "new": // Start new transfer
                if (EXT_IS_ACTIVE("nickname")) {
                        // Load userid and nickname
                        $result = SQL_QUERY_ESC("SELECT userid, nickname FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' AND opt_in='Y' AND userid != '%s' ORDER BY userid",
-                        array($GLOBALS['userid']), __FILE__, __LINE__);
+                        array(getUserId()), __FILE__, __LINE__);
                } else {
                        // Load only userid
                        $result = SQL_QUERY_ESC("SELECT userid, userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' AND opt_in='Y' AND userid != '%s' ORDER BY userid",
-                        array($GLOBALS['userid']), __FILE__, __LINE__);
+                        array(getUserId()), __FILE__, __LINE__);
                }
 
                if (SQL_NUMROWS($result) > 0) {
@@ -275,7 +275,7 @@ case "new": // Start new transfer
                // Generate Code
                if (getConfig('transfer_code') > 0) {
                        $rand = mt_rand(0, 99999);
-                       $code = generateRandomCodde(getConfig('transfer_code'), $rand, $GLOBALS['userid'], constant('__TRANSFER_MAX_VALUE'));
+                       $code = generateRandomCodde(getConfig('transfer_code'), $rand, getUserId(), constant('__TRANSFER_MAX_VALUE'));
                        $img = GENERATE_IMAGE($code, false);
                        define('__TRANSFER_IMAGE_INPUT', "<input type=\"hidden\" name=\"code_chk\" value=\"".$rand."\" /><input type=\"text\" name=\"code\" class=\"member_normal\" size=\"5\" maxlength=\"7\"{!__TRANSFER_TO_DISABLED!} />&nbsp;".$img);
                } else {
@@ -323,7 +323,7 @@ case "list_out": // List only outgoing transactions
 
        // Run the SQL command
        $total = 0;
-       $result = SQL_QUERY_ESC($sql, array($GLOBALS['userid']), __FILE__, __LINE__);
+       $result = SQL_QUERY_ESC($sql, array(getUserId()), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                $OUT = ""; $SW = 2;
                // @TODO This should be somehow rewritten to $content = SQL_FETCHARRAY(), see switch() block above for SQL queries
@@ -389,7 +389,7 @@ KEY(party_uid)
 
        // Let's begin with the incoming list
        $result = SQL_QUERY_ESC("SELECT trans_id, from_uid, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_in` WHERE userid=%s ORDER BY `id` LIMIT %s",
-array($GLOBALS['userid'], getConfig('transfer_max')), __FILE__, __LINE__);
+array(getUserId(), getConfig('transfer_max')), __FILE__, __LINE__);
        while ($DATA = SQL_FETCHROW($result)) {
                $DATA[] = "IN";
                $DATA = implode("','", $DATA);
@@ -401,7 +401,7 @@ array($GLOBALS['userid'], getConfig('transfer_max')), __FILE__, __LINE__);
 
        // As the last table transfer data from outgoing table to temporary
        $result = SQL_QUERY_ESC("SELECT trans_id, to_uid, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_out` WHERE userid=%s ORDER BY `id` LIMIT %s",
-array($GLOBALS['userid'], getConfig('transfer_max')), __FILE__, __LINE__);
+array(getUserId(), getConfig('transfer_max')), __FILE__, __LINE__);
        while ($DATA = SQL_FETCHROW($result)) {
                $DATA[] = "OUT";
                $DATA = implode("','", $DATA);
@@ -472,7 +472,7 @@ array($GLOBALS['userid'], getConfig('transfer_max')), __FILE__, __LINE__);
 
 case "": // Overview page
        // Check incoming transfers
-       $result = SQL_QUERY_ESC("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_user_transfers_in` WHERE userid=%s", array($GLOBALS['userid']), __FILE__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_user_transfers_in` WHERE userid=%s", array(getUserId()), __FILE__, __LINE__);
        list($dmy) = SQL_FETCHROW($result);
        SQL_FREERESULT($result);
 
@@ -484,7 +484,7 @@ case "": // Overview page
        }
 
        // Check outgoing transfers
-       $result = SQL_QUERY_ESC("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_user_transfers_out` WHERE userid=%s", array($GLOBALS['userid']), __FILE__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_user_transfers_out` WHERE userid=%s", array(getUserId()), __FILE__, __LINE__);
        list($dmy) = SQL_FETCHROW($result);
        SQL_FREERESULT($result);
 
@@ -505,7 +505,7 @@ case "": // Overview page
        if (IS_FORM_SENT()) {
                // Save settings
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET opt_in='%s' WHERE userid=%s LIMIT 1",
-                       array(REQUEST_POST('opt_in'), $GLOBALS['userid']), __FILE__, __LINE__);
+                       array(REQUEST_POST('opt_in'), getUserId()), __FILE__, __LINE__);
 
                // Rember for next switch() command
                $opt_in = REQUEST_POST('opt_in');
@@ -534,7 +534,7 @@ case "": // Overview page
 FROM `{!_MYSQL_PREFIX!}_user_transfers_out`
 WHERE time_trans > (UNIX_TIMESTAMP() - %s) AND userid=%s
 ORDER BY time_trans DESC
-LIMIT 1", array(getConfig('transfer_timeout'), $GLOBALS['userid']), __FILE__, __LINE__);
+LIMIT 1", array(getConfig('transfer_timeout'), getUserId()), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 0) {
                // Load template
                define('__TRANSFER_SETTINGS_CONTENT', LOAD_TEMPLATE("member_transfer_settings", true));
index 4586eccadbc1ee86e4256bd08db16f4d5022d054..9616b698b04f37cabcc54956d1086bd47e8d4357 100644 (file)
@@ -69,7 +69,7 @@ WHERE id=%s LIMIT 1",
        $content['is_notify'] = TRANSLATE_YESNO($content['is_notify']);
        $content['sender']    = _ADMIN_SHORT;
        $content['time']      = CREATE_FANCY_TIME($content['time']);
-       $content['uid']       = $GLOBALS['userid'];
+       $content['uid']       = getUserId();
 
        // Get timestamp from insert
        $content['user_status'] = sprintf(getMessage('MEMBER_MAIL_BONUS_CONFIRMED_ON'),
@@ -102,7 +102,7 @@ WHERE s.id=%s LIMIT 1",
        $content['category']  = GET_CATEGORY($content['cat_id']);
        $content['points']    = TRANSLATE_COMMA($content['points']);
        $content['time']      = CREATE_FANCY_TIME($content['time']);
-       $content['uid']       = $GLOBALS['userid'];
+       $content['uid']       = getUserId();
 
        // Get timestamp from insert
        $content['user_status'] = sprintf(getMessage('MEMBER_MAIL_NORMAL_CONFIRMED_ON'),
@@ -119,11 +119,11 @@ WHERE s.id=%s LIMIT 1",
 if (EXT_IS_ACTIVE("bonus")) {
        // Load bonus ID
        $result = SQL_QUERY_ESC("SELECT stats_id, bonus_id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE userid=%s ORDER BY bonus_id DESC, stats_id DESC",
-               array($GLOBALS['userid']), __FILE__, __LINE__);
+               array(getUserId()), __FILE__, __LINE__);
 } else {
        // Don't load bonus ID
        $result = SQL_QUERY_ESC("SELECT stats_id, stats_id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE userid=%s ORDER BY stats_id DESC",
-               array($GLOBALS['userid']), __FILE__, __LINE__);
+               array(getUserId()), __FILE__, __LINE__);
 }
 
 // Mails left for confirmation?
@@ -188,7 +188,7 @@ LIMIT 1",
                        // Prepare data for template
                        $content = array(
                                'sw'      => $SW,
-                               'uid'     => $GLOBALS['userid'],
+                               'uid'     => getUserId(),
                                'data'    => bigintval($DATA),
                                'type'    => $type,
                                'subject' => $subject,
index 9b9fdccedfdc291fdde9a1ca96ea3bd4cf0e0ae7..8086c002e20ec95d733c67056b705ba10adba717 100644 (file)
@@ -56,7 +56,7 @@ LOAD_TEMPLATE("member_welcome_header");
 
 // Chedk if he is returning from a profile update notification
 $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE notified='Y' AND userid=%s LIMIT 1",
-       array($GLOBALS['userid']), __FILE__, __LINE__);
+       array(getUserId()), __FILE__, __LINE__);
 
 if ((SQL_NUMROWS($result) == 1) && (EXT_IS_ACTIVE("profile"))) {
        // Yes, he is so let's place him his wanted buttons
index 07acfed252134a45c0b530f41966dd84cf28ca3b..3ff9a62dd16ff8ae700177a55be9fa5366a2a6e6 100644 (file)
@@ -69,7 +69,7 @@ if ((!REQUEST_ISSET_GET(('mode'))) || (REQUEST_GET('mode') == "choose")) {
 
        // Get WDS66 id
        $result = SQL_QUERY_ESC("SELECT wernis_userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-               array($GLOBALS['userid']), __FILE__, __LINE__);
+               array(getUserId()), __FILE__, __LINE__);
 
        // Are there some entries?
        if (SQL_NUMROWS($result) == 1) {
@@ -87,7 +87,7 @@ if ((!REQUEST_ISSET_GET(('mode'))) || (REQUEST_GET('mode') == "choose")) {
 
                // And load all rows!
                $result = SQL_QUERY_ESC("SELECT `id`, `wernis_account`, `wernis_amount`, `wernis_timestamp`, `wernis_type` FROM `{!_MYSQL_PREFIX!}_user_wernis` WHERE `userid` = %s ORDER BY `wernis_timestamp` DESC",
-                       array($GLOBALS['userid']), __FILE__, __LINE__);
+                       array(getUserId()), __FILE__, __LINE__);
 
                // Load all rows
                $content['rows'] = ""; $SW = 2;
@@ -131,7 +131,7 @@ if ((!REQUEST_ISSET_GET(('mode'))) || (REQUEST_GET('mode') == "choose")) {
        }
 } elseif ((REQUEST_GET('mode') == "payout") && (getConfig('wernis_payout_active') == "Y")) {
        // Get total points and check if the user can request a payout
-       $points = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
+       $points = GET_TOTAL_DATA(getUserId(), "user_points", "points") - GET_TOTAL_DATA(getUserId(), "user_data", "used_points");
 
        // Remove the registration fee
        $points = $points - getConfig('points_register');
@@ -160,7 +160,7 @@ if ((!REQUEST_ISSET_GET(('mode'))) || (REQUEST_GET('mode') == "choose")) {
        // Get WDS66 id
        $content['wds66_id'] = "";
        $result = SQL_QUERY_ESC("SELECT wernis_userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-               array($GLOBALS['userid']), __FILE__, __LINE__);
+               array(getUserId()), __FILE__, __LINE__);
 
        // Are there some entries?
        if (SQL_NUMROWS($result) == 1) {
@@ -172,7 +172,7 @@ if ((!REQUEST_ISSET_GET(('mode'))) || (REQUEST_GET('mode') == "choose")) {
        SQL_FREERESULT($result);
 } elseif ((REQUEST_GET('mode') == "withdraw") && (getConfig('wernis_withdraw_active') == "Y")) {
        // Get total points for just displaying them
-       $points = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
+       $points = GET_TOTAL_DATA(getUserId(), "user_points", "points") - GET_TOTAL_DATA(getUserId(), "user_data", "used_points");
 
        // Prepare data for the template
        $content['points']     = TRANSLATE_COMMA($points);
@@ -184,7 +184,7 @@ if ((!REQUEST_ISSET_GET(('mode'))) || (REQUEST_GET('mode') == "choose")) {
 
        // Get WDS66 id
        $result = SQL_QUERY_ESC("SELECT wernis_userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-               array($GLOBALS['userid']), __FILE__, __LINE__);
+               array(getUserId()), __FILE__, __LINE__);
 
        // Are there some entries?
        if (SQL_NUMROWS($result) == 1) {
@@ -231,11 +231,11 @@ if ((IS_FORM_SENT()) && (REQUEST_ISSET_GET(('mode')))) {
                                        if ($success) {
                                                // Add it to this amount
                                                unset($GLOBALS['ref_level']);
-                                               ADD_POINTS_REFSYSTEM("wernis_withdraw", $GLOBALS['userid'], bigintval(REQUEST_POST('amount')), false, 0, false, "direct");
+                                               ADD_POINTS_REFSYSTEM("wernis_withdraw", getUserId(), bigintval(REQUEST_POST('amount')), false, 0, false, "direct");
 
                                                // Update the user data as well..
                                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `wernis_userid`=%s WHERE userid=%s LIMIT 1",
-                                                       array(bigintval(REQUEST_POST('wds66_id')), $GLOBALS['userid']), __FILE__, __LINE__);
+                                                       array(bigintval(REQUEST_POST('wds66_id')), getUserId()), __FILE__, __LINE__);
 
                                                // All done!
                                                LOAD_TEMPLATE("admin_settings_saved", false, getMessage('WERNIS_MEMBER_WITHDRAW_DONE'));
@@ -262,11 +262,11 @@ if ((IS_FORM_SENT()) && (REQUEST_ISSET_GET(('mode')))) {
                                        $success = WERNIS_EXECUTE_PAYOUT(REQUEST_POST('wds66_id'), REQUEST_POST('amount'));
                                        if ($success) {
                                                // Sub points
-                                               SUB_POINTS("wernis_payout", $GLOBALS['userid'], REQUEST_POST('amount'));
+                                               SUB_POINTS("wernis_payout", getUserId(), REQUEST_POST('amount'));
 
                                                // Update WDS66 id
                                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `wernis_userid`=%s WHERE userid=%s LIMIT 1",
-                                                       array(bigintval(REQUEST_POST('wds66_id')), $GLOBALS['userid']), __FILE__, __LINE__);
+                                                       array(bigintval(REQUEST_POST('wds66_id')), getUserId()), __FILE__, __LINE__);
 
                                                // All done!
                                                LOAD_TEMPLATE("admin_settings_saved", false, getMessage('WERNIS_MEMBER_PAYOUT_DONE'));
index 87d0ce83ce429dd0c3bfd02411a7788f8397029b..9ebd3a5c3895fbd3297a27811e9a742b7dcc3c2d 100644 (file)
@@ -69,19 +69,19 @@ if (empty($URL)) {
 
        // Update sending pool
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='%s' WHERE id=%s AND sender=%s AND data_type='TEMP' LIMIT 1",
-               array($type, bigintval(REQUEST_GET('order')), $GLOBALS['userid']), __FILE__, __LINE__);
+               array($type, bigintval(REQUEST_GET('order')), getUserId()), __FILE__, __LINE__);
 
        // Finally is the entry valid?
        if (SQL_AFFECTEDROWS() == 1) {
                // Load personal data...
                $result = SQL_QUERY_ESC("SELECT gender, surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-                       array($GLOBALS['userid']), __FILE__, __LINE__);
+                       array(getUserId()), __FILE__, __LINE__);
                list($gender, $sname, $fname, $email) = SQL_FETCHROW($result);
                SQL_FREERESULT($result);
 
                // Load mail again...              0       1        2           3          4      5      6         7
                $result = SQL_QUERY_ESC("SELECT subject, text, receivers, payment_id, timestamp, url, cat_id, target_send FROM `{!_MYSQL_PREFIX!}_pool` WHERE id=%s AND sender=%s LIMIT 1",
-                       array(bigintval(REQUEST_GET('order')), $GLOBALS['userid']), __FILE__, __LINE__);
+                       array(bigintval(REQUEST_GET('order')), getUserId()), __FILE__, __LINE__);
                $DATA = SQL_FETCHROW($result);
                SQL_FREERESULT($result);
                if (empty($DATA[0])) $DATA[0] = getMessage('DEFAULT_SUBJECT_LINE');
@@ -92,7 +92,7 @@ if (empty($URL)) {
                // Update used points
                $ADD = "";
                if (getConfig('order_max_full') == "ORDER") $ADD = ", mail_orders=mail_orders+1";
-               SUB_POINTS("order", $GLOBALS['userid'], $USED);
+               SUB_POINTS("order", getUserId(), $USED);
 
                // Prepare content
                $content = array(
@@ -105,11 +105,11 @@ if (empty($URL)) {
                );
 
                // Send an email to the user
-               $msg_mem = LOAD_EMAIL_TEMPLATE("order-member", $content, $GLOBALS['userid']);
+               $msg_mem = LOAD_EMAIL_TEMPLATE("order-member", $content, getUserId());
                SEND_EMAIL($email, getMessage('MEMBER_NEW_QUEUE'), $msg_mem);
 
                // Notify admins about this
-               SEND_ADMIN_NOTIFICATION(getMessage('ADMIN_NEW_QUEUE'), "order-admin", $content, $GLOBALS['userid']);
+               SEND_ADMIN_NOTIFICATION(getMessage('ADMIN_NEW_QUEUE'), "order-admin", $content, getUserId());
 
                // Output back bottom
                LOAD_TEMPLATE("member_order-back", false);
index 4d9d0e51f2dd2280edcc734719ebfd69c260aaaf..cfede034e8db98db0d5a32aa8411604b782be40f 100644 (file)
@@ -66,7 +66,7 @@ if (getConfig('last_month') != $curr) {
                        SEND_EMAIL($content['email'], getMessage('NL_MEMBER_RESET_SUBJECT'), $msg);
 
                        // Send email to admin
-                       SEND_ADMIN_NOTIFICATION(getMessage('NL_ADMIN_SUBJECT'), "admin_newsletter_reset", array(), $GLOBALS['userid']);
+                       SEND_ADMIN_NOTIFICATION(getMessage('NL_ADMIN_SUBJECT'), "admin_newsletter_reset", array(), getUserId());
                } // END - if
 
                // Free memory
index e8650d08a26ba70836d396d633080bd731edae20..3ad0efec6165f539c9cd20419c79d397a43b54ae 100644 (file)
@@ -42,9 +42,6 @@ if (!defined('__SECURITY')) {
        require($INC);
 }
 
-// CFG: DEBUG-SQL (if enabled and DEBUG_MODE is enabled all SQL queries will be logged to debug.log)
-define('DEBUG_SQL', false);
-
 // Non-database functions
 require("inc/functions.php");
 
@@ -173,8 +170,8 @@ if ((!isInstalling()) && (isInstalled())) {
                                // Is the extension sql_patches installed and at least 0.3.6?
                                if (GET_EXT_VERSION("sql_patches") >= "0.3.6") {
                                        // Generate random number
-                                       if (isset($GLOBALS['userid'])) {
-                                               define('RAND_NUMBER', generateRandomCodde(10, mt_rand(10000,32766), $GLOBALS['userid'], ""));
+                                       if (isset(getUserId())) {
+                                               define('RAND_NUMBER', generateRandomCodde(10, mt_rand(10000,32766), getUserId(), ""));
                                        } else {
                                                define('RAND_NUMBER', generateRandomCodde(10, mt_rand(10000,32766), 0, ""));
                                        }
index 4ffb8e4167a311c7647a452fdcfad9e74266d3ea..d9c2eddf94bcd44d676c7e97dc2da48ed68ae9e9 100644 (file)
@@ -629,10 +629,10 @@ function IS_MEMBER () {
        FIX_DELETED_COOKIES(array('userid', 'u_hash'));
 
        // Are cookies set?
-       if ((!empty($GLOBALS['userid'])) && (isSessionVariableSet('u_hash'))) {
+       if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) {
                // Cookies are set with values, but are they valid?
                $result = SQL_QUERY_ESC("SELECT password, status, last_module, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-                       array($GLOBALS['userid']), __FUNCTION__, __LINE__);
+                       array(getUserId()), __FUNCTION__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Load data from cookies
                        list($password, $status, $mod, $onl) = SQL_FETCHROW($result);
@@ -761,7 +761,7 @@ function SEND_MODE_MAILS($mod, $modes) {
 
        // Load hash
        $result_main = SQL_QUERY_ESC("SELECT password FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
-               array($GLOBALS['userid']), __FUNCTION__, __LINE__);
+               array(getUserId()), __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result_main) == 1) {
                // Load hash from database
                list($hashDB) = SQL_FETCHROW($result_main);
@@ -774,7 +774,7 @@ function SEND_MODE_MAILS($mod, $modes) {
                if (($hash == get_session('u_hash')) || (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
                        // Load user's data
                        $result = SQL_QUERY_ESC("SELECT gender, surname, family, street_nr, country, zip, city, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND password='%s' LIMIT 1",
-                               array($GLOBALS['userid'], $hashDB), __FUNCTION__, __LINE__);
+                               array(getUserId(), $hashDB), __FUNCTION__, __LINE__);
                        if (SQL_NUMROWS($result) == 1) {
                                // Load the data
                                $DATA = SQL_FETCHROW($result);
@@ -818,7 +818,7 @@ function SEND_MODE_MAILS($mod, $modes) {
                                        } // END - if
 
                                        // Load template
-                                       $msg = LOAD_EMAIL_TEMPLATE("member_mydata_notify", $content, $GLOBALS['userid']);
+                                       $msg = LOAD_EMAIL_TEMPLATE("member_mydata_notify", $content, getUserId());
 
                                        if (getConfig('admin_notify') == "Y") {
                                                // The admin needs to be notified about a profile change
@@ -865,7 +865,7 @@ function SEND_MODE_MAILS($mod, $modes) {
        if (empty($content)) {
                if ((!empty($sub_adm)) && (!empty($msg_admin))) {
                        // Send admin mail
-                       SEND_ADMIN_NOTIFICATION($sub_adm, $msg_admin, $content, $GLOBALS['userid']);
+                       SEND_ADMIN_NOTIFICATION($sub_adm, $msg_admin, $content, getUserId());
                } elseif (getConfig('admin_notify') == "Y") {
                        // Cannot send mails to admin!
                        $content = getMessage('CANNOT_SEND_ADMIN_MAILS');
@@ -1990,8 +1990,8 @@ function USER_STATS_GET_TIMESTAMP ($type, $data, $uid = 0) {
        $stamp = 0;
 
        // User id set?
-       if ((isset($GLOBALS['userid'])) && ($uid == 0)) {
-               $uid = $GLOBALS['userid'];
+       if ((isUserIdSet()) && ($uid == 0)) {
+               $uid = getUserId();
        } // END - if
 
        // Is the extension installed and updated?
index 7b5d58c151e13cf4d551bea84c28a2d6f5c067e2..a3c2596626dd129e320fbdf9715b2ab884d59f46 100644 (file)
@@ -105,7 +105,7 @@ function get_session ($var) {
 // Destroy user session
 function destroy_user_session () {
        // Reset userid
-       $GLOBALS['userid'] = 0;
+       setUserId(0);
 
        // Remove all user data from session
        return ((set_session('userid', "")) && (set_session('u_hash', "")));
index 8cfddd385db6202010a0663badbfcbf5c21a800f..9ecac46de367c775819f1c44843ea6ed93ffb69f 100644 (file)
@@ -69,9 +69,9 @@ LOAD_INC_ONCE("inc/load_extensions.php");
 DETERMINE_REFID();
 
 // Transfer userid from session and validate it
-if (isset($_SESSION['userid'])) {
+if (isSessionVariableSet('userid')) {
        // Get it secured from session
-       $GLOBALS['userid'] = bigintval($_SESSION['userid']);
+       setUserId(GET_SESSION('userid'));
 
        // Is it valid?
        if (!IS_MEMBER()) {
@@ -79,7 +79,7 @@ if (isset($_SESSION['userid'])) {
                destroy_user_session();
 
                // Kill userid
-               $GLOBALS['userid'] = 0;
+               setUserId(0);
        } // END - if
 } // END - if
 
index a5f7420f61710ef98ad14bcc6d3a421a4e7fce04..80efd41b7508e46f229e623cb0fe5c09a8c9ed19 100644 (file)
@@ -47,7 +47,6 @@ $GLOBALS['startTime'] = microtime(true);
 $GLOBALS['output_mode'] = 0;
 $GLOBALS['what']   = "";
 $GLOBALS['action'] = "";
-$GLOBALS['userid'] = 0;
 $GLOBALS['module'] = "";
 
 // Needed include files
@@ -60,7 +59,7 @@ if (!REQUEST_ISSET_GET(('module'))) REQUEST_SET_GET('module', "index");
 if (IS_MEMBER()) {
        // Is still logged in so we welcome him with his name
        $result = SQL_QUERY_ESC("SELECT surname, family FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-        array($GLOBALS['userid']), __FILE__, __LINE__);
+               array(getUserId()), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Load surname and family's name and build the username
                list($s, $f) = SQL_FETCHROW($result);
@@ -79,7 +78,7 @@ if (IS_MEMBER()) {
                destroy_user_session();
 
                // Kill userid
-               $GLOBALS['userid'] = 0;
+               setUserId(0);
        }
 
        // Free memory
index 119453ad9dd38b80e5ca324e72c324317df2e111..de542f132bc5ff2001ec4fd91fca1e4c46eb7109 100644 (file)
@@ -87,7 +87,7 @@ if (isInstalled()) {
                        REQUEST_UNSET_GET(('frame'));
                } elseif ((REQUEST_ISSET_GET(('frame'))) && (REQUEST_GET('frame') == "stats")) {
                        // Get total points amount
-                       $points = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
+                       $points = GET_TOTAL_DATA(getUserId(), "user_points", "points") - GET_TOTAL_DATA(getUserId(), "user_data", "used_points");
 
                        // Prepare content
                        $content = array(