This 'caching' thing is sometimes anoying, but basicly it shortcuts call trees to...
authorRoland Häder <roland@mxchange.org>
Mon, 1 Oct 2012 20:48:25 +0000 (20:48 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 1 Oct 2012 20:48:25 +0000 (20:48 +0000)
inc/filter/register_filter.php
inc/mysql-manager.php
inc/wrapper-functions.php

index ac93c916fa47f670166d524a02d1e4f3c4437ec6..0720d5f8dddae4f9bd5aea03e851b0dffeb59357 100644 (file)
@@ -43,7 +43,6 @@ if (!defined('__SECURITY')) {
 // Run a filter for must-fillout fields
 function FILTER_REGISTER_MUST_FILLOUT ($filterData) {
        // Get all fields for output
-       die('!Ok');
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
        $result = SQL_QUERY('SELECT `field_name`,`field_required` FROM `{?_MYSQL_PREFIX?}_must_register` ORDER BY `id` ASC',
                __FUNCTION__, __LINE__);
index bb31db5bdf8fb718021f3ee35fdd1519659ed79b..a890c6e36118e498c6518b6da1c356f913c311c7 100644 (file)
@@ -464,9 +464,6 @@ function fetchUserData ($value, $column = 'userid') {
                // Secure userid
                $value = bigintval($value);
 
-               // Set it here
-               setCurrentUserId($value);
-
                // Don't look for invalid userids...
                if (!isValidUserId($value)) {
                        // Invalid, so abort here
@@ -1800,7 +1797,7 @@ function registerExtensionPointsData ($subject, $columnName, $lockedMode, $payme
        } // END - if
 
        // Is the 'subject' there?
-       if (((!ifSqlTableExist('points_data')) && ((getExtensionMode() == 'register') || (getExtensionMode() == 'update'))) || (countSumTotalData($subject, 'points_data', 'id', 'subject', true, $add) == 0)) {
+       if (((!ifSqlTableExists('points_data')) && ((getExtensionMode() == 'register') || (getExtensionMode() == 'update'))) || (countSumTotalData($subject, 'points_data', 'id', 'subject', true, $add) == 0)) {
                // Not found so add an SQL query
                addExtensionSql(sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_points_data` (`subject`,`column_name`,`locked_mode`,`payment_method`) VALUES ('%s','%s','%s','%s')",
                        $subject,
index 3dbbfa8dc3e3b8ae5c0f11f6777ce0e2ccf867b7..2adbd0968ceb67d5f4016c5990ae4be3649ffef5 100644 (file)
@@ -972,6 +972,10 @@ function getUserDataArray () {
 function isUserDataValid () {
        // User id should not be zero so abort here
        if (!isCurrentUserIdSet()) {
+               // Debug message
+               /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isCurrentUserIdSet()=false - ABORTING!');
+
+               // Abort here
                return false;
        } // END - if
 
@@ -987,18 +991,25 @@ function isUserDataValid () {
 
 // Setter for current userid
 function setCurrentUserId ($userid) {
-       // Set userid
-       $GLOBALS['current_userid'] = bigintval($userid);
-
-       // Unset it to re-determine the actual state
-       unset($GLOBALS['is_userdata_valid'][$userid]);
+       // Debug message
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid[' . gettype($userid) . ']=' . $userid . ' - ENTERED!');
 
        // Is the cache from below functions different?
-       if ((isset($GLOBALS['getCurrentUserId'])) && ($GLOBALS['getCurrentUserId'] != $userid)) {
+       if (((isset($GLOBALS['getCurrentUserId'])) && ($GLOBALS['getCurrentUserId'] != $userid)) || ((!isset($GLOBALS['current_userid'])) && (isset($GLOBALS['isCurrentUserIdSet'])))) {
                // Then unset both
                unset($GLOBALS['getCurrentUserId']);
                unset($GLOBALS['isCurrentUserIdSet']);
+               unset($GLOBALS['isValidUserId'][$userid]);
        } // END - if
+
+       // Set userid
+       $GLOBALS['current_userid'] = bigintval($userid);
+
+       // Unset it to re-determine the actual state
+       unset($GLOBALS['is_userdata_valid'][$userid]);
+
+       // Debug message
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid[' . gettype($userid) . ']=' . $userid . ' - EXIT!');
 }
 
 // Getter for current userid
@@ -1249,12 +1260,6 @@ function isValidUserId ($userid) {
        // Debug message
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid[' . gettype($userid) . ']=' . $userid);
 
-       // Handle NULL
-       if (is_null($userid)) {
-               // Do not handle this as of below isset() will always return false
-               return false;
-       } // END - if
-
        // Do we have cache?
        if (!isset($GLOBALS[__FUNCTION__][$userid])) {
                // Check it out
@@ -1262,6 +1267,7 @@ function isValidUserId ($userid) {
        } // END - if
 
        // Return cache
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',result=' . intval($GLOBALS[__FUNCTION__][$userid]));
        return $GLOBALS[__FUNCTION__][$userid];
 }