From 62b8f74ec2e1d527ea0c606e1137a82f099b284b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 28 Jul 2009 19:17:43 +0000 Subject: [PATCH] is now located in ['config'] --- DOCS/TODOs.txt | 28 ++++++++++++++-------------- inc/autopurge/purge- | 2 +- inc/config-functions.php | 40 +++++++++++++--------------------------- inc/functions.php | 5 ++++- 4 files changed, 32 insertions(+), 43 deletions(-) diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index f76e6c0e9b..a31fbd24ec 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -3,8 +3,8 @@ ./beg.php:195: // @TODO Opps, what is missing here??? ./doubler.php:269:// @TODO Rewrite all constants ./inc/cache/config-local.php:120:// @TODO Rewrite the following three constants, somehow... -./inc/config-functions.php:182: // @TODO Make this all better... :-/ -./inc/config-functions.php:207: // @TODO Rewrite these all to config entries, if somehow possible +./inc/config-functions.php:168: // @TODO Make this all better... :-/ +./inc/config-functions.php:193: // @TODO Rewrite these all to config entries, if somehow possible ./inc/config-global.php:60:// @TODO These constants should be rewritten ./inc/extensions/ext-sql_patches.php:705: // @TODO Rewrite this to a filter! ./inc/extensions/ext-sql_patches.php:743: // @TODO Can we remove this? setConfigEntry('verbose_sql' , 'N'); @@ -12,21 +12,21 @@ ./inc/extensions/ext-surfbar.php:237: // @TODO Set some constants we need??? ./inc/extensions.php:355:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) ) ./inc/extensions.php:431: // @TODO Extension is loaded, what next? -./inc/functions.php:1224: // @TODO Rewrite this unnice code -./inc/functions.php:1285: // @TODO Remove this if() block if all is working fine -./inc/functions.php:1585: // @TODO This can be, somehow, rewritten +./inc/functions.php:1227: // @TODO Rewrite this unnice code +./inc/functions.php:1288: // @TODO Remove this if() block if all is working fine +./inc/functions.php:1588: // @TODO This can be, somehow, rewritten ./inc/functions.php:211: // @TODO Remove this sanity-check if all is fine -./inc/functions.php:2389: // @TODO The status should never be empty -./inc/functions.php:2465: $GLOBALS['cache_instance']->destroyCacheFile(); // @TODO isn't it better to do $GLOBALS['cache_instance']->destroyCacheFile('revision')? -./inc/functions.php:2467: // @TODO shouldn't do the unset and the reloading $GLOBALS['cache_instance']->destroyCacheFile() Or a new methode like forceCacheReload('revision')? +./inc/functions.php:2392: // @TODO The status should never be empty +./inc/functions.php:2468: $GLOBALS['cache_instance']->destroyCacheFile(); // @TODO isn't it better to do $GLOBALS['cache_instance']->destroyCacheFile('revision')? +./inc/functions.php:2470: // @TODO shouldn't do the unset and the reloading $GLOBALS['cache_instance']->destroyCacheFile() Or a new methode like forceCacheReload('revision')? ./inc/functions.php:250: // @TODO Fine all templates which are using these direct variables and rewrite them. ./inc/functions.php:251: // @TODO After this step is done, this else-block is history -./inc/functions.php:2528:// @TODO Please describe this function -./inc/functions.php:2540: searchDirsRecursive($next_dir, $last_changed); // @TODO small change to API to $last_changed = searchDirsRecursive($next_dir, $time); -./inc/functions.php:2623: // @TODO Add a little more infos here -./inc/functions.php:2634: // @TODO This cannot be rewritten to app_die(), try to find a solution for this. -./inc/functions.php:2791: // @TODO Are these convertions still required? -./inc/functions.php:2809:// @TODO Rewrite this function to use readFromFile() and writeToFile() +./inc/functions.php:2531:// @TODO Please describe this function +./inc/functions.php:2543: searchDirsRecursive($next_dir, $last_changed); // @TODO small change to API to $last_changed = searchDirsRecursive($next_dir, $time); +./inc/functions.php:2626: // @TODO Add a little more infos here +./inc/functions.php:2637: // @TODO This cannot be rewritten to app_die(), try to find a solution for this. +./inc/functions.php:2794: // @TODO Are these convertions still required? +./inc/functions.php:2812:// @TODO Rewrite this function to use readFromFile() and writeToFile() ./inc/functions.php:466:// @TODO Rewrite this to an extension 'smtp' ./inc/install-inc.php:20: * @TODO Rewrite all constants in this include file * ./inc/language/de.php:1159:// @TODO Rewrite these two constants diff --git a/inc/autopurge/purge- b/inc/autopurge/purge- index b0c5c7e5d8..85bf8951a9 100644 --- a/inc/autopurge/purge- +++ b/inc/autopurge/purge- @@ -43,7 +43,7 @@ if (!defined('__SECURITY')) { } // END - if // Abort if autopurge is not active or disabled by admin -if ((!EXT_IS_ACTIVE("autopurge")) || ($_CONFIG['auto_purge_active'] == "N")) { +if ((!EXT_IS_ACTIVE('autopurge')) || (getConfig('auto_purge_active') == 'N')) { // Abort here return false; } // END - if diff --git a/inc/config-functions.php b/inc/config-functions.php index c15828ad8f..531ad18844 100644 --- a/inc/config-functions.php +++ b/inc/config-functions.php @@ -42,33 +42,28 @@ if (!defined('__SECURITY')) { require($INC); } -// Merges $_CONFIG with data in given array +// Merges $GLOBALS['config'] with data in given array function mergeConfig ($newConfig) { - global $_CONFIG; - $_CONFIG = merge_array(getConfigArray(), $newConfig); + $GLOBALS['config'] = merge_array(getConfigArray(), $newConfig); } -// Getter for $_CONFIG entries +// Getter for $GLOBALS['config'] entries function getConfig ($configEntry) { - global $_CONFIG; - // Default value $value = null; // Is the entry there? if (isConfigEntrySet($configEntry)) { // Then use it - $value = $_CONFIG[$configEntry]; + $value = $GLOBALS['config'][$configEntry]; } // END - if // Return it return $value; } -// Setter for $_CONFIG entries +// Setter for $GLOBALS['config'] entries function setConfigEntry ($configEntry, $value) { - global $_CONFIG; - // Secure the entry name if (function_exists('SQL_ESCAPE')) { // Use our secure function @@ -85,41 +80,34 @@ function setConfigEntry ($configEntry, $value) { } // END - if // And set it - $_CONFIG[$configEntry] = $value; + $GLOBALS['config'][$configEntry] = $value; } // Checks wether the given config entry is set function isConfigEntrySet ($configEntry) { - global $_CONFIG; - return (isset($_CONFIG[$configEntry])); + return (isset($GLOBALS['config'][$configEntry])); } // Increment or init with given value or 1 as default the given config entry function incrementConfigEntry ($configEntry, $value=1) { - global $_CONFIG; - // Increment it if set or init it with 1 if (getConfig($configEntry) > 0) { - $_CONFIG[$configEntry] += $value; + $GLOBALS['config'][$configEntry] += $value; } else { - $_CONFIG[$configEntry] = $value; + $GLOBALS['config'][$configEntry] = $value; } } // Checks wether the configuration array is set so the config is loaded function isConfigLoaded () { - global $_CONFIG; - // Check all - return ((isset($_CONFIG)) && (is_array($_CONFIG)) && (count($_CONFIG) > 0)); + return ((isset($GLOBALS['config'])) && (is_array($GLOBALS['config'])) && (count($GLOBALS['config']) > 0)); } // Init the config array function initConfig () { - global $_CONFIG; - // Set a minimum dummy configuration - $_CONFIG = array( + $GLOBALS['config'] = array( 'code_length' => 0, 'patch_level' => 0, 'last_update' => time() @@ -159,17 +147,15 @@ function loadConfiguration ($no = '0') { } } -// Getter for whole $_CONFIG array +// Getter for whole $GLOBALS['config'] array function getConfigArray () { - global $_CONFIG; - // Default is null $return = null; // Is the config set? if (isConfigLoaded()) { // Then use it - $return = $_CONFIG; + $return = $GLOBALS['config']; } // END - if // Return result diff --git a/inc/functions.php b/inc/functions.php index 16a7194b80..78bd0a8540 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -735,7 +735,10 @@ function generateCaptchaCode ($code, $type, $DATA, $uid) { // Loads an email template and compiles it function LOAD_EMAIL_TEMPLATE ($template, $content = array(), $UID = '0') { - global $DATA, $_CONFIG; + global $DATA; + + // Our configuration is kept non-global here + $_CONFIG = getConfigArray(); // Make sure all template names are lowercase! $template = strtolower($template); -- 2.30.2