More globals rewritten, see ticket #100
authorRoland Häder <roland@mxchange.org>
Fri, 13 Mar 2009 03:06:50 +0000 (03:06 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 13 Mar 2009 03:06:50 +0000 (03:06 +0000)
inc/extensions/ext-yoomedia.php
inc/functions.php
inc/libs/surfbar_functions.php
inc/libs/user_functions.php
inc/libs/yoomedia_functions.php
inc/modules/guest/what-login.php
inc/modules/login.php
inc/mysql-manager.php

index a650014b282b13243150768b1c79e50139faa252..3dccf5fae5029695d2072440d8e0578a29984fcb 100644 (file)
@@ -118,7 +118,7 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha
 
 default: // Do stuff when extension is loaded
        // The translation table
-       $yoomediaTranslationTable = array(
+       $GLOBALS['translation_tables']['yoomedia'] = array(
                // Error messages
                'error_codes' => array(
                        1  => 'wrong_pass',
index c875a91aee04841958e6e8b7fc6116a155c61fca..e202db15d3e7750537b78684bf6b0ae533f3c5be 100644 (file)
@@ -2484,7 +2484,7 @@ function WRITE_FILE ($FQFN, $content) {
 // Generates an error code from given account status
 function GEN_ERROR_CODE_FROM_ACCOUNT_STATUS ($status) {
        // Default error code if unknown account status
-       $ERROR = getCode('UNKNOWN_STATUS');
+       $errorCode = getCode('UNKNOWN_STATUS');
 
        // Generate constant name
        $constantName = sprintf("ID_%s", $status);
@@ -2492,14 +2492,14 @@ function GEN_ERROR_CODE_FROM_ACCOUNT_STATUS ($status) {
        // Is the constant there?
        if (isCodeSet($constantName)) {
                // Then get it!
-               $ERROR = getCode($constantName);
+               $errorCode = getCode($constantName);
        } else {
                // Unknown status
                DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unknown error status %s detected.", $status));
        }
 
        // Return error code
-       return $ERROR;
+       return $errorCode;
 }
 
 // Clears the output buffer. This function does *NOT* backup sent content.
index 5280fc06a1fc1d14ce5c9130619e52c0b31564f9..6babc26648a71476ff46913158b757cd07042a6d 100644 (file)
@@ -519,10 +519,8 @@ function SURFBAR_LOOKUP_BY_URL ($url, $uid) {
 
 // Load URL data by given search term and column
 function SURFBAR_GET_URL_DATA ($searchTerm, $column="id", $order="id", $sort="ASC", $group="id", $add="") {
-       global $lastUrlData;
-
        // By default nothing is found
-       $lastUrlData = array();
+       $GLOBALS['last_url_data'] = array();
 
        // Is the column an id number?
        if (($column == "id") || ($column == "userid")) {
@@ -551,10 +549,10 @@ ORDER BY %s %s
                        // Shall we group these results?
                        if ($group == "id") {
                                // Add the row by id as index
-                               $lastUrlData[$dataRow['id']] = $dataRow;
+                               $GLOBALS['last_url_data'][$dataRow['id']] = $dataRow;
                        } else {
                                // Group entries
-                               $lastUrlData[$dataRow[$group]][$dataRow['id']] = $dataRow;
+                               $GLOBALS['last_url_data'][$dataRow[$group]][$dataRow['id']] = $dataRow;
                        }
                } // END - while
        } // END - if
@@ -563,7 +561,7 @@ ORDER BY %s %s
        SQL_FREERESULT($result);
 
        // Return the result
-       return $lastUrlData;
+       return $GLOBALS['last_url_data'];
 }
 
 // Registers an URL with the surfbar. You should have called SURFBAR_LOOKUP_BY_URL() first!
index 8e913f21ae3d51c9a9c228e4ff060f5f35951c4b..f5103384843691161a1fae922459644670daabbe 100644 (file)
@@ -384,14 +384,14 @@ function USER_DO_LOGIN ($uid, $passwd) {
                        list($status) = SQL_FETCHROW($result);
 
                        // Create an error code from given status
-                       $ERROR = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status);
+                       $errorCode = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status);
                } else {
                        // ID not found!
-                       $ERROR = getCode('WRONG_ID');
+                       $errorCode = getCode('WRONG_ID');
                }
 
                // Construct URL
-               $URL = "modules.php?module=index&amp;what=login&amp;login=".$ERROR;
+               $URL = "modules.php?module=index&amp;what=login&amp;login=".$errorCode;
        } else {
                // ID not found!
                $URL = "modules.php?module=index&amp;what=login&amp;login=".getCode('WRONG_ID');
@@ -407,7 +407,7 @@ function USER_DO_NEW_PASSWORD ($email, $uid) {
        if (!empty($email)) $email = str_replace("{DOT}", '.', $email);
 
        // Init result and error
-       $ERROR = "";
+       $errorCode = "";
        $result = false;
 
        // Probe userid/nickname
@@ -426,7 +426,7 @@ function USER_DO_NEW_PASSWORD ($email, $uid) {
        } else {
                // Userid not set!
                DEBUG_LOG(__FUNCTION__, __LINE__, "Userid is not set! BUG!");
-               $ERROR = getCode('WRONG_ID');
+               $errorCode = getCode('WRONG_ID');
        }
 
        // Any entry found?
@@ -450,10 +450,10 @@ function USER_DO_NEW_PASSWORD ($email, $uid) {
                        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('GUEST_NEW_PASSWORD_SEND'));
                } else {
                        // Account is locked or unconfirmed
-                       $ERROR = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status);
+                       $errorCode = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status);
 
                        // Load URL
-                       LOAD_URL("modules.php?module=index&amp;what=login&amp;login=".$ERROR);
+                       LOAD_URL("modules.php?module=index&amp;what=login&amp;login=".$errorCode);
                }
        } else {
                // ID or email is wrong
@@ -461,7 +461,7 @@ function USER_DO_NEW_PASSWORD ($email, $uid) {
        }
 
        // Return the error code
-       return $ERROR;
+       return $errorCode;
 }
 
 // [EOF]
index 97e3ba3b41e26df8ff4c7d77247addce58c94682..69d4b301f79e44fe70cec8ae52be93d5311a140f 100644 (file)
@@ -262,15 +262,13 @@ function YOOMEDIA_UNLIST_MAIL ($data, $mode) {
 
 // "Translates" the index number into an assosiative value
 function YOOMEDIA_TRANSLATE_INDEX ($type, $index) {
-       global $yoomediaTranslationTable;
-
        // Default is the index
        $return = $index;
 
        // Is the element there?
-       if (isset($yoomediaTranslationTable[$type][$index])) {
+       if (isset($GLOBALS['translation_tables']['yoomedia'][$type][$index])) {
                // Use this element
-               $return = $yoomediaTranslationTable[$type][$index];
+               $return = $GLOBALS['translation_tables']['yoomedia'][$type][$index];
        } else {
                // Not found!
                DEBUG_LOG(__FUNCTION__, __LINE__, " type={$type},index={$index} not found.");
@@ -282,15 +280,13 @@ function YOOMEDIA_TRANSLATE_INDEX ($type, $index) {
 
 // "Translate" error code
 function YOOMEDIA_TRANSLATE_ERROR ($errorCode) {
-       global $yoomediaTranslationTable;
-
        // Default is "failed"
        $return = "failed";
 
        // Is the entry there?
-       if (isset($yoomediaTranslationTable['error_codes'][$errorCode])) {
+       if (isset($GLOBALS['translation_tables']['yoomedia']['error_codes'][$errorCode])) {
                // Entry found!
-               $return = $yoomediaTranslationTable['error_codes'][$errorCode];
+               $return = $GLOBALS['translation_tables']['yoomedia']['error_codes'][$errorCode];
        } else {
                // Log missing entries
                DEBUG_LOG(__FUNCTION__, __LINE__, " errorCode={$errorCode}");
index 28da47741c14c6558761fe525fc839b05ba15590..bcea77ddb74a573b2211d33112a8967fad3c92f7 100644 (file)
@@ -49,10 +49,10 @@ if (!defined('__SECURITY')) {
 // Add description as navigation point
 ADD_DESCR("guest", __FILE__);
 
-global $DATA, $ERROR;
+global $DATA;
 
 // Initialize variables
-$ERROR = 0;
+$errorCode = 0;
 $probe_nickname = false;
 $uid = false;
 $hash = "";
@@ -90,30 +90,30 @@ if (IS_MEMBER()) {
        $URL = "modules.php?module=login";
 } elseif ((IS_FORM_SENT()) && ("".$uid."" != "".REQUEST_POST('id')."")) {
        // Invalid input (no nickname extension installed but nickname entered)
-       $ERROR = getCode('EXTENSION_PROBLEM');
+       $errorCode = getCode('EXTENSION_PROBLEM');
 } elseif (IS_FORM_SENT()) {
        // Try the login (see inc/libs/user_functions.php)
        $URL = USER_DO_LOGIN(REQUEST_POST('id'), REQUEST_POST('password'));
 } elseif ((REQUEST_ISSET_POST(('new_pass'))) && (isset($uid))) {
        // Try the userid/email lookup (see inc/libs/user_functions.php)
-       $ERROR = USER_DO_NEW_PASSWORD(REQUEST_POST('email'), $uid);
+       $errorCode = USER_DO_NEW_PASSWORD(REQUEST_POST('email'), $uid);
 }
 
 // Login problems?
 if (REQUEST_ISSET_GET(('login'))) {
        // Use code from URL
-       $ERROR = REQUEST_GET(('login'));
+       $errorCode = REQUEST_GET(('login'));
 } // END  - if
 
 // Login problems?
-if (!empty($ERROR)) {
+if (!empty($errorCode)) {
        // Ok, which one now?
        $message = "<tr>
   <td width=\"10\" class=\"seperator\">&nbsp;</td>
   <td colspan=\"7\" align=\"center\">
     <span class=\"guest_failed\">";
 
-       switch ($ERROR) {
+       switch ($errorCode) {
                case getCode('WRONG_PASS'):
                        $message .= getMessage('LOGIN_WRONG_PASS');
                        break;
@@ -143,7 +143,7 @@ if (!empty($ERROR)) {
                        break;
 
                default:
-                       DEBUG_LOG(__FILE__, __LINE__, sprintf("Unhandled error code %s detected.", $ERROR));
+                       DEBUG_LOG(__FILE__, __LINE__, sprintf("Unhandled error code %s detected.", $errorCode));
                        $message .= getMessage('LOGIN_WRONG_ID');
                        break;
                }
index 6e8193a4b3be651b6db7264d08faddb43b238bbf..f06e6bac8f27d1f8e133a96a5b33d4a31630786d 100644 (file)
@@ -48,10 +48,10 @@ if (!defined('__SECURITY')) {
 
 if ($status != "CONFIRMED") {
        // If the status is different than confirmed move the user away from here
-       $ERROR = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status);
+       $errorCode = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status);
 
        // Load URL
-       LOAD_URL("modules.php?module=index&amp;what=login&amp;login=".$ERROR);
+       LOAD_URL("modules.php?module=index&amp;what=login&amp;login=".$errorCode);
 } // END - if
 
 // Load adverstising template
index db3015241a05653e8326fa33ccd6c73562a577eb..e9e263e34db0c1a5bdc751354216285af2cea676 100644 (file)
@@ -616,6 +616,7 @@ function SEARCH_EMAIL_USERTAB ($email) {
 function IS_MEMBER () {
        // @TODO Why is this global??? #100
        global $status;
+
        if (!is_array($GLOBALS['last'])) $GLOBALS['last'] = array();
        $ret = false;