// Output HTML code directly or "render" it. You addionally switch the new-line character off
function OUTPUT_HTML ($HTML, $newLine = true) {
// Some global variables
- global $OUTPUT, $footer, $CSS;
+ global $OUTPUT;
// Do we have HTML-Code here?
if (!empty($HTML)) {
mxchange_die("<strong>{--FATAL_ERROR--}:</strong> {--LANG_NO_RENDER_DIRECT--}");
break;
}
- } elseif ((constant('_OB_CACHING') == "on") && ($footer == 1)) {
+ } elseif ((constant('_OB_CACHING') == "on") && ($GLOBALS['footer_sent'] == 1)) {
// Headers already sent?
if (headers_sent()) {
// Log this error
header("Connection: Close");
// Extension "rewrite" installed?
- if ((EXT_IS_ACTIVE("rewrite")) && ($CSS != "1") && ($CSS != "-1")) {
+ if ((EXT_IS_ACTIVE("rewrite")) && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
$OUTPUT = REWRITE_LINKS($OUTPUT);
} // END - if
OUTPUT_RAW($OUTPUT);
} elseif ((constant('OUTPUT_MODE') == "render") && (!empty($OUTPUT))) {
// Rewrite links when rewrite extension is active
- if ((EXT_IS_ACTIVE("rewrite")) && ($CSS != "1") && ($CSS != "-1")) {
+ if ((EXT_IS_ACTIVE("rewrite")) && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
$OUTPUT = REWRITE_LINKS($OUTPUT);
} // END - if
}
//
function GET_LANGUAGE() {
- global $cacheArray;
-
// Set default return value to default language from config
$ret = constant('DEFAULT_LANG');
if (!empty($_GET['mx_lang'])) {
// Accept only first 2 chars
$lang = substr($_GET['mx_lang'], 0, 2);
- } elseif (isset($cacheArray['language'])) {
+ } elseif (isset($GLOBALS['cache_array']['language'])) {
// Use cached
- $ret = $cacheArray['language'];
+ $ret = $GLOBALS['cache_array']['language'];
} elseif (!empty($lang)) {
// Check if main language file does exist
if (FILE_READABLE(constant('PATH')."inc/language/".$lang.".php")) {
}
// Cache entry
- $cacheArray['language'] = $ret;
+ $GLOBALS['cache_array']['language'] = $ret;
// Return value
return $ret;
}
//
function LOAD_URL($URL, $addUrlData=true) {
- global $CSS, $footer;
-
// Compile out URI codes
$URL = compileUriCode($URL);
}
// Insert the code in $img_code into jpeg or PNG image
-function GENERATE_IMAGE ($img_code, $header=true) {
+function GENERATE_IMAGE ($img_code, $headerSent=true) {
if ((strlen($img_code) > 6) || (empty($img_code)) || (getConfig('code_length') == 0)) {
// Stop execution of function here because of over-sized code length
return;
- } elseif (!$header) {
+ } elseif (!$headerSent) {
// Return in an HTML code code
return "<img src=\"{!URL!}/img.php?code=".$img_code."\" alt=\"Image\" />\n";
}
// Unset/set session variables
function set_session ($var, $value) {
- global $CSS;
-
// Abort in CSS mode here
- if ($CSS == 1) return true;
+ if ($GLOBALS['output_mode'] == 1) return true;
// Trim value and session variable
$var = trim(SQL_ESCAPE($var)); $value = trim($value);
// Check wether a boolean constant is set
// Taken from user comments in PHP documentation for function constant()
function isBooleanConstantAndTrue($constName) { // : Boolean
- global $cacheArray;
-
// Failed by default
$res = false;
// In cache?
- if (isset($cacheArray['const'][$constName])) {
+ if (isset($GLOBALS['cache_array']['const'][$constName])) {
// Use cache
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ".$constName."-CACHE!<br />\n";
- $res = $cacheArray['const'][$constName];
+ $res = $GLOBALS['cache_array']['const'][$constName];
} else {
// Check constant
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ".$constName."-RESOLVE!<br />\n";
if (defined($constName)) $res = (constant($constName) === true);
// Set cache
- $cacheArray['const'][$constName] = $res;
+ $GLOBALS['cache_array']['const'][$constName] = $res;
}
//* DEBUG: */ var_dump($res);
}
// Returns wether the value of the session variable or NULL if not set
function get_session ($var) {
- global $cacheArray;
-
// Default is not found! ;-)
$value = null;
// Is the variable there or cached values?
- if (isset($cacheArray['session'][$var])) {
+ if (isset($GLOBALS['cache_array']['session'][$var])) {
// Get cached value (skips a lot SQL_ESCAPE() calles!
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ".$var."-CACHE!<br />\n";
- $value = $cacheArray['session'][$var];
+ $value = $GLOBALS['cache_array']['session'][$var];
} elseif (isSessionVariableSet($var)) {
// Then get it secured!
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ".$var."-RESOLVE!<br />\n";
$value = SQL_ESCAPE($_SESSION[$var]);
// Cache the value
- $cacheArray['session'][$var] = $value;
+ $GLOBALS['cache_array']['session'][$var] = $value;
} // END - if
// Return the value
// Rebuild cache
function REBUILD_CACHE ($cache, $inc="") {
- global $cacheInstance, $CSS;
-
// Shall I remove the cache file?
- if ((EXT_IS_ACTIVE("cache")) && (is_object($cacheInstance))) {
+ if ((EXT_IS_ACTIVE("cache")) && (is_object($GLOBALS['cache_instance']))) {
// Rebuild cache
- if ($cacheInstance->loadCacheFile($cache)) {
+ if ($GLOBALS['cache_instance']->loadCacheFile($cache)) {
// Destroy it
- $cacheInstance->destroyCacheFile();
+ $GLOBALS['cache_instance']->destroyCacheFile();
} // END - if
// Include file given?
// Purge admin menu cache
function CACHE_PURGE_ADMIN_MENU ($id=0, $action="", $what="", $str="") {
- global $cacheInstance;
-
// Is the cache extension enabled or no cache instance or admin menu cache disabled?
if (!EXT_IS_ACTIVE("cache")) {
// Cache extension not active
return false;
- } elseif (!is_object($cacheInstance)) {
+ } elseif (!is_object($GLOBALS['cache_instance'])) {
// No cache instance!
DEBUG_LOG(__FUNCTION__, __LINE__, " No cache instance found.");
return false;
// Get current theme name
function GET_CURR_THEME() {
- global $INC_POOL, $CSS, $cacheArray;
+ global $INC_POOL;
// The default theme is 'default'... ;-)
$ret = "default";
// Set default theme
set_session('mxchange_theme', $ret);
} elseif ((isSessionVariableSet('mxchange_theme')) && (GET_EXT_VERSION("sql_patches") >= "0.1.4")) {
- //die("<pre>".print_r($cacheArray['themes'], true)."</pre>");
+ //die("<pre>".print_r($GLOBALS['cache_array']['themes'], true)."</pre>");
// Get theme from cookie
$ret = get_session('mxchange_theme');
// Fix it to default
$ret = "default";
} // END - if
- } elseif ((!isBooleanConstantAndTrue('mxchange_installed')) && ((isBooleanConstantAndTrue('mxchange_installing')) || ($CSS == true)) && ((!empty($_GET['theme'])) || (!empty($_POST['theme'])))) {
+ } elseif ((!isBooleanConstantAndTrue('mxchange_installed')) && ((isBooleanConstantAndTrue('mxchange_installing')) || ($GLOBALS['output_mode'] == true)) && ((!empty($_GET['theme'])) || (!empty($_POST['theme'])))) {
// Prepare FQFN for checking
$theme = sprintf("%stheme/%s/theme.php", constant('PATH'), SQL_ESCAPE($_GET['theme']));
// Get id from theme
function THEME_GET_ID ($name) {
- global $cacheArray;
-
// Is the extension "theme" installed?
if (!EXT_IS_ACTIVE("theme")) {
// Then abort here
$id = 0;
// Is the cache entry there?
- if (isset($cacheArray['themes']['id'][$name])) {
+ if (isset($GLOBALS['cache_array']['themes']['id'][$name])) {
// Get the version from cache
- $id = $cacheArray['themes']['id'][$name];
+ $id = $GLOBALS['cache_array']['themes']['id'][$name];
// Count up
incrementConfigEntry('cache_hits');
// Loads an include file once
function LOAD_INC_ONCE ($INC) {
- global $cacheArray;
-
// Is it not loaded?
- if (!isset($cacheArray['load_once'][$INC])) {
+ if (!isset($GLOBALS['cache_array']['load_once'][$INC])) {
// Then try to load it
LOAD_INC($INC);
// And mark it as loaded
- $cacheArray['load_once'][$INC] = true;
+ $GLOBALS['cache_array']['load_once'][$INC] = true;
} // END - if
}