// Set module
$GLOBALS['module'] = "admin";
-$CSS = -1;
+$GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
// Set module
-$GLOBALS['module'] = "agb"; $CSS = -1;
+$GLOBALS['module'] = "agb"; $GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
// Set module
$GLOBALS['module'] = "beg";
$GLOBALS['refid'] = 0;
-$CSS = -1;
+$GLOBALS['output_mode'] = -1;
$msg = null;
// Load the required file(s)
$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
// Set module
-$GLOBALS['module'] = "birthday_confirm"; $CSS = -1;
+$GLOBALS['module'] = "birthday_confirm"; $GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
// Set module
-$GLOBALS['module'] = "click"; $CSS = -1;
+$GLOBALS['module'] = "click"; $GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
// Set module to confirm
-$GLOBALS['module'] = "confirm"; $CSS = -1;
+$GLOBALS['module'] = "confirm"; $GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action, $footer;
+global $what, $action;
// Footer is disabled in CSS mode
-$footer = "-1";
+$GLOBALS['footer_sent'] = "-1";
// Init variables
$GLOBALS['what'] = "";
$GLOBALS['action'] = "";
// This is a CSS file loader!
-$CSS = "1";
+$GLOBALS['output_mode'] = "1";
$GLOBALS['module'] = "css";
// Set header
$GLOBALS['action'] = "";
// Set module and fake "CSS mode"
-$GLOBALS['module'] = "debug"; $CSS = -1;
+$GLOBALS['module'] = "debug"; $GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
// Set module
$GLOBALS['module'] = "doubler";
$GLOBALS['refid'] = 0;
-$CSS = 0;
+$GLOBALS['output_mode'] = 0;
// Load the required file(s)
require("inc/config.php");
$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
// Set module
-$GLOBALS['module'] = "img"; $CSS = -1;
+$GLOBALS['module'] = "img"; $GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
require($INC);
}
-// 01 2 3 32 2 3321 12 3 32 2 21 1 2 21 1 2 21 1 2 21 1 10
-if ((date("d", getConfig('last_update')) != date("d", time())) && ((!defined('mxchange_installing')) || (!mxchange_installing)) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (!isset($_GET['register'])) && ($CSS != 1)) {
+// 01 2 3 32 2 3321 12 3 32 2 21 1 2 21 1 2 21 1 2 21 1 10
+if ((date("d", getConfig('last_update')) != date("d", time())) && ((!defined('mxchange_installing')) || (!mxchange_installing)) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (!isset($_GET['register'])) && ($GLOBALS['output_mode'] != 1)) {
// Do daily things in external PHP file but only when script is completely setup
// Daily reset was run!
define('__DAILY_RESET', true);
// SQL queries
function SQL_QUERY ($sql_string, $F, $L) {
- global $link, $CSS, $OK;
+ global $link, $OK;
// Link is up?
if (!is_resource($link)) return false;
// Debug output
//* DEBUG: */ print "Query=<pre>".$sql_string."</pre>, affected=<strong>".SQL_AFFECTEDROWS()."</strong>, numrows=<strong>".SQL_NUMROWS($result)."</strong><br />\n";
- if (($CSS != "1") && ($CSS != "-1") && (isBooleanConstantAndTrue('DEBUG_MODE')) && (isBooleanConstantAndTrue('DEBUG_SQL'))) {
+ if (($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1") && (isBooleanConstantAndTrue('DEBUG_MODE')) && (isBooleanConstantAndTrue('DEBUG_SQL'))) {
//
// Debugging stuff...
//
// SQL close link
function SQL_CLOSE (&$link, $F, $L) {
- global $cacheInstance, $cacheArray;
-
if (!is_resource($link)) {
// Skip double close
return false;
// Do we need to update cache/db counter?
//* DEBUG: */ echo "DB=".getConfig('db_hits').",CACHE=".getConfig('cache_hits')."<br />\n";
- if ((GET_EXT_VERSION("cache") >= "0.0.7") && (getConfig('db_hits') > 0) && (getConfig('cache_hits') > 0) && (is_object($cacheInstance))) {
+ if ((GET_EXT_VERSION("cache") >= "0.0.7") && (getConfig('db_hits') > 0) && (getConfig('cache_hits') > 0) && (is_object($GLOBALS['cache_instance']))) {
// Add new hits
incrementConfigEntry('db_hits', getConfig('db_hits_run'));
// Load the extension and maybe found language and function files.
function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run = false, &$SQLs = array()) {
- global $EXT_LOADED, $_CONFIG, $CSS, $cacheMode, $EXT_VER_HISTORY;
+ global $EXT_LOADED, $_CONFIG, $EXT_VER_HISTORY;
global $INC_POOL, $EXT_UPDATE_DEPENDS, $EXT_DEPRECATED, $UPDATE_NOTES;
global $EXT_VERSION, $EXT_ALWAYS_ACTIVE;
// Registeres an extension and possible update depencies
function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = true) {
- global $UPDATE_NOTES, $INC_POOL, $cacheInstance;
+ global $UPDATE_NOTES, $INC_POOL;
global $EXT_VER_HISTORY, $NOTES, $EXT_ALWAYS_ACTIVE, $EXT_VERSION;
global $EXT_UPDATE_DEPENDS;
// Run SQL queries for given extension id
// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
function EXTENSION_RUN_SQLS ($ext_id, $load_mode) {
- global $cacheInstance;
-
// This shall never do a non-admin user!
if (!IS_ADMIN()) return false;
// Check if given extension is active
function EXT_IS_ACTIVE ($ext_name) {
- global $cacheArray;
-
// Extensions are all inactive during installation
if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing')) || (empty($ext_name))) return false;
$active = "N";
// Check cache
- if (isset($cacheArray['extensions']['ext_active'][$ext_name])) {
+ if (isset($GLOBALS['cache_array']['extensions']['ext_active'][$ext_name])) {
// Load from cache
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "CACHE! ext_name={$ext_name}");
- $active = $cacheArray['extensions']['ext_active'][$ext_name];
+ $active = $GLOBALS['cache_array']['extensions']['ext_active'][$ext_name];
// Count cache hits
incrementConfigEntry('cache_hits');
// Write cache array
//* DEBUG: */ echo $ext_name."[DB]: {$active}");
- $cacheArray['extensions']['ext_active'][$ext_name] = $active;
+ $GLOBALS['cache_array']['extensions']['ext_active'][$ext_name] = $active;
} else {
// Extension not active!
//* DEBUG: */ echo $ext_name.": Not active!");
- $cacheArray['extensions']['ext_active'][$ext_name] = "N";
+ $GLOBALS['cache_array']['extensions']['ext_active'][$ext_name] = "N";
}
// Debug message
}
// Get version from extensions
function GET_EXT_VERSION ($ext_name) {
- global $cacheArray, $cacheInstance;
+ // By default no extension is found
$ext_ver = false;
// Extensions are all inactive during installation
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": ext_name={$ext_name}");
// Is the cache written?
- if (isset($cacheArray['extensions']['ext_version'][$ext_name])) {
+ if (isset($GLOBALS['cache_array']['extensions']['ext_version'][$ext_name])) {
// Load data from cache
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": CACHE!");
- $ext_ver = $cacheArray['extensions']['ext_version'][$ext_name];
+ $ext_ver = $GLOBALS['cache_array']['extensions']['ext_version'][$ext_name];
// Count cache hits
incrementConfigEntry('cache_hits');
- } elseif (!is_object($cacheInstance)) {
+ } elseif (!is_object($GLOBALS['cache_instance'])) {
// Load from database
$result = SQL_QUERY_ESC("SELECT ext_version FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_name='%s' LIMIT 1",
array($ext_name), __FILE__, __LINE__);
SQL_FREERESULT($result);
// Set cache
- $cacheArray['extensions']['ext_version'][$ext_name] = $ext_ver;
+ $GLOBALS['cache_array']['extensions']['ext_version'][$ext_name] = $ext_ver;
}
// Return result
// Updates a given extension with current extension version to latest version
function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) {
// This shall never do a non-admin user!
- global $cacheInstance, $UPDATE_NOTES, $NOTES, $EXT_VER_HISTORY;
- global $EXT_UPDATE_DEPENDS, $EXT_VERSION, $INC_POOL, $cacheArray, $SQLs;
+ global $UPDATE_NOTES, $NOTES, $EXT_VER_HISTORY;
+ global $EXT_UPDATE_DEPENDS, $EXT_VERSION, $INC_POOL, $SQLs;
// Init arrays
$SQLs = array(); $INC_POOL = array();
// And load SQL queries in order of version history
for ($idx = ($start + 1); $idx < sizeof($history); $idx++) {
// Set extension version
- $cacheArray['update_ver'][$ext_name] = $history[$idx];
+ $GLOBALS['cache_array']['update_ver'][$ext_name] = $history[$idx];
// Load again...
- LOAD_EXTENSION($ext_name, "update", $cacheArray['update_ver'][$ext_name], $dry_run, $SQLs);
+ LOAD_EXTENSION($ext_name, "update", $GLOBALS['cache_array']['update_ver'][$ext_name], $dry_run, $SQLs);
if (!empty($EXT_UPDATE_DEPENDS)) {
// Backup current SQL queries
- $cacheArray['update_sqls'][$ext_name] = $SQLs;
+ $GLOBALS['cache_array']['update_sqls'][$ext_name] = $SQLs;
// Is the extension there?
if (GET_EXT_VERSION($EXT_UPDATE_DEPENDS) != "") {
}
// Restore previous SQL queries
- $SQLs = $cacheArray['update_sqls'][$ext_name];
- unset($cacheArray['update_sqls'][$ext_name]);
+ $SQLs = $GLOBALS['cache_array']['update_sqls'][$ext_name];
+ unset($GLOBALS['cache_array']['update_sqls'][$ext_name]);
} // END - if
// Add notes
- $NOTES .= ADD_EXTENSION_NOTES($cacheArray['update_ver'][$ext_name], $UPDATE_NOTES);
+ $NOTES .= ADD_EXTENSION_NOTES($GLOBALS['cache_array']['update_ver'][$ext_name], $UPDATE_NOTES);
} // END - for
// In real-mode execute any existing includes
if (!$dry_run) {
- $cacheArray['inc_pool'][$ext_name] = $INC_POOL;
+ $GLOBALS['cache_array']['inc_pool'][$ext_name] = $INC_POOL;
RUN_FILTER('load_includes', $INC_POOL);
- $INC_POOL = $cacheArray['inc_pool'][$ext_name];
- unset($cacheArray['inc_pool'][$ext_name]);
+ $INC_POOL = $GLOBALS['cache_array']['inc_pool'][$ext_name];
+ unset($GLOBALS['cache_array']['inc_pool'][$ext_name]);
} // END - if
// Run SQLs
if (!$dry_run) {
// Create task
- CREATE_EXTENSION_UPDATE_TASK(GET_CURRENT_ADMIN_ID(), $ext_name, $cacheArray['update_ver'][$ext_name], SQL_ESCAPE($NOTES));
+ CREATE_EXTENSION_UPDATE_TASK(GET_CURRENT_ADMIN_ID(), $ext_name, $GLOBALS['cache_array']['update_ver'][$ext_name], SQL_ESCAPE($NOTES));
// Update extension's version
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_version='%s' WHERE ext_name='%s' LIMIT 1",
- array($cacheArray['update_ver'][$ext_name], $ext_name), __FILE__, __LINE__);
+ array($GLOBALS['cache_array']['update_ver'][$ext_name], $ext_name), __FILE__, __LINE__);
// Remove arrays
unset($SQLs);
- unset($cacheArray['update_ver'][$ext_name]);
+ unset($GLOBALS['cache_array']['update_ver'][$ext_name]);
// Run filters on success extension update
RUN_FILTER('extension_update', $ext_name);
// Get extension name from id
function GET_EXT_NAME ($ext_id) {
- global $cacheArray;
-
// Init extension name
$ret = "";
// Is cache there?
- if (isset($cacheArray['extensions']['ext_name'][$ext_id])) {
+ if (isset($GLOBALS['cache_array']['extensions']['ext_name'][$ext_id])) {
// Load from cache
- $ret = $cacheArray['extensions']['ext_name'][$ext_id];
+ $ret = $GLOBALS['cache_array']['extensions']['ext_name'][$ext_id];
// Count cache hits
incrementConfigEntry('cache_hits');
// Get extension id from name
function GET_EXT_ID ($ext_name) {
- global $cacheArray;
-
// Init ID number
$ret = 0;
- if (isset($cacheArray['extensions']['ext_id'][$ext_name])) {
+ if (isset($GLOBALS['cache_array']['extensions']['ext_id'][$ext_name])) {
// Load from cache
- $ret = $cacheArray['extensions']['ext_id'][$ext_name];
+ $ret = $GLOBALS['cache_array']['extensions']['ext_id'][$ext_name];
// Count cache hits
incrementConfigEntry('cache_hits');
// Checks if the module has a menu
function MODULE_HAS_MENU ($mod, $forceDb = false) {
- global $cacheArray;
-
// All is false by default
$ret = false;
+
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):mod={$mod},cache=".GET_EXT_VERSION("cache")."<br />\n";
if (GET_EXT_VERSION("cache") >= "0.1.2") {
// Cache version is okay, so let's check the cache!
- if (isset($cacheArray['modules']['has_menu'][$mod])) {
+ if (isset($GLOBALS['cache_array']['modules']['has_menu'][$mod])) {
// Check module cache and count hit
- $ret = ($cacheArray['modules']['has_menu'][$mod] == "Y");
+ $ret = ($GLOBALS['cache_array']['modules']['has_menu'][$mod] == "Y");
incrementConfigEntry('cache_hits');
- } elseif (isset($cacheArray['extensions']['ext_menu'][$mod])) {
+ } elseif (isset($GLOBALS['cache_array']['extensions']['ext_menu'][$mod])) {
// Check cache and count hit
- $ret = ($cacheArray['extensions']['ext_menu'][$mod] == "Y");
+ $ret = ($GLOBALS['cache_array']['extensions']['ext_menu'][$mod] == "Y");
incrementConfigEntry('cache_hits');
} elseif ((IS_ADMIN()) && ($mod == "admin")) {
// Admin module has always a menu!
list($has_menu) = SQL_FETCHROW($result);
// Fake cache... ;-)
- $cacheArray['extensions']['ext_menu'][$mod] = $has_menu;
+ $GLOBALS['cache_array']['extensions']['ext_menu'][$mod] = $has_menu;
// Does it have a menu?
$ret = ($has_menu == "Y");
default: // Do stuff when extension is loaded
// Do we have a daily-reset-run?
- if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($CSS != 1))
- {
+ if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($GLOBALS['output_mode'] != 1)) {
// Yes, we have. So let's auto-purge some campaigns, inactive users and unconfirmed accounts
$INC_POOL[] = sprintf("%sinc/autopurge.php", constant('PATH'));
}
break;
default: // Do stuff when extension is loaded
- if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($CSS != 1)) {
+ if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($GLOBALS['output_mode'] != 1)) {
// Daily reset was run so let's check if active rallye is activated
if (getConfig('bonus_active') == "Y") {
// Run active rallye
// Is the cache extension itself there?
if (EXT_IS_ACTIVE("cache")) {
// Check for cache when extension is already installed
- if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("extensions", true)) $GLOBALS['cache_instance']->destroyCacheFile();
} // END - if
// Update notes (these will be set as task text!)
default: // Do stuff when extension is loaded
// Create instance on class
- if ($cacheMode != "init") {
- // Make cacheInstance global
- global $cacheInstance;
-
+ if ($GLOBALS['cacheMode'] != "init") {
// Initialize cache system only when it's needed
- $cacheInstance = new CacheSystem(getConfig('cache_update'), constant('PATH')."inc/".getConfig('cache_path'), getConfig('cache_tested'));
- if ($cacheInstance->getStatus() != "done") {
+ $GLOBALS['cache_instance'] = new CacheSystem(getConfig('cache_update'), constant('PATH')."inc/".getConfig('cache_path'), getConfig('cache_tested'));
+ if ($GLOBALS['cache_instance']->getStatus() != "done") {
// Failed to initialize cache sustem
addFatalMessage(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_CANNOT_INITIALIZE);
} // END - if
'2','3','4','5','6','7','8','9'
);
- if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($CSS != 1)) {
+ if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($GLOBALS['output_mode'] != 1)) {
// Daily reset was run so let's check out for expired newsletter orders
$INC_POOL[] = sprintf("%sinc/monthly/monthly_newsletter.php", constant('PATH'));
}
default: // Do stuff when extension is loaded
// Do we have a daily-reset-run?
- if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($CSS != 1)) {
+ if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($GLOBALS['output_mode'] != 1)) {
// So let's check for profiles which needs an update
$INC_POOL[] = sprintf("%sinc/profile-updte.php", constant('PATH'));
}
default: // Do stuff when extension is loaded
// Do stuff only when not in CSS mode
- if (($CSS != "1") && ($CSS != "-1") && ($cacheMode != "init")) {
+ if (($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1") && ($GLOBALS['cacheMode'] != "init")) {
// Get total member count
$TOTAL = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true);
// Read key from secret file
if ((getConfig('file_hash') == "") || (getConfig('master_salt') == "") || (getConfig('pass_scramble') == "")) {
// Cache instance
- global $cacheInstance;
-
// Maybe need setup of secret key!
LOAD_INC_ONCE("inc/gen_sql_patches.php");
// @TODO Rewrite this to a filter!
- if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($cacheInstance)) && (is_object($cacheInstance))) {
+ if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($GLOBALS['cache_instance'])) && (is_object($GLOBALS['cache_instance']))) {
// Remove extensions and mod_reg cache file
LOAD_INC_ONCE("inc/libs/cache_functions.php");
require(sprintf("%sinc/extensions/ext-cache.php", constant('PATH')));
- if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("extensions", true)) $GLOBALS['cache_instance']->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("mod_reg")) $GLOBALS['cache_instance']->destroyCacheFile();
} // END - if
} // END - if
// Filter to load include files
function FILTER_LOAD_INCLUDES ($data) {
- global $CSS;
-
// Default is $data as inclusion list
$INC_POOL = $data;
************************************************************************/
// Global variable stuff
-global $link, $frame, $CSS, $header, $footer;
+global $link, $frame;
// Some security stuff...
if (!defined('__SECURITY')) {
} // END - if
// Footer disabled or already sent?
-if (($footer != "1") && ($footer != "2") && ($CSS != "1")) {
+if (($GLOBALS['footer_sent'] != "1") && ($GLOBALS['footer_sent'] != "2") && ($GLOBALS['output_mode'] != "1")) {
// Output the generated HTML code or do nothing in direct-mode
if (getTotalFatalErrors() > 0) {
// Output fatal error messages
} // END - if
// Shall we display the copyright notice?
- if ((empty($frame)) && (empty($_GET['frame'])) && (basename($_SERVER['PHP_SELF']) != "mailid_top.php") && (isBooleanConstantAndTrue('WRITE_FOOTER')) && ($header == "2")) {
+ if ((empty($frame)) && (empty($_GET['frame'])) && (basename($_SERVER['PHP_SELF']) != "mailid_top.php") && (isBooleanConstantAndTrue('WRITE_FOOTER')) && ($GLOBALS['header_sent'] == "2")) {
// Backlink enabled?
if (isBooleanConstantAndTrue('ENABLE_BACKLINK')) {
// Copyright with backlink, thanks! :-)
} // END - if
// Shall we display the parsing time and number of queries?
- if ((getConfig('show_timings') == "Y") && (empty($_GET['frame'])) && ($header == "2")) {
+ if ((getConfig('show_timings') == "Y") && (empty($_GET['frame'])) && ($GLOBALS['header_sent'] == "2")) {
// Then display it here
DISPLAY_PARSING_TIME_FOOTER();
} // END - if
} // END - if
// Footer has been reached
-$footer = 1;
+$GLOBALS['footer_sent'] = 1;
// Output HTML code
OUTPUT_HTML("");
// 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
}
// Do we have entries?
if (SQL_NUMROWS($result_direct) > 0) {
- global $cacheArray;
-
// When "walk" through all users
while (list($uid) = SQL_FETCHROW($result_direct)) {
// Init level
- $cacheArray['back_level'] = 1;
+ $GLOBALS['cache_array']['back_level'] = 1;
// Update refback table
//* DEBUG: */ echo "uid={$uid}<br />\n";
require($INC);
}
-global $header;
-
// Is the header already sent?
-if (($header != "1") && ($header != "2")) {
+if (($GLOBALS['header_sent'] != "1") && ($GLOBALS['header_sent'] != "2")) {
// If not in CSS mode generate the header
- if (($CSS != "1")) {
+ if (($GLOBALS['output_mode'] != "1")) {
// Generate header
$TITLE = "";
} // END - if
// Closing HEAD tag
- if ($CSS != "1") OUTPUT_HTML("</head>");
- $header = 1;
+ if ($GLOBALS['output_mode'] != "1") OUTPUT_HTML("</head>");
+ $GLOBALS['header_sent'] = 1;
} // END - if
// Load body or not
-if (($GLOBALS['module'] != "frametester") || (($GLOBALS['module'] == "frametester") && (isset($_GET['frame']))) || (($header == "1") && (!empty($_GET['frame']))) && ($CSS != "1")) {
+if (($GLOBALS['module'] != "frametester") || (($GLOBALS['module'] == "frametester") && (isset($_GET['frame']))) || (($GLOBALS['header_sent'] == "1") && (!empty($_GET['frame']))) && ($GLOBALS['output_mode'] != "1")) {
// Is the header sent and the script is not the mail confirmation script and not a CSS?
- if (($header == "1") && (basename($_SERVER['PHP_SELF']) != "mailid.php") && ($CSS != "1")) {
+ if (($GLOBALS['header_sent'] == "1") && (basename($_SERVER['PHP_SELF']) != "mailid.php") && ($GLOBALS['output_mode'] != "1")) {
// Add BODY tag
LOAD_TEMPLATE("page_body");
- $header = 2;
+ $GLOBALS['header_sent'] = 2;
} // END - if
} // END - if
// Check ACL for menu combination
function ADMINS_CHECK_ACL($act, $wht) {
- global $cacheArray, $cacheInstance;
// If action is login or logout allow allways!
$default = "allow";
if (($act == "login") || ($act == "logout")) return true;
$lines = 0; $acl_mode = "failed";
if (GET_EXT_VERSION("cache") >= "0.1.2") {
// Load only from array when there are lines!
- if ((isset($cacheArray['admin_acls'])) && (is_array($cacheArray['admin_acls'])) && (count($cacheArray['admin_acls']) > 0)) {
+ if ((isset($GLOBALS['cache_array']['admin_acls'])) && (is_array($GLOBALS['cache_array']['admin_acls'])) && (count($GLOBALS['cache_array']['admin_acls']) > 0)) {
// Load ACL from array
- foreach ($cacheArray['admin_acls']['admin_id'] as $id => $aid_acls) {
+ foreach ($GLOBALS['cache_array']['admin_acls']['admin_id'] as $id => $aid_acls) {
if ($aid == $aid_acls) {
// Okay, one line was found!
- if ((!empty($act)) && ($cacheArray['admin_acls']['action_menu'][$id] == $act)) {
+ if ((!empty($act)) && ($GLOBALS['cache_array']['admin_acls']['action_menu'][$id] == $act)) {
// Main menu line found
- $acl_mode = $cacheArray['admin_acls']['access_mode'][$id];
+ $acl_mode = $GLOBALS['cache_array']['admin_acls']['access_mode'][$id];
$lines = 1;
}
- elseif ((!empty($wht)) && ($cacheArray['admin_acls']['what_menu'][$id] == $wht)) {
+ elseif ((!empty($wht)) && ($GLOBALS['cache_array']['admin_acls']['what_menu'][$id] == $wht)) {
// Check sub menu
- $acl_mode = $cacheArray['admin_acls']['access_mode'][$id];
+ $acl_mode = $GLOBALS['cache_array']['admin_acls']['access_mode'][$id];
$lines = 1;
}
if ($lines == 1) {
// Change a lot admin account
function ADMINS_CHANGE_ADMIN_ACCOUNT($POST) {
- global $cacheInstance;
-
// Begin the update
$cache_update = 0;
foreach ($POST['login'] as $id => $login) {
}
function addRow ($data) {
- global $cacheArray;
-
+ // Is the pointe rvalid?
if (is_resource($this->pointer)) {
// Write every array element to cache file
foreach ($data as $k => $v) {
// Write global cache array for immediate access
if ((substr($k, 0, 4) == "ext_") && (isset($data['ext_name'])) && (isset($data['ext_id']))) {
if ($k != "ext_name") {
- $cacheArray['extensions'][$k][$data['ext_name']] = $v;
+ $GLOBALS['cache_array']['extensions'][$k][$data['ext_name']] = $v;
} else {
- $cacheArray['extensions'][$k][$data['ext_id']] = $v;
+ $GLOBALS['cache_array']['extensions'][$k][$data['ext_id']] = $v;
}
if (($k == "ext_keep") && ($v == "Y")) {
- $cacheArray['active_extensions'][$data['ext_name']] = $v;
+ $GLOBALS['cache_array']['active_extensions'][$data['ext_name']] = $v;
} // END - if
} elseif (is_array($v)) {
// Serialize and BASE64-encode the array
// Destroy the cache on extension changes
function FILTER_CACHE_DESTROY_ON_EXT_CHANGE ($data) {
- global $cacheInstance;
-
// Remove cache
if (EXT_IS_ACTIVE("cache")) {
- if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("extensions")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("config")) $GLOBALS['cache_instance']->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("extensions")) $GLOBALS['cache_instance']->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("mod_reg")) $GLOBALS['cache_instance']->destroyCacheFile();
} // END - if
// Return it
// Destroy the cache on changing admin
function FILTER_CACHE_DESTROY_ON_ADMIN_CHANGE () {
- global $cacheInstance;
-
// Remove cache
if (EXT_IS_ACTIVE("cache")) {
- if ($cacheInstance->loadCacheFile("admins")) $cacheInstance->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("admins")) $GLOBALS['cache_instance']->destroyCacheFile();
} // END - if
}
// Destroy all cache files
function FILTER_CACHE_DESTROY_ALL () {
- global $cacheInstance;
-
// Remove cache
if (EXT_IS_ACTIVE("cache")) {
- if ($cacheInstance->loadCacheFile("admins")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("admins_acls")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("extensions")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("refdepths")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("refsystem")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("themes")) $cacheInstance->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("admins")) $GLOBALS['cache_instance']->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("admins_acls")) $GLOBALS['cache_instance']->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("config")) $GLOBALS['cache_instance']->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("extensions")) $GLOBALS['cache_instance']->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("mod_reg")) $GLOBALS['cache_instance']->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("refdepths")) $GLOBALS['cache_instance']->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("refsystem")) $GLOBALS['cache_instance']->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("themes")) $GLOBALS['cache_instance']->destroyCacheFile();
} // END - if
}
//
function NICKNAME_IS_ACTIVE ($uidNick) {
- global $cacheArray;
-
// By default nothing is found...
$ret = false;
// Found in cache?
- if (isset($cacheArray['nick_active'][$uidNick])) {
+ if (isset($GLOBALS['cache_array']['nick_active'][$uidNick])) {
// Use it directly
- $ret = $cacheArray['nick_active'][$uidNick];
+ $ret = $GLOBALS['cache_array']['nick_active'][$uidNick];
// Increment cache counter
incrementConfigEntry('cache_hits');
$ret = (SQL_NUMROWS($result) == 1);
// Put it in cache
- $cacheArray['nick_active'][$uidNick] = $ret;
+ $GLOBALS['cache_array']['nick_active'][$uidNick] = $ret;
// Free result
SQL_FREERESULT($result);
//
function NICKNAME_GET_NICK ($userid) {
- global $cacheArray;
-
// If not found...
$ret = "";
// Found in cache?
- if (isset($cacheArray['nicknames'][$userid])) {
+ if (isset($GLOBALS['cache_array']['nicknames'][$userid])) {
// Use it directly
- $ret = $cacheArray['nicknames'][$userid];
+ $ret = $GLOBALS['cache_array']['nicknames'][$userid];
// Increment cache counter
incrementConfigEntry('cache_hits');
list($ret) = SQL_FETCHROW($result);
// Put it in cche
- $cacheArray['nicknames'][$userid] = $ret;
+ $GLOBALS['cache_array']['nicknames'][$userid] = $ret;
} // END - if
// Free result
}
//
function RALLYE_GET_REFCOUNT($uid, $old=0) {
- global $cacheArray;
-
// Check current refs
if (GET_EXT_VERSION("cache") >= "0.1.2") {
// Get refs from cache
$cnt = 0;
- foreach ($cacheArray['refsystem']['userid'] as $id => $u_id) {
+ foreach ($GLOBALS['cache_array']['refsystem']['userid'] as $id => $u_id) {
// Do we have a ref for this user?
- //* DEBUG: */ echo "id={$id},u_id={$u_id},uid={$uid},old={$old},level={$cacheArray['refsystem']['level'][$id]}<br />\n";
- if (($u_id == $uid) && ($cacheArray['refsystem']['level'][$id] == 1)) {
+ //* DEBUG: */ echo "id={$id},u_id={$u_id},uid={$uid},old={$old},level={$GLOBALS['cache_array']['refsystem']['level'][$id]}<br />\n";
+ if (($u_id == $uid) && ($GLOBALS['cache_array']['refsystem']['level'][$id] == 1)) {
//* DEBUG: */ echo "uid matches!<br />\n";
- foreach ($cacheArray['ref_depths']['level'] as $level) {
- if (($level == $cacheArray['refsystem']['level'][$id]) && ($level == 1)) {
+ foreach ($GLOBALS['cache_array']['ref_depths']['level'] as $level) {
+ if (($level == $GLOBALS['cache_array']['refsystem']['level'][$id]) && ($level == 1)) {
// Level does exist so abort here
- $cnt = $cacheArray['refsystem']['counter'][$id];
+ $cnt = $GLOBALS['cache_array']['refsystem']['counter'][$id];
//* DEBUG: */ echo "*".$uid."/".$cnt."*<br />";
break;
} elseif ($level > 1) {
}
}
//* DEBUG: */ echo "<pre>";
- //* DEBUG: */ print_r($cacheArray['refsystem']);
+ //* DEBUG: */ print_r($GLOBALS['cache_array']['refsystem']);
//* DEBUG: */ echo "</pre>";
//* DEBUG: */ die();
// Payback refback for refid and reduce it for current user
function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) {
//* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
- global $cacheArray;
-
// Back ref depths
- $cacheArray['depth'][$uid][$ref] = $GLOBALS['ref_level'];
+ $GLOBALS['cache_array']['depth'][$uid][$ref] = $GLOBALS['ref_level'];
// Init points
$return = $points;
SQL_FREERESULT($result_refs);
// Restore ref depth
- $GLOBALS['ref_level'] = $cacheArray['depth'][$uid][$ref];
+ $GLOBALS['ref_level'] = $GLOBALS['cache_array']['depth'][$uid][$ref];
// Return them
//* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
return $return;
}
+
// "Getter" for refback percents
function GET_REFBACK_PERCENTS ($uid, $ref) {
//* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
//* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
return $percents;
}
+
// "Getter" for userid array which will return only one entry
function GET_REFBACK_USERID_ARRAY ($rid, $level) {
//* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
//* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
return $userIds;
}
+
// Update "refback table"
function UPDATE_REFBACK_TABLE($uid) {
//* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
- global $cacheArray, $cacheInstance;
-
// Make it sure referal level zero (member him-/herself) is at least selected
- if (empty($cacheArray['back_level'])) $cacheArray['back_level'] = 1;
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$cacheArray['back_level']}<br />\n";
+ if (empty($GLOBALS['cache_array']['back_level'])) $GLOBALS['cache_array']['back_level'] = 1;
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$GLOBALS['cache_array']['back_level']}<br />\n";
// Init refid
- $cacheArray['up_refid'][$cacheArray['back_level']] = 0;
+ $GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']] = 0;
$old = 0; $minus = 0;
// Check for his referal
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):found=".SQL_NUMROWS($result_refid)."<br />\n";
if (SQL_NUMROWS($result_refid) > 0) {
// Load all refids
- while (list($cacheArray['up_refid'][$cacheArray['back_level']]) = SQL_FETCHROW($result_refid)) {
+ while (list($GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']]) = SQL_FETCHROW($result_refid)) {
// Remmber userid
- $cacheArray['up_userid'][$cacheArray['up_refid'][$cacheArray['back_level']]] = $uid;
+ $GLOBALS['cache_array']['up_userid'][$GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']]] = $uid;
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$cacheArray['up_refid'][$cacheArray['back_level']]}<br />\n";
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']]}<br />\n";
// Refid set?
- if (($cacheArray['up_refid'][$cacheArray['back_level']] > 0) && ($cacheArray['up_refid'][$cacheArray['back_level']] != $uid) && (isset($cacheArray['up_refid'][$cacheArray['back_level']]))) {
+ if (($GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']] > 0) && ($GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']] != $uid) && (isset($GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']]))) {
// New userid?
- if ((isset($cacheArray['up_refid'][$cacheArray['back_level']-1])) && (isset($cacheArray['up_userid'][$cacheArray['up_refid'][$cacheArray['back_level']-1]]))) {
+ if ((isset($GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']-1])) && (isset($GLOBALS['cache_array']['up_userid'][$GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']-1]]))) {
// New userid!
$old = $uid;
- $uid = $cacheArray['up_userid'][$cacheArray['up_refid'][$cacheArray['back_level']-1]];
+ $uid = $GLOBALS['cache_array']['up_userid'][$GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']-1]];
$minus = 1;
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},old={$old},level={$cacheArray['back_level']},ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - NEW UID!<br />\n";
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},old={$old},level={$GLOBALS['cache_array']['back_level']},ref={$GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']]} - NEW UID!<br />\n";
} // END - if
// Check existence
$result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_refs` WHERE userid=%s AND level='%s' AND refid=%s LIMIT 1",
- array(bigintval($uid), $cacheArray['back_level'], bigintval($cacheArray['up_refid'][$cacheArray['back_level']])), __FILE__, __LINE__);
+ array(bigintval($uid), $GLOBALS['cache_array']['back_level'], bigintval($GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']])), __FILE__, __LINE__);
// Do we have no entry?
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$cacheArray['back_level']},ref={$cacheArray['up_refid'][$cacheArray['back_level']]},minus={$minus},numRows=".SQL_NUMROWS($result)." - FOUND!<br />\n";
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$GLOBALS['cache_array']['back_level']},ref={$GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']]},minus={$minus},numRows=".SQL_NUMROWS($result)." - FOUND!<br />\n";
if (SQL_NUMROWS($result) == 0) {
// Insert this level
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$cacheArray['back_level']},ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - ADD!<br />\n";
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$GLOBALS['cache_array']['back_level']},ref={$GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']]} - ADD!<br />\n";
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_refs` (userid,level,refid) VALUES (%s,%s,%s)",
- array(bigintval($uid), $cacheArray['back_level'], bigintval($cacheArray['up_refid'][$cacheArray['back_level']])), __FILE__, __LINE__);
+ array(bigintval($uid), $GLOBALS['cache_array']['back_level'], bigintval($GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']])), __FILE__, __LINE__);
// Move to next referal level and count his counter one up!
- $cacheArray['back_level']++; UPDATE_REFBACK_TABLE($cacheArray['up_refid'][($cacheArray['back_level'] - 1)]);
+ $GLOBALS['cache_array']['back_level']++; UPDATE_REFBACK_TABLE($GLOBALS['cache_array']['up_refid'][($GLOBALS['cache_array']['back_level'] - 1)]);
} // END - if
// Do we have another level here?
- if ((($cacheArray['back_level']-$minus) > 0) && ($old > 0)) {
+ if ((($GLOBALS['cache_array']['back_level']-$minus) > 0) && ($old > 0)) {
// Restore old one
$uid = $old;
// Shall we add this as well?
$result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_refs` WHERE userid=%s AND level='%s' AND refid=%s LIMIT 1",
- array(bigintval($uid), ($cacheArray['back_level']-$minus), bigintval($cacheArray['up_refid'][$cacheArray['back_level']])), __FILE__, __LINE__);
+ array(bigintval($uid), ($GLOBALS['cache_array']['back_level']-$minus), bigintval($GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']])), __FILE__, __LINE__);
// Do we have no entry?
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level=".($cacheArray['back_level']-$minus).",ref={$cacheArray['up_refid'][$cacheArray['back_level']]},numRows=".SQL_NUMROWS($result)." - BACK!<br />\n";
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level=".($GLOBALS['cache_array']['back_level']-$minus).",ref={$GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']]},numRows=".SQL_NUMROWS($result)." - BACK!<br />\n";
if (SQL_NUMROWS($result) == 0) {
// Insert this level
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_refs` (userid,level,refid) VALUES (%s,%s,%s)",
- array(bigintval($uid), ($cacheArray['back_level']-$minus), bigintval($cacheArray['up_refid'][$cacheArray['back_level']])), __FILE__, __LINE__);
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level=".($cacheArray['back_level']-$minus).",ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - RETURNED!<br />\n";
+ array(bigintval($uid), ($GLOBALS['cache_array']['back_level']-$minus), bigintval($GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']])), __FILE__, __LINE__);
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level=".($GLOBALS['cache_array']['back_level']-$minus).",ref={$GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']]} - RETURNED!<br />\n";
} // END - if
} // END - if
} // END - if
} // END - if
// When he has a referal...
- if ((($cacheArray['up_refid'][$cacheArray['back_level']] == $uid) || ($cacheArray['up_refid'][$cacheArray['back_level']] == 0)) && (GET_EXT_VERSION("cache") >= "0.1.2") && (!isset($cacheArray['back_cached']))) {
+ if ((($GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']] == $uid) || ($GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']] == 0)) && (GET_EXT_VERSION("cache") >= "0.1.2") && (!isset($GLOBALS['cache_array']['back_cached']))) {
// Remove cache here
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - CACHE!<br />\n";
- if ($cacheInstance->loadCacheFile("refback")) $cacheInstance->destroyCacheFile();
- $cacheArray['back_cached'] = 1;
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']]} - CACHE!<br />\n";
+ if ($GLOBALS['cache_instance']->loadCacheFile("refback")) $GLOBALS['cache_instance']->destroyCacheFile();
+ $GLOBALS['cache_array']['back_cached'] = 1;
} // END - if
// "Walk" back here
- $cacheArray['back_level']--;
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$cacheArray['back_level']} - LEVEL!<br />\n";
+ $GLOBALS['cache_array']['back_level']--;
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$GLOBALS['cache_array']['back_level']} - LEVEL!<br />\n";
// Fix empty refid
- if (!isset($cacheArray['up_refid'][$cacheArray['back_level']-1])) $cacheArray['up_refid'][$cacheArray['back_level']-1] = 0;
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$cacheArray['back_level']},ref={$cacheArray['up_refid'][$cacheArray['back_level']-1]} - BACK!<br />\n";
+ if (!isset($GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']-1])) $GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']-1] = 0;
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$GLOBALS['cache_array']['back_level']},ref={$GLOBALS['cache_array']['up_refid'][$GLOBALS['cache_array']['back_level']-1]} - BACK!<br />\n";
//* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
}
+
// "Getter" for array for user refs in given level
function GET_USER_REFS ($uid, $level) {
//* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
//* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
return $refs;
}
+
// "Getter" for refback entry
function GET_USER_REF_ENTRY ($id) {
//* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
//* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
return $data;
}
+
// Update refback percents (but with some sanity-checks!
function REFBACK_CHANGE_MEMBER_PERCENTS ($id, $percents) {
//* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
// Default status is failed
- $status['message'] = MEMBER_REFBACK_ERROR_GENERAL;
+ $status['message'] = getMessage('MEMBER_REFBACK_ERROR_GENERAL');
// Do some sanity-checks
if (!IS_MEMBER()) {
// No member!
- $status['message'] = MEMBER_REFBACK_ERROR_NO_MEMBER;
+ $status['message'] = getMessage('MEMBER_REFBACK_ERROR_NO_MEMBER');
return $status;
} elseif ("".$id."" != "".($id + 0)."") {
// No number!
- $status['message'] = MEMBER_REFBACK_ERROR_INVALID_ID_NUMBER;
+ $status['message'] = getMessage('MEMBER_REFBACK_ERROR_INVALID_ID_NUMBER');
return $status;
} elseif (($percents < 0) || ($percents > 100)) {
// Percentage is not valid!
- $status['message'] = MEMBER_REFBACK_ERROR_INVALID_PERCENTAGE;
+ $status['message'] = getMessage('MEMBER_REFBACK_ERROR_INVALID_PERCENTAGE');
return $status;
}
// Is this valid?
if (count($dummy) == 0) {
// ID does not belong to user!
- $status['message'] = MEMBER_REFBACK_ERROR_ID_MISMATCH;
+ $status['message'] = getMessage('MEMBER_REFBACK_ERROR_ID_MISMATCH');
return $status;
} // END - if
// Entry updated?
if (SQL_AFFECTEDROWS() < 1) {
// Entry not updated!
- $status['message'] = MEMBER_REFBACK_ERROR_NOT_UPDATED;;
+ $status['message'] = getMessage('MEMBER_REFBACK_ERROR_NOT_UPDATED');
return $status;
} // END - if
$mail = LOAD_EMAIL_TEMPLATE("member_refback", $content, $GLOBALS['userid']);
// Send email to user
- SEND_EMAIL($dummy['refid'], MEMBER_REFBACK_SUBJECT, $mail);
+ SEND_EMAIL($dummy['refid'], getMessage('MEMBER_REFBACK_SUBJECT'), $mail);
// Send admin notification
- SEND_ADMIN_NOTIFICATION(ADMIN_REFBACK_SUBJECT, "admin_refback", $content, $GLOBALS['userid']);
+ SEND_ADMIN_NOTIFICATION(getMessage('ADMIN_REFBACK_SUBJECT'), "admin_refback", $content, $GLOBALS['userid']);
// All fine!
$status['ok'] = true;
// Get version from name
function THEME_GET_VERSION ($name) {
- global $cacheArray;
-
// Is the extension "theme" installed?
if (!EXT_IS_ACTIVE("theme")) {
// Then abort here
$cver = "?.?";
// Is the cache entry there?
- if (isset($cacheArray['themes']['theme_ver'][$name])) {
+ if (isset($GLOBALS['cache_array']['themes']['theme_ver'][$name])) {
// Get the version from cache
- $cver = $cacheArray['themes']['theme_ver'][$name];
+ $cver = $GLOBALS['cache_array']['themes']['theme_ver'][$name];
// Count up
incrementConfigEntry('cache_hits');
// Checks if a theme is active
function THEME_IS_ACTIVE ($name) {
- global $cacheArray;
-
// Is the extension "theme" installed?
if (!EXT_IS_ACTIVE("theme")) {
// Then abort here
$active = false;
// Is the cache entry there?
- if (isset($cacheArray['themes']['theme_active'][$name])) {
+ if (isset($GLOBALS['cache_array']['themes']['theme_active'][$name])) {
// Get the version from cache
- $active = ($cacheArray['themes']['theme_active'][$name] == "Y");
+ $active = ($GLOBALS['cache_array']['themes']['theme_active'][$name] == "Y");
// Count up
incrementConfigEntry('cache_hits');
// Gets current human-readable theme name
function GET_CURR_THEME_NAME () {
- global $cacheArray;
-
// Is the extension "theme" installed?
if (!EXT_IS_ACTIVE("theme")) {
// Then abort here
$name = GET_CURR_THEME();
// Is the cache entry there?
- if (isset($cacheArray['themes']['theme_name'][$name])) {
+ if (isset($GLOBALS['cache_array']['themes']['theme_name'][$name])) {
// Get the version from cache
- $name = $cacheArray['themes']['theme_name'][$name];
+ $name = $GLOBALS['cache_array']['themes']['theme_name'][$name];
// Count up
incrementConfigEntry('cache_hits');
$ADD = "";
// Init cache instance and array
-global $cacheInstance, $cacheArray;
-$cacheInstance = null;
-$cacheArray = array();
+$GLOBALS['cache_instance'] = null;
+$GLOBALS['cache_array'] = array();
// Skip loading extensions
if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing'))) return;
// Initialize array for "always keep active extensions"
-$cacheArray['active_extensions'] = array();
+$GLOBALS['cache_array']['active_extensions'] = array();
// By default no cache is set
-$cacheMode = "no";
+$GLOBALS['cacheMode'] = "no";
// Load sql_patchrs extension alone
LOAD_EXTENSION("sql_patches");
LOAD_EXTENSION("cache");
// Check extension cache
- switch (($cacheInstance->loadCacheFile("extensions", true)) && ($cacheInstance->extensionVersionMatches("sql_patches"))) {
- case true : $cacheMode = "load"; break;
- case false: $cacheMode = "init"; break;
+ switch (($GLOBALS['cache_instance']->loadCacheFile("extensions", true)) && ($GLOBALS['cache_instance']->extensionVersionMatches("sql_patches"))) {
+ case true : $GLOBALS['cacheMode'] = "load"; break;
+ case false: $GLOBALS['cacheMode'] = "init"; break;
}
// Do we need to init the cache?
- if (($cacheMode == "init") && (getConfig('cache_exts') == "Y")) {
+ if (($GLOBALS['cacheMode'] == "init") && (getConfig('cache_exts') == "Y")) {
// Init cache file
- $cacheInstance->init("EXTENSIONS");
- $cacheInstance->storeExtensionVersion("sql_patches");
+ $GLOBALS['cache_instance']->init("EXTENSIONS");
+ $GLOBALS['cache_instance']->storeExtensionVersion("sql_patches");
} elseif (getConfig('cache_exts') != "Y") {
// Cache will not be created for extensions
- $cacheMode = "skip";
+ $GLOBALS['cacheMode'] = "skip";
}
} // END - if
// Load cache?
-if ($cacheMode == "load") {
+if ($GLOBALS['cacheMode'] == "load") {
// Init include array
$EXT_POOL = array();
// Re-initialize handler
- $cacheInstance->loadCacheFile("extensions", true);
+ $GLOBALS['cache_instance']->loadCacheFile("extensions", true);
// Load extension data from cache file
- $EXT_DUMMY = $cacheInstance->getArrayFromCache();
+ $EXT_DUMMY = $GLOBALS['cache_instance']->getArrayFromCache();
// Is the cache file fine?
if (!isset($EXT_DUMMY['ext_name'])) {
// Cache file is damaged so kill it
- $cacheInstance->destroyCacheFile();
+ $GLOBALS['cache_instance']->destroyCacheFile();
// Retry it
LOAD_INC(__FILE__);
$EXT_DUMMY['ext_deprecated'][$name] = "N";
// Mark it as active extension
- $cacheArray['active_extensions']['$name'] = $EXT_DUMMY['ext_keep'][$k];
+ $GLOBALS['cache_array']['active_extensions']['$name'] = $EXT_DUMMY['ext_keep'][$k];
unset($EXT_DUMMY['ext_keep'][$k]);
// Remove unneccessary data from memory
// Loading cache is done so let's free some memory!
unset($EXT_DUMMY['ext_keep']);
unset($EXT_DUMMY['ext_css']);
- $cacheArray['extensions'] = $EXT_DUMMY;
+ $GLOBALS['cache_array']['extensions'] = $EXT_DUMMY;
unset($EXT_DUMMY);
// No database load needed
// If current user is not admin load only activated extensions. But load
// them all if we are going to init the cache files. The admin shall use
// every available extension for testing purposes.
- if ((!IS_ADMIN()) && ($cacheMode != "init")) $ADD = " WHERE ext_active='Y'";
+ if ((!IS_ADMIN()) && ($GLOBALS['cacheMode'] != "init")) $ADD = " WHERE ext_active='Y'";
if (GET_EXT_VERSION("sql_patches") >= "0.0.6") {
// Query with CSS file from DB
$DEL = array();
// At least one found?
-if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($cacheMode == "init") && ($CSS != "1") && ($CSS != "-1")) || ($cacheMode == "no"))) {
+if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($GLOBALS['cacheMode'] == "init") && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) || ($GLOBALS['cacheMode'] == "no"))) {
// Load session management
LOAD_INC_ONCE("inc/session.php");
// CSS file handling:
if ((!isset($content['ext_css'])) || ($content['ext_css'] == "Y")) {
// Create FQFN for the CSS file
- $CSS_FILE = sprintf("%stheme/%s/css/%s.css", constant('PATH'), GET_CURR_THEME(), $content['ext_name']);
+ $GLOBALS['output_mode']_FILE = sprintf("%stheme/%s/css/%s.css", constant('PATH'), GET_CURR_THEME(), $content['ext_name']);
// Is the file there?
- if (FILE_READABLE($CSS_FILE)) {
+ if (FILE_READABLE($GLOBALS['output_mode']_FILE)) {
// CSS file for extension was found (use only relative path for now!)
$EXT_CSS_FILES[] = $content['ext_name'].".css";
$content['ext_css'] = "Y";
} // END - if
// Shall we cache?
- if ($cacheMode == "init") {
+ if ($GLOBALS['cacheMode'] == "init") {
// Add cache row
- $cacheInstance->addRow($content);
- } elseif ($cacheMode == "no") {
+ $GLOBALS['cache_instance']->addRow($content);
+ } elseif ($GLOBALS['cacheMode'] == "no") {
// Remember this value for later usage
- $cacheArray['active_extensions'][$content['ext_name']] = $EXT_ALWAYS_ACTIVE;
+ $GLOBALS['cache_array']['active_extensions'][$content['ext_name']] = $EXT_ALWAYS_ACTIVE;
}
} elseif (!FILE_READABLE($FQFN)) {
// Deleted extension file so we mark it for removal from DB
// Init filter system
INIT_FILTER_SYSTEM();
- if ($cacheMode == "init") {
+ if ($GLOBALS['cacheMode'] == "init") {
// Close cache file
- $cacheInstance->finalize();
+ $GLOBALS['cache_instance']->finalize();
// Load more cache files (like admins)
LOAD_INC_ONCE("inc/load_cache.php");
require($INC);
} // END - if
-// Make cacheInstance global
-global $cacheInstance;
-
// Let's start with the admins table...
-if (($cacheInstance->loadCacheFile("admins")) && ($cacheInstance->extensionVersionMatches("admins"))) {
+if (($GLOBALS['cache_instance']->loadCacheFile("admins")) && ($GLOBALS['cache_instance']->extensionVersionMatches("admins"))) {
// Load cache
- global $cacheArray;
- $cacheArray['admins'] = $cacheInstance->getArrayFromCache();
+ $GLOBALS['cache_array']['admins'] = $GLOBALS['cache_instance']->getArrayFromCache();
// Check if valid
- if ((isset($cacheArray['admins']['login'])) && (is_array($cacheArray['admins']['login'])) && (is_array($cacheArray['admins']['aid']))) {
+ if ((isset($GLOBALS['cache_array']['admins']['login'])) && (is_array($GLOBALS['cache_array']['admins']['login'])) && (is_array($GLOBALS['cache_array']['admins']['aid']))) {
// Check count
- if (count($cacheArray['admins']['login']) == count($cacheArray['admins']['aid'])) {
+ if (count($GLOBALS['cache_array']['admins']['login']) == count($GLOBALS['cache_array']['admins']['aid'])) {
// Get "id map"
- $idMap = $cacheArray['admins']['aid'];
+ $idMap = $GLOBALS['cache_array']['admins']['aid'];
// Rewrite the cache array
for ($idx = (count($idMap) - 1); $idx >= 0; $idx--) {
// Rewrite all entries
- foreach ($cacheArray['admins'] as $key=>$entryArray) {
+ foreach ($GLOBALS['cache_array']['admins'] as $key=>$entryArray) {
// Rewrite the entry
if ($key == "aid") {
// Rewrite admin id (use login name as index)
- $cacheArray['admins']['aid'][$cacheArray['admins']['login'][$idx]] = $entryArray[$idx];
+ $GLOBALS['cache_array']['admins']['aid'][$GLOBALS['cache_array']['admins']['login'][$idx]] = $entryArray[$idx];
} else {
// Rewrite regular entry
- $cacheArray['admins'][$key][$idMap[$idx]] = $entryArray[$idx];
+ $GLOBALS['cache_array']['admins'][$key][$idMap[$idx]] = $entryArray[$idx];
}
// Is the last entry reached?
if ($idx == 0) {
// Remove it
- unset($cacheArray['admins'][$key][0]);
+ unset($GLOBALS['cache_array']['admins'][$key][0]);
} // END - if
} // END - if
} // END - for
} else {
// Nope, cache file is corrupted!
- $cacheInstance->destroyCacheFile();
- unset($cacheArray['admins']);
+ $GLOBALS['cache_instance']->destroyCacheFile();
+ unset($GLOBALS['cache_array']['admins']);
}
} else {
// Nope, cache file is corrupted!
- $cacheInstance->destroyCacheFile();
- unset($cacheArray['admins']);
+ $GLOBALS['cache_instance']->destroyCacheFile();
+ unset($GLOBALS['cache_array']['admins']);
}
-} elseif ((getConfig('cache_admins') == "Y") && ($CSS != "1") && ($CSS != "-1")) {
+} elseif ((getConfig('cache_admins') == "Y") && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
// Create cache file
- $cacheInstance->init("ADMINS");
- $cacheInstance->storeExtensionVersion("admins");
+ $GLOBALS['cache_instance']->init("ADMINS");
+ $GLOBALS['cache_instance']->storeExtensionVersion("admins");
// Load every data from DB to cache file
$ADD = RUN_FILTER('sql_admin_extra_data');
ORDER BY login", __FILE__, __LINE__);
while($dummy = SQL_FETCHARRAY($result_admins)) {
// Save row
- $cacheInstance->addRow($dummy);
+ $GLOBALS['cache_instance']->addRow($dummy);
} // END - while
// Free memory
SQL_FREERESULT($result_admins);
// Close cache
- $cacheInstance->finalize();
+ $GLOBALS['cache_instance']->finalize();
// Reload the cache
LOAD_INC(__FILE__);
// Next cached table are the admins_acls...
if (GET_EXT_VERSION("admins") >= "0.3") {
// Check for cache file
- if (($cacheInstance->loadCacheFile("admins_acls")) && ($cacheInstance->extensionVersionMatches("admins"))) {
+ if (($GLOBALS['cache_instance']->loadCacheFile("admins_acls")) && ($GLOBALS['cache_instance']->extensionVersionMatches("admins"))) {
// Load referal system from cache
- global $cacheArray;
- $cacheArray['admin_acls'] = $cacheInstance->getArrayFromCache();
- } elseif ((getConfig('cache_acls') == "Y") && ($CSS != "1") && ($CSS != "-1")) {
+ global $GLOBALS['cache_array'];
+ $GLOBALS['cache_array']['admin_acls'] = $GLOBALS['cache_instance']->getArrayFromCache();
+ } elseif ((getConfig('cache_acls') == "Y") && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
// Create cache file here
- $cacheInstance->init("ADMINS_ACLS");
- $cacheInstance->storeExtensionVersion("admins");
+ $GLOBALS['cache_instance']->init("ADMINS_ACLS");
+ $GLOBALS['cache_instance']->storeExtensionVersion("admins");
// Load all modules and their data
$result = SQL_QUERY("SELECT id, admin_id, action_menu, what_menu, access_mode FROM `{!_MYSQL_PREFIX!}_admins_acls` ORDER BY admin_id, action_menu, what_menu", __FILE__, __LINE__);
// Add all rows
while ($data = SQL_FETCHARRAY($result)) {
// Add row to cache file
- $cacheInstance->addRow($data);
+ $GLOBALS['cache_instance']->addRow($data);
} // END - while
// Free memory
SQL_FREERESULT($result);
// Close cache
- $cacheInstance->finalize();
+ $GLOBALS['cache_instance']->finalize();
// Reload the cache
LOAD_INC(__FILE__);
require($INC);
}
-// Make cacheInstance global
-global $cacheInstance;
-
// Next cached table is the configuration (config)...
-if (($cacheInstance->loadCacheFile("config", true)) && ($cacheInstance->extensionVersionMatches("sql_patches"))) {
+if (($GLOBALS['cache_instance']->loadCacheFile("config", true)) && ($GLOBALS['cache_instance']->extensionVersionMatches("sql_patches"))) {
// Load config from cache
- global $cacheArray;
- $cacheArray['config'] = $cacheInstance->getArrayFromCache();
+ $GLOBALS['cache_array']['config'] = $GLOBALS['cache_instance']->getArrayFromCache();
// @TODO: Do we really need to cache the config???
-} elseif ((getConfig('cache_config') == "Y") && ($CSS != "1") && ($CSS != "-1")) {
+} elseif ((getConfig('cache_config') == "Y") && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
// Create cache file here
- $cacheInstance->init("CONFIG");
- $cacheInstance->storeExtensionVersion("sql_patches");
+ $GLOBALS['cache_instance']->init("CONFIG");
+ $GLOBALS['cache_instance']->storeExtensionVersion("sql_patches");
// Load all modules and their data
$result = SQL_QUERY("SELECT * FROM `{!_MYSQL_PREFIX!}_config` ORDER BY config ASC", __FILE__, __LINE__);
while ($data = SQL_FETCHARRAY($result)) {
// Add row to cache file
- $cacheInstance->addRow($data);
+ $GLOBALS['cache_instance']->addRow($data);
} // END - while
// Free memory
SQL_FREERESULT($result);
// Close the cache
- $cacheInstance->finalize();
+ $GLOBALS['cache_instance']->finalize();
// Reload the cache
LOAD_INC(__FILE__);
require($INC);
}
-// Make cacheInstance global
-global $cacheInstance;
-
// Next cached table is the module registry (mod_reg)...
-if (($cacheInstance->loadCacheFile("mod_reg")) && ($cacheInstance->extensionVersionMatches("sql_patches"))) {
+if (($GLOBALS['cache_instance']->loadCacheFile("mod_reg")) && ($GLOBALS['cache_instance']->extensionVersionMatches("sql_patches"))) {
// Load cache
- global $cacheArray;
- $cacheArray['modules'] = $cacheInstance->getArrayFromCache();
+ $GLOBALS['cache_array']['modules'] = $GLOBALS['cache_instance']->getArrayFromCache();
// Rewrite module cache
- $modArray = $cacheArray['modules'];
+ $modArray = $GLOBALS['cache_array']['modules'];
foreach ($modArray['module'] as $key => $mod) {
- $cacheArray['modules']['id'][$mod] = $modArray['id'][$key];
- unset($cacheArray['modules']['id'][$key]);
- $cacheArray['modules']['title'][$mod] = $modArray['title'][$key];
- unset($cacheArray['modules']['title'][$key]);
- $cacheArray['modules']['locked'][$mod] = $modArray['locked'][$key];
- unset($cacheArray['modules']['locked'][$key]);
- $cacheArray['modules']['hidden'][$mod] = $modArray['hidden'][$key];
- unset($cacheArray['modules']['hidden'][$key]);
- $cacheArray['modules']['admin_only'][$mod] = $modArray['admin_only'][$key];
- unset($cacheArray['modules']['admin_only'][$key]);
- $cacheArray['modules']['mem_only'][$mod] = $modArray['mem_only'][$key];
- unset($cacheArray['modules']['mem_only'][$key]);
- if (isset($cacheArray['modules']['has_menu'][$key])) {
- $cacheArray['modules']['has_menu'][$mod] = $modArray['has_menu'][$key];
- unset($cacheArray['modules']['has_menu'][$key]);
+ $GLOBALS['cache_array']['modules']['id'][$mod] = $modArray['id'][$key];
+ unset($GLOBALS['cache_array']['modules']['id'][$key]);
+ $GLOBALS['cache_array']['modules']['title'][$mod] = $modArray['title'][$key];
+ unset($GLOBALS['cache_array']['modules']['title'][$key]);
+ $GLOBALS['cache_array']['modules']['locked'][$mod] = $modArray['locked'][$key];
+ unset($GLOBALS['cache_array']['modules']['locked'][$key]);
+ $GLOBALS['cache_array']['modules']['hidden'][$mod] = $modArray['hidden'][$key];
+ unset($GLOBALS['cache_array']['modules']['hidden'][$key]);
+ $GLOBALS['cache_array']['modules']['admin_only'][$mod] = $modArray['admin_only'][$key];
+ unset($GLOBALS['cache_array']['modules']['admin_only'][$key]);
+ $GLOBALS['cache_array']['modules']['mem_only'][$mod] = $modArray['mem_only'][$key];
+ unset($GLOBALS['cache_array']['modules']['mem_only'][$key]);
+ if (isset($GLOBALS['cache_array']['modules']['has_menu'][$key])) {
+ $GLOBALS['cache_array']['modules']['has_menu'][$mod] = $modArray['has_menu'][$key];
+ unset($GLOBALS['cache_array']['modules']['has_menu'][$key]);
} // END - if
} // END - foreach
unset($modArray);
-} elseif ((getConfig('cache_modreg') == "Y") && ($CSS != "1") && ($CSS != "-1")) {
+} elseif ((getConfig('cache_modreg') == "Y") && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
// Create cache file here
- $cacheInstance->init("MODULES");
- $cacheInstance->storeExtensionVersion("sql_patches");
+ $GLOBALS['cache_instance']->init("MODULES");
+ $GLOBALS['cache_instance']->storeExtensionVersion("sql_patches");
// Load all modules and their data
if (GET_EXT_VERSION("sql_patches") >= "0.3.6") {
// Cache all data
while ($data = SQL_FETCHARRAY($result)) {
// Add row to cache file
- $cacheInstance->addRow($data);
+ $GLOBALS['cache_instance']->addRow($data);
} // END - while
// Free memory
SQL_FREERESULT($result);
// Close the cache
- $cacheInstance->finalize();
+ $GLOBALS['cache_instance']->finalize();
// Reload the cache
LOAD_INC(__FILE__);
require($INC);
}
-// Make cacheInstance global
-global $cacheInstance;
-
// Next cached table is the referal system (refdepths)...
-if (($cacheInstance->loadCacheFile("refdepths")) && ($cacheInstance->extensionVersionMatches("sql_patches"))) {
+if (($GLOBALS['cache_instance']->loadCacheFile("refdepths")) && ($GLOBALS['cache_instance']->extensionVersionMatches("sql_patches"))) {
// Load referal system from cache
- global $cacheArray;
- $cacheArray['ref_depths'] = $cacheInstance->getArrayFromCache();
-} elseif ((getConfig('cache_refdepth') == "Y") && ($CSS != "1") && ($CSS != "-1")) {
+ $GLOBALS['cache_array']['ref_depths'] = $GLOBALS['cache_instance']->getArrayFromCache();
+} elseif ((getConfig('cache_refdepth') == "Y") && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
// Create cache file here
- $cacheInstance->init("REFDEPTHS");
- $cacheInstance->storeExtensionVersion("sql_patches");
+ $GLOBALS['cache_instance']->init("REFDEPTHS");
+ $GLOBALS['cache_instance']->storeExtensionVersion("sql_patches");
// Load all modules and their data
$result = SQL_QUERY("SELECT id, level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` ORDER BY level", __FILE__, __LINE__);
while ($data = SQL_FETCHARRAY($result)) {
// Add row to cache file
- $cacheInstance->addRow($data);
+ $GLOBALS['cache_instance']->addRow($data);
} // END - while
// Free memory
SQL_FREERESULT($result);
// Close the cache
- $cacheInstance->finalize();
+ $GLOBALS['cache_instance']->finalize();
// Reload the cache
LOAD_INC(__FILE__);
require($INC);
}
-// Make cacheInstance global
-global $cacheInstance;
-
// Next cached table is the referal system (refsystem)...
-if (($cacheInstance->loadCacheFile("refsystem")) && ($cacheInstance->extensionVersionMatches("sql_patches"))) {
+if (($GLOBALS['cache_instance']->loadCacheFile("refsystem")) && ($GLOBALS['cache_instance']->extensionVersionMatches("sql_patches"))) {
// Load referal system from cache
- global $cacheArray;
- $cacheArray['refsystem'] = $cacheInstance->getArrayFromCache();
-} elseif ((getConfig('cache_refsys') == "Y") && ($CSS != "1") && ($CSS != "-1")) {
+ $GLOBALS['cache_array']['refsystem'] = $GLOBALS['cache_instance']->getArrayFromCache();
+} elseif ((getConfig('cache_refsys') == "Y") && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
// Create cache file here
- $cacheInstance->init("REFSYSTEM");
- $cacheInstance->storeExtensionVersion("sql_patches");
+ $GLOBALS['cache_instance']->init("REFSYSTEM");
+ $GLOBALS['cache_instance']->storeExtensionVersion("sql_patches");
// Load all modules and their data
$result = SQL_QUERY("SELECT id, userid, level, counter FROM `{!_MYSQL_PREFIX!}_refsystem` ORDER BY userid, level", __FILE__, __LINE__);
while ($data = SQL_FETCHARRAY($result)) {
// Add row to cache file
- $cacheInstance->addRow($data);
+ $GLOBALS['cache_instance']->addRow($data);
} // END - while
// Free memory
SQL_FREERESULT($result);
// Close the cache
- $cacheInstance->finalize();
+ $GLOBALS['cache_instance']->finalize();
// Reload the cache
LOAD_INC(__FILE__);
return false;
}
-// Make cacheInstance global
-global $cacheInstance;
-
// Next cached table is the referal system (themes)...
-if (($cacheInstance->loadCacheFile("themes")) && ($cacheInstance->extensionVersionMatches("theme"))) {
+if (($GLOBALS['cache_instance']->loadCacheFile("themes")) && ($GLOBALS['cache_instance']->extensionVersionMatches("theme"))) {
// Load referal system from cache
- global $cacheArray;
- $cache = $cacheInstance->getArrayFromCache();
+ $cache = $GLOBALS['cache_instance']->getArrayFromCache();
// Restructure the array
- $cacheArray['themes'] = array();
+ $GLOBALS['cache_array']['themes'] = array();
foreach ($cache as $key => $data) {
// Skip "theme_path" because we don't need to rebuild it
if ($key == "theme_path") {
// Add entries with id
foreach ($data as $id => $entry) {
- $cacheArray['themes']['theme_path'][$cache['id'][$id]] = $entry;
+ $GLOBALS['cache_array']['themes']['theme_path'][$cache['id'][$id]] = $entry;
} // END - foreach
} else {
// Add all themes with theme name as array index
foreach ($data as $id => $entry) {
- $cacheArray['themes'][$key][$cache['theme_path'][$id]] = $entry;
+ $GLOBALS['cache_array']['themes'][$key][$cache['theme_path'][$id]] = $entry;
} // END - foreach
}
} // END - if
// Remove dummy array
unset($cache);
-} elseif ((getConfig('cache_themes') == "Y") && ($CSS != "1") && ($CSS != "-1")) {
+} elseif ((getConfig('cache_themes') == "Y") && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
// Create cache file here
- $cacheInstance->init("THEMES");
- $cacheInstance->storeExtensionVersion("theme");
+ $GLOBALS['cache_instance']->init("THEMES");
+ $GLOBALS['cache_instance']->storeExtensionVersion("theme");
// Load all themes and their data
if (GET_EXT_VERSION("theme") >= "0.0.7") {
}
while ($data = SQL_FETCHARRAY($result)) {
// Add row to cache file
- $cacheInstance->addRow($data);
+ $GLOBALS['cache_instance']->addRow($data);
} // END - while
// Free memory
SQL_FREERESULT($result);
// Close the cache
- $cacheInstance->finalize();
+ $GLOBALS['cache_instance']->finalize();
// Reload the cache
LOAD_INC(__FILE__);
}
// Do not execute when script is in CSS mode
-global $CSS;
-if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
//
?>
}
// Do not execute when script is in CSS mode
-global $CSS;
-if ($CSS == 1) return;
+if ($GLOBALS['output_mode'] == 1) return;
// Create timemark from saved month
$mark = mktime(0, 0, 0, getConfig('last_month'), date("d", time()), date('Y', time()));
}
// Do not execute when script is in CSS mode
-global $CSS;
-if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
// Get current day (01 to 31), month (01 to 12) and year (4-digits year)
$DAY = date("d", time());
}
// Do not execute when script is in CSS mode
-global $CSS;
-if ($CSS == 1) return;
+if ($GLOBALS['output_mode'] == 1) return;
// Create timemark from saved month
$mark = mktime(0, 0, 0, getConfig('last_month'), date("d", time()), date('Y', time()));
}
// Only be executed on login procedure!
function CHECK_ADMIN_LOGIN ($admin_login, $password) {
- global $cacheArray, $cacheInstance;
-
// By default no admin is found
$ret = "404";
$data = array('aid' => $aid);
// Is the cache valid?
- if (isset($cacheArray['admins']['password'][$aid])) {
+ if (isset($GLOBALS['cache_array']['admins']['password'][$aid])) {
// Get password from cache
- $data['password'] = $cacheArray['admins']['password'][$aid];
+ $data['password'] = $GLOBALS['cache_array']['admins']['password'][$aid];
$ret = "pass";
incrementConfigEntry('cache_hits');
// Include more admins data?
if (GET_EXT_VERSION("admins") >= "0.7.0") {
// Load them here
- $data['login_failures'] = $cacheArray['admins']['login_failures'][$aid];
- $data['last_failure'] = $cacheArray['admins']['last_failure'][$aid];
+ $data['login_failures'] = $GLOBALS['cache_array']['admins']['login_failures'][$aid];
+ $data['last_failure'] = $GLOBALS['cache_array']['admins']['last_failure'][$aid];
} // END - if
} elseif (!EXT_IS_ACTIVE("cache")) {
// Add extra data via filter now
// Try to login the admin by setting some session/cookie variables
function LOGIN_ADMIN ($adminLogin, $passHash) {
- global $cacheInstance;
-
// Reset failure counter on matching admins version
if ((GET_EXT_VERSION("admins") >= "0.7.0") && ((EXT_VERSION_IS_OLDER("sql_patches", "0.3.6")) || (GET_EXT_VERSION("sql_patches") == ""))) {
// Reset counter on out-dated sql_patches version
// Only be executed on cookie checking
function CHECK_ADMIN_COOKIES ($admin_login, $password) {
- global $cacheArray;
+ // By default no admin cookies are found
$ret = "404"; $pass = "";
// Get hash
//
function ADMIN_DO_ACTION($wht) {
- global $menuDesription, $menuTitle, $cacheArray, $DATA;
-
+ global $menuDesription, $menuTitle, $DATA;
//* DEBUG: */ echo __LINE__."*".$wht."/".$GLOBALS['module']."/".$GLOBALS['action']."/".$GLOBALS['what']."*<br />\n";
- if (EXT_IS_ACTIVE("cache")) {
- // Include cache instance
- global $cacheInstance;
- }
// Remove any spaces from variable
if (empty($wht)) {
}
//
function ADD_ADMIN_MENU($act, $wht, $return=false) {
- global $menuDesription, $menuTitle, $cacheInstance;
+ global $menuDesription, $menuTitle;
// Init variables
$SUB = false;
$menuTitle = array();
// Is there a cache instance?
- if ((is_object($cacheInstance)) && (getConfig('cache_admin_menu') == "Y")) {
+ if ((is_object($GLOBALS['cache_instance'])) && (getConfig('cache_admin_menu') == "Y")) {
// Create cache name
$cacheName = "admin_".$act."_".$wht."_".GET_LANGUAGE()."_".strtolower(get_session('admin_login'));
// Is that cache there?
- if ($cacheInstance->loadCacheFile($cacheName)) {
+ if ($GLOBALS['cache_instance']->loadCacheFile($cacheName)) {
// Then load it
- $data = $cacheInstance->getArrayFromCache();
+ $data = $GLOBALS['cache_instance']->getArrayFromCache();
// Extract all parts
$OUT = base64_decode($data['output'][0]);
eval($eval);
// Is there a cache instance again?
- if ((is_object($cacheInstance)) && (getConfig('cache_admin_menu') == "Y")) {
+ if ((is_object($GLOBALS['cache_instance'])) && (getConfig('cache_admin_menu') == "Y")) {
// Init cache
- $cacheInstance->init($cacheName);
+ $GLOBALS['cache_instance']->init($cacheName);
// Prepare cache data
$data = array(
);
// Write the data away
- $cacheInstance->addRow($data);
+ $GLOBALS['cache_instance']->addRow($data);
// Close cache
- $cacheInstance->finalize();
+ $GLOBALS['cache_instance']->finalize();
} // END - if
// Return or output content?
// Save settings to the database
function ADMIN_SAVE_SETTINGS (&$POST, $tableName="_config", $whereStatement="config=0", $translateComma=array(), $alwaysAdd=false) {
- global $cacheArray, $cacheInstance;
-
// Prepare all arrays, variables
$DATA = array();
$skip = false;
// Check "logical-area-mode"
function ADMIN_CHECK_MENU_MODE () {
- global $cacheArray;
-
// Set the global mode as the mode for all admins
$MODE = getConfig('admin_menu');
$ADMIN = $MODE;
$aid = GET_CURRENT_ADMIN_ID();
// Check individual settings of current admin
- if (isset($cacheArray['admins']['la_mode'][$aid])) {
+ if (isset($GLOBALS['cache_array']['admins']['la_mode'][$aid])) {
// Load from cache
- $ADMIN = $cacheArray['admins']['la_mode'][$aid];
+ $ADMIN = $GLOBALS['cache_array']['admins']['la_mode'][$aid];
incrementConfigEntry('cache_hits');
} elseif (GET_EXT_VERSION("admins") >= "0.6.7") {
// Load from database when version of "admins" is enough
}
function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) {
- global $cacheArray;
-
// First check for solved and not assigned tasks and assign them to current admin
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET assigned_admin='%s' WHERE assigned_admin < 1 AND status != 'NEW'",
array(GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
EXTENSION_UPDATE($ext_name, $ext_ver);
} // END - if
- if (isset($cacheArray['active_extensions'][$ext_name])) {
+ if (isset($GLOBALS['cache_array']['active_extensions'][$ext_name])) {
// Maybe we want to keept the current extension active?
- if (($cacheArray['active_extensions'][$ext_name] == "Y") && (!EXT_IS_ACTIVE($ext_name))) {
+ if (($GLOBALS['cache_array']['active_extensions'][$ext_name] == "Y") && (!EXT_IS_ACTIVE($ext_name))) {
// Reactivate this extension!
ACTIVATE_EXTENSION($ext_name);
} // END - if
// Add description as navigation point
ADD_DESCR("admin", __FILE__);
-global $cacheInstance;
-
// Display form is default
$FORM = true;
// Add description as navigation point
ADD_DESCR("admin", __FILE__);
-// Instance for the cache extension
-global $cacheInstance;
-
// Set selection data to empty array when it is empty
if (empty($_POST['sel'])) $_POST['sel'] = array();
if ($SEL > 0)
{
// Add option for events
- $cacheArray['admins'] = ADD_OPTION_LINES("admins", "id", "login", "", "email");
+ $GLOBALS['cache_array']['admins'] = ADD_OPTION_LINES("admins", "id", "login", "", "email");
$SW = 2; $rowNameS = "";
foreach ($_POST['sel'] as $template => $sel) {
// First of all load data from DB
'id' => $id,
'id2' => $id2,
'tpl' => $template,
- 'admins' => $cacheArray['admins']
+ 'admins' => $GLOBALS['cache_array']['admins']
);
if ($aid2 > 0)
// Update cache when installed
if (EXT_IS_ACTIVE("cache")) {
- if ($cacheInstance->loadCacheFile("admins_acls")) $cacheInstance->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("admins_acls")) $GLOBALS['cache_instance']->destroyCacheFile();
// Purge menu cache
CACHE_PURGE_ADMIN_MENU($_POST['admin'][$id]);
// Update cache when installed
if (EXT_IS_ACTIVE("cache")) {
- if ($cacheInstance->loadCacheFile("admins_acls")) $cacheInstance->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("admins_acls")) $GLOBALS['cache_instance']->destroyCacheFile();
// @TODO This causes the whole (!) menu cache being rebuild
CACHE_PURGE_ADMIN_MENU();
// Update cache when installed
if (EXT_IS_ACTIVE("cache")) {
- if ($cacheInstance->loadCacheFile("admins_acls")) $cacheInstance->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("admins_acls")) $GLOBALS['cache_instance']->destroyCacheFile();
// Purge cache
CACHE_PURGE_ADMIN_MENU($_POST['admin_id'], $_POST['action_menu'], $_POST['what_menu']);
}
// Delete deactivated cache files
- if (($_POST['cache_admins'] == "N") && ($cacheInstance->loadCacheFile("admins"))) {
- $cacheInstance->destroyCacheFile();
+ if (($_POST['cache_admins'] == "N") && ($GLOBALS['cache_instance']->loadCacheFile("admins"))) {
+ $GLOBALS['cache_instance']->destroyCacheFile();
}
- if (($_POST['cache_acls'] == "N") && ($cacheInstance->loadCacheFile("acls"))) {
- $cacheInstance->destroyCacheFile();
+ if (($_POST['cache_acls'] == "N") && ($GLOBALS['cache_instance']->loadCacheFile("acls"))) {
+ $GLOBALS['cache_instance']->destroyCacheFile();
}
- if (($_POST['cache_exts'] == "N") && ($cacheInstance->loadCacheFile("extensions", true))) {
- $cacheInstance->destroyCacheFile();
+ if (($_POST['cache_exts'] == "N") && ($GLOBALS['cache_instance']->loadCacheFile("extensions", true))) {
+ $GLOBALS['cache_instance']->destroyCacheFile();
}
- if (($_POST['cache_config'] == "N") && ($cacheInstance->loadCacheFile("config"))) {
- $cacheInstance->destroyCacheFile();
+ if (($_POST['cache_config'] == "N") && ($GLOBALS['cache_instance']->loadCacheFile("config"))) {
+ $GLOBALS['cache_instance']->destroyCacheFile();
}
- if (($_POST['cache_modreg'] == "N") && ($cacheInstance->loadCacheFile("modreg"))) {
- $cacheInstance->destroyCacheFile();
+ if (($_POST['cache_modreg'] == "N") && ($GLOBALS['cache_instance']->loadCacheFile("modreg"))) {
+ $GLOBALS['cache_instance']->destroyCacheFile();
}
- if (($_POST['cache_refdepth'] == "N") && ($cacheInstance->loadCacheFile("refdepth"))) {
- $cacheInstance->destroyCacheFile();
+ if (($_POST['cache_refdepth'] == "N") && ($GLOBALS['cache_instance']->loadCacheFile("refdepth"))) {
+ $GLOBALS['cache_instance']->destroyCacheFile();
}
- if (($_POST['cache_refsys'] == "N") && ($cacheInstance->loadCacheFile("refsys"))) {
- $cacheInstance->destroyCacheFile();
+ if (($_POST['cache_refsys'] == "N") && ($GLOBALS['cache_instance']->loadCacheFile("refsys"))) {
+ $GLOBALS['cache_instance']->destroyCacheFile();
}
// Save configuration
// Remove cache file if version matches
if (GET_EXT_VERSION("cache") >= "0.1.2") {
- if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("mod_reg")) $GLOBALS['cache_instance']->destroyCacheFile();
}
// Entries updated
// Update cache file
if (GET_EXT_VERSION("cache") >= "0.1.2") {
- if ($cacheInstance->loadCacheFile("refdepths")) $cacheInstance->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("refdepths")) $GLOBALS['cache_instance']->destroyCacheFile();
}
break;
// Add description as navigation point
ADD_DESCR("admin", __FILE__);
-global $cacheInstance, $cacheArray, $cacheMode;
-
// Normally we want the overview of all registered extensions
$do = "overview";
$SEL = 0;
// De-/activate extensions
foreach ($_POST['sel'] as $ext_id => $active) {
// Shall we keep the extension always active?
- if ((isset($cacheArray['active_extensions'][GET_EXT_NAME($ext_id)])) && ($cacheArray['active_extensions'][GET_EXT_NAME($ext_id)] == "Y") && ($active == "N")) {
+ if ((isset($GLOBALS['cache_array']['active_extensions'][GET_EXT_NAME($ext_id)])) && ($GLOBALS['cache_array']['active_extensions'][GET_EXT_NAME($ext_id)] == "Y") && ($active == "N")) {
// Keep this extension active!
} else {
// De/activate extension
}
// Output row
- $CSS = "---";
- if (GET_EXT_VERSION("sql_patches") >= "0.0.6") $CSS = ADD_SELECTION("yn", $css, "css", $ext_id);
+ $cssSelection = "---";
+ if (GET_EXT_VERSION("sql_patches") >= "0.0.6") $cssSelection = ADD_SELECTION("yn", $css, "css", $ext_id);
// Prepare data for the row template
$content = array(
'id' => $ext_id,
'name' => $name,
'active' => ADD_SELECTION("yn", $active, "active", $ext_id),
- 'css' => $CSS,
+ 'css' => $cssSelection,
);
// Load row template and switch color
// Extensions are registered
$SW = 2; $OUT = "";
while ($content = SQL_FETCHARRAY($result)) {
- $CSS = "---";
- if (GET_EXT_VERSION("sql_patches") >= "0.0.6") $CSS = TRANSLATE_YESNO($content['ext_css']);
+ // Prepare CSS selection output
+ $cssSelection = "---";
+ if (GET_EXT_VERSION("sql_patches") >= "0.0.6") $cssSelection = TRANSLATE_YESNO($content['ext_css']);
// Prepare data for the row template
$content = array(
'name' => $content['ext_name'],
'active' => TRANSLATE_YESNO($content['ext_active']),
'act_val' => $content['ext_active'],
- 'css' => $CSS,
+ 'css' => $cssSelection,
'ver' => $content['ext_version'],
);
}
// Do we need to update cache file?
- if ((EXT_IS_ACTIVE("cache")) && ($cacheMode != "no")) {
+ if ((EXT_IS_ACTIVE("cache")) && ($GLOBALS['cacheMode'] != "no")) {
// Remove cache file (will be auto-created again!)
- if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("config")) $GLOBALS['cache_instance']->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("extensions", true)) $GLOBALS['cache_instance']->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("mod_reg")) $GLOBALS['cache_instance']->destroyCacheFile();
} // END - if
} elseif (GET_EXT_VERSION($ext_name) != "") {
// Notify the admin that we have a problem here...
// Add description as navigation point
ADD_DESCR("admin", __FILE__);
-global $cacheInstance, $cacheArray, $cacheMode;
-
// Normally we want the overview of all registered theme_check
$mode = "overview";
$SEL = 0;
}
// Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (!defined('__DAILY_RESET')) || (getConfig('beg_rallye') != "Y")) return;
+if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET')) || (getConfig('beg_rallye') != "Y")) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Get current month (2 digits)
$curr = date("m", time());
// Check if month is done
-if (($curr != getConfig('last_month')) && (getConfig('last_month') > 0) && (getConfig('beg_ranks') > 0) && ($CSS != 1)) {
+if (($curr != getConfig('last_month')) && (getConfig('last_month') > 0) && (getConfig('beg_ranks') > 0) && ($GLOBALS['output_mode'] != 1)) {
// Extension "autopurge" is inactive or purging of inactive accounts is deactivated
$whereStatement1 = "";
$whereStatement2 = bigintval(getConfig('beg_ranks'));
}
// Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Get current month (2 digits)
$curr = date("m", time());
-if (($curr != getConfig('last_month')) && (getConfig('bonus_ranks') > 0) && ($CSS != 1)) {
+if (($curr != getConfig('last_month')) && (getConfig('bonus_ranks') > 0) && ($GLOBALS['output_mode'] != 1)) {
// Extension "autopurge" is inactive or purging of inactive accounts is deactivated
$whereStatement1 = "WHERE `status`='CONFIRMED'";
$whereStatement2 = bigintval(getConfig('bonus_ranks'));
}
// Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Get current month (2 digits)
}
// Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Reset surfbar counter
'last_update' => time()
);
-// Init important $header variable
-global $header;
-$header = 0;
+// Set important header_sent
+$GLOBALS['header_sent'] = 0;
// Init fatal messages
global $FATAL;
//* DEBUG: */ die();
// Get all values
- if (($CSS != 1) && ($CSS != -1)) {
+ if (($GLOBALS['output_mode'] != 1) && ($GLOBALS['output_mode'] != -1)) {
if (empty($GLOBALS['module'])) $GLOBALS['module'] = "empty";
if (empty($GLOBALS['what'])) $GLOBALS['what'] = GET_WHAT($GLOBALS['module']);
if (empty($GLOBALS['action'])) $GLOBALS['action'] = GET_ACTION($GLOBALS['module'], $GLOBALS['what']);
// Set default 'what' value
//* DEBUG: */ OUTPUT_HTML("-".$GLOBALS['module']."/".$GLOBALS['what']."-<br />");
- if ((empty($GLOBALS['what'])) && (empty($GLOBALS['action'])) && ($CSS != 1) && ($CSS != -1)) {
+ if ((empty($GLOBALS['what'])) && (empty($GLOBALS['action'])) && ($GLOBALS['output_mode'] != 1) && ($GLOBALS['output_mode'] != -1)) {
if ($GLOBALS['module'] == "admin") {
// Set 'action' value to 'login' in admin menu
$GLOBALS['action'] = GET_ACTION($GLOBALS['module'], $GLOBALS['what']);
} // END - if
// Update sending pool
- if (($CSS != "1") && ($CSS != "-1")) LOAD_INC_ONCE("inc/pool-update.php"); // Sends out mails in configureable steps
+ if (($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) LOAD_INC_ONCE("inc/pool-update.php"); // Sends out mails in configureable steps
// Load all active extension including language files when not upgrading.
// Check module for testing and count one click
///////////////////////////////////////////////////
// Set other missing variables
- if (!isset($CSS)) $CSS = "0";
+ if (!isset($GLOBALS['output_mode'])) $GLOBALS['output_mode'] = "0";
$link = false; // No database link by default
// Include required files
LOAD_INC_ONCE("inc/session.php");
// Check if we are in installation routine
- if ((basename($_SERVER['PHP_SELF']) != "install.php") && ($CSS != "1") && ($CSS != -1)) {
+ if ((basename($_SERVER['PHP_SELF']) != "install.php") && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != -1)) {
// Redirect to the installation system
LOAD_URL("install.php");
} // END - if
} // END - if
}
-if ((getTotalFatalErrors() > 0) && (isBooleanConstantAndTrue('mxchange_installed')) && (!defined('mxchange_installing')) && ($CSS != "1")) {
+if ((getTotalFatalErrors() > 0) && (isBooleanConstantAndTrue('mxchange_installed')) && (!defined('mxchange_installing')) && ($GLOBALS['output_mode'] != "1")) {
// One or more fatal error(s) occur during connect...
LOAD_INC_ONCE("inc/header.php");
LOAD_INC_ONCE("inc/fatal_errors.php");
// Returns the title for given module
function ADD_MODULE_TITLE ($mod) {
- global $cacheArray;
-
// Init variables
$name = "";
$result = false;
// Is the script installed?
if (isBooleanConstantAndTrue('mxchange_installed')) {
// Check if cache is valid
- if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($cacheArray['modules']['module'])) && (in_array($mod, $cacheArray['modules']['module']))) {
+ if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($GLOBALS['cache_array']['modules']['module'])) && (in_array($mod, $GLOBALS['cache_array']['modules']['module']))) {
// Load from cache
- $name = $cacheArray['modules']['title'][$mod];
+ $name = $GLOBALS['cache_array']['modules']['title'][$mod];
// Update cache hits
incrementConfigEntry('cache_hits');
// Check validity of a given module name (no file extension)
function CHECK_MODULE ($mod) {
- // We need them now here...
- global $cacheArray, $cacheInstance;
-
// Filter module name (names with low chars and underlines are fine!)
$mod = preg_replace("/[^a-z_]/", "", $mod);
$locked = "Y"; $hidden = "N"; $admin = "N"; $mem = "N"; $found = false;
if (GET_EXT_VERSION("cache") >= "0.1.2") {
// Is the module cached?
- if (isset($cacheArray['modules']['locked'][$mod_chk])) {
+ if (isset($GLOBALS['cache_array']['modules']['locked'][$mod_chk])) {
// Check cache
- $locked = $cacheArray['modules']['locked'][$mod_chk];
- $hidden = $cacheArray['modules']['hidden'][$mod_chk];
- $admin = $cacheArray['modules']['admin_only'][$mod_chk];
- $mem = $cacheArray['modules']['mem_only'][$mod_chk];
+ $locked = $GLOBALS['cache_array']['modules']['locked'][$mod_chk];
+ $hidden = $GLOBALS['cache_array']['modules']['hidden'][$mod_chk];
+ $admin = $GLOBALS['cache_array']['modules']['admin_only'][$mod_chk];
+ $mem = $GLOBALS['cache_array']['modules']['mem_only'][$mod_chk];
// Update cache hits
incrementConfigEntry('cache_hits');
// This patched function will reduce many SELECT queries for the specified or current admin login
function IS_ADMIN ($admin="") {
- global $cacheArray;
-
// Init variables
$ret = false; $passCookie = ""; $valPass = "";
//* DEBUG: */ echo __LINE__."ADMIN:".$admin."<br />";
//* DEBUG: */ echo __LINE__."ADMIN:".$admin."/".$passCookie."<br />";
// Search in array for entry
- if (isset($cacheArray['admin_hash'])) {
+ if (isset($GLOBALS['cache_array']['admin_hash'])) {
// Use cached string
- $valPass = $cacheArray['admin_hash'];
- } elseif ((!empty($passCookie)) && (isset($cacheArray['admins']['password'][$admin])) && (!empty($admin))) {
+ $valPass = $GLOBALS['cache_array']['admin_hash'];
+ } elseif ((!empty($passCookie)) && (isset($GLOBALS['cache_array']['admins']['password'][$admin])) && (!empty($admin))) {
// Login data is valid or not?
- $valPass = generatePassString($cacheArray['admins']['password'][$admin]);
+ $valPass = generatePassString($GLOBALS['cache_array']['admins']['password'][$admin]);
// Cache it away
- $cacheArray['admin_hash'] = $valPass;
+ $GLOBALS['cache_array']['admin_hash'] = $valPass;
// Count cache hits
incrementConfigEntry('cache_hits');
- } elseif ((!empty($admin)) && ((!EXT_IS_ACTIVE("cache"))) || (!isset($cacheArray['admins']['password'][$admin]))) {
+ } elseif ((!empty($admin)) && ((!EXT_IS_ACTIVE("cache"))) || (!isset($GLOBALS['cache_array']['admins']['password'][$admin]))) {
// Search for admin
$result = SQL_QUERY_ESC("SELECT HIGH_PRIORITY password FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1",
array($admin), __FILE__, __LINE__);
list($passDB) = SQL_FETCHROW($result);
// Temporary cache it
- $cacheArray['admins']['password'][$admin] = $passDB;
+ $GLOBALS['cache_array']['admins']['password'][$admin] = $passDB;
// Generate password hash
$valPass = generatePassString($passDB);
// Checks wether the current user is a member
function IS_MEMBER () {
- global $status, $LAST, $cacheArray;
+ global $status, $LAST;
if (!is_array($LAST)) $LAST = array();
$ret = false;
// is the cache entry there?
- if (isset($cacheArray['is_member'])) {
+ if (isset($GLOBALS['cache_array']['is_member'])) {
// Then return it
- return $cacheArray['is_member'];
+ return $GLOBALS['cache_array']['is_member'];
} // END - if
// Fix "deleted" cookies first
}
// Cache status
- $cacheArray['is_member'] = $ret;
+ $GLOBALS['cache_array']['is_member'] = $ret;
// Return status
return $ret;
// Validate the given menu action
function VALIDATE_MENU_ACTION ($MODE, $act, $wht, $UPDATE=false) {
- global $cacheArray;
-
// Is the cache entry there and we shall not update?
- if ((isset($cacheArray['action_valid'][$MODE][$act][$wht])) && ($UPDATE === false)) {
+ if ((isset($GLOBALS['cache_array']['action_valid'][$MODE][$act][$wht])) && ($UPDATE === false)) {
// Count cache hit
incrementConfigEntry('cache_hits');
// Then use this cache
- return $cacheArray['action_valid'][$MODE][$act][$wht];
+ return $GLOBALS['cache_array']['action_valid'][$MODE][$act][$wht];
} // END - if
// By default nothing is valid
SQL_FREERESULT($result);
// Set cache entry
- $cacheArray['action_valid'][$MODE][$act][$wht] = $ret;
+ $GLOBALS['cache_array']['action_valid'][$MODE][$act][$wht] = $ret;
// Return result
return $ret;
}
// "Getter fro ref level percents
function GET_REF_LEVEL_PERCENTS ($level) {
- global $cacheInstance, $cacheArray;
-
// Default is zero
$per = 0;
// Do we have cache?
- if ((isset($cacheArray['ref_depths']['level'])) && (EXT_IS_ACTIVE("cache"))) {
+ if ((isset($GLOBALS['cache_array']['ref_depths']['level'])) && (EXT_IS_ACTIVE("cache"))) {
// First look for level
- $key = array_search($level, $cacheArray['ref_depths']['level']);
+ $key = array_search($level, $GLOBALS['cache_array']['ref_depths']['level']);
if ($key !== false) {
// Entry found!
- $per = $cacheArray['ref_depths']['percents'][$key];
+ $per = $GLOBALS['cache_array']['ref_depths']['percents'][$key];
// Count cache hit
incrementConfigEntry('cache_hits');
*/
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 $DATA, $cacheArray;
+ global $DATA;
// Convert mode to lower-case
$add_mode = strtolower($add_mode);
if (SQL_NUMROWS($result_user) == 1) {
// This is the user and his ref
list($ref, $email) = SQL_FETCHROW($result_user);
- $cacheArray['add_uid'][$ref] = $uid;
+ $GLOBALS['cache_array']['add_uid'][$ref] = $uid;
// Get percents
$per = GET_REF_LEVEL_PERCENTS($GLOBALS['ref_level']);
$ref_points = $points * $per / 100;
// Pay refback here if level > 0 and in ref-mode
- if ((EXT_IS_ACTIVE("refback")) && ($GLOBALS['ref_level'] > 0) && ($per < 100) && ($add_mode == "ref") && (isset($cacheArray['add_uid'][$uid]))) {
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},data={$cacheArray['add_uid'][$uid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - BEFORE!<br />\n";
- $ref_points = ADD_REFBACK_POINTS($cacheArray['add_uid'][$uid], $uid, $points, $ref_points);
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},data={$cacheArray['add_uid'][$uid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - AFTER!<br />\n";
+ if ((EXT_IS_ACTIVE("refback")) && ($GLOBALS['ref_level'] > 0) && ($per < 100) && ($add_mode == "ref") && (isset($GLOBALS['cache_array']['add_uid'][$uid]))) {
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},data={$GLOBALS['cache_array']['add_uid'][$uid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - BEFORE!<br />\n";
+ $ref_points = ADD_REFBACK_POINTS($GLOBALS['cache_array']['add_uid'][$uid], $uid, $points, $ref_points);
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},data={$GLOBALS['cache_array']['add_uid'][$uid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - AFTER!<br />\n";
} // END - if
// Update points...
}
//
function UPDATE_REF_COUNTER ($uid) {
- global $cacheArray, $cacheInstance;
-
// Make it sure referal level zero (member him-/herself) is at least selected
- if (empty($cacheArray['ref_level'][$uid])) $cacheArray['ref_level'][$uid] = 1;
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$cacheArray['ref_level'][$uid]}<br />\n";
+ if (empty($GLOBALS['cache_array']['ref_level'][$uid])) $GLOBALS['cache_array']['ref_level'][$uid] = 1;
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},level={$GLOBALS['cache_array']['ref_level'][$uid]}<br />\n";
// Update counter
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_refsystem` SET counter=counter+1 WHERE userid=%s AND level='%s' LIMIT 1",
- array(bigintval($uid), $cacheArray['ref_level'][$uid]), __FILE__, __LINE__);
+ array(bigintval($uid), $GLOBALS['cache_array']['ref_level'][$uid]), __FILE__, __LINE__);
// When no entry was updated then we have to create it here
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):updated=".SQL_AFFECTEDROWS()."<br />\n";
if (SQL_AFFECTEDROWS() < 1) {
// First count!
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_refsystem` (userid, level, counter) VALUES (%s,%s,1)",
- array(bigintval($uid), $cacheArray['ref_level'][$uid]), __FILE__, __LINE__);
+ array(bigintval($uid), $GLOBALS['cache_array']['ref_level'][$uid]), __FILE__, __LINE__);
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid}<br />\n";
} // END - if
if (($ref > 0) && ($ref != $uid)) {
// Move to next referal level and count his counter one up!
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - ADVANCE!<br />\n";
- $cacheArray['ref_level'][$uid]++; UPDATE_REF_COUNTER($ref);
+ $GLOBALS['cache_array']['ref_level'][$uid]++; UPDATE_REF_COUNTER($ref);
} elseif ((($ref == $uid) || ($ref == 0)) && (GET_EXT_VERSION("cache") >= "0.1.2")) {
// Remove cache here
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - CACHE!<br />\n";
}
// "Walk" back here
- $cacheArray['ref_level'][$uid]--;
+ $GLOBALS['cache_array']['ref_level'][$uid]--;
// Handle refback here if extension is installed
if (EXT_IS_ACTIVE("refback")) {
// Get ID number from administrator's login name
function GET_ADMIN_ID ($login) {
- global $cacheArray;
+ // By default no admin is found
$ret = "-1";
- if (isset($cacheArray['admins']['aid'][$login])) {
- // Check cache
- $ret = $cacheArray['admins']['aid'][$login];
+
+ // Check cache
+ if (isset($GLOBALS['cache_array']['admins']['aid'][$login])) {
+ // Use it if found to save SQL queries
+ $ret = $GLOBALS['cache_array']['admins']['aid'][$login];
// Update cache hits
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",
- array($login), __FILE__, __LINE__);
+ array($login), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
list($ret) = SQL_FETCHROW($result);
} // END - if
// Get password hash from administrator's login name
function GET_ADMIN_HASH ($aid) {
- global $cacheArray;
+ // By default an invalid hash is returned
$ret = "-1";
- if (isset($cacheArray['admins']['password'][$aid])) {
+
+ if (isset($GLOBALS['cache_array']['admins']['password'][$aid])) {
// Check cache
- $ret = $cacheArray['admins']['password'][$aid];
+ $ret = $GLOBALS['cache_array']['admins']['password'][$aid];
// Update cache hits
incrementConfigEntry('cache_hits');
list($ret) = SQL_FETCHROW($result);
// Set cache
- $cacheArray['admins']['password'][$aid] = $ret;
+ $GLOBALS['cache_array']['admins']['password'][$aid] = $ret;
}
// Free result
}
//
function GET_ADMIN_LOGIN ($aid) {
- global $cacheArray;
+ // By default a non-existent login is returned (other functions react on this!)
$ret = "***";
- if (isset($cacheArray['admins']['login'][$aid])) {
+
+ if (isset($GLOBALS['cache_array']['admins']['login'][$aid])) {
// Get cache
- $ret = $cacheArray['admins']['login'][$aid];
+ $ret = $GLOBALS['cache_array']['admins']['login'][$aid];
// Update cache hits
incrementConfigEntry('cache_hits');
list($ret) = SQL_FETCHROW($result);
// Set cache
- $cacheArray['admins']['login'][$aid] = $ret;
+ $GLOBALS['cache_array']['admins']['login'][$aid] = $ret;
} // END - if
// Free memory
}
// Get email address of admin id
function GET_ADMIN_EMAIL ($aid) {
- global $cacheArray;
-
+ // By default an invalid emails is returned
$ret = "***";
- if (isset($cacheArray['admins']['email'][$aid])) {
+
+ if (isset($GLOBALS['cache_array']['admins']['email'][$aid])) {
// Get cache
- $ret = $cacheArray['admins']['email'][$aid];
+ $ret = $GLOBALS['cache_array']['admins']['email'][$aid];
// Update cache hits
incrementConfigEntry('cache_hits');
list($ret) = SQL_FETCHROW($result_aid);
// Set cache
- $cacheArray['admins']['email'][$aid] = $ret;
+ $GLOBALS['cache_array']['admins']['email'][$aid] = $ret;
} // END - if
// Free result
}
// Get default ACL of admin id
function GET_ADMIN_DEFAULT_ACL ($aid) {
- global $cacheArray;
-
+ // By default an invalid ACL value is returned
$ret = "***";
- if (isset($cacheArray['admins']['def_acl'][$aid])) {
+
+ if (isset($GLOBALS['cache_array']['admins']['def_acl'][$aid])) {
// Use cache
- $ret = $cacheArray['admins']['def_acl'][$aid];
+ $ret = $GLOBALS['cache_array']['admins']['def_acl'][$aid];
// Update cache hits
incrementConfigEntry('cache_hits');
list($ret) = SQL_FETCHROW($result_aid);
// Set cache
- $cacheArray['admins']['def_acl'][$aid] = $ret;
+ $GLOBALS['cache_array']['admins']['def_acl'][$aid] = $ret;
}
// Free result
}
//
function LOAD_CONFIG ($no="0") {
- global $cacheArray;
$CFG_DUMMY = array();
// Check for cache extension, cache-array and if the requested configuration is in cache
- if ((is_array($cacheArray)) && (isset($cacheArray['config'][$no])) && (is_array($cacheArray['config'][$no]))) {
+ if ((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($cacheArray['config'][$no])."<br />\n";
- foreach ($cacheArray['config'][$no] as $key => $value) {
+ //* DEBUG: */ echo gettype($GLOBALS['cache_array']['config'][$no])."<br />\n";
+ foreach ($GLOBALS['cache_array']['config'][$no] as $key => $value) {
$CFG_DUMMY[$key] = $value;
} // END - foreach
if ((isset($CFG_DUMMY['cache_hits'])) && (EXT_IS_ACTIVE("cache"))) {
$CFG_DUMMY['cache_hits']++;
} // END - if
- } elseif ((!EXT_IS_ACTIVE("cache")) || (!isset($cacheArray['config'][$no]))) {
+ } elseif ((!EXT_IS_ACTIVE("cache")) || (!isset($GLOBALS['cache_array']['config'][$no]))) {
// Load config from DB
$result_config = SQL_QUERY_ESC("SELECT * FROM `{!_MYSQL_PREFIX!}_config` WHERE config=%d LIMIT 1",
array(bigintval($no)), __FILE__, __LINE__);
SQL_FREERESULT($result_config);
// Remember this config in the array
- $cacheArray['config'][$no] = $CFG_DUMMY;
+ $GLOBALS['cache_array']['config'][$no] = $CFG_DUMMY;
}
// Return config array
// Update config entries
function UPDATE_CONFIG ($entries, $values, $updateMode="") {
- global $CSS;
-
// Do not update config in CSS mode
- if (($CSS == "1") || ($CSS == -1)) {
+ if (($GLOBALS['output_mode'] == "1") || ($GLOBALS['output_mode'] == -1)) {
return;
} // END - if
}
// Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (!defined('__DAILY_RESET')) || (getConfig('beg_rallye') == "Y")) return;
+if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET')) || (getConfig('beg_rallye') == "Y")) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Reset accounts
}
// Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Purge expired entries in _bonus_turbo
}
// Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Update user profiles
}
// Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
//
}
// Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || ((!defined('__DAILY_RESET')) && (getConfig('holiday_mode') == "RESET"))) return;
+if (($GLOBALS['output_mode'] == 1) || ((!defined('__DAILY_RESET')) && (getConfig('holiday_mode') == "RESET"))) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Check for holidays we need to enable and send email to user
}
// Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Reset surfbar counter
}
// Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
// Simply reset the requests here
UPDATE_CONFIG("yoomedia_requests_remain", getConfig('yoomedia_requests_total'));
if (!isConfigEntrySet('css_php')) setConfigEntry('css_php', "FILE");
// Output CSS files or content or link to css.php ?
-if (($CSS == "1") || (getConfig('css_php') == "DIRECT")) {
+if (($GLOBALS['output_mode'] == "1") || (getConfig('css_php') == "DIRECT")) {
// Load CSS files
if (is_array($EXT_CSS_FILES)) {
// Load extension's CSS files
}
// Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+if (($GLOBALS['output_mode'] == 1) || (!defined('__DAILY_RESET'))) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
// Reset the surfbar counter
$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
// Set "CSS-Mode"
-$CSS = "0";
+$GLOBALS['output_mode'] = "0";
// Set module
$GLOBALS['module'] = "index";
$GLOBALS['action'] = "";
// Set CSS variable for "normal mode"
-$CSS = 0;
+$GLOBALS['output_mode'] = 0;
// Set module
$GLOBALS['module'] = "install";
// pattern is given...
//
// But mxchange 0.3.0 will show that in better way! :D :D :D
-$CSS = "1"; $GLOBALS['module'] = "js";
+$GLOBALS['output_mode'] = "1"; $GLOBALS['module'] = "js";
// Load the required file(s)
require("inc/config.php");
$GLOBALS['module'] = "lead-confirm";
// Set "CSS-Mode"
-$CSS = "0";
+$GLOBALS['output_mode'] = "0";
// Load config.php
require("inc/config.php");
$GLOBALS['module'] = "login";
// Set "CSS-Mode"
-$CSS = "0";
+$GLOBALS['output_mode'] = "0";
// Load the required file(s)
require("inc/config.php");
$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
// Tell everyone we are in this module
-$GLOBALS['module'] = "mailid"; $CSS = -1;
+$GLOBALS['module'] = "mailid"; $GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
// Tell everyone we are in this module
-$GLOBALS['module'] = "mailid"; $CSS = 0;
+$GLOBALS['module'] = "mailid"; $GLOBALS['output_mode'] = 0;
// Load the required file(s)
require("inc/config.php");
// Init "action" and "what"
global $what, $action, $startTime;
$GLOBALS['startTime'] = microtime(true);
-$CSS = 0;
+$GLOBALS['output_mode'] = 0;
$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
$GLOBALS['userid'] = 0;
$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
// Set module
-$GLOBALS['module'] = "ref"; $CSS = -1;
+$GLOBALS['module'] = "ref"; $GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
$GLOBALS['action'] = "";
// Set this because we have no module in URI
-$GLOBALS['module'] = "show_bonus"; $CSS = 0;
+$GLOBALS['module'] = "show_bonus"; $GLOBALS['output_mode'] = 0;
// Load the required file(s)
require("inc/config.php");
$GLOBALS['module'] = "sponsor_confirm";
// Set "CSS-Mode"
-$CSS = "0";
+$GLOBALS['output_mode'] = "0";
// Load the required file(s)
require("inc/config.php");
$GLOBALS['module'] = "sponsor_ref";
// Set "CSS-Mode"
-$CSS = "0";
+$GLOBALS['output_mode'] = "0";
// Load the required file(s)
require("inc/config.php");
// Set module
$GLOBALS['module'] = "surfbar";
$GLOBALS['refid'] = 0;
-$CSS = 0;
+$GLOBALS['output_mode'] = 0;
$msg = null;
// Load the required file(s)
}
// All done, so fix notice for footer.php
- $footer = 1;
+ $GLOBALS['footer_sent'] = 1;
} else {
// Prepare content
$content = "";
$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
// Set module
-$GLOBALS['module'] = "view"; $CSS = -1;
+$GLOBALS['module'] = "view"; $GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");