'userid' rewritten to functions
[mailer.git] / inc / mysql-manager.php
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?