X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fconfig-functions.php;h=c70857e9af77a6b39957d952af2335b5cb34ab74;hp=c15828ad8f04eef15f1ed6c699eec2030c3e937e;hb=d234d1de6ad6e7afe77507f421c9930833731d88;hpb=5071030af40e69ca4284642f44758964e18f5be8 diff --git a/inc/config-functions.php b/inc/config-functions.php index c15828ad8f..c70857e9af 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 @@ -78,48 +73,35 @@ function setConfigEntry ($configEntry, $value) { $configEntry = smartAddSlashes($configEntry); } - // If config array isn't set, set it - if (!isConfigLoaded()) { - // Init configuration array - initConfig(); - } // 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() @@ -131,7 +113,7 @@ function loadConfiguration ($no = '0') { // Check for cache extension, cache-array and if the requested configuration is in cache if ((isset($GLOBALS['cache_array'])) && (is_array($GLOBALS['cache_array'])) && (isset($GLOBALS['cache_array']['config'][$no])) && (is_array($GLOBALS['cache_array']['config'][$no]))) { // Load config from cache - //* DEBUG: */ echo gettype($GLOBALS['cache_array']['config'][$no])."
\n"; + //* DEBUG: */ OUTPUT_HTML(gettype($GLOBALS['cache_array']['config'][$no])."
"); foreach ($GLOBALS['cache_array']['config'][$no] as $key => $value) { setConfigEntry($key, $value); } // END - foreach @@ -159,17 +141,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 @@ -236,7 +216,7 @@ function updateOldConfigFile () { // Is the line found? if ((substr($line, 0, strlen($old)) == $old) && (!isset($done[$old]))) { // Entry found! - //* DEBUG: */ print htmlentities($line) . " - FOUND!
\n"; + //* DEBUG: */ OUTPUT_HTML(htmlentities($line) . " - FOUND!
"); // Eval the line... eval($line); @@ -267,9 +247,9 @@ function updateOldConfigFile () { } // END - if /// ... and write it to the new config - //* DEBUG: */ print 'function=' . $function . ',new=' . $new . ',comment=' . $comment . "
\n"; + //* DEBUG: */ OUTPUT_HTML('function=' . $function . ',new=' . $new . ',comment=' . $comment . "
"); changeDataInFile(constant('PATH') . 'inc/cache/config-local.php', $comment, $function . "('" . $oldNew . "', \"", "\");", constant($new), 0); - //* DEBUG: */ print "CHANGED!
\n"; + //* DEBUG: */ OUTPUT_HTML("CHANGED!
"); // Mark it as done $done[$old] = 1; @@ -300,7 +280,7 @@ function updateOldConfigFile () { } // Debug output only - //* DEBUG: */ print htmlentities($line) . " - MySQL!
\n"; + //* DEBUG: */ OUTPUT_HTML(htmlentities($line) . " - MySQL!
"); // Split parts so we can check them and prepare them $parts = explode('=>', $line);