Global removed on many places, rewritten to use incrementConfigEntry()
authorRoland Häder <roland@mxchange.org>
Sat, 20 Dec 2008 10:54:11 +0000 (10:54 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 20 Dec 2008 10:54:11 +0000 (10:54 +0000)
inc/databases.php
inc/extensions.php
inc/functions.php
inc/libs/admins_functions.php
inc/libs/rallye_functions.php
inc/libs/theme_functions.php
inc/modules/admin/admin-inc.php
inc/mysql-manager.php

index ccf528d3b37de13b5cdad0b4eb2cbd6ffcf378b1..62ecf0d9975e402e01b2e1f5796a616f6253fffb 100644 (file)
@@ -115,7 +115,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // Current SVN revision
 define('SERVER_URL', "http://www.mxchange.org");
 
 // Current SVN revision
-define('CURR_SVN_REVISION', "689");
+define('CURR_SVN_REVISION', "690");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index 0e49343d0ac81b16312485f88395ff9b563964d6..5abc6756d5b67cdd79c5009cfc832eab431ea1eb 100644 (file)
@@ -329,7 +329,7 @@ function EXTENSION_RUN_SQLS ($ext_id, $load_mode) {
 
 // Check if given extension is active
 function EXT_IS_ACTIVE ($ext_name) {
 
 // Check if given extension is active
 function EXT_IS_ACTIVE ($ext_name) {
-       global $cacheArray, $_CONFIG;
+       global $cacheArray;
 
        // Extensions are all inactive during installation
        if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing')) || (empty($ext_name))) return false;
 
        // Extensions are all inactive during installation
        if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing')) || (empty($ext_name))) return false;
@@ -344,7 +344,7 @@ function EXT_IS_ACTIVE ($ext_name) {
                $active = $cacheArray['extensions']['ext_active'][$ext_name];
 
                // Count cache hits
                $active = $cacheArray['extensions']['ext_active'][$ext_name];
 
                // Count cache hits
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               incrementConfigEntry('cache_hits');
        } elseif (($ext_name == "cache") || (GET_EXT_VERSION("cache") == "")) {
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "DB! ext_name={$ext_name}");
                // Load from database
        } elseif (($ext_name == "cache") || (GET_EXT_VERSION("cache") == "")) {
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "DB! ext_name={$ext_name}");
                // Load from database
@@ -377,7 +377,7 @@ function EXT_IS_ACTIVE ($ext_name) {
 }
 // Get version from extensions
 function GET_EXT_VERSION ($ext_name) {
 }
 // Get version from extensions
 function GET_EXT_VERSION ($ext_name) {
-       global $cacheArray, $_CONFIG, $cacheInstance;
+       global $cacheArray, $cacheInstance;
        $ext_ver = false;
 
        // Extensions are all inactive during installation
        $ext_ver = false;
 
        // Extensions are all inactive during installation
@@ -391,7 +391,7 @@ function GET_EXT_VERSION ($ext_name) {
                $ext_ver = $cacheArray['extensions']['ext_version'][$ext_name];
 
                // Count cache hits
                $ext_ver = $cacheArray['extensions']['ext_version'][$ext_name];
 
                // Count cache hits
-               if (getConfig('cache_hits') > 0) $_CONFIG['cache_hits']++; else $_CONFIG['cache_hits'] = 1;
+               incrementConfigEntry('cache_hits');
        } elseif (!is_object($cacheInstance)) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT ext_version FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
        } elseif (!is_object($cacheInstance)) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT ext_version FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
@@ -575,7 +575,7 @@ function EXTENSION_VERBOSE_TABLE ($queries = array(), $title = ADMIN_SQLS_EXECUT
 
 // Get extension name from id
 function GET_EXT_NAME ($ext_id) {
 
 // Get extension name from id
 function GET_EXT_NAME ($ext_id) {
-       global $cacheArray, $_CONFIG;
+       global $cacheArray;
 
        // Init extension name
        $ret = "";
 
        // Init extension name
        $ret = "";
@@ -586,7 +586,7 @@ function GET_EXT_NAME ($ext_id) {
                $ret = $cacheArray['extensions']['ext_name'][$ext_id];
 
                // Count cache hits
                $ret = $cacheArray['extensions']['ext_name'][$ext_id];
 
                // Count cache hits
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               incrementConfigEntry('cache_hits');
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT ext_name FROM "._MYSQL_PREFIX."_extensions WHERE id=%s LIMIT 1",
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT ext_name FROM "._MYSQL_PREFIX."_extensions WHERE id=%s LIMIT 1",
@@ -599,7 +599,7 @@ function GET_EXT_NAME ($ext_id) {
 
 // Get extension id from name
 function GET_EXT_ID ($ext_name) {
 
 // Get extension id from name
 function GET_EXT_ID ($ext_name) {
-       global $cacheArray, $_CONFIG;
+       global $cacheArray;
 
        // Init ID number
        $ret = 0;
 
        // Init ID number
        $ret = 0;
@@ -608,7 +608,7 @@ function GET_EXT_ID ($ext_name) {
                $ret = $cacheArray['extensions']['ext_id'][$ext_name];
 
                // Count cache hits
                $ret = $cacheArray['extensions']['ext_id'][$ext_name];
 
                // Count cache hits
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               incrementConfigEntry('cache_hits');
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
@@ -734,7 +734,7 @@ VALUES (0,0,'NEW','EXTENSION_DEACTIVATION','%s','%s',UNIX_TIMESTAMP())",
 
 // Checks if the module has a menu
 function MODULE_HAS_MENU ($mod, $forceDb = false) {
 
 // Checks if the module has a menu
 function MODULE_HAS_MENU ($mod, $forceDb = false) {
-       global $cacheArray, $_CONFIG;
+       global $cacheArray;
 
        // All is false by default
        $ret = false;
 
        // All is false by default
        $ret = false;
@@ -744,11 +744,11 @@ function MODULE_HAS_MENU ($mod, $forceDb = false) {
                if (isset($cacheArray['modules']['has_menu'][$mod])) {
                        // Check module cache and count hit
                        $ret = ($cacheArray['modules']['has_menu'][$mod] == "Y");
                if (isset($cacheArray['modules']['has_menu'][$mod])) {
                        // Check module cache and count hit
                        $ret = ($cacheArray['modules']['has_menu'][$mod] == "Y");
-                       if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+                       incrementConfigEntry('cache_hits');
                } elseif (isset($cacheArray['extensions']['ext_menu'][$mod])) {
                        // Check cache and count hit
                        $ret = ($cacheArray['extensions']['ext_menu'][$mod] == "Y");
                } elseif (isset($cacheArray['extensions']['ext_menu'][$mod])) {
                        // Check cache and count hit
                        $ret = ($cacheArray['extensions']['ext_menu'][$mod] == "Y");
-                       if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+                       incrementConfigEntry('cache_hits');
                } elseif ((IS_ADMIN()) && ($mod == "admin")) {
                        // Admin module has always a menu!
                        $ret = true;
                } elseif ((IS_ADMIN()) && ($mod == "admin")) {
                        // Admin module has always a menu!
                        $ret = true;
index 67a149808f6a231ce91a6d12910edd2bc2bf5900..d26f28da5f3393a184ac002726f458926e48aa86 100644 (file)
@@ -530,8 +530,8 @@ function SEND_RAW_EMAIL ($to, $subject, $msg, $from) {
 //
 
 // Generate a password in a specified length or use default password length
 //
 
 // Generate a password in a specified length or use default password length
-function GEN_PASS($LEN = 0) {
-       global $_CONFIG;
+function GEN_PASS ($LEN = 0) {
+       // Auto-fix invalid length of zero
        if ($LEN == 0) $LEN = getConfig('pass_len');
 
        // Initialize array with all allowed chars
        if ($LEN == 0) $LEN = getConfig('pass_len');
 
        // Initialize array with all allowed chars
@@ -748,8 +748,6 @@ function GET_LANGUAGE() {
 }
 //
 function SET_LANGUAGE($lang) {
 }
 //
 function SET_LANGUAGE($lang) {
-       global $_CONFIG;
-
        // Accept only first 2 chars!
        $lang = substr(SQL_ESCAPE(strip_tags($lang)), 0, 2);
 
        // Accept only first 2 chars!
        $lang = substr(SQL_ESCAPE(strip_tags($lang)), 0, 2);
 
@@ -758,7 +756,7 @@ function SET_LANGUAGE($lang) {
 }
 //
 function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") {
 }
 //
 function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") {
-       global $DATA, $_CONFIG, $REPLACER;
+       global $DATA, $REPLACER;
 
        // Make sure all template names are lowercase!
        $template = strtolower($template);
 
        // Make sure all template names are lowercase!
        $template = strtolower($template);
@@ -923,7 +921,7 @@ function MAKE_TIME($H, $M, $S, $stamp) {
 }
 //
 function LOAD_URL($URL, $addUrlData=true) {
 }
 //
 function LOAD_URL($URL, $addUrlData=true) {
-       global $CSS, $_CONFIG, $footer;
+       global $CSS, $footer;
 
        // Compile out URI codes
        $URL = COMPILE_CODE($URL);
 
        // Compile out URI codes
        $URL = COMPILE_CODE($URL);
@@ -1105,7 +1103,7 @@ function array_pk_sort(&$array, $a_sort, $primary_key = 0, $order = -1, $nums =
 }
 //
 function ADD_SELECTION($type, $DEFAULT, $prefix="", $id="0") {
 }
 //
 function ADD_SELECTION($type, $DEFAULT, $prefix="", $id="0") {
-       global $MONTH_DESCR, $_CONFIG;
+       global $MONTH_DESCR;
        $OUT = "";
 
        if ($type == "yn") {
        $OUT = "";
 
        if ($type == "yn") {
@@ -1233,8 +1231,6 @@ function TRANSLATE_YESNO($yn)
 // Optional   : $DATA
 //
 function GEN_RANDOM_CODE($length, $code, $uid, $DATA="") {
 // Optional   : $DATA
 //
 function GEN_RANDOM_CODE($length, $code, $uid, $DATA="") {
-       global $_CONFIG;
-
        // Fix missing _MAX constant
        if (!defined('_MAX')) define('_MAX', 15235);
 
        // Fix missing _MAX constant
        if (!defined('_MAX')) define('_MAX', 15235);
 
@@ -1309,8 +1305,6 @@ function bigintval($num, $castValue = true) {
 }
 // Insert the code in $img_code into jpeg or PNG image
 function GENERATE_IMAGE($img_code, $header=true) {
 }
 // Insert the code in $img_code into jpeg or PNG image
 function GENERATE_IMAGE($img_code, $header=true) {
-       global $_CONFIG;
-
        if ((strlen($img_code) > 6) || (empty($img_code)) || (getConfig('code_length') == 0)) {
                // Stop execution of function here because of over-sized code length
                return;
        if ((strlen($img_code) > 6) || (empty($img_code)) || (getConfig('code_length') == 0)) {
                // Stop execution of function here because of over-sized code length
                return;
@@ -1360,8 +1354,6 @@ function GENERATE_IMAGE($img_code, $header=true) {
 }
 // Create selection box or array of splitted timestamp
 function CREATE_TIME_SELECTIONS ($timestamp, $prefix="", $display="", $align="center", $return_array=false) {
 }
 // Create selection box or array of splitted timestamp
 function CREATE_TIME_SELECTIONS ($timestamp, $prefix="", $display="", $align="center", $return_array=false) {
-       global $_CONFIG;
-
        // Calculate 2-seconds timestamp
        $stamp = round($timestamp);
        //* DEBUG: */ print("*".$stamp."/".$timestamp."*<br />");
        // Calculate 2-seconds timestamp
        $stamp = round($timestamp);
        //* DEBUG: */ print("*".$stamp."/".$timestamp."*<br />");
@@ -1553,8 +1545,8 @@ function CREATE_TIME_SELECTIONS ($timestamp, $prefix="", $display="", $align="ce
        return $OUT;
 }
 //
        return $OUT;
 }
 //
-function CREATE_TIMESTAMP_FROM_SELECTIONS($prefix, $POST) {
-       global $_CONFIG;
+function CREATE_TIMESTAMP_FROM_SELECTIONS ($prefix, $POST) {
+       // Initial return value
        $ret = 0;
 
        // Do we have a leap year?
        $ret = 0;
 
        // Do we have a leap year?
@@ -1814,8 +1806,6 @@ function POST_URL ($script, $postData) {
 
 // Sends a raw request to another host
 function SEND_RAW_REQUEST ($host, $request) {
 
 // Sends a raw request to another host
 function SEND_RAW_REQUEST ($host, $request) {
-       global $_CONFIG;
-
        // Initialize array
        $response = array("", "", "");
 
        // Initialize array
        $response = array("", "", "");
 
@@ -2025,7 +2015,7 @@ function CREATE_EMAIL_LINK ($email, $table = "admins") {
 }
 // Generate a hash for extra-security for all passwords
 function generateHash ($plainText, $salt = "") {
 }
 // Generate a hash for extra-security for all passwords
 function generateHash ($plainText, $salt = "") {
-       global $_CONFIG, $_SERVER;
+       global $_SERVER;
 
        // Is the required extension "sql_patches" there and a salt is not given?
        if (((EXT_VERSION_IS_OLDER("sql_patches", "0.3.6")) || (!EXT_IS_ACTIVE("sql_patches"))) && (empty($salt))) {
 
        // Is the required extension "sql_patches" there and a salt is not given?
        if (((EXT_VERSION_IS_OLDER("sql_patches", "0.3.6")) || (!EXT_IS_ACTIVE("sql_patches"))) && (empty($salt))) {
@@ -2077,8 +2067,6 @@ function generateHash ($plainText, $salt = "") {
 }
 //
 function scrambleString($str) {
 }
 //
 function scrambleString($str) {
-       global $_CONFIG;
-
        // Init
        $scrambled = "";
 
        // Init
        $scrambled = "";
 
@@ -2110,7 +2098,6 @@ function scrambleString($str) {
 }
 //
 function descrambleString($str) {
 }
 //
 function descrambleString($str) {
-       global $_CONFIG;
        // Scramble only 40 chars long strings
        if (strlen($str) != 40) return $str;
 
        // Scramble only 40 chars long strings
        if (strlen($str) != 40) return $str;
 
@@ -2158,8 +2145,8 @@ function genScrambleString($len) {
 }
 // Append data like session ID or referal ID to the given URL which would
 // normally be stored in cookies
 }
 // Append data like session ID or referal ID to the given URL which would
 // normally be stored in cookies
-function ADD_URL_DATA($URL) {
-       global $_CONFIG;
+function ADD_URL_DATA ($URL) {
+       // Init add
        $ADD = "";
 
        // Determine URL binder
        $ADD = "";
 
        // Determine URL binder
@@ -2194,8 +2181,6 @@ function ADD_URL_DATA($URL) {
 }
 // Generate an PGP-like encrypted hash of given hash for e.g. cookies
 function generatePassString($passHash) {
 }
 // Generate an PGP-like encrypted hash of given hash for e.g. cookies
 function generatePassString($passHash) {
-       global $_CONFIG;
-
        // Return vanilla password hash
        $ret = $passHash;
 
        // Return vanilla password hash
        $ret = $passHash;
 
@@ -2263,8 +2248,6 @@ function mxchange_die ($msg) {
 
 // Display parsing time and number of SQL queries in footer
 function DISPLAY_PARSING_TIME_FOOTER() {
 
 // Display parsing time and number of SQL queries in footer
 function DISPLAY_PARSING_TIME_FOOTER() {
-       global $_CONFIG;
-
        // Is the timer started?
        if (!isset($GLOBALS['startTime'])) {
                // Abort here
        // Is the timer started?
        if (!isset($GLOBALS['startTime'])) {
                // Abort here
@@ -2467,8 +2450,6 @@ function GET_DIR_AS_ARRAY ($baseDir, $prefix) {
 }
 // Load more reset scripts
 function RESET_ADD_INCLUDES () {
 }
 // Load more reset scripts
 function RESET_ADD_INCLUDES () {
-       global $_CONFIG;
-
        // Is the reset set or old sql_patches?
        if ((!defined('__DAILY_RESET')) || (EXT_VERSION_IS_OLDER("sql_patches", "0.4.5"))) {
                // Then abort here
        // Is the reset set or old sql_patches?
        if ((!defined('__DAILY_RESET')) || (EXT_VERSION_IS_OLDER("sql_patches", "0.4.5"))) {
                // Then abort here
@@ -2629,7 +2610,7 @@ function HANDLE_LOGIN_FAILTURES ($accessLevel) {
 }
 // Rebuild cache
 function REBUILD_CACHE ($cache, $inc="") {
 }
 // Rebuild cache
 function REBUILD_CACHE ($cache, $inc="") {
-       global $cacheInstance, $_CONFIG, $CSS;
+       global $cacheInstance, $CSS;
 
        // Shall I remove the cache file?
        if ((EXT_IS_ACTIVE("cache")) && (is_object($cacheInstance))) {
 
        // Shall I remove the cache file?
        if ((EXT_IS_ACTIVE("cache")) && (is_object($cacheInstance))) {
@@ -2786,7 +2767,7 @@ function ADD_NEW_BONUS_MAIL ($data, $mode="", $output=true) {
 }
 // Determines referal id and sets it
 function DETERMINE_REFID () {
 }
 // Determines referal id and sets it
 function DETERMINE_REFID () {
-       global $_CONFIG, $CLICK, $_SERVER;
+       global $CLICK, $_SERVER;
 
        // Check if refid is set
        if ((!empty($_GET['user'])) && ($CLICK == 1) && (basename($_SERVER['PHP_SELF']) == "click.php")) {
 
        // Check if refid is set
        if ((!empty($_GET['user'])) && ($CLICK == 1) && (basename($_SERVER['PHP_SELF']) == "click.php")) {
@@ -2889,7 +2870,7 @@ function getMessage ($messageId) {
 
 // Get current theme name
 function GET_CURR_THEME() {
 
 // Get current theme name
 function GET_CURR_THEME() {
-       global $INC_POOL, $_CONFIG, $CSS, $cacheArray;
+       global $INC_POOL, $CSS, $cacheArray;
 
        // The default theme is 'default'... ;-)
        $ret = "default";
 
        // The default theme is 'default'... ;-)
        $ret = "default";
@@ -2942,7 +2923,7 @@ function GET_CURR_THEME() {
 
 // Get id from theme
 function THEME_GET_ID ($name) {
 
 // Get id from theme
 function THEME_GET_ID ($name) {
-       global $cacheArray, $_CONFIG;
+       global $cacheArray;
 
        // Is the extension "theme" installed?
        if (!EXT_IS_ACTIVE("theme")) {
 
        // Is the extension "theme" installed?
        if (!EXT_IS_ACTIVE("theme")) {
@@ -2959,7 +2940,7 @@ function THEME_GET_ID ($name) {
                $id = $cacheArray['themes']['id'][$name];
 
                // Count up
                $id = $cacheArray['themes']['id'][$name];
 
                // Count up
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               incrementConfigEntry('cache_hits');
        } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
                // Check if current theme is already imported or not
                $result = SQL_QUERY_ESC("SELECT id FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' LIMIT 1",
        } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
                // Check if current theme is already imported or not
                $result = SQL_QUERY_ESC("SELECT id FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' LIMIT 1",
@@ -2979,6 +2960,14 @@ function THEME_GET_ID ($name) {
        return $id;
 }
 
        return $id;
 }
 
+// Increment or init with 1 the given config entry
+function incrementConfigEntry ($configEntry) {
+       global $_CONFIG;
+
+       // Increment it if set or init it with 1
+       if (getConfig($configEntry) > 0) { $_CONFIG[$configEntry]++; } else { $_CONFIG[$configEntry] = 1; }
+}
+
 //////////////////////////////////////////////////
 //                                              //
 // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
 //////////////////////////////////////////////////
 //                                              //
 // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
index b792bbbb4f978cf72c80e6650887090be8ce2c87..403c32150ce7d1f047e1f9968965bf8d41f75341 100644 (file)
@@ -39,7 +39,7 @@ if (!defined('__SECURITY')) {
 
 // Check ACL for menu combination
 function ADMINS_CHECK_ACL($act, $wht) {
 
 // Check ACL for menu combination
 function ADMINS_CHECK_ACL($act, $wht) {
-       global $cacheArray, $_CONFIG, $cacheInstance;
+       global $cacheArray, $cacheInstance;
        // If action is login or logout allow allways!
        $default = "allow";
        if (($act == "login") || ($act == "logout")) return true;
        // If action is login or logout allow allways!
        $default = "allow";
        if (($act == "login") || ($act == "logout")) return true;
@@ -87,7 +87,7 @@ function ADMINS_CHECK_ACL($act, $wht) {
                                        }
                                        if ($lines == 1) {
                                                // Count cache hits
                                        }
                                        if ($lines == 1) {
                                                // Count cache hits
-                                               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+                                               incrementConfigEntry('cache_hits');
                                                break;
                                        }
                                }
                                                break;
                                        }
                                }
index 9e096a317e5d761be0a2ac3de513272a537c1592..c313fa7389e2e3e40b4285d7032054eb35fe8c0a 100644 (file)
@@ -42,7 +42,7 @@ function RALLYE_AUTOSTART_RALLYES($result)
 {
        // Global data array for LOAD_EMAIL_TEMPLATE()
        $DATA = array();
 {
        // Global data array for LOAD_EMAIL_TEMPLATE()
        $DATA = array();
-       global $DATA, $_CONFIG;
+       global $DATA;
 
        // Load all rallyes (usally we have only one rallye active per time!
        list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result);
 
        // Load all rallyes (usally we have only one rallye active per time!
        list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result);
@@ -184,8 +184,6 @@ function RALLYE_ADD_PRICES($rallye,$mode="email")
 //
 function RALLYE_ADD_TOPUSERS($rallye,$default=0)
 {
 //
 function RALLYE_ADD_TOPUSERS($rallye,$default=0)
 {
-       global $_CONFIG;
-
        // First check how many prices are set
        $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_prices WHERE rallye_id=%s ORDER BY price_level",
         array(bigintval($rallye)), __FILE__, __LINE__);
        // First check how many prices are set
        $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_prices WHERE rallye_id=%s ORDER BY price_level",
         array(bigintval($rallye)), __FILE__, __LINE__);
@@ -348,7 +346,7 @@ VALUES ('%s','%s','0')",
 //
 function RALLYE_EXPIRE_RALLYES($result)
 {
 //
 function RALLYE_EXPIRE_RALLYES($result)
 {
-       global $DATA, $_CONFIG;
+       global $DATA;
 
        // Load rallye data
        list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result);
 
        // Load rallye data
        list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result);
@@ -650,7 +648,7 @@ function RALLYE_LIST_WINNERS($rallye,$default=0)
 //
 function RALLYE_DELETE_EXPIRED_RALLYES()
 {
 //
 function RALLYE_DELETE_EXPIRED_RALLYES()
 {
-       global $DATA, $_CONFIG;
+       global $DATA;
 
        // Check for expired rallyes
        $EXPIRE = getConfig('one_day') * 3; // @TODO The hard-coded value...
 
        // Check for expired rallyes
        $EXPIRE = getConfig('one_day') * 3; // @TODO The hard-coded value...
@@ -739,7 +737,7 @@ function RALLYE_TEMPLATE_SELECTION($name="template", $default="")
 }
 //
 function RALLYE_GET_REFCOUNT($uid, $old=0) {
 }
 //
 function RALLYE_GET_REFCOUNT($uid, $old=0) {
-       global $_CONFIG, $cacheArray;
+       global $cacheArray;
 
        // Check current refs
        if (GET_EXT_VERSION("cache") >= "0.1.2") {
 
        // Check current refs
        if (GET_EXT_VERSION("cache") >= "0.1.2") {
@@ -773,7 +771,7 @@ function RALLYE_GET_REFCOUNT($uid, $old=0) {
 
                if ($cnt > 0) {
                        // Count cache hits
 
                if ($cnt > 0) {
                        // Count cache hits
-                       if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+                       incrementConfigEntry('cache_hits');
 
                        // Remove old refs
                        //* DEBUG: */ echo "+".$cnt."/".$old."+<br />";
 
                        // Remove old refs
                        //* DEBUG: */ echo "+".$cnt."/".$old."+<br />";
@@ -788,12 +786,9 @@ ON s.level=d.level
 WHERE s.userid=%s AND s.level=1", array(bigintval($uid)), __FILE__, __LINE__);
                list($cnt) = SQL_FETCHROW($result_ref);
                SQL_FREERESULT($result_ref);
 WHERE s.userid=%s AND s.level=1", array(bigintval($uid)), __FILE__, __LINE__);
                list($cnt) = SQL_FETCHROW($result_ref);
                SQL_FREERESULT($result_ref);
-               if (empty($cnt))
-               {
+               if (empty($cnt)) {
                        $cnt = 0;
                        $cnt = 0;
-               }
-                else
-               {
+               } else {
                        $cnt -= $old;
                }
        }
                        $cnt -= $old;
                }
        }
index db1eb19ee1319380a08142022627c99ef93a9756..0169427c732fbd194ce85e069fa677035cfd0a5d 100644 (file)
@@ -81,7 +81,7 @@ function THEME_SELECTION_BOX($mod, $act, $wht, $result) {
 
 // Get version from name
 function THEME_GET_VERSION ($name) {
 
 // Get version from name
 function THEME_GET_VERSION ($name) {
-       global $cacheArray, $_CONFIG;
+       global $cacheArray;
 
        // Is the extension "theme" installed?
        if (!EXT_IS_ACTIVE("theme")) {
 
        // Is the extension "theme" installed?
        if (!EXT_IS_ACTIVE("theme")) {
@@ -98,7 +98,7 @@ function THEME_GET_VERSION ($name) {
                $cver = $cacheArray['themes']['theme_ver'][$name];
 
                // Count up
                $cver = $cacheArray['themes']['theme_ver'][$name];
 
                // Count up
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               incrementConfigEntry('cache_hits');
        } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
                // Load version from database
                $result = SQL_QUERY_ESC("SELECT theme_ver FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' LIMIT 1",
        } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
                // Load version from database
                $result = SQL_QUERY_ESC("SELECT theme_ver FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' LIMIT 1",
@@ -126,7 +126,7 @@ function THEME_CHECK_EXIST ($name) {
 
 // Checks if a theme is active
 function THEME_IS_ACTIVE ($name) {
 
 // Checks if a theme is active
 function THEME_IS_ACTIVE ($name) {
-       global $cacheArray, $_CONFIG;
+       global $cacheArray;
 
        // Is the extension "theme" installed?
        if (!EXT_IS_ACTIVE("theme")) {
 
        // Is the extension "theme" installed?
        if (!EXT_IS_ACTIVE("theme")) {
@@ -143,7 +143,7 @@ function THEME_IS_ACTIVE ($name) {
                $active = ($cacheArray['themes']['theme_active'][$name] == "Y");
 
                // Count up
                $active = ($cacheArray['themes']['theme_active'][$name] == "Y");
 
                // Count up
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               incrementConfigEntry('cache_hits');
        } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
                // Check if current theme is already imported or not
                $result = SQL_QUERY_ESC("SELECT theme_active FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
        } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
                // Check if current theme is already imported or not
                $result = SQL_QUERY_ESC("SELECT theme_active FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
@@ -162,7 +162,7 @@ function THEME_IS_ACTIVE ($name) {
 
 // Gets current human-readable theme name
 function GET_CURR_THEME_NAME () {
 
 // Gets current human-readable theme name
 function GET_CURR_THEME_NAME () {
-       global $cacheArray, $_CONFIG;
+       global $cacheArray;
 
        // Is the extension "theme" installed?
        if (!EXT_IS_ACTIVE("theme")) {
 
        // Is the extension "theme" installed?
        if (!EXT_IS_ACTIVE("theme")) {
@@ -179,7 +179,7 @@ function GET_CURR_THEME_NAME () {
                $name = $cacheArray['themes']['theme_name'][$name];
 
                // Count up
                $name = $cacheArray['themes']['theme_name'][$name];
 
                // Count up
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               incrementConfigEntry('cache_hits');
        } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
                // Check if current theme is already imported or not
                $result = SQL_QUERY_ESC("SELECT theme_name FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
        } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
                // Check if current theme is already imported or not
                $result = SQL_QUERY_ESC("SELECT theme_name FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
index 38bd814274fdaf32df5e7870b8188c10b01c0b30..5965d8f3942c88a52c38107a96d1d5cf815039ff 100644 (file)
@@ -59,7 +59,7 @@ function REGISTER_ADMIN ($user, $md5, $email=WEBMASTER)
 }
 // Only be executed on login procedure!
 function CHECK_ADMIN_LOGIN ($admin_login, $password) {
 }
 // Only be executed on login procedure!
 function CHECK_ADMIN_LOGIN ($admin_login, $password) {
-       global $cacheArray, $_CONFIG, $cacheInstance;
+       global $cacheArray, $cacheInstance;
 
        // By default no admin is found
        $ret = "404";
 
        // By default no admin is found
        $ret = "404";
@@ -75,7 +75,7 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password) {
                // Get password from cache
                $data['password'] = $cacheArray['admins']['password'][$aid];
                $ret = "pass";
                // Get password from cache
                $data['password'] = $cacheArray['admins']['password'][$aid];
                $ret = "pass";
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               incrementConfigEntry('cache_hits');
 
                // Include more admins data?
                if (GET_EXT_VERSION("admins") >= "0.7.0") {
 
                // Include more admins data?
                if (GET_EXT_VERSION("admins") >= "0.7.0") {
@@ -212,7 +212,7 @@ function LOGIN_ADMIN ($adminLogin, $passHash) {
 
 // Only be executed on cookie checking
 function CHECK_ADMIN_COOKIES ($admin_login, $password) {
 
 // Only be executed on cookie checking
 function CHECK_ADMIN_COOKIES ($admin_login, $password) {
-       global $cacheArray, $_CONFIG;
+       global $cacheArray;
        $ret = "404"; $pass = "";
 
        // Get hash
        $ret = "404"; $pass = "";
 
        // Get hash
@@ -303,7 +303,7 @@ function admin_WriteData ($file, $comment, $prefix, $suffix, $DATA, $seek=0) {
 
 //
 function ADMIN_DO_ACTION($wht) {
 
 //
 function ADMIN_DO_ACTION($wht) {
-       global $menuDesription, $menuTitle, $_CONFIG, $cacheArray, $DATA;
+       global $menuDesription, $menuTitle, $cacheArray, $DATA;
 
        //* DEBUG: */ echo __LINE__."*".$wht."/".$GLOBALS['module']."/".$GLOBALS['action']."/".$GLOBALS['what']."*<br />\n";
        if (EXT_IS_ACTIVE("cache")) {
 
        //* DEBUG: */ echo __LINE__."*".$wht."/".$GLOBALS['module']."/".$GLOBALS['action']."/".$GLOBALS['what']."*<br />\n";
        if (EXT_IS_ACTIVE("cache")) {
@@ -373,7 +373,7 @@ LIMIT 1", array($act, $wht, $wht), __FILE__, __LINE__);
 }
 //
 function ADD_ADMIN_MENU($act, $wht, $return=false) {
 }
 //
 function ADD_ADMIN_MENU($act, $wht, $return=false) {
-       global $menuDesription, $menuTitle, $cacheInstance, $_CONFIG;
+       global $menuDesription, $menuTitle, $cacheInstance;
 
        // Init variables
        $SUB = false;
 
        // Init variables
        $SUB = false;
@@ -773,7 +773,7 @@ function ADMIN_USER_PROFILE_LINK ($uid, $title="", $wht="list_user") {
 }
 //
 function ADMIN_CHECK_MENU_MODE() {
 }
 //
 function ADMIN_CHECK_MENU_MODE() {
-       global $_CONFIG, $cacheArray;
+       global $cacheArray;
 
        // Set the global mode as the mode for all admins
        $MODE = getConfig('admin_menu');
 
        // Set the global mode as the mode for all admins
        $MODE = getConfig('admin_menu');
@@ -786,7 +786,7 @@ function ADMIN_CHECK_MENU_MODE() {
        if (isset($cacheArray['admins']['la_mode'][$aid])) {
                // Load from cache
                $ADMIN = $cacheArray['admins']['la_mode'][$aid];
        if (isset($cacheArray['admins']['la_mode'][$aid])) {
                // Load from cache
                $ADMIN = $cacheArray['admins']['la_mode'][$aid];
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               incrementConfigEntry('cache_hits');
        } elseif (GET_EXT_VERSION("admins") >= "0.6.7") {
                // Load from database when version of "admins" is enough
                $result = SQL_QUERY_ESC("SELECT la_mode FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
        } elseif (GET_EXT_VERSION("admins") >= "0.6.7") {
                // Load from database when version of "admins" is enough
                $result = SQL_QUERY_ESC("SELECT la_mode FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
@@ -808,7 +808,6 @@ function ADMIN_CHECK_MENU_MODE() {
 }
 // Change activation status
 function ADMIN_CHANGE_ACTIVATION_STATUS ($IDs, $table, $row, $idRow = "id") {
 }
 // Change activation status
 function ADMIN_CHANGE_ACTIVATION_STATUS ($IDs, $table, $row, $idRow = "id") {
-       global $_CONFIG;
        $cnt = 0; $newStatus = "Y";
        if ((is_array($IDs)) && (count($IDs) > 0)) {
                // "Walk" all through and count them
        $cnt = 0; $newStatus = "Y";
        if ((is_array($IDs)) && (count($IDs) > 0)) {
                // "Walk" all through and count them
@@ -887,7 +886,6 @@ function ADMIN_SEND_BUILD_MAILS ($mode, $table, $content, $id, $subjectPart="")
 }
 // Build a special template list
 function ADMIN_BUILD_LIST ($listType, $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn) {
 }
 // Build a special template list
 function ADMIN_BUILD_LIST ($listType, $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn) {
-       global $_CONFIG;
        $OUT = ""; $SW = 2;
 
        // "Walk" through all entries
        $OUT = ""; $SW = 2;
 
        // "Walk" through all entries
@@ -1207,7 +1205,6 @@ function ADMIN_TEST_PROXY_SETTINGS ($settingsArray) {
 }
 // Sends out a link to the given email adress so the admin can reset his/her password
 function ADMIN_SEND_PASSWORD_RESET_LINK ($email) {
 }
 // Sends out a link to the given email adress so the admin can reset his/her password
 function ADMIN_SEND_PASSWORD_RESET_LINK ($email) {
-       global $_CONFIG;
        // Init output
        $OUT = "";
 
        // Init output
        $OUT = "";
 
index 3e3b5124a42578cab52ef822ddc9e665dc1ed86b..ef9e1cc911cf6505a28ff8575ac193e68ba38e30 100644 (file)
@@ -39,7 +39,7 @@ if (!defined('__SECURITY')) {
 
 //
 function ADD_MODULE_TITLE($mod) {
 
 //
 function ADD_MODULE_TITLE($mod) {
-       global $cacheArray, $_CONFIG;
+       global $cacheArray;
        $name = ""; $result = false;
 
        // Is the script installed?
        $name = ""; $result = false;
 
        // Is the script installed?
@@ -50,7 +50,7 @@ function ADD_MODULE_TITLE($mod) {
                        $name = $cacheArray['modules']['title'][$mod];
 
                        // Update cache hits
                        $name = $cacheArray['modules']['title'][$mod];
 
                        // Update cache hits
-                       if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+                       incrementConfigEntry('cache_hits');
                } elseif (!EXT_IS_ACTIVE("cache")) {
                        // Load from database
                        $result = SQL_QUERY_ESC("SELECT title FROM "._MYSQL_PREFIX."_mod_reg WHERE module='%s' LIMIT 1", array($mod), __FILE__, __LINE__);
                } elseif (!EXT_IS_ACTIVE("cache")) {
                        // Load from database
                        $result = SQL_QUERY_ESC("SELECT title FROM "._MYSQL_PREFIX."_mod_reg WHERE module='%s' LIMIT 1", array($mod), __FILE__, __LINE__);
@@ -79,7 +79,7 @@ function ADD_MODULE_TITLE($mod) {
 // Check validity of a given module name (no file extension)
 function CHECK_MODULE ($mod) {
        // We need them now here...
 // Check validity of a given module name (no file extension)
 function CHECK_MODULE ($mod) {
        // We need them now here...
-       global $cacheArray, $_CONFIG, $cacheInstance;
+       global $cacheArray, $cacheInstance;
 
        // Filter module name (names with low chars and underlines are fine!)
        $mod = preg_replace("/[^a-z_]/", "", $mod);
 
        // Filter module name (names with low chars and underlines are fine!)
        $mod = preg_replace("/[^a-z_]/", "", $mod);
@@ -115,7 +115,7 @@ function CHECK_MODULE ($mod) {
                        $mem    = $cacheArray['modules']['mem_only'][$mod_chk];
 
                        // Update cache hits
                        $mem    = $cacheArray['modules']['mem_only'][$mod_chk];
 
                        // Update cache hits
-                       if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+                       incrementConfigEntry('cache_hits');
                        $found = true;
                } else {
                        // No, then we have to update it!
                        $found = true;
                } else {
                        // No, then we have to update it!
@@ -202,8 +202,8 @@ function CHECK_MODULE ($mod) {
 }
 
 // Add menu description pending on given file name (without path!)
 }
 
 // Add menu description pending on given file name (without path!)
-function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true) {
-       global $NAV_DEPTH, $_CONFIG;
+function ADD_DESCR ($ACC_LVL, $file, $return = false, $output = true) {
+       global $NAV_DEPTH;
        // Use only filename of the file ;)
        $file = basename($file);
 
        // Use only filename of the file ;)
        $file = basename($file);
 
@@ -297,7 +297,6 @@ function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true) {
 
                        // Can we close the you-are-here navigation?
                        //* DEBUG: */ echo __LINE__."*".$type."/".$GLOBALS['what']."*<br />\n";
 
                        // Can we close the you-are-here navigation?
                        //* DEBUG: */ echo __LINE__."*".$type."/".$GLOBALS['what']."*<br />\n";
-                       //* DEBUG: */ die("<pre>".print_r($_CONFIG, true)."</pre>");
                        if (($type == "what") || (($type == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview")))) {
                                //* DEBUG: */ echo __LINE__."+".$type."+<br />\n";
                                // Add closing div and br-tag
                        if (($type == "what") || (($type == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview")))) {
                                //* DEBUG: */ echo __LINE__."+".$type."+<br />\n";
                                // Add closing div and br-tag
@@ -324,9 +323,7 @@ function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true) {
        }
 }
 //
        }
 }
 //
-function ADD_MENU($MODE, $act, $wht) {
-       global $_CONFIG;
-
+function ADD_MENU ($MODE, $act, $wht) {
        // Init some variables
        $main_cnt = 0;
        $AND = "";
        // Init some variables
        $main_cnt = 0;
        $AND = "";
@@ -441,9 +438,10 @@ function ADD_MENU($MODE, $act, $wht) {
        }
 }
 // This patched function will reduce many SELECT queries for the specified or current admin login
        }
 }
 // This patched function will reduce many SELECT queries for the specified or current admin login
-function IS_ADMIN($admin="")
-{
-       global $cacheArray, $_CONFIG;
+function IS_ADMIN ($admin="") {
+       global $cacheArray;
+
+       // Init variables
        $ret = false; $passCookie = ""; $valPass = "";
        //* DEBUG: */ echo __LINE__."ADMIN:".$admin."<br />";
 
        $ret = false; $passCookie = ""; $valPass = "";
        //* DEBUG: */ echo __LINE__."ADMIN:".$admin."<br />";
 
@@ -461,7 +459,7 @@ function IS_ADMIN($admin="")
                $valPass = $cacheArray['admin_hash'];
        } elseif ((!empty($passCookie)) && (isset($cacheArray['admins']['password'][$admin])) && (!empty($admin))) {
                // Count cache hits
                $valPass = $cacheArray['admin_hash'];
        } elseif ((!empty($passCookie)) && (isset($cacheArray['admins']['password'][$admin])) && (!empty($admin))) {
                // Count cache hits
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               incrementConfigEntry('cache_hits');
 
                // Login data is valid or not?
                $valPass = generatePassString($cacheArray['admins']['password'][$admin]);
 
                // Login data is valid or not?
                $valPass = generatePassString($cacheArray['admins']['password'][$admin]);
@@ -735,9 +733,8 @@ function GET_MOD_DESCR($MODE, $wht, $column="what")
        return $ret;
 }
 //
        return $ret;
 }
 //
-function SEND_MODE_MAILS($mod, $modes)
-{
-       global $_CONFIG, $DATA;
+function SEND_MODE_MAILS($mod, $modes) {
+       global $DATA;
 
        // Load hash
        $result_main = SQL_QUERY_ESC("SELECT password FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1",
 
        // Load hash
        $result_main = SQL_QUERY_ESC("SELECT password FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1",
@@ -867,9 +864,9 @@ function COUNT_MODULE($mod) {
        } // END - if
 }
 // Get action value from mode (admin/guest/member) and what-value
        } // END - if
 }
 // Get action value from mode (admin/guest/member) and what-value
-function GET_ACTION ($MODE, &$wht)
-{
-       global $ret, $_CONFIG;
+function GET_ACTION ($MODE, &$wht) {
+       global $ret;
+
        // @DEPRECATED Init status
        $ret = "";
 
        // @DEPRECATED Init status
        $ret = "";
 
@@ -1062,7 +1059,7 @@ function GET_TOTAL_DATA ($search, $tableName, $lookFor, $whereStatement="userid"
 }
 // "Getter fro ref level percents
 function GET_REF_LEVEL_PERCENTS ($level) {
 }
 // "Getter fro ref level percents
 function GET_REF_LEVEL_PERCENTS ($level) {
-       global $cacheInstance, $_CONFIG, $cacheArray;
+       global $cacheInstance, $cacheArray;
 
        // Default is zero
        $per = 0;
 
        // Default is zero
        $per = 0;
@@ -1076,7 +1073,7 @@ function GET_REF_LEVEL_PERCENTS ($level) {
                        $per = $cacheArray['ref_depths']['percents'][$key];
 
                        // Count cache hit
                        $per = $cacheArray['ref_depths']['percents'][$key];
 
                        // Count cache hit
-                       if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+                       incrementConfigEntry('cache_hits');
                }
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Get referal data
                }
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Get referal data
@@ -1111,7 +1108,7 @@ function GET_REF_LEVEL_PERCENTS ($level) {
  */
 function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid="0", $locked=false, $add_mode="ref") {
        //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
  */
 function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid="0", $locked=false, $add_mode="ref") {
        //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
-       global $_CONFIG, $DATA, $cacheArray;
+       global $DATA, $cacheArray;
 
        // Convert mode to lower-case
        $add_mode = strtolower($add_mode);
 
        // Convert mode to lower-case
        $add_mode = strtolower($add_mode);
@@ -1306,14 +1303,14 @@ function SEND_ADMIN_EMAILS ($subj, $msg) {
 
 // Get ID number from administrator's login name
 function GET_ADMIN_ID ($login) {
 
 // Get ID number from administrator's login name
 function GET_ADMIN_ID ($login) {
-       global $cacheArray, $_CONFIG;
+       global $cacheArray;
        $ret = "-1";
        if (isset($cacheArray['admins']['aid'][$login])) {
                // Check cache
                $ret = $cacheArray['admins']['aid'][$login];
 
                // Update cache hits
        $ret = "-1";
        if (isset($cacheArray['admins']['aid'][$login])) {
                // Check cache
                $ret = $cacheArray['admins']['aid'][$login];
 
                // Update cache hits
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               incrementConfigEntry('cache_hits');
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1",
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1",
@@ -1343,14 +1340,14 @@ function GET_CURRENT_ADMIN_ID () {
 // Get password hash from administrator's login name
 function GET_ADMIN_HASH ($aid)
 {
 // Get password hash from administrator's login name
 function GET_ADMIN_HASH ($aid)
 {
-       global $cacheArray, $_CONFIG;
+       global $cacheArray;
        $ret = "-1";
        if (isset($cacheArray['admins']['password'][$aid])) {
                // Check cache
                $ret = $cacheArray['admins']['password'][$aid];
 
                // Update cache hits
        $ret = "-1";
        if (isset($cacheArray['admins']['password'][$aid])) {
                // Check cache
                $ret = $cacheArray['admins']['password'][$aid];
 
                // Update cache hits
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               incrementConfigEntry('cache_hits');
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT password FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT password FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
@@ -1370,14 +1367,14 @@ function GET_ADMIN_HASH ($aid)
 }
 //
 function GET_ADMIN_LOGIN ($aid) {
 }
 //
 function GET_ADMIN_LOGIN ($aid) {
-       global $cacheArray, $_CONFIG;
+       global $cacheArray;
        $ret = "***";
        if (isset($cacheArray['admins']['login'][$aid])) {
                // Get cache
                $ret = $cacheArray['admins']['login'][$aid];
 
                // Update cache hits
        $ret = "***";
        if (isset($cacheArray['admins']['login'][$aid])) {
                // Get cache
                $ret = $cacheArray['admins']['login'][$aid];
 
                // Update cache hits
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               incrementConfigEntry('cache_hits');
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT login FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT login FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
@@ -1397,7 +1394,7 @@ function GET_ADMIN_LOGIN ($aid) {
 }
 // Get email address of admin id
 function GET_ADMIN_EMAIL ($aid) {
 }
 // Get email address of admin id
 function GET_ADMIN_EMAIL ($aid) {
-       global $cacheArray, $_CONFIG;
+       global $cacheArray;
 
        $ret = "***";
        if (isset($cacheArray['admins']['email'][$aid])) {
 
        $ret = "***";
        if (isset($cacheArray['admins']['email'][$aid])) {
@@ -1405,7 +1402,7 @@ function GET_ADMIN_EMAIL ($aid) {
                $ret = $cacheArray['admins']['email'][$aid];
 
                // Update cache hits
                $ret = $cacheArray['admins']['email'][$aid];
 
                // Update cache hits
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               incrementConfigEntry('cache_hits');
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result_aid = SQL_QUERY_ESC("SELECT email FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result_aid = SQL_QUERY_ESC("SELECT email FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
@@ -1427,7 +1424,7 @@ function GET_ADMIN_EMAIL ($aid) {
 }
 // Get default ACL  of admin id
 function GET_ADMIN_DEFAULT_ACL ($aid) {
 }
 // Get default ACL  of admin id
 function GET_ADMIN_DEFAULT_ACL ($aid) {
-       global $cacheArray, $_CONFIG;
+       global $cacheArray;
 
        $ret = "***";
        if (isset($cacheArray['admins']['def_acl'][$aid])) {
 
        $ret = "***";
        if (isset($cacheArray['admins']['def_acl'][$aid])) {
@@ -1435,7 +1432,7 @@ function GET_ADMIN_DEFAULT_ACL ($aid) {
                $ret = $cacheArray['admins']['def_acl'][$aid];
 
                // Update cache hits
                $ret = $cacheArray['admins']['def_acl'][$aid];
 
                // Update cache hits
-               if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+               incrementConfigEntry('cache_hits');
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result_aid = SQL_QUERY_ESC("SELECT default_acl FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result_aid = SQL_QUERY_ESC("SELECT default_acl FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
@@ -1561,10 +1558,9 @@ WHERE p.userid=%s", array(bigintval($uid)), __FILE__, __LINE__);
        // Ok, delete the account!
        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__);
 }
        // Ok, delete the account!
        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__);
 }
+
 //
 function META_DESCRIPTION ($mod, $wht) {
 //
 function META_DESCRIPTION ($mod, $wht) {
-       global $_CONFIG;
-
        // Exclude admin and member's area
        if (($mod != "admin") && ($mod != "login")) {
                // Construct dynamic description
        // Exclude admin and member's area
        if (($mod != "admin") && ($mod != "login")) {
                // Construct dynamic description
@@ -1657,8 +1653,6 @@ function LOAD_CONFIG ($no="0") {
 }
 // Gets the matching what name from module
 function GET_WHAT($modCheck) {
 }
 // Gets the matching what name from module
 function GET_WHAT($modCheck) {
-       global $_CONFIG;
-
        $wht = "";
        //* DEBUG: */ echo __LINE__."!".$modCheck."!<br />\n";
        switch ($modCheck)
        $wht = "";
        //* DEBUG: */ echo __LINE__."!".$modCheck."!<br />\n";
        switch ($modCheck)
@@ -1918,8 +1912,6 @@ VALUES ('%s','%s','%s','%s','%s','NEW', UNIX_TIMESTAMP(),'%s','%s','%s','%s')",
 
 // Generate a receiver list for given category and maximum receivers
 function GENERATE_RECEIVER_LIST ($cat, $receiver, $mode="") {
 
 // Generate a receiver list for given category and maximum receivers
 function GENERATE_RECEIVER_LIST ($cat, $receiver, $mode="") {
-       global $_CONFIG;
-
        // Init variables
        $CAT_TABS     = "%s";
        $CAT_WHERE    = "";
        // Init variables
        $CAT_TABS     = "%s";
        $CAT_WHERE    = "";
@@ -2034,8 +2026,6 @@ function USER_STATS_INSERT_RECORD ($uid, $type, $data) {
 
 // "Getter" for array for user refs and points in given level
 function GET_USER_REF_POINTS ($uid, $level) {
 
 // "Getter" for array for user refs and points in given level
 function GET_USER_REF_POINTS ($uid, $level) {
-       global $_CONFIG;
-
        //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
        // Default is no refs and no nickname
        $ADD = "";
        //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
        // Default is no refs and no nickname
        $ADD = "";