From: Roland Häder Date: Sat, 28 Feb 2009 13:00:32 +0000 (+0000) Subject: Global variables rewritten X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=59bd8a9805c51c895a92cc12825f4cbdfd792597;p=mailer.git Global variables rewritten --- diff --git a/admin.php b/admin.php index f4c3d824cf..c60d0823e7 100644 --- a/admin.php +++ b/admin.php @@ -41,7 +41,7 @@ $GLOBALS['action'] = ""; // Set module $GLOBALS['module'] = "admin"; -$CSS = -1; +$GLOBALS['output_mode'] = -1; // Load the required file(s) require("inc/config.php"); diff --git a/agb.php b/agb.php index c44da3e8c9..c5f79b55f4 100644 --- a/agb.php +++ b/agb.php @@ -39,7 +39,7 @@ global $what, $action; $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"); diff --git a/beg.php b/beg.php index ae27b8168f..efa0cd5363 100644 --- a/beg.php +++ b/beg.php @@ -42,7 +42,7 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; // Set module $GLOBALS['module'] = "beg"; $GLOBALS['refid'] = 0; -$CSS = -1; +$GLOBALS['output_mode'] = -1; $msg = null; // Load the required file(s) diff --git a/birthday_confirm.php b/birthday_confirm.php index cfbbb60f2d..d93bc3a0aa 100644 --- a/birthday_confirm.php +++ b/birthday_confirm.php @@ -39,7 +39,7 @@ global $what, $action; $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"); diff --git a/click.php b/click.php index 94d68602c7..e7c7e4d04b 100644 --- a/click.php +++ b/click.php @@ -39,7 +39,7 @@ global $what, $action; $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"); diff --git a/confirm.php b/confirm.php index ef0b7d9169..8a8ac8106d 100644 --- a/confirm.php +++ b/confirm.php @@ -39,7 +39,7 @@ global $what, $action; $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"); diff --git a/css.php b/css.php index 9efdc9588b..03eb704d1a 100644 --- a/css.php +++ b/css.php @@ -38,17 +38,17 @@ define('_OB_CACHING', "old"); 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 diff --git a/debug.php b/debug.php index 2466faa858..dcbc274a9c 100644 --- a/debug.php +++ b/debug.php @@ -40,7 +40,7 @@ $GLOBALS['what'] = ""; $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"); diff --git a/doubler.php b/doubler.php index fb92ccfbd4..9a48157044 100644 --- a/doubler.php +++ b/doubler.php @@ -43,7 +43,7 @@ $GLOBALS['action'] = ""; // Set module $GLOBALS['module'] = "doubler"; $GLOBALS['refid'] = 0; -$CSS = 0; +$GLOBALS['output_mode'] = 0; // Load the required file(s) require("inc/config.php"); diff --git a/img.php b/img.php index 4a6c77dd70..cf410ccdb1 100644 --- a/img.php +++ b/img.php @@ -39,7 +39,7 @@ global $what, $action; $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"); diff --git a/inc/check-reset.php b/inc/check-reset.php index 88335c12cc..44e0944eb0 100644 --- a/inc/check-reset.php +++ b/inc/check-reset.php @@ -37,8 +37,8 @@ if (!defined('__SECURITY')) { 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); diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 50b7189f83..ea128166a7 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -39,7 +39,7 @@ if (!defined('__SECURITY')) { // 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; @@ -75,7 +75,7 @@ Query string:
// Debug output //* DEBUG: */ print "Query=
".$sql_string."
, affected=".SQL_AFFECTEDROWS().", numrows=".SQL_NUMROWS($result)."
\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... // @@ -197,8 +197,6 @@ function SQL_SELECT_DB ($dbName, $link, $F, $L) { // SQL close link function SQL_CLOSE (&$link, $F, $L) { - global $cacheInstance, $cacheArray; - if (!is_resource($link)) { // Skip double close return false; @@ -206,7 +204,7 @@ function SQL_CLOSE (&$link, $F, $L) { // Do we need to update cache/db counter? //* DEBUG: */ echo "DB=".getConfig('db_hits').",CACHE=".getConfig('cache_hits')."
\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')); diff --git a/inc/extensions.php b/inc/extensions.php index 608cb3234f..0f02e6a124 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -39,7 +39,7 @@ if (!defined('__SECURITY')) { // 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; @@ -128,7 +128,7 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run // 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; @@ -271,8 +271,6 @@ function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = tr // 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; @@ -321,8 +319,6 @@ function EXTENSION_RUN_SQLS ($ext_id, $load_mode) { // 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; @@ -330,10 +326,10 @@ function EXT_IS_ACTIVE ($ext_name) { $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'); @@ -354,11 +350,11 @@ function EXT_IS_ACTIVE ($ext_name) { // 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 @@ -369,7 +365,7 @@ function EXT_IS_ACTIVE ($ext_name) { } // 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 @@ -377,14 +373,14 @@ function GET_EXT_VERSION ($ext_name) { //* 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__); @@ -399,7 +395,7 @@ function GET_EXT_VERSION ($ext_name) { 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 @@ -410,8 +406,8 @@ function GET_EXT_VERSION ($ext_name) { // 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(); @@ -439,14 +435,14 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) { // 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) != "") { @@ -458,20 +454,20 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) { } // 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 @@ -479,15 +475,15 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) { 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); @@ -563,15 +559,13 @@ function EXTENSION_VERBOSE_TABLE ($queries = array(), $title = "", $dashed = "", // 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'); @@ -587,13 +581,11 @@ function GET_EXT_NAME ($ext_id) { // 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'); @@ -726,20 +718,19 @@ VALUES (0,0,'NEW','EXTENSION_DEACTIVATION','%s','%s',UNIX_TIMESTAMP())", // 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__."(".__LINE__."):mod={$mod},cache=".GET_EXT_VERSION("cache")."
\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! @@ -756,7 +747,7 @@ function MODULE_HAS_MENU ($mod, $forceDb = false) { 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"); diff --git a/inc/extensions/ext-autopurge.php b/inc/extensions/ext-autopurge.php index d876c0188b..2a49e5361c 100644 --- a/inc/extensions/ext-autopurge.php +++ b/inc/extensions/ext-autopurge.php @@ -254,8 +254,7 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha 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')); } diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index 637aef5494..ce535c2481 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -546,7 +546,7 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha 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 diff --git a/inc/extensions/ext-cache.php b/inc/extensions/ext-cache.php index 897c3e370c..5f7a2d412b 100644 --- a/inc/extensions/ext-cache.php +++ b/inc/extensions/ext-cache.php @@ -106,7 +106,7 @@ case "update": // Update an extension // 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!) @@ -243,13 +243,10 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha 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__."(".__LINE__."): ".CACHE_CANNOT_INITIALIZE); } // END - if diff --git a/inc/extensions/ext-newsletter.php b/inc/extensions/ext-newsletter.php index e71f0362be..e0132cf332 100644 --- a/inc/extensions/ext-newsletter.php +++ b/inc/extensions/ext-newsletter.php @@ -168,7 +168,7 @@ default: // Do stuff when extension is loaded '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')); } diff --git a/inc/extensions/ext-profile.php b/inc/extensions/ext-profile.php index 6d2805798f..d9fe6f61a7 100644 --- a/inc/extensions/ext-profile.php +++ b/inc/extensions/ext-profile.php @@ -123,7 +123,7 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha 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')); } diff --git a/inc/extensions/ext-rallye.php b/inc/extensions/ext-rallye.php index a4d6c26d05..6fa30c5ba0 100644 --- a/inc/extensions/ext-rallye.php +++ b/inc/extensions/ext-rallye.php @@ -324,7 +324,7 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha 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); diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index 4c6b4cf8ca..e589f5f699 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -732,18 +732,16 @@ default: // Do stuff when extension is loaded // 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 diff --git a/inc/filters.php b/inc/filters.php index f289810b53..1ffea5b420 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -389,8 +389,6 @@ function FILTER_SOLVE_TASK ($data) { // Filter to load include files function FILTER_LOAD_INCLUDES ($data) { - global $CSS; - // Default is $data as inclusion list $INC_POOL = $data; diff --git a/inc/footer.php b/inc/footer.php index e2d31c6e6d..365b5dceec 100644 --- a/inc/footer.php +++ b/inc/footer.php @@ -32,7 +32,7 @@ ************************************************************************/ // Global variable stuff -global $link, $frame, $CSS, $header, $footer; +global $link, $frame; // Some security stuff... if (!defined('__SECURITY')) { @@ -41,7 +41,7 @@ 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 @@ -49,7 +49,7 @@ if (($footer != "1") && ($footer != "2") && ($CSS != "1")) { } // 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! :-) @@ -61,7 +61,7 @@ if (($footer != "1") && ($footer != "2") && ($CSS != "1")) { } // 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 @@ -74,7 +74,7 @@ if (($footer != "1") && ($footer != "2") && ($CSS != "1")) { } // END - if // Footer has been reached -$footer = 1; +$GLOBALS['footer_sent'] = 1; // Output HTML code OUTPUT_HTML(""); diff --git a/inc/functions.php b/inc/functions.php index a511347297..a292a5b1bc 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -62,7 +62,7 @@ function IS_INC_WRITEABLE($inc) { // 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)) { @@ -101,7 +101,7 @@ function OUTPUT_HTML ($HTML, $newLine = true) { mxchange_die("{--FATAL_ERROR--}: {--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 @@ -131,7 +131,7 @@ function OUTPUT_HTML ($HTML, $newLine = true) { 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 @@ -154,7 +154,7 @@ function OUTPUT_HTML ($HTML, $newLine = true) { 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 @@ -703,8 +703,6 @@ function TRANSLATE_STATUS ($status) { } // function GET_LANGUAGE() { - global $cacheArray; - // Set default return value to default language from config $ret = constant('DEFAULT_LANG'); @@ -715,9 +713,9 @@ function GET_LANGUAGE() { 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")) { @@ -733,7 +731,7 @@ function GET_LANGUAGE() { } // Cache entry - $cacheArray['language'] = $ret; + $GLOBALS['cache_array']['language'] = $ret; // Return value return $ret; @@ -908,8 +906,6 @@ function MAKE_TIME($H, $M, $S, $stamp) { } // function LOAD_URL($URL, $addUrlData=true) { - global $CSS, $footer; - // Compile out URI codes $URL = compileUriCode($URL); @@ -1309,11 +1305,11 @@ function bigintval($num, $castValue = true) { } // 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 "\"Image\"\n"; } @@ -2288,10 +2284,8 @@ function DISPLAY_PARSING_TIME_FOOTER() { // 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); @@ -2322,23 +2316,21 @@ function set_session ($var, $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__."(".__LINE__."): ".$constName."-CACHE!
\n"; - $res = $cacheArray['const'][$constName]; + $res = $GLOBALS['cache_array']['const'][$constName]; } else { // Check constant //* DEBUG: */ print __FUNCTION__."(".__LINE__."): ".$constName."-RESOLVE!
\n"; if (defined($constName)) $res = (constant($constName) === true); // Set cache - $cacheArray['const'][$constName] = $res; + $GLOBALS['cache_array']['const'][$constName] = $res; } //* DEBUG: */ var_dump($res); @@ -2353,23 +2345,21 @@ function isSessionVariableSet ($var) { } // 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__."(".__LINE__."): ".$var."-CACHE!
\n"; - $value = $cacheArray['session'][$var]; + $value = $GLOBALS['cache_array']['session'][$var]; } elseif (isSessionVariableSet($var)) { // Then get it secured! //* DEBUG: */ print __FUNCTION__."(".__LINE__."): ".$var."-RESOLVE!
\n"; $value = SQL_ESCAPE($_SESSION[$var]); // Cache the value - $cacheArray['session'][$var] = $value; + $GLOBALS['cache_array']['session'][$var] = $value; } // END - if // Return the value @@ -2634,14 +2624,12 @@ function HANDLE_LOGIN_FAILTURES ($accessLevel) { // 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? @@ -2664,13 +2652,11 @@ function REBUILD_CACHE ($cache, $inc="") { // 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; @@ -2936,7 +2922,7 @@ function getMessage ($messageId) { // Get current theme name function GET_CURR_THEME() { - global $INC_POOL, $CSS, $cacheArray; + global $INC_POOL; // The default theme is 'default'... ;-) $ret = "default"; @@ -2948,7 +2934,7 @@ function GET_CURR_THEME() { // Set default theme set_session('mxchange_theme', $ret); } elseif ((isSessionVariableSet('mxchange_theme')) && (GET_EXT_VERSION("sql_patches") >= "0.1.4")) { - //die("
".print_r($cacheArray['themes'], true)."
"); + //die("
".print_r($GLOBALS['cache_array']['themes'], true)."
"); // Get theme from cookie $ret = get_session('mxchange_theme'); @@ -2957,7 +2943,7 @@ function GET_CURR_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'])); @@ -2989,8 +2975,6 @@ function GET_CURR_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 @@ -3001,9 +2985,9 @@ function THEME_GET_ID ($name) { $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'); @@ -3183,15 +3167,13 @@ function LOAD_INC ($INC) { // 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 } diff --git a/inc/gen_refback.php b/inc/gen_refback.php index 596aa5b916..449edcaa1d 100644 --- a/inc/gen_refback.php +++ b/inc/gen_refback.php @@ -70,12 +70,10 @@ ORDER BY u.userid ASC", __FILE__, __LINE__); // 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}
\n"; diff --git a/inc/header.php b/inc/header.php index 56cafa67ce..dc81c5a868 100644 --- a/inc/header.php +++ b/inc/header.php @@ -39,12 +39,10 @@ if (!defined('__SECURITY')) { 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 = ""; @@ -122,17 +120,17 @@ if (($header != "1") && ($header != "2")) { } // END - if // Closing HEAD tag - if ($CSS != "1") OUTPUT_HTML(""); - $header = 1; + if ($GLOBALS['output_mode'] != "1") OUTPUT_HTML(""); + $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 diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 2ee0d45299..5f3c4a5d5d 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -39,7 +39,6 @@ if (!defined('__SECURITY')) { // 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; @@ -69,19 +68,19 @@ function ADMINS_CHECK_ACL($act, $wht) { $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) { @@ -162,8 +161,6 @@ WHERE email='%s'".$locked." LIMIT 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) { diff --git a/inc/libs/cache_functions.php b/inc/libs/cache_functions.php index 121cfc096a..98d29819ab 100644 --- a/inc/libs/cache_functions.php +++ b/inc/libs/cache_functions.php @@ -117,20 +117,19 @@ class CacheSystem { } 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 @@ -395,13 +394,11 @@ class CacheSystem { // 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 @@ -410,28 +407,24 @@ function FILTER_CACHE_DESTROY_ON_EXT_CHANGE ($data) { // 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 } diff --git a/inc/libs/nickname_functions.php b/inc/libs/nickname_functions.php index d218289fd5..116e35f658 100644 --- a/inc/libs/nickname_functions.php +++ b/inc/libs/nickname_functions.php @@ -39,15 +39,13 @@ if (!defined('__SECURITY')) { // 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'); @@ -61,7 +59,7 @@ function NICKNAME_IS_ACTIVE ($uidNick) { $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); @@ -73,15 +71,13 @@ function NICKNAME_IS_ACTIVE ($uidNick) { // 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'); @@ -96,7 +92,7 @@ function NICKNAME_GET_NICK ($userid) { list($ret) = SQL_FETCHROW($result); // Put it in cche - $cacheArray['nicknames'][$userid] = $ret; + $GLOBALS['cache_array']['nicknames'][$userid] = $ret; } // END - if // Free result diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index d156ee865b..3d70abc824 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -733,21 +733,19 @@ function RALLYE_TEMPLATE_SELECTION($name="template", $default="") } // 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]}
\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]}
\n"; + if (($u_id == $uid) && ($GLOBALS['cache_array']['refsystem']['level'][$id] == 1)) { //* DEBUG: */ echo "uid matches!
\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."*
"; break; } elseif ($level > 1) { @@ -761,7 +759,7 @@ function RALLYE_GET_REFCOUNT($uid, $old=0) { } } //* DEBUG: */ echo "
";
-		//* DEBUG: */ print_r($cacheArray['refsystem']);
+		//* DEBUG: */ print_r($GLOBALS['cache_array']['refsystem']);
 		//* DEBUG: */ echo "
"; //* DEBUG: */ die(); diff --git a/inc/libs/refback_functions.php b/inc/libs/refback_functions.php index 8dd3c22671..dc3d068160 100644 --- a/inc/libs/refback_functions.php +++ b/inc/libs/refback_functions.php @@ -40,10 +40,8 @@ if (!defined('__SECURITY')) { // Payback refback for refid and reduce it for current user function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) { //* DEBUG: */ print "----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- ".__FUNCTION__." - EXIT ------------------------
\n"; return $return; } + // "Getter" for refback percents function GET_REFBACK_PERCENTS ($uid, $ref) { //* DEBUG: */ print "----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- ".__FUNCTION__." - EXIT ------------------------
\n"; return $percents; } + // "Getter" for userid array which will return only one entry function GET_REFBACK_USERID_ARRAY ($rid, $level) { //* DEBUG: */ print "----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- ".__FUNCTION__." - EXIT ------------------------
\n"; return $userIds; } + // Update "refback table" function UPDATE_REFBACK_TABLE($uid) { //* DEBUG: */ print "----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- ".__FUNCTION__." - EXIT ------------------------
\n"; } + // "Getter" for array for user refs in given level function GET_USER_REFS ($uid, $level) { //* DEBUG: */ print "----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- ".__FUNCTION__." - EXIT ------------------------
\n"; return $refs; } + // "Getter" for refback entry function GET_USER_REF_ENTRY ($id) { //* DEBUG: */ print "----------------------- ".__FUNCTION__." - ENTRY ----------------------------------------------- ".__FUNCTION__." - EXIT ------------------------
\n"; return $data; } + // Update refback percents (but with some sanity-checks! function REFBACK_CHANGE_MEMBER_PERCENTS ($id, $percents) { //* DEBUG: */ print "----------------------- ".__FUNCTION__." - ENTRY ------------------------