More globals rewritten, see #100
authorRoland Häder <roland@mxchange.org>
Sat, 28 Feb 2009 16:55:26 +0000 (16:55 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 28 Feb 2009 16:55:26 +0000 (16:55 +0000)
60 files changed:
admin.php
agb.php
beg.php
birthday_confirm.php
click.php
confirm.php
css.php
debug.php
doubler.php
img.php
inc/databases.php
inc/db/lib-mysql3.php
inc/doubler_send.php
inc/extensions.php
inc/extensions/ext-html_mail.php
inc/extensions/ext-newsletter.php
inc/extensions/ext-primera.php
inc/extensions/ext-wernis.php
inc/filters.php
inc/footer.php
inc/functions.php
inc/libs/autopurge_functions.php
inc/libs/html_mail_functions.php
inc/libs/newsletter_functions.php
inc/libs/rallye_functions.php
inc/libs/security_functions.php
inc/libs/surfbar_functions.php
inc/libs/task_functions.php
inc/libs/theme_functions.php
inc/libs/user_functions.php
inc/libs/wernis_functions.php
inc/load_extensions.php
inc/loader/load_cache-admin.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-list_beg.php
inc/modules/admin/what-list_bonus.php
inc/modules/admin/what-overview.php
inc/modules/admin/what-theme_edit.php
inc/modules/member/what-beg2.php
inc/modules/member/what-bonus.php
inc/modules/member/what-welcome.php
inc/mysql-connect.php
inc/mysql-manager.php
inc/pool/pool-bonus.php
inc/pool/pool-user.php
inc/stylesheet.php
index.php
install.php
js.php
lead-confirm.php
login.php
mailid.php
mailid_top.php
modules.php
ref.php
show_bonus.php
sponsor_confirm.php
sponsor_ref.php
surfbar.php
view.php

index c60d082..97c2630 100644 (file)
--- a/admin.php
+++ b/admin.php
@@ -35,7 +35,6 @@
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
 $GLOBALS['what'] = "";
 $GLOBALS['action'] = "";
 
diff --git a/agb.php b/agb.php
index c5f79b5..adf6172 100644 (file)
--- a/agb.php
+++ b/agb.php
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
 
 // Set module
-$GLOBALS['module'] = "agb"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "agb";
+$GLOBALS['output_mode'] = -1;
 
 // Load the required file(s)
 require("inc/config.php");
diff --git a/beg.php b/beg.php
index efa0cd5..ae84055 100644 (file)
--- a/beg.php
+++ b/beg.php
@@ -35,9 +35,9 @@
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action, $startTime;
 $GLOBALS['startTime'] = microtime(true);
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
 
 // Set module
 $GLOBALS['module'] = "beg";
index d93bc3a..7b0a83b 100644 (file)
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
 
 // Set module
-$GLOBALS['module'] = "birthday_confirm"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "birthday_confirm";
+$GLOBALS['output_mode'] = -1;
 
 // Load the required file(s)
 require("inc/config.php");
index e7c7e4d..4018e63 100644 (file)
--- a/click.php
+++ b/click.php
@@ -35,8 +35,8 @@
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
 
 // Set module
 $GLOBALS['module'] = "click"; $GLOBALS['output_mode'] = -1;
index 8a8ac81..278c428 100644 (file)
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
 
 // Set module to confirm
-$GLOBALS['module'] = "confirm"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "confirm";
+$GLOBALS['output_mode'] = -1;
 
 // Load the required file(s)
 require("inc/config.php");
diff --git a/css.php b/css.php
index 03eb704..c722525 100644 (file)
--- a/css.php
+++ b/css.php
@@ -37,9 +37,6 @@ define('_OB_CACHING', "old");
 // Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
 require("inc/libs/security_functions.php");
 
-// Init "action" and "what"
-global $what, $action;
-
 // Footer is disabled in CSS mode
 $GLOBALS['footer_sent'] = "-1";
 
index dcbc274..38b90c5 100644 (file)
--- a/debug.php
+++ b/debug.php
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
 $GLOBALS['what'] = "";
 $GLOBALS['action'] = "";
 
 // Set module and fake "CSS mode"
-$GLOBALS['module'] = "debug"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "debug";
+$GLOBALS['output_mode'] = -1;
 
 // Load the required file(s)
 require("inc/config.php");
index 9a48157..92ebdc4 100644 (file)
@@ -35,7 +35,6 @@
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action, $startTime;
 $GLOBALS['startTime'] = microtime(true);
 $GLOBALS['what'] = "";
 $GLOBALS['action'] = "";
diff --git a/img.php b/img.php
index cf410cc..0d68f14 100644 (file)
--- a/img.php
+++ b/img.php
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
 
 // Set module
-$GLOBALS['module'] = "img"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "img";
+$GLOBALS['output_mode'] = -1;
 
 // Load the required file(s)
 require("inc/config.php");
index 81b40f4..6170141 100644 (file)
@@ -78,7 +78,7 @@ define('CODE_UNHANDLED_STATUS' , 0x022);
 define('FULL_VERSION', "0.2.1-FINAL");
 
 // Replacement strings
-$REPLACER = array(
+$GLOBALS['replacer'] = array(
        'userid'  => "%uid%",           // User-ID
        'surname' => "%vorname%",       // Surname
        'family'  => "%nachname%",      // Family name
index 4492111..c98de97 100644 (file)
@@ -39,8 +39,6 @@ if (!defined('__SECURITY')) {
 
 // SQL queries
 function SQL_QUERY ($sql_string, $F, $L) {
-       global $OK;
-
        // Link is up?
        if (!SQL_IS_LINK_UP()) return false;
 
@@ -80,10 +78,10 @@ Query string:<br />
                // Debugging stuff...
                //
                $fp = fopen(constant('PATH')."inc/cache/mysql.log", 'a') or mxchange_die("Cannot write mysql.log!");
-               if (!isset($OK)) {
+               if (!isset($GLOBALS['sql_first_entry'])) {
                        // Write first entry
                        fwrite($fp, "Module=".$GLOBALS['module']."\n");
-                       $OK = true;
+                       $GLOBALS['sql_first_entry'] = true;
                } // END - if
                fwrite($fp, $F."(LINE=".$L."|NUM=".SQL_NUMROWS($result)."|AFFECTED=".SQL_AFFECTEDROWS()."|QUERYTIME:".$queryTime."): ".str_replace('\r', "", str_replace('\n', " ", $sql_string))."\n");
                fclose($fp);
index 58bf1ab..fe1f026 100644 (file)
@@ -106,7 +106,7 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == "Y"))
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_doubler` SET completed='Y' WHERE id=%s LIMIT 1",
                                array(bigintval($id)), __FILE__, __LINE__);
 
-                       $OK = false;
+                       $okay = false;
                        // Check for jackpot inclusion in doubling process
                        if (($jackpot > 0) && ($jackpot >= $points) && (getConfig('doubler_jackpot') == "Y")) {
                                // Subtract points from jackpot
@@ -114,20 +114,20 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == "Y"))
                                $jackpot -= $points;
 
                                // Okay, done!
-                               $OK = true;
+                               $okay = true;
                        } // END - if
 
                        // Exclude also webmaster's ID in taking points from webmaster's account
-                       if (($user > 0) && ($user >= $points) && (!$OK) && (getConfig('doubler_uid') > 0) && ($uid != getConfig('doubler_uid'))) {
+                       if (($user > 0) && ($user >= $points) && (!$okay) && (getConfig('doubler_uid') > 0) && ($uid != getConfig('doubler_uid'))) {
                                // Add points to used points
                                SUB_POINTS("doubler_payout", getConfig('doubler_uid'), $points);
 
                                // Okay, done!
-                               $OK = true;
+                               $okay = true;
                        } // END - if
 
                        // Update doubler's account only when others are not updated
-                       if (!$OK) {
+                       if (!$okay) {
                                // Add points to used doubler points
                                UPDATE_CONFIG("doubler_used", $points, "+");
                        } // END - if
index 0f02e6a..b5185fe 100644 (file)
@@ -847,5 +847,38 @@ function ADD_EXTENSION_NOTES ($ver, &$UPDATE_NOTES) {
        return $out;
 }
 
+// Getter for CSS files array
+function EXT_GET_CSS_FILES () {
+       // By default no additional CSS files are found
+       $cssFiles = array();
+
+       // Is the array there?
+       if (isset($GLOBALS['css_files'])) {
+               // Then use it
+               $cssFiles = $GLOBALS['css_files'];
+       } // END - if
+
+       // Return array
+       return $cssFiles;
+}
+
+// Init CSS files array
+function EXT_INIT_CSS_FILES () {
+       // Simply init it
+       $GLOBALS['css_files'] = array();
+}
+
+// Add new entry
+function EXT_ADD_CSS_FILE ($file) {
+       // Is the array there?
+       if (!isset($GLOBALS['css_files'])) {
+               // Then auto-init them
+               EXT_INIT_CSS_FILES();
+       } // END - if
+
+       // Add the entry
+       $GLOBALS['css_files'][] = $file;
+}
+
 //
 ?>
index 7db775f..a0685fe 100644 (file)
@@ -134,11 +134,8 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha
        break;
 
 default: // Do stuff when extension is loaded
-       // Define all arrary variables as global!
-       global $HTML_TAGS, $URL_ENDS, $VALID_EMAI_CHARS;
-
        // Valid HTML tags (only simple and no attributes!)
-       $HTML_TAGS = array(
+       $GLOBALS['html_tags'] = array(
                "b",
                "i",
                "u",
@@ -155,7 +152,7 @@ default: // Do stuff when extension is loaded
        // URL ends which are used to indentify the end of an URL or email link
        // Don't use these chars in links... ;-)
        //
-       $URL_ENDS = array(
+       $GLOBALS['url_ends'] = array(
                " ",
                "\n",
                "\r",
@@ -163,7 +160,7 @@ default: // Do stuff when extension is loaded
        );
 
        // Valid email chars (without @, or do you want to have another @ inside your email addy?)
-       $VALID_EMAIL_CHARS = array(
+       $GLOBALS['valid_email_chars'] = array(
                'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s',
                't','u','v','w','x','y','z','a','B','C','D','E','F','G','H','I','J','K','L',
                'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','-','.','_','0','1',
index e0132cf..5d741c6 100644 (file)
@@ -152,8 +152,7 @@ default: // Do stuff when extension is loaded
        // URL ends which are used to indentify the end of an URL or email link
        // Don't use these chars in links... ;-)
        //
-       global $URL_ENDS, $VALID_EMAIL_CHARS;
-       $URL_ENDS = array(
+       $GLOBALS['url_ends'] = array(
                " ",
                "\n",
                "\r",
@@ -161,7 +160,7 @@ default: // Do stuff when extension is loaded
        );
 
        // Valid email chars (without @, or do you want to have another @ inside your email addy?)
-       $VALID_EMAIL_CHARS = array(
+       $GLOBALS['valid_email_chars'] = array(
                'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s',
                't','u','v','w','x','y','z','a','B','C','D','E','F','G','H','I','J','K','L',
                'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','-','.','_','0','1',
index 30070d6..1b78946 100644 (file)
@@ -117,9 +117,5 @@ default: // Do stuff when extension is loaded
        break;
 }
 
-// Init array
-global $primera;
-$primera = array();
-
 //
 ?>
index 1b95422..5bb988f 100644 (file)
@@ -151,8 +151,7 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha
 
 default: // Do stuff when extension is loaded
        // Init array
-       global $WERNIS;
-       $WERNIS = array();
+       $GLOBALS['wernis_data'] = array();
        break;
 }
 
index 72c61a0..d409525 100644 (file)
@@ -39,17 +39,15 @@ if (!defined('__SECURITY')) {
 
 // Init "generic filter system"
 function INIT_FILTER_SYSTEM () {
-       global $filters, $loadedFilters, $counter;
-
        // Is the filter already initialized?
-       if ((isset($filters)) && (is_array($filters))) {
+       if ((isset($GLOBALS['filters']['chains'])) && (is_array($GLOBALS['filters']['chains']))) {
                // Then abort here
                addFatalMessage(getMessage('FILTER_FAILED_ALREADY_INIT'));
                return false;
        } // END - if
 
        // Init the filter system (just some ideas)
-       $filters = array(
+       $GLOBALS['filters']['chains'] = array(
                // Filters for pre-init phase
                'preinit'   => array(),
                // Filters for post-init phase
@@ -59,8 +57,8 @@ function INIT_FILTER_SYSTEM () {
        );
 
        // Init loaded filters and counter
-       $loadedFilters =  array();
-       $counter = array();
+       $GLOBALS['filters']['loaded'] =  array();
+       $GLOBALS['filters']['counter'] = array();
 
        // Load all saved filers if sql_patches is updated
        if (GET_EXT_VERSION("sql_patches") >= "0.5.9") {
@@ -82,18 +80,18 @@ ORDER BY `filter_id` ASC", __FILE__, __LINE__);
                                $filterFunction = $filterArray['filter_function'];
 
                                // Set counter to default
-                               $counter[$filterName][$filterFunction] = 0;
+                               $GLOBALS['filters']['counter'][$filterName][$filterFunction] = 0;
 
                                // Mark this filter as loaded (from database)
-                               $loadedFilters[$filterName][$filterFunction] = true;
+                               $GLOBALS['filters']['loaded'][$filterName][$filterFunction] = true;
 
                                // Set this filter
-                               $filters[$filterName][$filterFunction] = $filterArray['filter_active'];
+                               $GLOBALS['filters']['chains'][$filterName][$filterFunction] = $filterArray['filter_active'];
 
                                // Is the array element for counter there?
                                if (isset($filterArray['filter_counter'])) {
                                        // Then use this value!
-                                       $counter[$filterName][$filterFunction] = $filterArray['filter_counter'];
+                                       $GLOBALS['filters']['counter'][$filterName][$filterFunction] = $filterArray['filter_counter'];
                                } // END - if
                        } // END - while
                } // END - if
@@ -135,13 +133,11 @@ ORDER BY `filter_id` ASC", __FILE__, __LINE__);
 
 // "Registers" a new filter function
 function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true, $force = false, $dry_run = false) {
-       global $filters, $counter;
-
        // Extend the filter function name
        $filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction));
 
        // Is that filter already there?
-       if ((isset($filters[$filterName][$filterFunction])) && (!$force)) {
+       if ((isset($GLOBALS['filters']['chains'][$filterName][$filterFunction])) && (!$force)) {
                // Then abort here
                if (!$silentAbort) {
                        addFatalMessage(getMessage('FILTER_FAILED_ALREADY_ADDED'), array($filterFunction, $filterName));
@@ -161,22 +157,20 @@ function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true, $fo
        // Shall we add it?
        if (!$dry_run) {
                // Simply add it to the array
-               $filters[$filterName][$filterFunction] = "Y";
-               $counter[$filterName][$filterFunction] = 0;
+               $GLOBALS['filters']['chains'][$filterName][$filterFunction] = "Y";
+               $GLOBALS['filters']['counter'][$filterName][$filterFunction] = 0;
        } // END - if
 }
 
 // "Unregisters" a filter from the given chain
 function UNREGISTER_FILTER ($filterName, $filterFunction, $force = false, $dry_run = false) {
-       global $filters, $counter, $loadedFilters;
-
        // Extend the filter function name only if not loaded from database
-       if (!isset($loadedFilters[$filterName][$filterFunction])) {
+       if (!isset($GLOBALS['filters']['loaded'][$filterName][$filterFunction])) {
                $filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction));
        } // END - if
 
        // Is that filter there?
-       if ((!isset($filters[$filterName][$filterFunction])) && (!$force)) {
+       if ((!isset($GLOBALS['filters']['chains'][$filterName][$filterFunction])) && (!$force)) {
                // Not found, so abort here
                addFatalMessage(getMessage('FILTER_FAILED_NOT_REMOVED'), array($filterFunction, $filterName));
                return false;
@@ -185,17 +179,15 @@ function UNREGISTER_FILTER ($filterName, $filterFunction, $force = false, $dry_r
        // Shall we remove? (default, not while just showing an extension removal)
        if (!$dry_run) {
                // Mark for filter removal
-               $filters[$filterName][$filterFunction] = "R";
-               unset($counter[$filterName][$filterFunction]);
+               $GLOBALS['filters']['chains'][$filterName][$filterFunction] = "R";
+               unset($GLOBALS['filters']['counter'][$filterName][$filterFunction]);
        } // END  - if
 }
 
 // "Runs" the given filters, data is optional and can be any type of data
 function RUN_FILTER ($filterName, $data = null, $silentAbort = true) {
-       global $filters, $counter;
-
        // Is that filter chain there?
-       if (!isset($filters[$filterName])) {
+       if (!isset($GLOBALS['filters']['chains'][$filterName])) {
                // Then abort here (quick'N'dirty hack)
                if ((!$silentAbort) && (defined('FILTER_FAILED_NO_FILTER_FOUND'))) {
                        // Add fatal message
@@ -210,7 +202,7 @@ function RUN_FILTER ($filterName, $data = null, $silentAbort = true) {
        $returnValue = $data;
 
        // Then run all filters
-       foreach ($filters[$filterName] as $filterFunction=>$active) {
+       foreach ($GLOBALS['filters']['chains'][$filterName] as $filterFunction=>$active) {
                // Debug message
                //* DEBUG: */ echo __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): name={$filterName},func={$filterFunction},active={$active}<br />\n";
 
@@ -229,7 +221,7 @@ function RUN_FILTER ($filterName, $data = null, $silentAbort = true) {
                        $returnValue = call_user_func_array($filterFunction, array($returnValue));
 
                        // Update usage counter
-                       $counter[$filterName][$filterFunction]++;
+                       $GLOBALS['filters']['counter'][$filterName][$filterFunction]++;
                } // END - if
        } // END - foreach
 
@@ -243,7 +235,7 @@ function RUN_FILTER ($filterName, $data = null, $silentAbort = true) {
 
 // Filter for flushing all new filters to the database
 function FILTER_FLUSH_FILTERS () {
-       global $filters, $counter, $loadedFilters, $SQLs;
+       global $SQLs;
 
        // Clear all previous SQL queries
        $SQLs = array();
@@ -269,11 +261,11 @@ function FILTER_FLUSH_FILTERS () {
        $removeSQL = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_filters` WHERE";
 
        // Write all filters to database
-       foreach ($filters as $filterName => $filterArray) {
+       foreach ($GLOBALS['filters']['chains'] as $filterName => $filterArray) {
                // Walk through all filters
                foreach ($filterArray as $filterFunction => $active) {
                        // Is this filter loaded?
-                       if (!isset($loadedFilters[$filterName][$filterFunction])) {
+                       if (!isset($GLOBALS['filters']['loaded'][$filterName][$filterFunction])) {
                                // Add this filter (all filters are active by default)
                                $insertSQL .= sprintf("('%s','%s','Y'),", $filterName, $filterFunction);
                                $inserted++;
@@ -306,7 +298,7 @@ function FILTER_FLUSH_FILTERS () {
        // Shall we update usage counters (ONLY FOR DEBUGGING!)
        if (getConfig('update_filter_usage') == "Y") {
                // Update all counters
-               foreach ($counter as $filterName => $filterArray) {
+               foreach ($GLOBALS['filters']['counter'] as $filterName => $filterArray) {
                        // Walk through all filters
                        foreach ($filterArray as $filterFunction => $cnt) {
                                // Construct and add the query
@@ -356,6 +348,7 @@ function FILTER_REDIRECT_TO_LOGOUT_SQL_PATCHES () {
 
 // Filter for auto-activation of a extension
 function FILTER_AUTO_ACTIVATE_EXTENSION ($data) {
+       // @TODO Try to rewrite this
        global $EXT_ALWAYS_ACTIVE;
 
        // Is this extension always activated?
@@ -440,8 +433,7 @@ function FILTER_RUN_SQLS ($data) {
 
 // Filter for updating/validating login data
 function FILTER_UPDATE_LOGIN_DATA () {
-       global $LAST;
-       if (!is_array($LAST)) $LAST = array();
+       if (!is_array($GLOBALS['last'])) $GLOBALS['last'] = array();
 
        // Recheck if logged in
        if (!IS_MEMBER()) return false;
@@ -462,8 +454,8 @@ function FILTER_UPDATE_LOGIN_DATA () {
                if (empty($mod)) $mod = "login";
 
                // This will be displayed on welcome page! :-)
-               if (empty($LAST['module'])) {
-                       $LAST['module'] = $mod; $LAST['online'] = $onl;
+               if (empty($GLOBALS['last']['module'])) {
+                       $GLOBALS['last']['module'] = $mod; $GLOBALS['last']['online'] = $onl;
                } // END - if
 
                // "what" not set?
index 7584148..47e3ed7 100644 (file)
@@ -32,8 +32,6 @@
  ************************************************************************/
 
 // Global variable stuff
-global $frame;
-
 // Some security stuff...
 if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
@@ -49,7 +47,7 @@ if (($GLOBALS['footer_sent'] != "1") && ($GLOBALS['footer_sent'] != "2") && ($GL
        } // END - if
 
        // Shall we display the copyright notice?
-       if ((empty($frame)) && (empty($_GET['frame'])) && (basename($_SERVER['PHP_SELF']) != "mailid_top.php") && (isBooleanConstantAndTrue('WRITE_FOOTER')) && ($GLOBALS['header_sent'] == "2")) {
+       if ((empty($_GET['frame'])) && (basename($_SERVER['PHP_SELF']) != "mailid_top.php") && (isBooleanConstantAndTrue('WRITE_FOOTER')) && ($GLOBALS['header_sent'] == "2")) {
                // Backlink enabled?
                if (isBooleanConstantAndTrue('ENABLE_BACKLINK')) {
                        // Copyright with backlink, thanks! :-)
index a292a5b..6635ab0 100644 (file)
@@ -181,10 +181,13 @@ function OUTPUT_RAW ($HTML) {
        } // END - if
 }
 
+// Init fatal message array
+function initFatalMessages () {
+       $GLOBALS['fatal_messages'] = array();
+}
+
 // Add a fatal error message to the queue array
 function addFatalMessage ($message, $extra="") {
-       global $FATAL;
-
        if (is_array($extra)) {
                // Multiple extras for a message with masks
                $message = call_user_func_array('sprintf', $extra);
@@ -193,8 +196,8 @@ function addFatalMessage ($message, $extra="") {
                $message = sprintf($message, $extra);
        }
 
-       // Add message to $FATAL
-       $FATAL[] = $message;
+       // Add message to $GLOBALS['fatal_messages']
+       $GLOBALS['fatal_messages'][] = $message;
 
        // Log fatal messages away
        DEBUG_LOG(__FUNCTION__, __LINE__, " message={$message}");
@@ -202,15 +205,13 @@ function addFatalMessage ($message, $extra="") {
 
 // Getter for total fatal message count
 function getTotalFatalErrors () {
-       global $FATAL;
-
        // Init coun
        $count = 0;
 
        // Do we have at least the first entry?
-       if (!empty($FATAL[0])) {
+       if (!empty($GLOBALS['fatal_messages'][0])) {
                // Get total count
-               $count = count($FATAL);
+               $count = count($GLOBALS['fatal_messages']);
        } // END - if
 
        // Return value
@@ -746,7 +747,7 @@ function SET_LANGUAGE ($lang) {
 }
 //
 function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") {
-       global $DATA, $REPLACER, $_CONFIG;
+       global $DATA, $_CONFIG;
 
        // Make sure all template names are lowercase!
        $template = strtolower($template);
@@ -964,17 +965,16 @@ function LOAD_CONFIGURED_URL ($configEntry) {
 
 //
 function COMPILE_CODE($code, $simple = false, $constants = true, $full = true) {
-       global $SEC_CHARS, $URL_CHARS;
        // Is the code a string?
        if (!is_string($code)) {
                // Silently return it
                return $code;
        } // END - if
 
-       $ARRAY = $SEC_CHARS;
+       $ARRAY = $GLOBALS['security_chars'];
 
        // Select smaller set of chars to replace when we e.g. want to compile URLs
-       if (!$full) $ARRAY = $URL_CHARS;
+       if (!$full) $ARRAY = $GLOBALS['url_chars'];
 
        // Compile constants
        if ($constants) {
index 31a1c82..e7c1b66 100644 (file)
@@ -38,8 +38,6 @@ if (!defined('__SECURITY')) {
 }
 
 function AUTOPURGE_ADD_POINTS($uid, $points) {
-       global $jackpot;
-
        // Check if he has locked points or not
        $result = SQL_QUERY_ESC("SELECT ref_payout FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
                array(bigintval($uid)), __FILE__, __LINE__);
index 1c3e657..236cd6e 100644 (file)
@@ -38,28 +38,22 @@ if (!defined('__SECURITY')) {
 }
 
 //
-function HTML_ADD_VALID_TAGS()
-{
-       global $HTML_TAGS; $OUT = "";
-       if (!is_array($HTML_TAGS)) return "";
-       foreach ($HTML_TAGS as $tag)
-       {
+function HTML_ADD_VALID_TAGS() {
+       $OUT = "";
+       if (!is_array($GLOBALS['html_tags'])) return "";
+       foreach ($GLOBALS['html_tags'] as $tag) {
                $OUT .= ", ".strtoupper($tag);
        }
        $OUT = substr($OUT, 2);
        return $OUT;
 }
 //
-function HTML_CHECK_TAGS($html)
-{
-       global $HTML_TAGS;
+function HTML_CHECK_TAGS($html {
        $test = stripslashes($html);
-       while (ereg("<", $test) && ereg(">", $test))
-       {
+       while (ereg("<", $test) && ereg(">", $test)) {
                $check = strtolower(substr($test, strpos($test, "<") + 1, strpos($test, ">") - strpos($test, "<") - 1));
                $check = str_replace("/", "", $check);
-               if (!in_array($check, $HTML_TAGS))
-               {
+               if (!in_array($check, $GLOBALS['html_tags'])) {
                        // Invalid tag found!
                        return "";
                }
@@ -69,9 +63,7 @@ function HTML_CHECK_TAGS($html)
        return $html;
 }
 //
-function HTML_INSERT_URLS($text)
-{
-       global $URL_ENDS, $VALID_EMAIL_CHARS;
+function HTML_INSERT_URLS ($text) {
        $test = $text;
 
        // First replace URLs...
@@ -80,7 +72,7 @@ function HTML_INSERT_URLS($text)
                $check = substr($test, strpos($test, "http://")); $check2 = $check;
 
                // See ext-html.php if you want to add more URL ends...
-               foreach ($URL_ENDS as $end)
+               foreach ($GLOBALS['url_ends'] as $end)
                {
                        if (ereg($end, $check)) $check = substr($check, 0, strpos($check, $end));
                }
@@ -110,7 +102,7 @@ function HTML_INSERT_URLS($text)
                while ($idx > 0)
                {
                        $check = substr($test2, $idx, 1);
-                       if (!in_array($check, $VALID_EMAIL_CHARS))
+                       if (!in_array($check, $GLOBALS['valid_email_chars']))
                        {
                                // Char found so we end here
                                break;
@@ -129,7 +121,7 @@ function HTML_INSERT_URLS($text)
                while ($idx < strlen($test))
                {
                        $check = substr($test, $idx, 1);
-                       if ((!in_array($check, $VALID_EMAIL_CHARS)) && ($check != "@"))
+                       if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != "@"))
                        {
                                // Char found so end here again
                                break;
index 2b03a73..7fccd6f 100644 (file)
@@ -38,28 +38,23 @@ if (!defined('__SECURITY')) {
 }
 
 //
-function NL_ADD_VALID_TAGS()
-{
-       global $HTML_TAGS; $OUT = "";
-       if (!is_array($HTML_TAGS)) return "";
-       foreach ($HTML_TAGS as $tag)
-       {
+function NL_ADD_VALID_TAGS () {
+       $OUT = "";
+       if (!is_array($GLOBALS['html_tags'])) return "";
+       foreach ($GLOBALS['html_tags'] as $tag) {
                $OUT .= ", ".strtoupper($tag);
        }
        $OUT = substr($OUT, 2);
        return $OUT;
 }
+
 //
-function NL_CHECK_TAGS($html)
-{
-       global $HTML_TAGS;
+function NL_CHECK_TAGS ($html) {
        $test = stripslashes($html);
-       while (ereg("<", $test) && ereg(">", $test))
-       {
+       while (ereg("<", $test) && ereg(">", $test)) {
                $check = strtolower(substr($test, strpos($test, "<") + 1, strpos($test, ">") - strpos($test, "<") - 1));
                $check = str_replace("/", "", $check);
-               if (!in_array($check, $HTML_TAGS))
-               {
+               if (!in_array($check, $GLOBALS['html_tags'])) {
                        // Invalid tag found!
                        return "";
                }
@@ -68,20 +63,17 @@ function NL_CHECK_TAGS($html)
        // Return tested code
        return $html;
 }
+
 //
-function NL_INSERT_URLS($text)
-{
-       global $URL_ENDS, $VALID_EMAIL_CHARS;
+function NL_INSERT_URLS ($text) {
        $test = $text;
 
        // First replace URLs...
-       while (ereg("http://", $test))
-       {
+       while (ereg("http://", $test)) {
                $check = substr($test, strpos($test, "http://")); $check2 = $check;
 
                // See ext-html.php if you want to add more URL ends...
-               foreach ($URL_ENDS as $end)
-               {
+               foreach ($GLOBALS['url_ends'] as $end) {
                        if (ereg($end, $check)) $check = substr($check, 0, strpos($check, $end));
                }
 
@@ -100,25 +92,23 @@ function NL_INSERT_URLS($text)
 
        // ... what will the email address be out the @... ;-)
        $PARTS = array();
-       while (ereg("@", $test))
-       {
+       while (ereg("@", $test)) {
                $pos = strpos($test, "@");
                $test2 = substr($test, 0, $pos);
 
                // First check backwards
                $idx = $pos - 1;
-               while ($idx > 0)
-               {
+               while ($idx > 0) {
                        $check = substr($test2, $idx, 1);
-                       if (!in_array($check, $VALID_EMAIL_CHARS))
+                       if (!in_array($check, $GLOBALS['valid_email_chars']))
                        {
                                // Char found so we end here
                                break;
                        }
                        $idx--;
                }
-               if ($idx > 0)
-               {
+
+               if ($idx > 0) {
                        // Starting mark is found
                        $check2 = substr($test, 0, ($idx + 1));
                        $test = substr($test, ($idx + 1));
@@ -126,18 +116,16 @@ function NL_INSERT_URLS($text)
 
                // And now go forward...
                $idx = 0;
-               while ($idx < strlen($test))
-               {
+               while ($idx < strlen($test)) {
                        $check = substr($test, $idx, 1);
-                       if ((!in_array($check, $VALID_EMAIL_CHARS)) && ($check != "@"))
-                       {
+                       if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != "@")) {
                                // Char found so end here again
                                break;
                        }
                        $idx++;
                }
-               if ($idx > 0)
-               {
+
+               if ($idx > 0) {
                        // Maybe this is the email address?
                        $check = substr($test, 0, $idx);
                }
@@ -148,20 +136,19 @@ function NL_INSERT_URLS($text)
                // Remove email from testing string (see above why...)
                $test = substr($test, strlen($check));
        }
+
        // Now put all parts together
        $text = ""; $PARTS[] = $test;
-       foreach ($PARTS as $part)
-       {
+       foreach ($PARTS as $part) {
                $text .= $part;
        }
 
        // Compile possible own HTML tags out...
        return COMPILE_CODE($text);
 }
+
 //
-function SEND_NEWSLETTER($TO, $SUBJECT, $MSG, $MODE)
-{
-       global $_POST;
+function SEND_NEWSLETTER ($TO, $SUBJECT, $MSG, $MODE) {
        // Send mail away as HTML
        if ($_POST['auto_urls'] == "Y") {
                // Automatically insert URLs into newsletter
@@ -181,5 +168,6 @@ function SEND_NEWSLETTER($TO, $SUBJECT, $MSG, $MODE)
                }
        }
 }
+
 //
 ?>
index 3d70abc..d38b61b 100644 (file)
@@ -65,7 +65,7 @@ function RALLYE_AUTOSTART_RALLYES($result)
 
        if ($min_users == 0) {
                // Rallye ends without user limitation
-               $DATA['min_users'] = RALLYE_END_NO_USER_LIMITATION;
+               $DATA['min_users'] = getMessage('RALLYE_END_NO_USER_LIMITATION');
        } else {
                // Rallye ends when X members are totally in your exchange
                $DATA['min_users'] = RALLYE_END_USERS_1." ".$min_users." ".RALLYE_END_USERS_2;
@@ -73,7 +73,7 @@ function RALLYE_AUTOSTART_RALLYES($result)
 
        if ($min_prices == 0) {
                // Rallye ends without user limitation
-               $DATA['min_prices'] = RALLYE_END_NO_PRICE_LIMITATION;
+               $DATA['min_prices'] = getMessage('RALLYE_END_NO_PRICE_LIMITATION');
        } else {
                // Rallye ends when X members are totally in your exchange
                $DATA['min_prices'] = RALLYE_END_PRICES_1." ".$min_prices." ".RALLYE_END_PRICES_2;
@@ -681,7 +681,7 @@ WHERE end_time <= (UNIX_TIMESTAMP() - %s) AND expired='Y'",
 
                // Add task
                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (status, task_type, subject, text, task_created)
-VALUES ('NEW','RALLYE_PURGED','".RALLYE_ADMIN_PURGED.": %s','".RALLYE_ADMIN_PURGED_TEXT."',UNIX_TIMESTAMP())",
+VALUES ('NEW','RALLYE_PURGED','{--RALLYE_ADMIN_PURGED--}: %s','{--RALLYE_ADMIN_PURGED_TEXT--}',UNIX_TIMESTAMP())",
                        array($title), __FILE__, __LINE__);
        }
 
index 1f08065..536fa68 100644 (file)
@@ -83,8 +83,7 @@ if (!isset($_POST)) {
 //require("/usr/share/php/ipfilter.php");
 
 // Generate arrays which holds the relevante chars to replace
-global $SEC_CHARS, $URL_CHARS;
-$SEC_CHARS = array(
+$GLOBALS['security_chars'] = array(
        // The chars we are looking for...
        'from' => array("{", "}", "/", ".", "'", "$", "(", ")", '{--', '--}', "%", ";", "[", "]", ":", "--"),
        // ... and we will replace to.
@@ -112,7 +111,7 @@ $SEC_CHARS = array(
 //
 // Note: Do not replace 'to' with 'from' and vise-versa! When you do this all booked URLs will be
 //       rejected because of the {SLASH}, {DOT} and all below listed items inside the URL.
-$URL_CHARS = array(
+$GLOBALS['url_chars'] = array(
        // Search for these secured characters
        'to'   => array("{SLASH}", "{DOT}", "{PER}", "{DBL_DOT}", "{COMMENT}"),
        // Replace with these characters
@@ -127,9 +126,9 @@ if (is_array($_GET)) {
                        unset($_GET[$seckey]);
                } else {
                        // Only variables are allowed (non-array) but we secure them all!
-                       foreach ($SEC_CHARS['from'] as $key => $char) {
+                       foreach ($GLOBALS['security_chars']['from'] as $key => $char) {
                                // Pass all through
-                               $_GET[$seckey] = str_replace($char  , $SEC_CHARS['to'][$key], $_GET[$seckey]);
+                               $_GET[$seckey] = str_replace($char  , $GLOBALS['security_chars']['to'][$key], $_GET[$seckey]);
                        }
 
                        // Strip all other out
@@ -143,9 +142,9 @@ if (basename($_SERVER['PHP_SELF']) != "install.php") {
        foreach ($_POST as $seckey => $secvalue) {
                if (!is_array($secvalue)) {
                        // Only variables are allowed (non-array) to be secured...
-                       foreach ($SEC_CHARS['from'] as $key => $char) {
+                       foreach ($GLOBALS['security_chars']['from'] as $key => $char) {
                                // Pass all through
-                               $_POST[$seckey] = str_replace($char  , $SEC_CHARS['to'][$key], $_POST[$seckey]);
+                               $_POST[$seckey] = str_replace($char  , $GLOBALS['security_chars']['to'][$key], $_POST[$seckey]);
                        }
 
                        // Strip all other out
index f97cab7..8fa321a 100644 (file)
@@ -200,8 +200,6 @@ function SURFBAR_MEMBER_ACTIONS ($urlId, $status) {
 }
 // Do the member form request
 function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) {
-       global $SURFBAR_CACHE;
-
        // By default no action is performed
        $performed = false;
 
@@ -235,7 +233,7 @@ function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) {
        // Is the function there?
        if (function_exists($functionName)) {
                // Add new status
-               $URLs[$formData['id']]['new_status'] = $SURFBAR_CACHE['new_status'];
+               $URLs[$formData['id']]['new_status'] = $GLOBALS['cache_array']['surfbar']['new_status'];
 
                // Extract URL data for call-back
                $urlData = array(merge_array($URLs[$formData['id']], array($action => $formData)));
@@ -253,8 +251,6 @@ function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) {
 }
 // Validate if the requested action can be performed on current URL status
 function SURFBAR_VALIDATE_MEMBER_ACTION_STATUS ($action, $status) {
-       global $SURFBAR_CACHE;
-
        // Search for the requested action/status combination in database
        $result = SQL_QUERY_ESC("SELECT new_status FROM `{!_MYSQL_PREFIX!}_surfbar_actions` WHERE `action`='%s' AND `status`='%s' LIMIT 1",
                array($action, $status), __FILE__, __LINE__);
@@ -265,7 +261,7 @@ function SURFBAR_VALIDATE_MEMBER_ACTION_STATUS ($action, $status) {
        // Fetch the new status if found
        if ($isValid) {
                // Load new status
-               list($SURFBAR_CACHE['new_status']) = SQL_FETCHROW($result);
+               list($GLOBALS['cache_array']['surfbar']['new_status']) = SQL_FETCHROW($result);
        } // END - if
 
        // Free result
@@ -789,19 +785,17 @@ function SURFBAR_DETERMINE_TEMPLATE_NAME() {
 // Check if the "reload lock" of the current user is full, call this function
 // before you call SURFBAR_CHECK_RELOAD_LOCK().
 function SURFBAR_CHECK_RELOAD_FULL() {
-       global $SURFBAR_CACHE;
-
        // Default is full!
        $isFull = true;
 
        // Cache static reload lock
-       $SURFBAR_CACHE['surf_lock'] = getConfig('surfbar_static_lock');
+       $GLOBALS['cache_array']['surfbar']['surf_lock'] = getConfig('surfbar_static_lock');
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Fixed surf lock is ".getConfig('surfbar_static_lock')."", false);
 
        // Do we have dynamic model?
        if (getConfig('surfbar_pay_model') == "DYNAMIC") {
                // "Calculate" dynamic lock
-               $SURFBAR_CACHE['surf_lock'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
+               $GLOBALS['cache_array']['surfbar']['surf_lock'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
        } // END - if
 
        // Ask the database
@@ -814,12 +808,12 @@ LIMIT 1",
        );
 
        // Fetch row
-       list($SURFBAR_CACHE['user_locks']) = SQL_FETCHROW($result);
+       list($GLOBALS['cache_array']['surfbar']['user_locks']) = SQL_FETCHROW($result);
 
        // Is it null?
-       if (is_null($SURFBAR_CACHE['user_locks'])) {
+       if (is_null($GLOBALS['cache_array']['surfbar']['user_locks'])) {
                // Then fix it to zero!
-               $SURFBAR_CACHE['user_locks'] = 0;
+               $GLOBALS['cache_array']['surfbar']['user_locks'] = 0;
        } // END - if
 
        // Free result
@@ -915,10 +909,8 @@ LIMIT %s",
 }
 // Generate a validation code for the given id number
 function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") {
-       global $SURFBAR_CACHE;
-
        // @TODO Invalid salt should be refused
-       $SURFBAR_CACHE['salt'] = "INVALID";
+       $GLOBALS['cache_array']['surfbar']['salt'] = "INVALID";
 
        // Get code length from config
        $length = getConfig('code_length');
@@ -932,11 +924,11 @@ function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") {
                // Is the salt set?
                if (empty($salt)) {
                        // Generate random hashed string
-                       $SURFBAR_CACHE['salt'] = sha1(GEN_PASS(255));
+                       $GLOBALS['cache_array']['surfbar']['salt'] = sha1(GEN_PASS(255));
                        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "newSalt=".SURFBAR_GET_SALT()."", false);
                } else {
                        // Use this as salt!
-                       $SURFBAR_CACHE['salt'] = $salt;
+                       $GLOBALS['cache_array']['surfbar']['salt'] = $salt;
                        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "oldSalt=".SURFBAR_GET_SALT()."", false);
                }
 
@@ -957,8 +949,6 @@ function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") {
 }
 // Check validation code
 function SURFBAR_CHECK_VALIDATION_CODE ($urlId, $check, $salt) {
-       global $SURFBAR_CACHE;
-
        // Secure id number
        $urlId = bigintval($urlId);
 
@@ -1453,8 +1443,6 @@ function SURFBAR_RELOAD_TO_STOP_PAGE($page="stop") {
 // Determine next id for surfbar or get data for given id, always call this before you call other
 // getters below this function!!!
 function SURFBAR_DETERMINE_NEXT_ID ($urlId = 0) {
-       global $SURFBAR_CACHE;
-
        // Default is no id and no random number
        $nextId = 0;
        $randNum = 0;
@@ -1522,37 +1510,37 @@ LIMIT 1",
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "lastQuery=".getConfig('db_last_query')."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS()."", false);
        if (SQL_NUMROWS($result) == 1) {
                // Load/cache data
-               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($SURFBAR_CACHE).") - BEFORE", false);
-               $SURFBAR_CACHE = merge_array($SURFBAR_CACHE, SQL_FETCHARRAY($result));
-               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($SURFBAR_CACHE).") - AFTER", false);
+               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($GLOBALS['cache_array']['surfbar']).") - BEFORE", false);
+               $GLOBALS['cache_array']['surfbar'] = merge_array($GLOBALS['cache_array']['surfbar'], SQL_FETCHARRAY($result));
+               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($GLOBALS['cache_array']['surfbar']).") - AFTER", false);
 
                // Determine waiting time
-               $SURFBAR_CACHE['time'] = SURFBAR_DETERMINE_WAIT_TIME();
+               $GLOBALS['cache_array']['surfbar']['time'] = SURFBAR_DETERMINE_WAIT_TIME();
 
                // Is the last salt there?
-               if (is_null($SURFBAR_CACHE['last_salt'])) {
+               if (is_null($GLOBALS['cache_array']['surfbar']['last_salt'])) {
                        // Then repair it wit the static!
                        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "last_salt - FIXED!", false);
-                       $SURFBAR_CACHE['last_salt'] = "";
+                       $GLOBALS['cache_array']['surfbar']['last_salt'] = "";
                } // END - if
 
                // Fix missing last_surfed
-               if ((!isset($SURFBAR_CACHE['last_surfed'])) || (is_null($SURFBAR_CACHE['last_surfed']))) {
+               if ((!isset($GLOBALS['cache_array']['surfbar']['last_surfed'])) || (is_null($GLOBALS['cache_array']['surfbar']['last_surfed']))) {
                        // Fix it here
                        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "last_surfed - FIXED!", false);
-                       $SURFBAR_CACHE['last_surfed'] = 0;
+                       $GLOBALS['cache_array']['surfbar']['last_surfed'] = 0;
                } // END - if
 
                // Get base/fixed reward and costs
-               $SURFBAR_CACHE['reward'] = SURFBAR_DETERMINE_REWARD();
-               $SURFBAR_CACHE['costs']  = SURFBAR_DETERMINE_COSTS();
+               $GLOBALS['cache_array']['surfbar']['reward'] = SURFBAR_DETERMINE_REWARD();
+               $GLOBALS['cache_array']['surfbar']['costs']  = SURFBAR_DETERMINE_COSTS();
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "BASE/STATIC - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."", false);
 
                // Only in dynamic model add the dynamic bonus!
                if (getConfig('surfbar_pay_model') == "DYNAMIC") {
                        // Calculate dynamic reward/costs and add it
-                       $SURFBAR_CACHE['reward'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
-                       $SURFBAR_CACHE['costs']  += SURFBAR_CALCULATE_DYNAMIC_ADD();
+                       $GLOBALS['cache_array']['surfbar']['reward'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
+                       $GLOBALS['cache_array']['surfbar']['costs']  += SURFBAR_CALCULATE_DYNAMIC_ADD();
                        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "DYNAMIC+ - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."", false);
                } // END - if
 
@@ -1569,23 +1557,22 @@ LIMIT 1",
 }
 // -----------------------------------------------------------------------------
 // PLEASE DO NOT ADD ANY OTHER FUNCTIONS BELOW THIS LINE ELSE THEY "WRAP" THE
-// $SURFBAR_CACHE ARRAY!
+// $GLOBALS['cache_array']['surfbar'] ARRAY!
 // -----------------------------------------------------------------------------
 // Private getter for data elements
 function SURFBAR_GET_DATA ($element) {
-       global $SURFBAR_CACHE;
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "element={$element}", false);
 
        // Default is null
        $data = null;
 
        // Is the entry there?
-       if (isset($SURFBAR_CACHE[$element])) {
+       if (isset($GLOBALS['cache_array']['surfbar'][$element])) {
                // Then take it
-               $data = $SURFBAR_CACHE[$element];
+               $data = $GLOBALS['cache_array']['surfbar'][$element];
        } else { // END - if
                print("<pre>");
-               print_r($SURFBAR_CACHE);
+               print_r($GLOBALS['cache_array']['surfbar']);
                print("</pre>");
                debug_report_bug();
        }
index dd7e324..cfd0277 100644 (file)
@@ -336,15 +336,15 @@ ORDER BY d.userid";
                }
 
                // Autopurge installed?
-               $LAST = "";
+               $lastOnline = "";
                if ((EXT_IS_ACTIVE("autopurge")) && (getConfig('autopurge_inactive') == "Y") && (getConfig('ap_inactive_since') > 0)) {
                        // Use last online timestamp to keep inactive members away from here
-                       $LAST   = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
+                       $lastOnline   = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
                }
 
                $SQLs[]   = "SELECT ".$USE." AS points
 FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND ".$USE.">0".$LAST."
+WHERE `status`='CONFIRMED' AND ".$USE.">0".$lastOnline."
 ORDER BY points DESC, userid";
                $WHATs[]  = "list_bonus";
                $DESCRs[] = getMessage('ADMIN_TASK_LIST_BONUS');
@@ -355,14 +355,14 @@ ORDER BY points DESC, userid";
                // Begging rallye
 
                // Autopurge installed?
-               $LAST = "";
+               $lastOnline = "";
                if ((EXT_IS_ACTIVE("autopurge")) && (getConfig('autopurge_inactive') == "Y") && (getConfig('ap_inactive_since') > 0)) {
                        // Use last online timestamp to keep inactive members away from here
-                       $LAST   = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
+                       $lastOnline   = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
                }
 
                $SQLs[]   = "SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND beg_points>0".$LAST."
+WHERE `status`='CONFIRMED' AND beg_points>0".$lastOnline."
 ORDER BY beg_points DESC, userid";
                $WHATs[]  = "list_beg";
                $DESCRs[] = getMessage('ADMIN_TASK_LIST_BEG');
index 4a56e67..2dfcac2 100644 (file)
@@ -191,10 +191,10 @@ function GET_CURR_THEME_NAME () {
 }
 
 // Initialize variables
-$currTheme = GET_CURR_THEME();
+$GLOBALS['curr_theme'] = GET_CURR_THEME();
 
 // Check if new theme is selcted
-if ((!empty($_POST['new_theme'])) && ($_POST['new_theme'] != $currTheme)) {
+if ((!empty($_POST['new_theme'])) && ($_POST['new_theme'] != $GLOBALS['curr_theme'])) {
        // Set new theme for guests
        $newTheme = $_POST['new_theme'];
 
@@ -202,7 +202,7 @@ if ((!empty($_POST['new_theme'])) && ($_POST['new_theme'] != $currTheme)) {
        set_session('mxchange_theme', $newTheme);
 
        // Remove current from array and set new
-       $theme = sprintf("%stheme/%s/theme.php", constant('PATH'), $currTheme);
+       $theme = sprintf("%stheme/%s/theme.php", constant('PATH'), $GLOBALS['curr_theme']);
        unset($INC_POOL[array_search($theme, $INC_POOL)]);
        $INC_POOL[] = sprintf("%stheme/%s/theme.php", constant('PATH'), $newTheme);
 } // END - if
index 7c747dd..05d43f9 100644 (file)
@@ -257,22 +257,22 @@ function SELECT_RANDOM_REFID () {
 // Do the user login
 function USER_DO_LOGIN ($uid, $passwd) {
        // Add last_login if available
-       $LAST = "";
+       $lastOnline = "";
        if (GET_EXT_VERSION("sql_patches") >= "0.2.8") {
-               $LAST = ", last_login";
+               $lastOnline = ", last_login";
        } // END - if
 
        // Check login data
        $password = ""; $uid2 = ""; $dmy = ""; $online = 0; $login = 0;
        if ((EXT_IS_ACTIVE("nickname")) && (NICKNAME_PROBE_ON_USERID($uid))) {
                // Nickname entered
-               $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$LAST." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' AND `status`='CONFIRMED' LIMIT 1",
+               $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$lastOnline." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' AND `status`='CONFIRMED' LIMIT 1",
                        array($uid), __FILE__, __LINE__);
                list($uid2, $password, $online, $login) = SQL_FETCHROW($result);
                if (!empty($uid2)) $uid = bigintval($uid2);
        } else {
                // Direct userid entered
-               $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$LAST." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
+               $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$lastOnline." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
                        array($uid, $hash), __FILE__, __LINE__);
                list($uid2, $password, $online, $login) = SQL_FETCHROW($result);
        }
@@ -346,11 +346,11 @@ function USER_DO_LOGIN ($uid, $passwd) {
                                        }
                                } else {
                                        // Cannot update counter!
-                                       $URL = "modules.php?module=index&amp;what=login&amp;login=".CODE_CNTR_FAILED;
+                                       $URL = "modules.php?module=index&amp;what=login&amp;login=".constant('CODE_CNTR_FAILED');
                                }
                        } else {
                                // Cookies not setable!
-                               $URL = "modules.php?module=index&amp;what=login&amp;login=".CODE_NO_COOKIES;
+                               $URL = "modules.php?module=index&amp;what=login&amp;login=".constant('CODE_NO_COOKIES');
                        }
                } elseif (GET_EXT_VERSION("sql_patches") >= "0.6.1") {
                        // Update failture counter
@@ -358,7 +358,7 @@ function USER_DO_LOGIN ($uid, $passwd) {
                                array($uid), __FILE__, __LINE__);
 
                        // Wrong password!
-                       $URL = "modules.php?module=index&amp;what=login&amp;login=".CODE_WRONG_PASS;
+                       $URL = "modules.php?module=index&amp;what=login&amp;login=".constant('CODE_WRONG_PASS');
                }
        } elseif ((($probe_nickname) && (!empty($uid2))) || ($uid2 == $uid)) {
                // Other account status?
index 0cb2753..ba46ef3 100644 (file)
@@ -39,20 +39,18 @@ if (!defined('__SECURITY')) {
 
 // Sets a status message and code
 function WERNIS_STATUS_MESSAGE ($msg, $status) {
-       global $WERNIS;
-       $WERNIS['message'] = $msg;
-       $WERNIS['status'] = $status;
+       $GLOBALS['wernis_data']['message'] = $msg;
+       $GLOBALS['wernis_data']['status'] = $status;
 }
 
 // Get the status message
 function GET_WERNIS_ERROR_MESSAGE () {
-       global $WERNIS;
-       if (isset($WERNIS['message'])) {
+       if (isset($GLOBALS['wernis_data']['message'])) {
                // Use raw message
-               return $WERNIS['message'];
-       } elseif (isset($WERNIS['status'])) {
+               return $GLOBALS['wernis_data']['message'];
+       } elseif (isset($GLOBALS['wernis_data']['status'])) {
                // Fall-back to status
-               return sprintf(WERNIS_ERROR_STATUS, $WERNIS['status']);
+               return sprintf(WERNIS_ERROR_STATUS, $GLOBALS['wernis_data']['status']);
        } else {
                // Something bad happend
                return WERNIS_UNKNOWN_ERROR;
@@ -61,10 +59,9 @@ function GET_WERNIS_ERROR_MESSAGE () {
 
 // Get the status code
 function GET_WERNIS_ERROR_CODE () {
-       global $WERNIS;
-       if (isset($WERNIS['status'])) {
+       if (isset($GLOBALS['wernis_data']['status'])) {
                // Use raw message
-               return $WERNIS['status'];
+               return $GLOBALS['wernis_data']['status'];
        } else {
                // Something bad happend
                return WERNIS_UNKNOWN_ERROR;
index c3d2574..67d43e2 100644 (file)
@@ -38,8 +38,7 @@ if (!defined('__SECURITY')) {
 }
 
 // Init variables
-global $EXT_CSS_FILES;
-$EXT_CSS_FILES = array();
+EXT_INIT_CSS_FILES();
 $ADD = "";
 
 // Init cache instance and array
@@ -107,7 +106,7 @@ if ($GLOBALS['cacheMode'] == "load") {
        $EXT_NAMES = array();
        foreach ($EXT_DUMMY['ext_name'] as $k => $name) {
                // Load CSS file
-               if ($EXT_DUMMY['ext_css'][$k] == "Y") $EXT_CSS_FILES[] = "".$name.".css";
+               if ($EXT_DUMMY['ext_css'][$k] == "Y") EXT_ADD_CSS_FILE("".$name.".css");
 
                // Load extension file itself
                if ((($EXT_DUMMY['ext_active'][$k] == "Y") || ($EXT_DUMMY['ext_keep'][$k] == "Y") || (IS_ADMIN())) && (!in_array($name, array("sql_patches", "cache")))) {
@@ -234,7 +233,7 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($GLOBALS['cacheMode'] == "init") && ($
                                // Is the file there?
                                if (FILE_READABLE($GLOBALS['output_mode']_FILE)) {
                                        // CSS file for extension was found (use only relative path for now!)
-                                       $EXT_CSS_FILES[] = $content['ext_name'].".css";
+                                       EXT_ADD_CSS_FILE($content['ext_name'].".css");
                                        $content['ext_css'] = "Y";
                                } else {
                                        // Don't load CSS file
index 2ae06ce..eb4de04 100644 (file)
@@ -111,7 +111,6 @@ if (GET_EXT_VERSION("admins") >= "0.3") {
        // Check for cache file
        if (($GLOBALS['cache_instance']->loadCacheFile("admins_acls")) && ($GLOBALS['cache_instance']->extensionVersionMatches("admins"))) {
                // Load referal system from cache
-               global $GLOBALS['cache_array'];
                $GLOBALS['cache_array']['admin_acls'] = $GLOBALS['cache_instance']->getArrayFromCache();
        } elseif ((getConfig('cache_acls') == "Y") && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
                // Create cache file here
index e7b1acb..ea677c8 100644 (file)
@@ -232,7 +232,7 @@ function CHECK_ADMIN_COOKIES ($admin_login, $password) {
 
 //
 function ADMIN_DO_ACTION($wht) {
-       global $menuDesription, $menuTitle, $DATA;
+       global $DATA;
        //* DEBUG: */ echo __LINE__."*".$wht."/".$GLOBALS['module']."/".$GLOBALS['action']."/".$GLOBALS['what']."*<br />\n";
 
        // Remove any spaces from variable
@@ -297,15 +297,13 @@ LIMIT 1", array($act, $wht, $wht), __FILE__, __LINE__);
 }
 //
 function ADD_ADMIN_MENU($act, $wht, $return=false) {
-       global $menuDesription, $menuTitle;
-
        // Init variables
        $SUB = false;
        $OUT = "";
 
        // Menu descriptions
-       $menuDesription = array();
-       $menuTitle = array();
+       $GLOBALS['menu']['description'] = array();
+       $GLOBALS['menu']['title'] = array();
 
        // Is there a cache instance?
        if ((is_object($GLOBALS['cache_instance'])) && (getConfig('cache_admin_menu') == "Y")) {
@@ -319,8 +317,8 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) {
 
                        // Extract all parts
                        $OUT = base64_decode($data['output'][0]);
-                       $menuTitle = unserialize(base64_decode($data['title'][0]));
-                       $menuDescription = unserialize(base64_decode($data['descr'][0]));
+                       $GLOBALS['menu']['title'] = unserialize(base64_decode($data['title'][0]));
+                       $GLOBALS['menu']['description'] = unserialize(base64_decode($data['descr'][0]));
 
                        // Return or output content?
                        if ($return) {
@@ -347,8 +345,8 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) {
                        if ($ACL === true) {
                                if (!$SUB) {
                                        // Insert compiled menu title and description
-                                       $menuTitle[$menu]      = $title;
-                                       $menuDesription[$menu] = $descr;
+                                       $GLOBALS['menu']['title'][$menu]      = $title;
+                                       $GLOBALS['menu']['description'][$menu] = $descr;
                                }
                                $OUT .= "<tr>
        <td class=\"admin_menu\" colspan=\"2\">
@@ -376,8 +374,8 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) {
                                        array($menu), __FILE__, __LINE__);
                                if ((SQL_NUMROWS($result_what) > 0) && ($act == $menu))
                                {
-                                       $menuDesription = array();
-                                       $menuTitle = array(); $SUB = true;
+                                       $GLOBALS['menu']['description'] = array();
+                                       $GLOBALS['menu']['title'] = array(); $SUB = true;
                                        $OUT .= "<tr>
        <td width=\"10\" class=\"seperator\">&nbsp;</td>
        <td class=\"admin_menu\">
@@ -394,8 +392,8 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) {
                                                $readable = INCLUDE_READABLE($INC);
                                                if ($ACL === true) {
                                                        // Insert compiled title and description
-                                                       $menuTitle[$wht_sub]      = $title_what;
-                                                       $menuDesription[$wht_sub] = $desc_what;
+                                                       $GLOBALS['menu']['title'][$wht_sub]      = $title_what;
+                                                       $GLOBALS['menu']['description'][$wht_sub] = $desc_what;
                                                        $OUT .= "<tr>
        <td class=\"admin_menu\" colspan=\"2\">
                <NOBR>&nbsp;<strong>--&gt;</strong>&nbsp;";
@@ -463,8 +461,8 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) {
                // Prepare cache data
                $data = array(
                        'output' => base64_encode($OUT),
-                       'title'  => $menuTitle,
-                       'descr'  => $menuDesription
+                       'title'  => $GLOBALS['menu']['title'],
+                       'descr'  => $GLOBALS['menu']['description']
                );
 
                // Write the data away
index 65a4452..f99652b 100644 (file)
@@ -50,17 +50,17 @@ if (getConfig('beg_rallye') == "Y") {
        } // END - if
 
        // Autopurge installed?
-       $LAST = "%s"; $ONLINE = "";
+       $lastOnline = "%s"; $ONLINE = "";
        if (EXT_IS_ACTIVE("autopurge")) {
                // Use last online timestamp to keep inactive members away from here
-               $LAST   = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
+               $lastOnline   = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
                $ONLINE = getConfig('ap_inactive_since');
        } // END - if
 
        // Check if at least one is in the active rallye
        $result = SQL_QUERY_ESC("SELECT userid, email, gender, surname, family, beg_points, last_online
 FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND beg_points > 0".$LAST."
+WHERE `status`='CONFIRMED' AND beg_points > 0".$lastOnline."
 ORDER BY beg_points DESC, last_online DESC, userid",
         array($ONLINE), __FILE__, __LINE__);
 
index f7719b9..3148e6c 100644 (file)
@@ -65,17 +65,17 @@ if (getConfig('bonus_active') == "Y") {
        }
 
        // Autopurge installed?
-       $LAST = "%s"; $ONLINE = "";
+       $lastOnline = "%s"; $ONLINE = "";
        if (EXT_IS_ACTIVE("autopurge")) {
                // Use last online timestamp to keep inactive members away from here
-               $LAST   = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
+               $lastOnline   = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
                $ONLINE = getConfig('ap_inactive_since');
        }
 
        // Check if at least one is in the active rallye
        $result = SQL_QUERY_ESC("SELECT userid AS uid, email, gender, surname, family, ".$USE." AS points, last_online AS last
 FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND ".$USE." > 0".$LAST."
+WHERE `status`='CONFIRMED' AND ".$USE." > 0".$lastOnline."
 ORDER BY points DESC, last_online DESC, userid",
         array($ONLINE), __FILE__, __LINE__);
 
index 2145246..9d43b8d 100644 (file)
@@ -61,14 +61,13 @@ if ($GLOBALS['action'] == "login") {
 // Are there jobs to be done?
 if ($JOBS_DONE) {
        // Generate overview of all main menus
-       global $menuDesription;
-       if ((is_array($menuDesription)) && (sizeof($menuDesription) > 0)) {
+       if ((is_array($GLOBALS['menu']['description'])) && (sizeof($GLOBALS['menu']['description']) > 0)) {
                $OUT = "";
-               foreach ($menuDesription as $key => $value)
+               foreach ($GLOBALS['menu']['description'] as $key => $value)
                {
                        // Prepare content
                        $content = array(
-                               'title' => $menuTitle[$key],
+                               'title' => $GLOBALS['menu']['title'][$key],
                                'text'  => $value
                        );
 
index eb590f7..13ffa23 100644 (file)
@@ -85,8 +85,7 @@ if ($SEL > 0) {
        set_session('mxchange_theme', $POST['default_theme']);
 
        // Set it in config and current theme as well
-       global $currTheme;
-       $currTheme = $POST['default_theme'];
+       $GLOBALS['curr_theme'] = $POST['default_theme'];
        setConfigEntry('default_theme', $POST['default_theme']);
 
        // Save theme
index ed3311a..27bf1f5 100644 (file)
@@ -46,16 +46,16 @@ if (!defined('__SECURITY')) {
 ADD_DESCR("member", __FILE__);
 
 // Autopurge installed?
-$LAST = "%s"; $ONLINE = "";
+$lastOnline = "%s"; $ONLINE = "";
 if (EXT_IS_ACTIVE("autopurge")) {
        // Use last online timestamp to keep inactive members away from here
-       $LAST   = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
+       $lastOnline   = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
        $ONLINE = getConfig('ap_inactive_since');
 }
 
 // Let's check if there are some points left we can "pay"...
 $result = SQL_QUERY_ESC("SELECT userid, beg_points AS beg, last_online FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE beg_points > 0 AND `status`='CONFIRMED'".$LAST."
+WHERE beg_points > 0 AND `status`='CONFIRMED'".$lastOnline."
 ORDER BY beg_points DESC, last_online DESC, userid LIMIT %s",
        array($ONLINE, getConfig('beg_ranks')), __FILE__, __LINE__);
 
index 60f6163..1d2a804 100644 (file)
@@ -61,16 +61,16 @@ if (GET_EXT_VERSION("bonus") >= "0.6.9") {
 }
 
 // Autopurge installed?
-$LAST = "%s"; $ONLINE = "";
+$lastOnline = "%s"; $ONLINE = "";
 if (EXT_IS_ACTIVE("autopurge")) {
        // Use last online timestamp to keep inactive members away from here
-       $LAST   = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
+       $lastOnline   = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
        $ONLINE = getConfig('ap_inactive_since');
 }
 
 // Let's check if there are some points left we can "pay"...
 $result = SQL_QUERY_ESC("SELECT userid, ".$USE." AS points, last_online FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE ".$USE." > 0 AND `status`='CONFIRMED'".$LAST."
+WHERE ".$USE." > 0 AND `status`='CONFIRMED'".$lastOnline."
 ORDER BY points DESC, last_online DESC, userid
 LIMIT %s",
        array($ONLINE, getConfig('bonus_ranks')), __FILE__, __LINE__);
index c52971a..cb48d77 100644 (file)
@@ -43,8 +43,8 @@ if (!defined('__SECURITY')) {
 ADD_DESCR ("member", basename(__FILE__));
 
 // Export data for template
-define('_LAST_ONLINE_VALUE', MAKE_DATETIME($LAST['online']));
-define('_LAST_MODULE_VALUE', GET_MOD_DESCR("member", $LAST['module']));
+define('_LAST_ONLINE_VALUE', MAKE_DATETIME($GLOBALS['last']['online']));
+define('_LAST_MODULE_VALUE', GET_MOD_DESCR("member", $GLOBALS['last']['module']));
 
 // Load header template
 LOAD_TEMPLATE("member_welcome_header");
index cb41c07..0d53569 100644 (file)
@@ -125,8 +125,7 @@ $_CONFIG = array(
 $GLOBALS['header_sent'] = 0;
 
 // Init fatal messages
-global $FATAL;
-$FATAL = array();
+initFatalMessages();
 
 // Check if this file is writeable or read-only and warn the user
 if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndTrue('mxchange_installed'))) {
@@ -134,7 +133,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT
        if (empty($GLOBALS['module'])) $GLOBALS['module'] = "index";
 
        // CSS array
-       $EXT_CSS_FILES = array();
+       EXT_INIT_CSS_FILES();
 
        if ((!empty($MySQL['host'])) && (!empty($MySQL['login'])) && (!empty($MySQL['password'])) && (!empty($MySQL['dbase']))) {
                // Connect to DB
index db512f6..2a9072d 100644 (file)
@@ -201,8 +201,6 @@ function CHECK_MODULE ($mod) {
 
 // Add menu description pending on given file name (without path!)
 function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) {
-       global $NAV_DEPTH;
-
        // Use only filename of the FQFN...
        $file = basename($FQFN);
 
@@ -263,11 +261,11 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) {
        }
 
        // Begin the navigation line
-       if ((!isset($NAV_DEPTH)) && (!$return)) {
-               $NAV_DEPTH = 0;
+       if ((!isset($GLOBALS['nav_depth'])) && (!$return)) {
+               $GLOBALS['nav_depth'] = 0;
                $prefix = "<div class=\"you_are_here\">{--YOU_ARE_HERE--}&nbsp;<strong><a class=\"you_are_here\" href=\"{!URL!}/modules.php?module=".$GLOBALS['module'].$LINK_ADD."\">Home</a></strong>";
        } else {
-               if (!$return) $NAV_DEPTH++;
+               if (!$return) $GLOBALS['nav_depth']++;
                $prefix = "";
        }
 
@@ -302,7 +300,7 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) {
                                //* DEBUG: */ echo __LINE__."+".$type."+<br />\n";
                                // Add closing div and br-tag
                                $OUT .= "</div><br />\n";
-                               $NAV_DEPTH = "0";
+                               $GLOBALS['nav_depth'] = "0";
 
                                // Run the filter chain
                                $ret = RUN_FILTER('post_youhere_line', array('access_level' => $ACC_LVL, 'type' => $type, 'content' => ""));
@@ -505,7 +503,6 @@ function IS_ADMIN ($admin="") {
 
 // Generates a list of "max receiveable emails per day"
 function ADD_MAX_RECEIVE_LIST ($MODE, $default = "", $return = false) {
-       global $_POST;
        $OUT = "";
        switch ($MODE) {
        case "guest":
@@ -580,8 +577,9 @@ function SEARCH_EMAIL_USERTAB ($email) {
 
 // Checks wether the current user is a member
 function IS_MEMBER () {
-       global $status, $LAST;
-       if (!is_array($LAST)) $LAST = array();
+       // @TODO Why is this global??? #100
+       global $status;
+       if (!is_array($GLOBALS['last'])) $GLOBALS['last'] = array();
        $ret = false;
 
        // is the cache entry there?
@@ -606,9 +604,9 @@ function IS_MEMBER () {
                        $valPass = generatePassString($password);
 
                        // Transfer last module and online time
-                       if ((!empty($mod)) && (empty($LAST['module']))) {
-                               $LAST['module'] = $mod;
-                               $LAST['online'] = $onl;
+                       if ((!empty($mod)) && (empty($GLOBALS['last']['module']))) {
+                               $GLOBALS['last']['module'] = $mod;
+                               $GLOBALS['last']['online'] = $onl;
                        } // END - if
 
                        // So did we now have valid data and an unlocked user?
@@ -694,9 +692,9 @@ function VALIDATE_MENU_ACTION ($MODE, $act, $wht, $UPDATE=false) {
        // Return result
        return $ret;
 }
+
 //
-function GET_MOD_DESCR($MODE, $wht, $column="what")
-{
+function GET_MOD_DESCR($MODE, $wht, $column="what") {
        // Fix empty "what"
        if (empty($wht)) {
                $wht = "welcome";
@@ -853,9 +851,7 @@ function COUNT_MODULE($mod) {
 }
 // Get action value from mode (admin/guest/member) and what-value
 function GET_ACTION ($MODE, &$wht) {
-       global $ret;
-
-       // @DEPRECATED Init status
+       // Init status
        $ret = "";
 
        //* DEBUG: */ echo __LINE__."=".$MODE."/".$wht."/".$GLOBALS['action']."=<br />";
index 7c295b2..e385882 100644 (file)
@@ -47,8 +47,6 @@ if (defined('__DAILY_RESET')) {
 }
 
 // Need this here
-global $REPLACER;
-
 // Only send bonus mail when bonus extension is active and maximum send-mails is not reached
 if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
        // Do we need to send out bonus mails?
@@ -101,7 +99,7 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
                                        // Mark this user as "spammed" ;-) And place a line for him...
                                        if (REMOVE_RECEIVER($dummy, $key, $uid, $DATA['id'], $DATA['id'], true) == "done") {
                                                // Replace text variables
-                                               foreach ($REPLACER as $key => $value) {
+                                               foreach ($GLOBALS['replacer'] as $key => $value) {
                                                        if (isset($DATA[$key])) $DATA['text'] = str_replace($value, $DATA[$key], $DATA['text']);
                                                } // END - foreach
 
index 96b1280..2245950 100644 (file)
@@ -47,8 +47,6 @@ if (defined('__DAILY_RESET')) {
 }
 
 // Need this here
-global $REPLACER;
-
 // Check for freed mail orders to send out
 if (EXT_IS_ACTIVE("html_mail")) {
        //                                0     1        2      3       4          5            6      7        8          9       10
@@ -59,7 +57,7 @@ if (EXT_IS_ACTIVE("html_mail")) {
 }
 
 // Reset variables
-$cnt2 = 0; $LAST_SENT_ID = 0; $cnt_back = array("0"); $pointsBack = array("0");
+$cnt2 = 0; $lastSentId = 0; $cnt_back = array("0"); $pointsBack = array("0");
 if (SQL_NUMROWS($result_main) > 0) {
        // Parse all mails
        while ($DATA = SQL_FETCHROW($result_main)) {
@@ -137,7 +135,7 @@ if (SQL_NUMROWS($result_main) > 0) {
                                                        $DATA[14] = TRANSLATE_GENDER($gender);
 
                                                        // Replace text variables
-                                                       foreach ($REPLACER as $key => $value) {
+                                                       foreach ($GLOBALS['replacer'] as $key => $value) {
                                                                if (isset($DATA[$key])) $DATA[3] = str_replace($value, $DATA[$key], $DATA[3]);
                                                        } // END - if
 
@@ -189,8 +187,8 @@ if (SQL_NUMROWS($result_main) > 0) {
                                        }
 
                                        // Do we have reached the maximum to send mails? || (getConfig('max_send') >= $GLOBALS['pool_cnt'])
-                                       //* DEBUG: */ echo "*L:".__LINE__."/".$GLOBALS['pool_cnt'].">=".$DATA[8]."/".getConfig('max_send').">=".$GLOBALS['pool_cnt']."/".$LAST_SENT_ID."!=".$DATA[0]."*<br />";
-                                       if ((($GLOBALS['pool_cnt'] >= $DATA[8])) && ($LAST_SENT_ID != $DATA[0])) {
+                                       //* DEBUG: */ echo "*L:".__LINE__."/".$GLOBALS['pool_cnt'].">=".$DATA[8]."/".getConfig('max_send').">=".$GLOBALS['pool_cnt']."/".$lastSentId."!=".$DATA[0]."*<br />";
+                                       if ((($GLOBALS['pool_cnt'] >= $DATA[8])) && ($lastSentId != $DATA[0])) {
                                                // Prepare content
                                                $content = array(
                                                        'sender_uid' => $DATA[1],
@@ -230,7 +228,7 @@ if (SQL_NUMROWS($result_main) > 0) {
                                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET timestamp_send=UNIX_TIMESTAMP() WHERE pool_id=%s LIMIT 1",
                                                        array(bigintval($DATA[0])), __FILE__, __LINE__);
 
-                                               $LAST_SENT_ID = $DATA[0]; $GLOBALS['pool_cnt'] = 0;
+                                               $lastSentId = $DATA[0]; $GLOBALS['pool_cnt'] = 0;
                                                $cnt2 += $GLOBALS['pool_cnt'];
 
                                                // Update mediadata if version is 0.0.4 or higher
index e9aa80c..6e6fafe 100644 (file)
@@ -51,10 +51,7 @@ if (!isConfigEntrySet('css_php')) setConfigEntry('css_php', "FILE");
 // Output CSS files or content or link to css.php ?
 if (($GLOBALS['output_mode'] == "1") || (getConfig('css_php') == "DIRECT")) {
        // Load CSS files
-       if (is_array($EXT_CSS_FILES)) {
-               // Load extension's CSS files
-               foreach ($EXT_CSS_FILES as $value) $STYLES[] = $value;
-       } // END - if
+       $STYLES = merge_array($STYLES, EXT_GET_CSS_FILES());
 
        // Output inclusion lines
        foreach ($STYLES as $value) {
index e9264b7..4f2b720 100644 (file)
--- a/index.php
+++ b/index.php
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
-
-// Set "CSS-Mode"
-$GLOBALS['output_mode'] = "0";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
 
 // Set module
 $GLOBALS['module'] = "index";
 
+// Set "CSS-Mode"
+$GLOBALS['output_mode'] = "0";
+
 // Load config.php
 require("inc/config.php");
 
index 8cab9a1..6858ef7 100644 (file)
@@ -48,7 +48,6 @@ define('mxchange_installing', true);
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
 $GLOBALS['what']   = "";
 $GLOBALS['action'] = "";
 
diff --git a/js.php b/js.php
index 9ef588d..ebbdbd7 100644 (file)
--- a/js.php
+++ b/js.php
@@ -38,7 +38,6 @@ define('_OB_CACHING', "old");
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
 $GLOBALS['what']   = "";
 $GLOBALS['action'] = "";
 
@@ -49,7 +48,8 @@ $GLOBALS['action'] = "";
 // pattern is given...
 //
 // But mxchange 0.3.0 will show that in better way! :D :D :D
-$GLOBALS['output_mode'] = "1"; $GLOBALS['module'] = "js";
+$GLOBALS['output_mode'] = "1";
+$GLOBALS['module'] = "js";
 
 // Load the required file(s)
 require("inc/config.php");
index 1e03ef8..3d51c0b 100644 (file)
@@ -35,9 +35,9 @@
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action, $startTime;
 $GLOBALS['startTime'] = microtime(true);
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
 
 // Set module
 $GLOBALS['module'] = "lead-confirm";
index 31c3fdb..231f9cd 100644 (file)
--- a/login.php
+++ b/login.php
@@ -35,8 +35,8 @@
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
 
 // Set module
 $GLOBALS['module'] = "login";
index 4371aad..0847e7d 100644 (file)
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
 
 // Tell everyone we are in this module
-$GLOBALS['module'] = "mailid"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "mailid";
+$GLOBALS['output_mode'] = -1;
 
 // Load the required file(s)
 require("inc/config.php");
index 42c8159..240588b 100644 (file)
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
 
 // Tell everyone we are in this module
-$GLOBALS['module'] = "mailid";  $GLOBALS['output_mode'] = 0;
+$GLOBALS['module'] = "mailid"; 
+$GLOBALS['output_mode'] = 0;
 
 // Load the required file(s)
 require("inc/config.php");
index 0b11117..d19dbb2 100644 (file)
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action, $startTime;
 $GLOBALS['startTime'] = microtime(true);
 $GLOBALS['output_mode'] = 0;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what']   = "";
+$GLOBALS['action'] = "";
 $GLOBALS['userid'] = 0;
 
 // Fix missing module to "index"
diff --git a/ref.php b/ref.php
index a9dc0ec..34fe633 100644 (file)
--- a/ref.php
+++ b/ref.php
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
 
 // Set module
-$GLOBALS['module'] = "ref"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "ref";
+$GLOBALS['output_mode'] = -1;
 
 // Load the required file(s)
 require("inc/config.php");
index eb0060f..b92c0a8 100644 (file)
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action, $startTime;
 $GLOBALS['startTime'] = microtime(true);
 $GLOBALS['what'] = "";
 $GLOBALS['action'] = "";
 
 // Set this because we have no module in URI
-$GLOBALS['module'] = "show_bonus"; $GLOBALS['output_mode'] = 0;
+$GLOBALS['module'] = "show_bonus";
+$GLOBALS['output_mode'] = 0;
 
 // Load the required file(s)
 require("inc/config.php");
index 9ad343c..5fb6ec5 100644 (file)
@@ -34,8 +34,8 @@
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
 
 // Set module
 $GLOBALS['module'] = "sponsor_confirm";
index a764d22..d3a6f67 100644 (file)
@@ -34,7 +34,6 @@
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
 $GLOBALS['what'] = ""; $GLOBALS['action'] = "";
 
 // Set module
index 80e9605..5ed6a8a 100644 (file)
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action, $startTime, $SURFBAR_CACHE;
-$SURFBAR_CACHE = array();
+$GLOBALS['cache_array']['surfbar'] = array();
 $GLOBALS['startTime'] = microtime(true);
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
 
 // Set module
 $GLOBALS['module'] = "surfbar";
index 7c311fa..f1d8562 100644 (file)
--- a/view.php
+++ b/view.php
 require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
 
 // Set module
-$GLOBALS['module'] = "view"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "view";
+$GLOBALS['output_mode'] = -1;
 
 // Load the required file(s)
 require("inc/config.php");