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
$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()
// 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])."<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(gettype($GLOBALS['cache_array']['config'][$no])."<br />");
foreach ($GLOBALS['cache_array']['config'][$no] as $key => $value) {
setConfigEntry($key, $value);
} // END - foreach
}
}
-// 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
// Is the line found?
if ((substr($line, 0, strlen($old)) == $old) && (!isset($done[$old]))) {
// Entry found!
- //* DEBUG: */ print htmlentities($line) . " - FOUND!<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(htmlentities($line) . " - FOUND!<br />");
// Eval the line...
eval($line);
} // END - if
/// ... and write it to the new config
- //* DEBUG: */ print 'function=' . $function . ',new=' . $new . ',comment=' . $comment . "<br />\n";
+ //* DEBUG: */ OUTPUT_HTML('function=' . $function . ',new=' . $new . ',comment=' . $comment . "<br />");
changeDataInFile(constant('PATH') . 'inc/cache/config-local.php', $comment, $function . "('" . $oldNew . "', \"", "\");", constant($new), 0);
- //* DEBUG: */ print "CHANGED!<br />\n";
+ //* DEBUG: */ OUTPUT_HTML("CHANGED!<br />");
// Mark it as done
$done[$old] = 1;
}
// Debug output only
- //* DEBUG: */ print htmlentities($line) . " - MySQL!<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(htmlentities($line) . " - MySQL!<br />");
// Split parts so we can check them and prepare them
$parts = explode('=>', $line);