From: Roland Häder Date: Sat, 28 Feb 2009 16:55:26 +0000 (+0000) Subject: More globals rewritten, see #100 X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=d016e24dd4686f613a17733b96bc28fac936a4ac More globals rewritten, see #100 --- diff --git a/admin.php b/admin.php index c60d0823e7..97c2630822 100644 --- a/admin.php +++ b/admin.php @@ -35,7 +35,6 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; diff --git a/agb.php b/agb.php index c5f79b55f4..adf6172c29 100644 --- a/agb.php +++ b/agb.php @@ -35,11 +35,12 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Set module -$GLOBALS['module'] = "agb"; $GLOBALS['output_mode'] = -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 efa0cd5363..ae84055593 100644 --- a/beg.php +++ b/beg.php @@ -35,9 +35,9 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action, $startTime; $GLOBALS['startTime'] = microtime(true); -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Set module $GLOBALS['module'] = "beg"; diff --git a/birthday_confirm.php b/birthday_confirm.php index d93bc3a0aa..7b0a83bc0d 100644 --- a/birthday_confirm.php +++ b/birthday_confirm.php @@ -35,11 +35,12 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Set module -$GLOBALS['module'] = "birthday_confirm"; $GLOBALS['output_mode'] = -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 e7c7e4d04b..4018e63236 100644 --- a/click.php +++ b/click.php @@ -35,8 +35,8 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Set module $GLOBALS['module'] = "click"; $GLOBALS['output_mode'] = -1; diff --git a/confirm.php b/confirm.php index 8a8ac8106d..278c428eb8 100644 --- a/confirm.php +++ b/confirm.php @@ -35,11 +35,12 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Set module to confirm -$GLOBALS['module'] = "confirm"; $GLOBALS['output_mode'] = -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 03eb704d1a..c722525cb3 100644 --- a/css.php +++ b/css.php @@ -37,9 +37,6 @@ define('_OB_CACHING', "old"); // Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) ) require("inc/libs/security_functions.php"); -// Init "action" and "what" -global $what, $action; - // Footer is disabled in CSS mode $GLOBALS['footer_sent'] = "-1"; diff --git a/debug.php b/debug.php index dcbc274a9c..38b90c5b9e 100644 --- a/debug.php +++ b/debug.php @@ -35,12 +35,12 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; // Set module and fake "CSS mode" -$GLOBALS['module'] = "debug"; $GLOBALS['output_mode'] = -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 9a48157044..92ebdc48e6 100644 --- a/doubler.php +++ b/doubler.php @@ -35,7 +35,6 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action, $startTime; $GLOBALS['startTime'] = microtime(true); $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; diff --git a/img.php b/img.php index cf410ccdb1..0d68f14238 100644 --- a/img.php +++ b/img.php @@ -35,11 +35,12 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Set module -$GLOBALS['module'] = "img"; $GLOBALS['output_mode'] = -1; +$GLOBALS['module'] = "img"; +$GLOBALS['output_mode'] = -1; // Load the required file(s) require("inc/config.php"); diff --git a/inc/databases.php b/inc/databases.php index 81b40f415b..6170141009 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -78,7 +78,7 @@ define('CODE_UNHANDLED_STATUS' , 0x022); define('FULL_VERSION', "0.2.1-FINAL"); // Replacement strings -$REPLACER = array( +$GLOBALS['replacer'] = array( 'userid' => "%uid%", // User-ID 'surname' => "%vorname%", // Surname 'family' => "%nachname%", // Family name diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 4492111863..c98de977be 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -39,8 +39,6 @@ if (!defined('__SECURITY')) { // SQL queries function SQL_QUERY ($sql_string, $F, $L) { - global $OK; - // Link is up? if (!SQL_IS_LINK_UP()) return false; @@ -80,10 +78,10 @@ Query string:
// Debugging stuff... // $fp = fopen(constant('PATH')."inc/cache/mysql.log", 'a') or mxchange_die("Cannot write mysql.log!"); - if (!isset($OK)) { + if (!isset($GLOBALS['sql_first_entry'])) { // Write first entry fwrite($fp, "Module=".$GLOBALS['module']."\n"); - $OK = true; + $GLOBALS['sql_first_entry'] = true; } // END - if fwrite($fp, $F."(LINE=".$L."|NUM=".SQL_NUMROWS($result)."|AFFECTED=".SQL_AFFECTEDROWS()."|QUERYTIME:".$queryTime."): ".str_replace('\r', "", str_replace('\n', " ", $sql_string))."\n"); fclose($fp); diff --git a/inc/doubler_send.php b/inc/doubler_send.php index 58bf1ab3e2..fe1f026218 100644 --- a/inc/doubler_send.php +++ b/inc/doubler_send.php @@ -106,7 +106,7 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == "Y")) SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_doubler` SET completed='Y' WHERE id=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__); - $OK = false; + $okay = false; // Check for jackpot inclusion in doubling process if (($jackpot > 0) && ($jackpot >= $points) && (getConfig('doubler_jackpot') == "Y")) { // Subtract points from jackpot @@ -114,20 +114,20 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == "Y")) $jackpot -= $points; // Okay, done! - $OK = true; + $okay = true; } // END - if // Exclude also webmaster's ID in taking points from webmaster's account - if (($user > 0) && ($user >= $points) && (!$OK) && (getConfig('doubler_uid') > 0) && ($uid != getConfig('doubler_uid'))) { + if (($user > 0) && ($user >= $points) && (!$okay) && (getConfig('doubler_uid') > 0) && ($uid != getConfig('doubler_uid'))) { // Add points to used points SUB_POINTS("doubler_payout", getConfig('doubler_uid'), $points); // Okay, done! - $OK = true; + $okay = true; } // END - if // Update doubler's account only when others are not updated - if (!$OK) { + if (!$okay) { // Add points to used doubler points UPDATE_CONFIG("doubler_used", $points, "+"); } // END - if diff --git a/inc/extensions.php b/inc/extensions.php index 0f02e6a124..b5185feee6 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -847,5 +847,38 @@ function ADD_EXTENSION_NOTES ($ver, &$UPDATE_NOTES) { return $out; } +// Getter for CSS files array +function EXT_GET_CSS_FILES () { + // By default no additional CSS files are found + $cssFiles = array(); + + // Is the array there? + if (isset($GLOBALS['css_files'])) { + // Then use it + $cssFiles = $GLOBALS['css_files']; + } // END - if + + // Return array + return $cssFiles; +} + +// Init CSS files array +function EXT_INIT_CSS_FILES () { + // Simply init it + $GLOBALS['css_files'] = array(); +} + +// Add new entry +function EXT_ADD_CSS_FILE ($file) { + // Is the array there? + if (!isset($GLOBALS['css_files'])) { + // Then auto-init them + EXT_INIT_CSS_FILES(); + } // END - if + + // Add the entry + $GLOBALS['css_files'][] = $file; +} + // ?> diff --git a/inc/extensions/ext-html_mail.php b/inc/extensions/ext-html_mail.php index 7db775f15f..a0685fe8c6 100644 --- a/inc/extensions/ext-html_mail.php +++ b/inc/extensions/ext-html_mail.php @@ -134,11 +134,8 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha break; default: // Do stuff when extension is loaded - // Define all arrary variables as global! - global $HTML_TAGS, $URL_ENDS, $VALID_EMAI_CHARS; - // Valid HTML tags (only simple and no attributes!) - $HTML_TAGS = array( + $GLOBALS['html_tags'] = array( "b", "i", "u", @@ -155,7 +152,7 @@ default: // Do stuff when extension is loaded // URL ends which are used to indentify the end of an URL or email link // Don't use these chars in links... ;-) // - $URL_ENDS = array( + $GLOBALS['url_ends'] = array( " ", "\n", "\r", @@ -163,7 +160,7 @@ default: // Do stuff when extension is loaded ); // Valid email chars (without @, or do you want to have another @ inside your email addy?) - $VALID_EMAIL_CHARS = array( + $GLOBALS['valid_email_chars'] = array( 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s', 't','u','v','w','x','y','z','a','B','C','D','E','F','G','H','I','J','K','L', 'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','-','.','_','0','1', diff --git a/inc/extensions/ext-newsletter.php b/inc/extensions/ext-newsletter.php index e0132cf332..5d741c6ce5 100644 --- a/inc/extensions/ext-newsletter.php +++ b/inc/extensions/ext-newsletter.php @@ -152,8 +152,7 @@ default: // Do stuff when extension is loaded // URL ends which are used to indentify the end of an URL or email link // Don't use these chars in links... ;-) // - global $URL_ENDS, $VALID_EMAIL_CHARS; - $URL_ENDS = array( + $GLOBALS['url_ends'] = array( " ", "\n", "\r", @@ -161,7 +160,7 @@ default: // Do stuff when extension is loaded ); // Valid email chars (without @, or do you want to have another @ inside your email addy?) - $VALID_EMAIL_CHARS = array( + $GLOBALS['valid_email_chars'] = array( 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s', 't','u','v','w','x','y','z','a','B','C','D','E','F','G','H','I','J','K','L', 'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','-','.','_','0','1', diff --git a/inc/extensions/ext-primera.php b/inc/extensions/ext-primera.php index 30070d6788..1b7894688d 100644 --- a/inc/extensions/ext-primera.php +++ b/inc/extensions/ext-primera.php @@ -117,9 +117,5 @@ default: // Do stuff when extension is loaded break; } -// Init array -global $primera; -$primera = array(); - // ?> diff --git a/inc/extensions/ext-wernis.php b/inc/extensions/ext-wernis.php index 1b95422242..5bb988fa6b 100644 --- a/inc/extensions/ext-wernis.php +++ b/inc/extensions/ext-wernis.php @@ -151,8 +151,7 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha default: // Do stuff when extension is loaded // Init array - global $WERNIS; - $WERNIS = array(); + $GLOBALS['wernis_data'] = array(); break; } diff --git a/inc/filters.php b/inc/filters.php index 72c61a02c4..d409525f8e 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -39,17 +39,15 @@ if (!defined('__SECURITY')) { // Init "generic filter system" function INIT_FILTER_SYSTEM () { - global $filters, $loadedFilters, $counter; - // Is the filter already initialized? - if ((isset($filters)) && (is_array($filters))) { + if ((isset($GLOBALS['filters']['chains'])) && (is_array($GLOBALS['filters']['chains']))) { // Then abort here addFatalMessage(getMessage('FILTER_FAILED_ALREADY_INIT')); return false; } // END - if // Init the filter system (just some ideas) - $filters = array( + $GLOBALS['filters']['chains'] = array( // Filters for pre-init phase 'preinit' => array(), // Filters for post-init phase @@ -59,8 +57,8 @@ function INIT_FILTER_SYSTEM () { ); // Init loaded filters and counter - $loadedFilters = array(); - $counter = array(); + $GLOBALS['filters']['loaded'] = array(); + $GLOBALS['filters']['counter'] = array(); // Load all saved filers if sql_patches is updated if (GET_EXT_VERSION("sql_patches") >= "0.5.9") { @@ -82,18 +80,18 @@ ORDER BY `filter_id` ASC", __FILE__, __LINE__); $filterFunction = $filterArray['filter_function']; // Set counter to default - $counter[$filterName][$filterFunction] = 0; + $GLOBALS['filters']['counter'][$filterName][$filterFunction] = 0; // Mark this filter as loaded (from database) - $loadedFilters[$filterName][$filterFunction] = true; + $GLOBALS['filters']['loaded'][$filterName][$filterFunction] = true; // Set this filter - $filters[$filterName][$filterFunction] = $filterArray['filter_active']; + $GLOBALS['filters']['chains'][$filterName][$filterFunction] = $filterArray['filter_active']; // Is the array element for counter there? if (isset($filterArray['filter_counter'])) { // Then use this value! - $counter[$filterName][$filterFunction] = $filterArray['filter_counter']; + $GLOBALS['filters']['counter'][$filterName][$filterFunction] = $filterArray['filter_counter']; } // END - if } // END - while } // END - if @@ -135,13 +133,11 @@ ORDER BY `filter_id` ASC", __FILE__, __LINE__); // "Registers" a new filter function function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true, $force = false, $dry_run = false) { - global $filters, $counter; - // Extend the filter function name $filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction)); // Is that filter already there? - if ((isset($filters[$filterName][$filterFunction])) && (!$force)) { + if ((isset($GLOBALS['filters']['chains'][$filterName][$filterFunction])) && (!$force)) { // Then abort here if (!$silentAbort) { addFatalMessage(getMessage('FILTER_FAILED_ALREADY_ADDED'), array($filterFunction, $filterName)); @@ -161,22 +157,20 @@ function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true, $fo // Shall we add it? if (!$dry_run) { // Simply add it to the array - $filters[$filterName][$filterFunction] = "Y"; - $counter[$filterName][$filterFunction] = 0; + $GLOBALS['filters']['chains'][$filterName][$filterFunction] = "Y"; + $GLOBALS['filters']['counter'][$filterName][$filterFunction] = 0; } // END - if } // "Unregisters" a filter from the given chain function UNREGISTER_FILTER ($filterName, $filterFunction, $force = false, $dry_run = false) { - global $filters, $counter, $loadedFilters; - // Extend the filter function name only if not loaded from database - if (!isset($loadedFilters[$filterName][$filterFunction])) { + if (!isset($GLOBALS['filters']['loaded'][$filterName][$filterFunction])) { $filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction)); } // END - if // Is that filter there? - if ((!isset($filters[$filterName][$filterFunction])) && (!$force)) { + if ((!isset($GLOBALS['filters']['chains'][$filterName][$filterFunction])) && (!$force)) { // Not found, so abort here addFatalMessage(getMessage('FILTER_FAILED_NOT_REMOVED'), array($filterFunction, $filterName)); return false; @@ -185,17 +179,15 @@ function UNREGISTER_FILTER ($filterName, $filterFunction, $force = false, $dry_r // Shall we remove? (default, not while just showing an extension removal) if (!$dry_run) { // Mark for filter removal - $filters[$filterName][$filterFunction] = "R"; - unset($counter[$filterName][$filterFunction]); + $GLOBALS['filters']['chains'][$filterName][$filterFunction] = "R"; + unset($GLOBALS['filters']['counter'][$filterName][$filterFunction]); } // END - if } // "Runs" the given filters, data is optional and can be any type of data function RUN_FILTER ($filterName, $data = null, $silentAbort = true) { - global $filters, $counter; - // Is that filter chain there? - if (!isset($filters[$filterName])) { + if (!isset($GLOBALS['filters']['chains'][$filterName])) { // Then abort here (quick'N'dirty hack) if ((!$silentAbort) && (defined('FILTER_FAILED_NO_FILTER_FOUND'))) { // Add fatal message @@ -210,7 +202,7 @@ function RUN_FILTER ($filterName, $data = null, $silentAbort = true) { $returnValue = $data; // Then run all filters - foreach ($filters[$filterName] as $filterFunction=>$active) { + foreach ($GLOBALS['filters']['chains'][$filterName] as $filterFunction=>$active) { // Debug message //* DEBUG: */ echo __FUNCTION__."(".__LINE__."): name={$filterName},func={$filterFunction},active={$active}
\n"; @@ -229,7 +221,7 @@ function RUN_FILTER ($filterName, $data = null, $silentAbort = true) { $returnValue = call_user_func_array($filterFunction, array($returnValue)); // Update usage counter - $counter[$filterName][$filterFunction]++; + $GLOBALS['filters']['counter'][$filterName][$filterFunction]++; } // END - if } // END - foreach @@ -243,7 +235,7 @@ function RUN_FILTER ($filterName, $data = null, $silentAbort = true) { // Filter for flushing all new filters to the database function FILTER_FLUSH_FILTERS () { - global $filters, $counter, $loadedFilters, $SQLs; + global $SQLs; // Clear all previous SQL queries $SQLs = array(); @@ -269,11 +261,11 @@ function FILTER_FLUSH_FILTERS () { $removeSQL = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_filters` WHERE"; // Write all filters to database - foreach ($filters as $filterName => $filterArray) { + foreach ($GLOBALS['filters']['chains'] as $filterName => $filterArray) { // Walk through all filters foreach ($filterArray as $filterFunction => $active) { // Is this filter loaded? - if (!isset($loadedFilters[$filterName][$filterFunction])) { + if (!isset($GLOBALS['filters']['loaded'][$filterName][$filterFunction])) { // Add this filter (all filters are active by default) $insertSQL .= sprintf("('%s','%s','Y'),", $filterName, $filterFunction); $inserted++; @@ -306,7 +298,7 @@ function FILTER_FLUSH_FILTERS () { // Shall we update usage counters (ONLY FOR DEBUGGING!) if (getConfig('update_filter_usage') == "Y") { // Update all counters - foreach ($counter as $filterName => $filterArray) { + foreach ($GLOBALS['filters']['counter'] as $filterName => $filterArray) { // Walk through all filters foreach ($filterArray as $filterFunction => $cnt) { // Construct and add the query @@ -356,6 +348,7 @@ function FILTER_REDIRECT_TO_LOGOUT_SQL_PATCHES () { // Filter for auto-activation of a extension function FILTER_AUTO_ACTIVATE_EXTENSION ($data) { + // @TODO Try to rewrite this global $EXT_ALWAYS_ACTIVE; // Is this extension always activated? @@ -440,8 +433,7 @@ function FILTER_RUN_SQLS ($data) { // Filter for updating/validating login data function FILTER_UPDATE_LOGIN_DATA () { - global $LAST; - if (!is_array($LAST)) $LAST = array(); + if (!is_array($GLOBALS['last'])) $GLOBALS['last'] = array(); // Recheck if logged in if (!IS_MEMBER()) return false; @@ -462,8 +454,8 @@ function FILTER_UPDATE_LOGIN_DATA () { if (empty($mod)) $mod = "login"; // This will be displayed on welcome page! :-) - if (empty($LAST['module'])) { - $LAST['module'] = $mod; $LAST['online'] = $onl; + if (empty($GLOBALS['last']['module'])) { + $GLOBALS['last']['module'] = $mod; $GLOBALS['last']['online'] = $onl; } // END - if // "what" not set? diff --git a/inc/footer.php b/inc/footer.php index 758414823f..47e3ed7b38 100644 --- a/inc/footer.php +++ b/inc/footer.php @@ -32,8 +32,6 @@ ************************************************************************/ // Global variable stuff -global $frame; - // Some security stuff... if (!defined('__SECURITY')) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; @@ -49,7 +47,7 @@ if (($GLOBALS['footer_sent'] != "1") && ($GLOBALS['footer_sent'] != "2") && ($GL } // END - if // Shall we display the copyright notice? - if ((empty($frame)) && (empty($_GET['frame'])) && (basename($_SERVER['PHP_SELF']) != "mailid_top.php") && (isBooleanConstantAndTrue('WRITE_FOOTER')) && ($GLOBALS['header_sent'] == "2")) { + if ((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! :-) diff --git a/inc/functions.php b/inc/functions.php index a292a5b1bc..6635ab0a6e 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -181,10 +181,13 @@ function OUTPUT_RAW ($HTML) { } // END - if } +// Init fatal message array +function initFatalMessages () { + $GLOBALS['fatal_messages'] = array(); +} + // Add a fatal error message to the queue array function addFatalMessage ($message, $extra="") { - global $FATAL; - if (is_array($extra)) { // Multiple extras for a message with masks $message = call_user_func_array('sprintf', $extra); @@ -193,8 +196,8 @@ function addFatalMessage ($message, $extra="") { $message = sprintf($message, $extra); } - // Add message to $FATAL - $FATAL[] = $message; + // Add message to $GLOBALS['fatal_messages'] + $GLOBALS['fatal_messages'][] = $message; // Log fatal messages away DEBUG_LOG(__FUNCTION__, __LINE__, " message={$message}"); @@ -202,15 +205,13 @@ function addFatalMessage ($message, $extra="") { // Getter for total fatal message count function getTotalFatalErrors () { - global $FATAL; - // Init coun $count = 0; // Do we have at least the first entry? - if (!empty($FATAL[0])) { + if (!empty($GLOBALS['fatal_messages'][0])) { // Get total count - $count = count($FATAL); + $count = count($GLOBALS['fatal_messages']); } // END - if // Return value @@ -746,7 +747,7 @@ function SET_LANGUAGE ($lang) { } // function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") { - global $DATA, $REPLACER, $_CONFIG; + global $DATA, $_CONFIG; // Make sure all template names are lowercase! $template = strtolower($template); @@ -964,17 +965,16 @@ function LOAD_CONFIGURED_URL ($configEntry) { // function COMPILE_CODE($code, $simple = false, $constants = true, $full = true) { - global $SEC_CHARS, $URL_CHARS; // Is the code a string? if (!is_string($code)) { // Silently return it return $code; } // END - if - $ARRAY = $SEC_CHARS; + $ARRAY = $GLOBALS['security_chars']; // Select smaller set of chars to replace when we e.g. want to compile URLs - if (!$full) $ARRAY = $URL_CHARS; + if (!$full) $ARRAY = $GLOBALS['url_chars']; // Compile constants if ($constants) { diff --git a/inc/libs/autopurge_functions.php b/inc/libs/autopurge_functions.php index 31a1c82e22..e7c1b667a8 100644 --- a/inc/libs/autopurge_functions.php +++ b/inc/libs/autopurge_functions.php @@ -38,8 +38,6 @@ if (!defined('__SECURITY')) { } function AUTOPURGE_ADD_POINTS($uid, $points) { - global $jackpot; - // Check if he has locked points or not $result = SQL_QUERY_ESC("SELECT ref_payout FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__); diff --git a/inc/libs/html_mail_functions.php b/inc/libs/html_mail_functions.php index 1c3e657729..236cd6ee6f 100644 --- a/inc/libs/html_mail_functions.php +++ b/inc/libs/html_mail_functions.php @@ -38,28 +38,22 @@ if (!defined('__SECURITY')) { } // -function HTML_ADD_VALID_TAGS() -{ - global $HTML_TAGS; $OUT = ""; - if (!is_array($HTML_TAGS)) return ""; - foreach ($HTML_TAGS as $tag) - { +function HTML_ADD_VALID_TAGS() { + $OUT = ""; + if (!is_array($GLOBALS['html_tags'])) return ""; + foreach ($GLOBALS['html_tags'] as $tag) { $OUT .= ", ".strtoupper($tag); } $OUT = substr($OUT, 2); return $OUT; } // -function HTML_CHECK_TAGS($html) -{ - global $HTML_TAGS; +function HTML_CHECK_TAGS($html { $test = stripslashes($html); - while (ereg("<", $test) && ereg(">", $test)) - { + while (ereg("<", $test) && ereg(">", $test)) { $check = strtolower(substr($test, strpos($test, "<") + 1, strpos($test, ">") - strpos($test, "<") - 1)); $check = str_replace("/", "", $check); - if (!in_array($check, $HTML_TAGS)) - { + if (!in_array($check, $GLOBALS['html_tags'])) { // Invalid tag found! return ""; } @@ -69,9 +63,7 @@ function HTML_CHECK_TAGS($html) return $html; } // -function HTML_INSERT_URLS($text) -{ - global $URL_ENDS, $VALID_EMAIL_CHARS; +function HTML_INSERT_URLS ($text) { $test = $text; // First replace URLs... @@ -80,7 +72,7 @@ function HTML_INSERT_URLS($text) $check = substr($test, strpos($test, "http://")); $check2 = $check; // See ext-html.php if you want to add more URL ends... - foreach ($URL_ENDS as $end) + foreach ($GLOBALS['url_ends'] as $end) { if (ereg($end, $check)) $check = substr($check, 0, strpos($check, $end)); } @@ -110,7 +102,7 @@ function HTML_INSERT_URLS($text) while ($idx > 0) { $check = substr($test2, $idx, 1); - if (!in_array($check, $VALID_EMAIL_CHARS)) + if (!in_array($check, $GLOBALS['valid_email_chars'])) { // Char found so we end here break; @@ -129,7 +121,7 @@ function HTML_INSERT_URLS($text) while ($idx < strlen($test)) { $check = substr($test, $idx, 1); - if ((!in_array($check, $VALID_EMAIL_CHARS)) && ($check != "@")) + if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != "@")) { // Char found so end here again break; diff --git a/inc/libs/newsletter_functions.php b/inc/libs/newsletter_functions.php index 2b03a73f11..7fccd6fa40 100644 --- a/inc/libs/newsletter_functions.php +++ b/inc/libs/newsletter_functions.php @@ -38,28 +38,23 @@ if (!defined('__SECURITY')) { } // -function NL_ADD_VALID_TAGS() -{ - global $HTML_TAGS; $OUT = ""; - if (!is_array($HTML_TAGS)) return ""; - foreach ($HTML_TAGS as $tag) - { +function NL_ADD_VALID_TAGS () { + $OUT = ""; + if (!is_array($GLOBALS['html_tags'])) return ""; + foreach ($GLOBALS['html_tags'] as $tag) { $OUT .= ", ".strtoupper($tag); } $OUT = substr($OUT, 2); return $OUT; } + // -function NL_CHECK_TAGS($html) -{ - global $HTML_TAGS; +function NL_CHECK_TAGS ($html) { $test = stripslashes($html); - while (ereg("<", $test) && ereg(">", $test)) - { + while (ereg("<", $test) && ereg(">", $test)) { $check = strtolower(substr($test, strpos($test, "<") + 1, strpos($test, ">") - strpos($test, "<") - 1)); $check = str_replace("/", "", $check); - if (!in_array($check, $HTML_TAGS)) - { + if (!in_array($check, $GLOBALS['html_tags'])) { // Invalid tag found! return ""; } @@ -68,20 +63,17 @@ function NL_CHECK_TAGS($html) // Return tested code return $html; } + // -function NL_INSERT_URLS($text) -{ - global $URL_ENDS, $VALID_EMAIL_CHARS; +function NL_INSERT_URLS ($text) { $test = $text; // First replace URLs... - while (ereg("http://", $test)) - { + while (ereg("http://", $test)) { $check = substr($test, strpos($test, "http://")); $check2 = $check; // See ext-html.php if you want to add more URL ends... - foreach ($URL_ENDS as $end) - { + foreach ($GLOBALS['url_ends'] as $end) { if (ereg($end, $check)) $check = substr($check, 0, strpos($check, $end)); } @@ -100,25 +92,23 @@ function NL_INSERT_URLS($text) // ... what will the email address be out the @... ;-) $PARTS = array(); - while (ereg("@", $test)) - { + while (ereg("@", $test)) { $pos = strpos($test, "@"); $test2 = substr($test, 0, $pos); // First check backwards $idx = $pos - 1; - while ($idx > 0) - { + while ($idx > 0) { $check = substr($test2, $idx, 1); - if (!in_array($check, $VALID_EMAIL_CHARS)) + if (!in_array($check, $GLOBALS['valid_email_chars'])) { // Char found so we end here break; } $idx--; } - if ($idx > 0) - { + + if ($idx > 0) { // Starting mark is found $check2 = substr($test, 0, ($idx + 1)); $test = substr($test, ($idx + 1)); @@ -126,18 +116,16 @@ function NL_INSERT_URLS($text) // And now go forward... $idx = 0; - while ($idx < strlen($test)) - { + while ($idx < strlen($test)) { $check = substr($test, $idx, 1); - if ((!in_array($check, $VALID_EMAIL_CHARS)) && ($check != "@")) - { + if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != "@")) { // Char found so end here again break; } $idx++; } - if ($idx > 0) - { + + if ($idx > 0) { // Maybe this is the email address? $check = substr($test, 0, $idx); } @@ -148,20 +136,19 @@ function NL_INSERT_URLS($text) // Remove email from testing string (see above why...) $test = substr($test, strlen($check)); } + // Now put all parts together $text = ""; $PARTS[] = $test; - foreach ($PARTS as $part) - { + foreach ($PARTS as $part) { $text .= $part; } // Compile possible own HTML tags out... return COMPILE_CODE($text); } + // -function SEND_NEWSLETTER($TO, $SUBJECT, $MSG, $MODE) -{ - global $_POST; +function SEND_NEWSLETTER ($TO, $SUBJECT, $MSG, $MODE) { // Send mail away as HTML if ($_POST['auto_urls'] == "Y") { // Automatically insert URLs into newsletter @@ -181,5 +168,6 @@ function SEND_NEWSLETTER($TO, $SUBJECT, $MSG, $MODE) } } } + // ?> diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index 3d70abc824..d38b61b2e6 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -65,7 +65,7 @@ function RALLYE_AUTOSTART_RALLYES($result) if ($min_users == 0) { // Rallye ends without user limitation - $DATA['min_users'] = RALLYE_END_NO_USER_LIMITATION; + $DATA['min_users'] = getMessage('RALLYE_END_NO_USER_LIMITATION'); } else { // Rallye ends when X members are totally in your exchange $DATA['min_users'] = RALLYE_END_USERS_1." ".$min_users." ".RALLYE_END_USERS_2; @@ -73,7 +73,7 @@ function RALLYE_AUTOSTART_RALLYES($result) if ($min_prices == 0) { // Rallye ends without user limitation - $DATA['min_prices'] = RALLYE_END_NO_PRICE_LIMITATION; + $DATA['min_prices'] = getMessage('RALLYE_END_NO_PRICE_LIMITATION'); } else { // Rallye ends when X members are totally in your exchange $DATA['min_prices'] = RALLYE_END_PRICES_1." ".$min_prices." ".RALLYE_END_PRICES_2; @@ -681,7 +681,7 @@ WHERE end_time <= (UNIX_TIMESTAMP() - %s) AND expired='Y'", // Add task SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (status, task_type, subject, text, task_created) -VALUES ('NEW','RALLYE_PURGED','".RALLYE_ADMIN_PURGED.": %s','".RALLYE_ADMIN_PURGED_TEXT."',UNIX_TIMESTAMP())", +VALUES ('NEW','RALLYE_PURGED','{--RALLYE_ADMIN_PURGED--}: %s','{--RALLYE_ADMIN_PURGED_TEXT--}',UNIX_TIMESTAMP())", array($title), __FILE__, __LINE__); } diff --git a/inc/libs/security_functions.php b/inc/libs/security_functions.php index 1f08065de4..536fa68aa8 100644 --- a/inc/libs/security_functions.php +++ b/inc/libs/security_functions.php @@ -83,8 +83,7 @@ if (!isset($_POST)) { //require("/usr/share/php/ipfilter.php"); // Generate arrays which holds the relevante chars to replace -global $SEC_CHARS, $URL_CHARS; -$SEC_CHARS = array( +$GLOBALS['security_chars'] = array( // The chars we are looking for... 'from' => array("{", "}", "/", ".", "'", "$", "(", ")", '{--', '--}', "%", ";", "[", "]", ":", "--"), // ... and we will replace to. @@ -112,7 +111,7 @@ $SEC_CHARS = array( // // Note: Do not replace 'to' with 'from' and vise-versa! When you do this all booked URLs will be // rejected because of the {SLASH}, {DOT} and all below listed items inside the URL. -$URL_CHARS = array( +$GLOBALS['url_chars'] = array( // Search for these secured characters 'to' => array("{SLASH}", "{DOT}", "{PER}", "{DBL_DOT}", "{COMMENT}"), // Replace with these characters @@ -127,9 +126,9 @@ if (is_array($_GET)) { unset($_GET[$seckey]); } else { // Only variables are allowed (non-array) but we secure them all! - foreach ($SEC_CHARS['from'] as $key => $char) { + foreach ($GLOBALS['security_chars']['from'] as $key => $char) { // Pass all through - $_GET[$seckey] = str_replace($char , $SEC_CHARS['to'][$key], $_GET[$seckey]); + $_GET[$seckey] = str_replace($char , $GLOBALS['security_chars']['to'][$key], $_GET[$seckey]); } // Strip all other out @@ -143,9 +142,9 @@ if (basename($_SERVER['PHP_SELF']) != "install.php") { foreach ($_POST as $seckey => $secvalue) { if (!is_array($secvalue)) { // Only variables are allowed (non-array) to be secured... - foreach ($SEC_CHARS['from'] as $key => $char) { + foreach ($GLOBALS['security_chars']['from'] as $key => $char) { // Pass all through - $_POST[$seckey] = str_replace($char , $SEC_CHARS['to'][$key], $_POST[$seckey]); + $_POST[$seckey] = str_replace($char , $GLOBALS['security_chars']['to'][$key], $_POST[$seckey]); } // Strip all other out diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index f97cab7c4b..8fa321af6a 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -200,8 +200,6 @@ function SURFBAR_MEMBER_ACTIONS ($urlId, $status) { } // Do the member form request function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) { - global $SURFBAR_CACHE; - // By default no action is performed $performed = false; @@ -235,7 +233,7 @@ function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) { // Is the function there? if (function_exists($functionName)) { // Add new status - $URLs[$formData['id']]['new_status'] = $SURFBAR_CACHE['new_status']; + $URLs[$formData['id']]['new_status'] = $GLOBALS['cache_array']['surfbar']['new_status']; // Extract URL data for call-back $urlData = array(merge_array($URLs[$formData['id']], array($action => $formData))); @@ -253,8 +251,6 @@ function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) { } // Validate if the requested action can be performed on current URL status function SURFBAR_VALIDATE_MEMBER_ACTION_STATUS ($action, $status) { - global $SURFBAR_CACHE; - // Search for the requested action/status combination in database $result = SQL_QUERY_ESC("SELECT new_status FROM `{!_MYSQL_PREFIX!}_surfbar_actions` WHERE `action`='%s' AND `status`='%s' LIMIT 1", array($action, $status), __FILE__, __LINE__); @@ -265,7 +261,7 @@ function SURFBAR_VALIDATE_MEMBER_ACTION_STATUS ($action, $status) { // Fetch the new status if found if ($isValid) { // Load new status - list($SURFBAR_CACHE['new_status']) = SQL_FETCHROW($result); + list($GLOBALS['cache_array']['surfbar']['new_status']) = SQL_FETCHROW($result); } // END - if // Free result @@ -789,19 +785,17 @@ function SURFBAR_DETERMINE_TEMPLATE_NAME() { // Check if the "reload lock" of the current user is full, call this function // before you call SURFBAR_CHECK_RELOAD_LOCK(). function SURFBAR_CHECK_RELOAD_FULL() { - global $SURFBAR_CACHE; - // Default is full! $isFull = true; // Cache static reload lock - $SURFBAR_CACHE['surf_lock'] = getConfig('surfbar_static_lock'); + $GLOBALS['cache_array']['surfbar']['surf_lock'] = getConfig('surfbar_static_lock'); //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Fixed surf lock is ".getConfig('surfbar_static_lock')."", false); // Do we have dynamic model? if (getConfig('surfbar_pay_model') == "DYNAMIC") { // "Calculate" dynamic lock - $SURFBAR_CACHE['surf_lock'] += SURFBAR_CALCULATE_DYNAMIC_ADD(); + $GLOBALS['cache_array']['surfbar']['surf_lock'] += SURFBAR_CALCULATE_DYNAMIC_ADD(); } // END - if // Ask the database @@ -814,12 +808,12 @@ LIMIT 1", ); // Fetch row - list($SURFBAR_CACHE['user_locks']) = SQL_FETCHROW($result); + list($GLOBALS['cache_array']['surfbar']['user_locks']) = SQL_FETCHROW($result); // Is it null? - if (is_null($SURFBAR_CACHE['user_locks'])) { + if (is_null($GLOBALS['cache_array']['surfbar']['user_locks'])) { // Then fix it to zero! - $SURFBAR_CACHE['user_locks'] = 0; + $GLOBALS['cache_array']['surfbar']['user_locks'] = 0; } // END - if // Free result @@ -915,10 +909,8 @@ LIMIT %s", } // Generate a validation code for the given id number function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") { - global $SURFBAR_CACHE; - // @TODO Invalid salt should be refused - $SURFBAR_CACHE['salt'] = "INVALID"; + $GLOBALS['cache_array']['surfbar']['salt'] = "INVALID"; // Get code length from config $length = getConfig('code_length'); @@ -932,11 +924,11 @@ function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") { // Is the salt set? if (empty($salt)) { // Generate random hashed string - $SURFBAR_CACHE['salt'] = sha1(GEN_PASS(255)); + $GLOBALS['cache_array']['surfbar']['salt'] = sha1(GEN_PASS(255)); //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "newSalt=".SURFBAR_GET_SALT()."", false); } else { // Use this as salt! - $SURFBAR_CACHE['salt'] = $salt; + $GLOBALS['cache_array']['surfbar']['salt'] = $salt; //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "oldSalt=".SURFBAR_GET_SALT()."", false); } @@ -957,8 +949,6 @@ function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") { } // Check validation code function SURFBAR_CHECK_VALIDATION_CODE ($urlId, $check, $salt) { - global $SURFBAR_CACHE; - // Secure id number $urlId = bigintval($urlId); @@ -1453,8 +1443,6 @@ function SURFBAR_RELOAD_TO_STOP_PAGE($page="stop") { // Determine next id for surfbar or get data for given id, always call this before you call other // getters below this function!!! function SURFBAR_DETERMINE_NEXT_ID ($urlId = 0) { - global $SURFBAR_CACHE; - // Default is no id and no random number $nextId = 0; $randNum = 0; @@ -1522,37 +1510,37 @@ LIMIT 1", //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "lastQuery=".getConfig('db_last_query')."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS()."", false); if (SQL_NUMROWS($result) == 1) { // Load/cache data - //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($SURFBAR_CACHE).") - BEFORE", false); - $SURFBAR_CACHE = merge_array($SURFBAR_CACHE, SQL_FETCHARRAY($result)); - //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($SURFBAR_CACHE).") - AFTER", false); + //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($GLOBALS['cache_array']['surfbar']).") - BEFORE", false); + $GLOBALS['cache_array']['surfbar'] = merge_array($GLOBALS['cache_array']['surfbar'], SQL_FETCHARRAY($result)); + //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($GLOBALS['cache_array']['surfbar']).") - AFTER", false); // Determine waiting time - $SURFBAR_CACHE['time'] = SURFBAR_DETERMINE_WAIT_TIME(); + $GLOBALS['cache_array']['surfbar']['time'] = SURFBAR_DETERMINE_WAIT_TIME(); // Is the last salt there? - if (is_null($SURFBAR_CACHE['last_salt'])) { + if (is_null($GLOBALS['cache_array']['surfbar']['last_salt'])) { // Then repair it wit the static! //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "last_salt - FIXED!", false); - $SURFBAR_CACHE['last_salt'] = ""; + $GLOBALS['cache_array']['surfbar']['last_salt'] = ""; } // END - if // Fix missing last_surfed - if ((!isset($SURFBAR_CACHE['last_surfed'])) || (is_null($SURFBAR_CACHE['last_surfed']))) { + if ((!isset($GLOBALS['cache_array']['surfbar']['last_surfed'])) || (is_null($GLOBALS['cache_array']['surfbar']['last_surfed']))) { // Fix it here //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "last_surfed - FIXED!", false); - $SURFBAR_CACHE['last_surfed'] = 0; + $GLOBALS['cache_array']['surfbar']['last_surfed'] = 0; } // END - if // Get base/fixed reward and costs - $SURFBAR_CACHE['reward'] = SURFBAR_DETERMINE_REWARD(); - $SURFBAR_CACHE['costs'] = SURFBAR_DETERMINE_COSTS(); + $GLOBALS['cache_array']['surfbar']['reward'] = SURFBAR_DETERMINE_REWARD(); + $GLOBALS['cache_array']['surfbar']['costs'] = SURFBAR_DETERMINE_COSTS(); //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "BASE/STATIC - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."", false); // Only in dynamic model add the dynamic bonus! if (getConfig('surfbar_pay_model') == "DYNAMIC") { // Calculate dynamic reward/costs and add it - $SURFBAR_CACHE['reward'] += SURFBAR_CALCULATE_DYNAMIC_ADD(); - $SURFBAR_CACHE['costs'] += SURFBAR_CALCULATE_DYNAMIC_ADD(); + $GLOBALS['cache_array']['surfbar']['reward'] += SURFBAR_CALCULATE_DYNAMIC_ADD(); + $GLOBALS['cache_array']['surfbar']['costs'] += SURFBAR_CALCULATE_DYNAMIC_ADD(); //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "DYNAMIC+ - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."", false); } // END - if @@ -1569,23 +1557,22 @@ LIMIT 1", } // ----------------------------------------------------------------------------- // PLEASE DO NOT ADD ANY OTHER FUNCTIONS BELOW THIS LINE ELSE THEY "WRAP" THE -// $SURFBAR_CACHE ARRAY! +// $GLOBALS['cache_array']['surfbar'] ARRAY! // ----------------------------------------------------------------------------- // Private getter for data elements function SURFBAR_GET_DATA ($element) { - global $SURFBAR_CACHE; //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "element={$element}", false); // Default is null $data = null; // Is the entry there? - if (isset($SURFBAR_CACHE[$element])) { + if (isset($GLOBALS['cache_array']['surfbar'][$element])) { // Then take it - $data = $SURFBAR_CACHE[$element]; + $data = $GLOBALS['cache_array']['surfbar'][$element]; } else { // END - if print("
");
-		print_r($SURFBAR_CACHE);
+		print_r($GLOBALS['cache_array']['surfbar']);
 		print("
"); debug_report_bug(); } diff --git a/inc/libs/task_functions.php b/inc/libs/task_functions.php index dd7e3249de..cfd0277d8d 100644 --- a/inc/libs/task_functions.php +++ b/inc/libs/task_functions.php @@ -336,15 +336,15 @@ ORDER BY d.userid"; } // Autopurge installed? - $LAST = ""; + $lastOnline = ""; if ((EXT_IS_ACTIVE("autopurge")) && (getConfig('autopurge_inactive') == "Y") && (getConfig('ap_inactive_since') > 0)) { // Use last online timestamp to keep inactive members away from here - $LAST = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since')); + $lastOnline = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since')); } $SQLs[] = "SELECT ".$USE." AS points FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE `status`='CONFIRMED' AND ".$USE.">0".$LAST." +WHERE `status`='CONFIRMED' AND ".$USE.">0".$lastOnline." ORDER BY points DESC, userid"; $WHATs[] = "list_bonus"; $DESCRs[] = getMessage('ADMIN_TASK_LIST_BONUS'); @@ -355,14 +355,14 @@ ORDER BY points DESC, userid"; // Begging rallye // Autopurge installed? - $LAST = ""; + $lastOnline = ""; if ((EXT_IS_ACTIVE("autopurge")) && (getConfig('autopurge_inactive') == "Y") && (getConfig('ap_inactive_since') > 0)) { // Use last online timestamp to keep inactive members away from here - $LAST = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since')); + $lastOnline = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since')); } $SQLs[] = "SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE `status`='CONFIRMED' AND beg_points>0".$LAST." +WHERE `status`='CONFIRMED' AND beg_points>0".$lastOnline." ORDER BY beg_points DESC, userid"; $WHATs[] = "list_beg"; $DESCRs[] = getMessage('ADMIN_TASK_LIST_BEG'); diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php index 4a56e674ef..2dfcac22cb 100644 --- a/inc/libs/theme_functions.php +++ b/inc/libs/theme_functions.php @@ -191,10 +191,10 @@ function GET_CURR_THEME_NAME () { } // Initialize variables -$currTheme = GET_CURR_THEME(); +$GLOBALS['curr_theme'] = GET_CURR_THEME(); // Check if new theme is selcted -if ((!empty($_POST['new_theme'])) && ($_POST['new_theme'] != $currTheme)) { +if ((!empty($_POST['new_theme'])) && ($_POST['new_theme'] != $GLOBALS['curr_theme'])) { // Set new theme for guests $newTheme = $_POST['new_theme']; @@ -202,7 +202,7 @@ if ((!empty($_POST['new_theme'])) && ($_POST['new_theme'] != $currTheme)) { set_session('mxchange_theme', $newTheme); // Remove current from array and set new - $theme = sprintf("%stheme/%s/theme.php", constant('PATH'), $currTheme); + $theme = sprintf("%stheme/%s/theme.php", constant('PATH'), $GLOBALS['curr_theme']); unset($INC_POOL[array_search($theme, $INC_POOL)]); $INC_POOL[] = sprintf("%stheme/%s/theme.php", constant('PATH'), $newTheme); } // END - if diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 7c747ddf57..05d43f9a84 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -257,22 +257,22 @@ function SELECT_RANDOM_REFID () { // Do the user login function USER_DO_LOGIN ($uid, $passwd) { // Add last_login if available - $LAST = ""; + $lastOnline = ""; if (GET_EXT_VERSION("sql_patches") >= "0.2.8") { - $LAST = ", last_login"; + $lastOnline = ", last_login"; } // END - if // Check login data $password = ""; $uid2 = ""; $dmy = ""; $online = 0; $login = 0; if ((EXT_IS_ACTIVE("nickname")) && (NICKNAME_PROBE_ON_USERID($uid))) { // Nickname entered - $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$LAST." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' AND `status`='CONFIRMED' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$lastOnline." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' AND `status`='CONFIRMED' LIMIT 1", array($uid), __FILE__, __LINE__); list($uid2, $password, $online, $login) = SQL_FETCHROW($result); if (!empty($uid2)) $uid = bigintval($uid2); } else { // Direct userid entered - $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$LAST." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$lastOnline." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", array($uid, $hash), __FILE__, __LINE__); list($uid2, $password, $online, $login) = SQL_FETCHROW($result); } @@ -346,11 +346,11 @@ function USER_DO_LOGIN ($uid, $passwd) { } } else { // Cannot update counter! - $URL = "modules.php?module=index&what=login&login=".CODE_CNTR_FAILED; + $URL = "modules.php?module=index&what=login&login=".constant('CODE_CNTR_FAILED'); } } else { // Cookies not setable! - $URL = "modules.php?module=index&what=login&login=".CODE_NO_COOKIES; + $URL = "modules.php?module=index&what=login&login=".constant('CODE_NO_COOKIES'); } } elseif (GET_EXT_VERSION("sql_patches") >= "0.6.1") { // Update failture counter @@ -358,7 +358,7 @@ function USER_DO_LOGIN ($uid, $passwd) { array($uid), __FILE__, __LINE__); // Wrong password! - $URL = "modules.php?module=index&what=login&login=".CODE_WRONG_PASS; + $URL = "modules.php?module=index&what=login&login=".constant('CODE_WRONG_PASS'); } } elseif ((($probe_nickname) && (!empty($uid2))) || ($uid2 == $uid)) { // Other account status? diff --git a/inc/libs/wernis_functions.php b/inc/libs/wernis_functions.php index 0cb27530e0..ba46ef374f 100644 --- a/inc/libs/wernis_functions.php +++ b/inc/libs/wernis_functions.php @@ -39,20 +39,18 @@ if (!defined('__SECURITY')) { // Sets a status message and code function WERNIS_STATUS_MESSAGE ($msg, $status) { - global $WERNIS; - $WERNIS['message'] = $msg; - $WERNIS['status'] = $status; + $GLOBALS['wernis_data']['message'] = $msg; + $GLOBALS['wernis_data']['status'] = $status; } // Get the status message function GET_WERNIS_ERROR_MESSAGE () { - global $WERNIS; - if (isset($WERNIS['message'])) { + if (isset($GLOBALS['wernis_data']['message'])) { // Use raw message - return $WERNIS['message']; - } elseif (isset($WERNIS['status'])) { + return $GLOBALS['wernis_data']['message']; + } elseif (isset($GLOBALS['wernis_data']['status'])) { // Fall-back to status - return sprintf(WERNIS_ERROR_STATUS, $WERNIS['status']); + return sprintf(WERNIS_ERROR_STATUS, $GLOBALS['wernis_data']['status']); } else { // Something bad happend return WERNIS_UNKNOWN_ERROR; @@ -61,10 +59,9 @@ function GET_WERNIS_ERROR_MESSAGE () { // Get the status code function GET_WERNIS_ERROR_CODE () { - global $WERNIS; - if (isset($WERNIS['status'])) { + if (isset($GLOBALS['wernis_data']['status'])) { // Use raw message - return $WERNIS['status']; + return $GLOBALS['wernis_data']['status']; } else { // Something bad happend return WERNIS_UNKNOWN_ERROR; diff --git a/inc/load_extensions.php b/inc/load_extensions.php index c3d2574d79..67d43e2e0b 100644 --- a/inc/load_extensions.php +++ b/inc/load_extensions.php @@ -38,8 +38,7 @@ if (!defined('__SECURITY')) { } // Init variables -global $EXT_CSS_FILES; -$EXT_CSS_FILES = array(); +EXT_INIT_CSS_FILES(); $ADD = ""; // Init cache instance and array @@ -107,7 +106,7 @@ if ($GLOBALS['cacheMode'] == "load") { $EXT_NAMES = array(); foreach ($EXT_DUMMY['ext_name'] as $k => $name) { // Load CSS file - if ($EXT_DUMMY['ext_css'][$k] == "Y") $EXT_CSS_FILES[] = "".$name.".css"; + if ($EXT_DUMMY['ext_css'][$k] == "Y") EXT_ADD_CSS_FILE("".$name.".css"); // Load extension file itself if ((($EXT_DUMMY['ext_active'][$k] == "Y") || ($EXT_DUMMY['ext_keep'][$k] == "Y") || (IS_ADMIN())) && (!in_array($name, array("sql_patches", "cache")))) { @@ -234,7 +233,7 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($GLOBALS['cacheMode'] == "init") && ($ // Is the file there? 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"; + EXT_ADD_CSS_FILE($content['ext_name'].".css"); $content['ext_css'] = "Y"; } else { // Don't load CSS file diff --git a/inc/loader/load_cache-admin.php b/inc/loader/load_cache-admin.php index 2ae06ced10..eb4de0475d 100644 --- a/inc/loader/load_cache-admin.php +++ b/inc/loader/load_cache-admin.php @@ -111,7 +111,6 @@ if (GET_EXT_VERSION("admins") >= "0.3") { // Check for cache file if (($GLOBALS['cache_instance']->loadCacheFile("admins_acls")) && ($GLOBALS['cache_instance']->extensionVersionMatches("admins"))) { // Load referal system from cache - 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 diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index e7b1acb619..ea677c8fdb 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -232,7 +232,7 @@ function CHECK_ADMIN_COOKIES ($admin_login, $password) { // function ADMIN_DO_ACTION($wht) { - global $menuDesription, $menuTitle, $DATA; + global $DATA; //* DEBUG: */ echo __LINE__."*".$wht."/".$GLOBALS['module']."/".$GLOBALS['action']."/".$GLOBALS['what']."*
\n"; // Remove any spaces from variable @@ -297,15 +297,13 @@ LIMIT 1", array($act, $wht, $wht), __FILE__, __LINE__); } // function ADD_ADMIN_MENU($act, $wht, $return=false) { - global $menuDesription, $menuTitle; - // Init variables $SUB = false; $OUT = ""; // Menu descriptions - $menuDesription = array(); - $menuTitle = array(); + $GLOBALS['menu']['description'] = array(); + $GLOBALS['menu']['title'] = array(); // Is there a cache instance? if ((is_object($GLOBALS['cache_instance'])) && (getConfig('cache_admin_menu') == "Y")) { @@ -319,8 +317,8 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) { // Extract all parts $OUT = base64_decode($data['output'][0]); - $menuTitle = unserialize(base64_decode($data['title'][0])); - $menuDescription = unserialize(base64_decode($data['descr'][0])); + $GLOBALS['menu']['title'] = unserialize(base64_decode($data['title'][0])); + $GLOBALS['menu']['description'] = unserialize(base64_decode($data['descr'][0])); // Return or output content? if ($return) { @@ -347,8 +345,8 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) { if ($ACL === true) { if (!$SUB) { // Insert compiled menu title and description - $menuTitle[$menu] = $title; - $menuDesription[$menu] = $descr; + $GLOBALS['menu']['title'][$menu] = $title; + $GLOBALS['menu']['description'][$menu] = $descr; } $OUT .= " @@ -376,8 +374,8 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) { array($menu), __FILE__, __LINE__); if ((SQL_NUMROWS($result_what) > 0) && ($act == $menu)) { - $menuDesription = array(); - $menuTitle = array(); $SUB = true; + $GLOBALS['menu']['description'] = array(); + $GLOBALS['menu']['title'] = array(); $SUB = true; $OUT .= "   @@ -394,8 +392,8 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) { $readable = INCLUDE_READABLE($INC); if ($ACL === true) { // Insert compiled title and description - $menuTitle[$wht_sub] = $title_what; - $menuDesription[$wht_sub] = $desc_what; + $GLOBALS['menu']['title'][$wht_sub] = $title_what; + $GLOBALS['menu']['description'][$wht_sub] = $desc_what; $OUT .= "  --> "; @@ -463,8 +461,8 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) { // Prepare cache data $data = array( 'output' => base64_encode($OUT), - 'title' => $menuTitle, - 'descr' => $menuDesription + 'title' => $GLOBALS['menu']['title'], + 'descr' => $GLOBALS['menu']['description'] ); // Write the data away diff --git a/inc/modules/admin/what-list_beg.php b/inc/modules/admin/what-list_beg.php index 65a4452501..f99652bc31 100644 --- a/inc/modules/admin/what-list_beg.php +++ b/inc/modules/admin/what-list_beg.php @@ -50,17 +50,17 @@ if (getConfig('beg_rallye') == "Y") { } // END - if // Autopurge installed? - $LAST = "%s"; $ONLINE = ""; + $lastOnline = "%s"; $ONLINE = ""; if (EXT_IS_ACTIVE("autopurge")) { // Use last online timestamp to keep inactive members away from here - $LAST = " AND last_online >= (UNIX_TIMESTAMP() - %s)"; + $lastOnline = " AND last_online >= (UNIX_TIMESTAMP() - %s)"; $ONLINE = getConfig('ap_inactive_since'); } // END - if // Check if at least one is in the active rallye $result = SQL_QUERY_ESC("SELECT userid, email, gender, surname, family, beg_points, last_online FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE `status`='CONFIRMED' AND beg_points > 0".$LAST." +WHERE `status`='CONFIRMED' AND beg_points > 0".$lastOnline." ORDER BY beg_points DESC, last_online DESC, userid", array($ONLINE), __FILE__, __LINE__); diff --git a/inc/modules/admin/what-list_bonus.php b/inc/modules/admin/what-list_bonus.php index f7719b9a32..3148e6cedc 100644 --- a/inc/modules/admin/what-list_bonus.php +++ b/inc/modules/admin/what-list_bonus.php @@ -65,17 +65,17 @@ if (getConfig('bonus_active') == "Y") { } // Autopurge installed? - $LAST = "%s"; $ONLINE = ""; + $lastOnline = "%s"; $ONLINE = ""; if (EXT_IS_ACTIVE("autopurge")) { // Use last online timestamp to keep inactive members away from here - $LAST = " AND last_online >= (UNIX_TIMESTAMP() - %s)"; + $lastOnline = " AND last_online >= (UNIX_TIMESTAMP() - %s)"; $ONLINE = getConfig('ap_inactive_since'); } // Check if at least one is in the active rallye $result = SQL_QUERY_ESC("SELECT userid AS uid, email, gender, surname, family, ".$USE." AS points, last_online AS last FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE `status`='CONFIRMED' AND ".$USE." > 0".$LAST." +WHERE `status`='CONFIRMED' AND ".$USE." > 0".$lastOnline." ORDER BY points DESC, last_online DESC, userid", array($ONLINE), __FILE__, __LINE__); diff --git a/inc/modules/admin/what-overview.php b/inc/modules/admin/what-overview.php index 21452467c8..9d43b8d6bf 100644 --- a/inc/modules/admin/what-overview.php +++ b/inc/modules/admin/what-overview.php @@ -61,14 +61,13 @@ if ($GLOBALS['action'] == "login") { // Are there jobs to be done? if ($JOBS_DONE) { // Generate overview of all main menus - global $menuDesription; - if ((is_array($menuDesription)) && (sizeof($menuDesription) > 0)) { + if ((is_array($GLOBALS['menu']['description'])) && (sizeof($GLOBALS['menu']['description']) > 0)) { $OUT = ""; - foreach ($menuDesription as $key => $value) + foreach ($GLOBALS['menu']['description'] as $key => $value) { // Prepare content $content = array( - 'title' => $menuTitle[$key], + 'title' => $GLOBALS['menu']['title'][$key], 'text' => $value ); diff --git a/inc/modules/admin/what-theme_edit.php b/inc/modules/admin/what-theme_edit.php index eb590f73c7..13ffa23221 100644 --- a/inc/modules/admin/what-theme_edit.php +++ b/inc/modules/admin/what-theme_edit.php @@ -85,8 +85,7 @@ if ($SEL > 0) { set_session('mxchange_theme', $POST['default_theme']); // Set it in config and current theme as well - global $currTheme; - $currTheme = $POST['default_theme']; + $GLOBALS['curr_theme'] = $POST['default_theme']; setConfigEntry('default_theme', $POST['default_theme']); // Save theme diff --git a/inc/modules/member/what-beg2.php b/inc/modules/member/what-beg2.php index ed3311adf1..27bf1f501a 100644 --- a/inc/modules/member/what-beg2.php +++ b/inc/modules/member/what-beg2.php @@ -46,16 +46,16 @@ if (!defined('__SECURITY')) { ADD_DESCR("member", __FILE__); // Autopurge installed? -$LAST = "%s"; $ONLINE = ""; +$lastOnline = "%s"; $ONLINE = ""; if (EXT_IS_ACTIVE("autopurge")) { // Use last online timestamp to keep inactive members away from here - $LAST = " AND last_online >= (UNIX_TIMESTAMP() - %s)"; + $lastOnline = " AND last_online >= (UNIX_TIMESTAMP() - %s)"; $ONLINE = getConfig('ap_inactive_since'); } // Let's check if there are some points left we can "pay"... $result = SQL_QUERY_ESC("SELECT userid, beg_points AS beg, last_online FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE beg_points > 0 AND `status`='CONFIRMED'".$LAST." +WHERE beg_points > 0 AND `status`='CONFIRMED'".$lastOnline." ORDER BY beg_points DESC, last_online DESC, userid LIMIT %s", array($ONLINE, getConfig('beg_ranks')), __FILE__, __LINE__); diff --git a/inc/modules/member/what-bonus.php b/inc/modules/member/what-bonus.php index 60f6163b65..1d2a80411a 100644 --- a/inc/modules/member/what-bonus.php +++ b/inc/modules/member/what-bonus.php @@ -61,16 +61,16 @@ if (GET_EXT_VERSION("bonus") >= "0.6.9") { } // Autopurge installed? -$LAST = "%s"; $ONLINE = ""; +$lastOnline = "%s"; $ONLINE = ""; if (EXT_IS_ACTIVE("autopurge")) { // Use last online timestamp to keep inactive members away from here - $LAST = " AND last_online >= (UNIX_TIMESTAMP() - %s)"; + $lastOnline = " AND last_online >= (UNIX_TIMESTAMP() - %s)"; $ONLINE = getConfig('ap_inactive_since'); } // Let's check if there are some points left we can "pay"... $result = SQL_QUERY_ESC("SELECT userid, ".$USE." AS points, last_online FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE ".$USE." > 0 AND `status`='CONFIRMED'".$LAST." +WHERE ".$USE." > 0 AND `status`='CONFIRMED'".$lastOnline." ORDER BY points DESC, last_online DESC, userid LIMIT %s", array($ONLINE, getConfig('bonus_ranks')), __FILE__, __LINE__); diff --git a/inc/modules/member/what-welcome.php b/inc/modules/member/what-welcome.php index c52971a46e..cb48d773b3 100644 --- a/inc/modules/member/what-welcome.php +++ b/inc/modules/member/what-welcome.php @@ -43,8 +43,8 @@ if (!defined('__SECURITY')) { ADD_DESCR ("member", basename(__FILE__)); // Export data for template -define('_LAST_ONLINE_VALUE', MAKE_DATETIME($LAST['online'])); -define('_LAST_MODULE_VALUE', GET_MOD_DESCR("member", $LAST['module'])); +define('_LAST_ONLINE_VALUE', MAKE_DATETIME($GLOBALS['last']['online'])); +define('_LAST_MODULE_VALUE', GET_MOD_DESCR("member", $GLOBALS['last']['module'])); // Load header template LOAD_TEMPLATE("member_welcome_header"); diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index cb41c079d1..0d53569e82 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -125,8 +125,7 @@ $_CONFIG = array( $GLOBALS['header_sent'] = 0; // Init fatal messages -global $FATAL; -$FATAL = array(); +initFatalMessages(); // Check if this file is writeable or read-only and warn the user if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndTrue('mxchange_installed'))) { @@ -134,7 +133,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT if (empty($GLOBALS['module'])) $GLOBALS['module'] = "index"; // CSS array - $EXT_CSS_FILES = array(); + EXT_INIT_CSS_FILES(); if ((!empty($MySQL['host'])) && (!empty($MySQL['login'])) && (!empty($MySQL['password'])) && (!empty($MySQL['dbase']))) { // Connect to DB diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index db512f6b59..2a9072d897 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -201,8 +201,6 @@ function CHECK_MODULE ($mod) { // Add menu description pending on given file name (without path!) function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) { - global $NAV_DEPTH; - // Use only filename of the FQFN... $file = basename($FQFN); @@ -263,11 +261,11 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) { } // Begin the navigation line - if ((!isset($NAV_DEPTH)) && (!$return)) { - $NAV_DEPTH = 0; + if ((!isset($GLOBALS['nav_depth'])) && (!$return)) { + $GLOBALS['nav_depth'] = 0; $prefix = "
{--YOU_ARE_HERE--} Home"; } else { - if (!$return) $NAV_DEPTH++; + if (!$return) $GLOBALS['nav_depth']++; $prefix = ""; } @@ -302,7 +300,7 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) { //* DEBUG: */ echo __LINE__."+".$type."+
\n"; // Add closing div and br-tag $OUT .= "

\n"; - $NAV_DEPTH = "0"; + $GLOBALS['nav_depth'] = "0"; // Run the filter chain $ret = RUN_FILTER('post_youhere_line', array('access_level' => $ACC_LVL, 'type' => $type, 'content' => "")); @@ -505,7 +503,6 @@ function IS_ADMIN ($admin="") { // Generates a list of "max receiveable emails per day" function ADD_MAX_RECEIVE_LIST ($MODE, $default = "", $return = false) { - global $_POST; $OUT = ""; switch ($MODE) { case "guest": @@ -580,8 +577,9 @@ function SEARCH_EMAIL_USERTAB ($email) { // Checks wether the current user is a member function IS_MEMBER () { - global $status, $LAST; - if (!is_array($LAST)) $LAST = array(); + // @TODO Why is this global??? #100 + global $status; + if (!is_array($GLOBALS['last'])) $GLOBALS['last'] = array(); $ret = false; // is the cache entry there? @@ -606,9 +604,9 @@ function IS_MEMBER () { $valPass = generatePassString($password); // Transfer last module and online time - if ((!empty($mod)) && (empty($LAST['module']))) { - $LAST['module'] = $mod; - $LAST['online'] = $onl; + if ((!empty($mod)) && (empty($GLOBALS['last']['module']))) { + $GLOBALS['last']['module'] = $mod; + $GLOBALS['last']['online'] = $onl; } // END - if // So did we now have valid data and an unlocked user? @@ -694,9 +692,9 @@ function VALIDATE_MENU_ACTION ($MODE, $act, $wht, $UPDATE=false) { // Return result return $ret; } + // -function GET_MOD_DESCR($MODE, $wht, $column="what") -{ +function GET_MOD_DESCR($MODE, $wht, $column="what") { // Fix empty "what" if (empty($wht)) { $wht = "welcome"; @@ -853,9 +851,7 @@ function COUNT_MODULE($mod) { } // Get action value from mode (admin/guest/member) and what-value function GET_ACTION ($MODE, &$wht) { - global $ret; - - // @DEPRECATED Init status + // Init status $ret = ""; //* DEBUG: */ echo __LINE__."=".$MODE."/".$wht."/".$GLOBALS['action']."=
"; diff --git a/inc/pool/pool-bonus.php b/inc/pool/pool-bonus.php index 7c295b2f34..e385882fb2 100644 --- a/inc/pool/pool-bonus.php +++ b/inc/pool/pool-bonus.php @@ -47,8 +47,6 @@ if (defined('__DAILY_RESET')) { } // Need this here -global $REPLACER; - // Only send bonus mail when bonus extension is active and maximum send-mails is not reached if ($GLOBALS['pool_cnt'] < getConfig('max_send')) { // Do we need to send out bonus mails? @@ -101,7 +99,7 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) { // Mark this user as "spammed" ;-) And place a line for him... if (REMOVE_RECEIVER($dummy, $key, $uid, $DATA['id'], $DATA['id'], true) == "done") { // Replace text variables - foreach ($REPLACER as $key => $value) { + foreach ($GLOBALS['replacer'] as $key => $value) { if (isset($DATA[$key])) $DATA['text'] = str_replace($value, $DATA[$key], $DATA['text']); } // END - foreach diff --git a/inc/pool/pool-user.php b/inc/pool/pool-user.php index 96b1280cbd..2245950676 100644 --- a/inc/pool/pool-user.php +++ b/inc/pool/pool-user.php @@ -47,8 +47,6 @@ if (defined('__DAILY_RESET')) { } // Need this here -global $REPLACER; - // Check for freed mail orders to send out if (EXT_IS_ACTIVE("html_mail")) { // 0 1 2 3 4 5 6 7 8 9 10 @@ -59,7 +57,7 @@ if (EXT_IS_ACTIVE("html_mail")) { } // Reset variables -$cnt2 = 0; $LAST_SENT_ID = 0; $cnt_back = array("0"); $pointsBack = array("0"); +$cnt2 = 0; $lastSentId = 0; $cnt_back = array("0"); $pointsBack = array("0"); if (SQL_NUMROWS($result_main) > 0) { // Parse all mails while ($DATA = SQL_FETCHROW($result_main)) { @@ -137,7 +135,7 @@ if (SQL_NUMROWS($result_main) > 0) { $DATA[14] = TRANSLATE_GENDER($gender); // Replace text variables - foreach ($REPLACER as $key => $value) { + foreach ($GLOBALS['replacer'] as $key => $value) { if (isset($DATA[$key])) $DATA[3] = str_replace($value, $DATA[$key], $DATA[3]); } // END - if @@ -189,8 +187,8 @@ if (SQL_NUMROWS($result_main) > 0) { } // Do we have reached the maximum to send mails? || (getConfig('max_send') >= $GLOBALS['pool_cnt']) - //* DEBUG: */ echo "*L:".__LINE__."/".$GLOBALS['pool_cnt'].">=".$DATA[8]."/".getConfig('max_send').">=".$GLOBALS['pool_cnt']."/".$LAST_SENT_ID."!=".$DATA[0]."*
"; - if ((($GLOBALS['pool_cnt'] >= $DATA[8])) && ($LAST_SENT_ID != $DATA[0])) { + //* DEBUG: */ echo "*L:".__LINE__."/".$GLOBALS['pool_cnt'].">=".$DATA[8]."/".getConfig('max_send').">=".$GLOBALS['pool_cnt']."/".$lastSentId."!=".$DATA[0]."*
"; + if ((($GLOBALS['pool_cnt'] >= $DATA[8])) && ($lastSentId != $DATA[0])) { // Prepare content $content = array( 'sender_uid' => $DATA[1], @@ -230,7 +228,7 @@ if (SQL_NUMROWS($result_main) > 0) { SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET timestamp_send=UNIX_TIMESTAMP() WHERE pool_id=%s LIMIT 1", array(bigintval($DATA[0])), __FILE__, __LINE__); - $LAST_SENT_ID = $DATA[0]; $GLOBALS['pool_cnt'] = 0; + $lastSentId = $DATA[0]; $GLOBALS['pool_cnt'] = 0; $cnt2 += $GLOBALS['pool_cnt']; // Update mediadata if version is 0.0.4 or higher diff --git a/inc/stylesheet.php b/inc/stylesheet.php index e9aa80ca45..6e6fafe2cd 100644 --- a/inc/stylesheet.php +++ b/inc/stylesheet.php @@ -51,10 +51,7 @@ if (!isConfigEntrySet('css_php')) setConfigEntry('css_php', "FILE"); // Output CSS files or content or link to css.php ? if (($GLOBALS['output_mode'] == "1") || (getConfig('css_php') == "DIRECT")) { // Load CSS files - if (is_array($EXT_CSS_FILES)) { - // Load extension's CSS files - foreach ($EXT_CSS_FILES as $value) $STYLES[] = $value; - } // END - if + $STYLES = merge_array($STYLES, EXT_GET_CSS_FILES()); // Output inclusion lines foreach ($STYLES as $value) { diff --git a/index.php b/index.php index e9264b7bcc..4f2b720262 100644 --- a/index.php +++ b/index.php @@ -36,15 +36,15 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; - -// Set "CSS-Mode" -$GLOBALS['output_mode'] = "0"; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Set module $GLOBALS['module'] = "index"; +// Set "CSS-Mode" +$GLOBALS['output_mode'] = "0"; + // Load config.php require("inc/config.php"); diff --git a/install.php b/install.php index 8cab9a1ce1..6858ef7d64 100644 --- a/install.php +++ b/install.php @@ -48,7 +48,6 @@ define('mxchange_installing', true); require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; diff --git a/js.php b/js.php index 9ef588d72b..ebbdbd789e 100644 --- a/js.php +++ b/js.php @@ -38,7 +38,6 @@ define('_OB_CACHING', "old"); require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; @@ -49,7 +48,8 @@ $GLOBALS['action'] = ""; // pattern is given... // // But mxchange 0.3.0 will show that in better way! :D :D :D -$GLOBALS['output_mode'] = "1"; $GLOBALS['module'] = "js"; +$GLOBALS['output_mode'] = "1"; +$GLOBALS['module'] = "js"; // Load the required file(s) require("inc/config.php"); diff --git a/lead-confirm.php b/lead-confirm.php index 1e03ef8159..3d51c0bb2e 100644 --- a/lead-confirm.php +++ b/lead-confirm.php @@ -35,9 +35,9 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action, $startTime; $GLOBALS['startTime'] = microtime(true); -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Set module $GLOBALS['module'] = "lead-confirm"; diff --git a/login.php b/login.php index 31c3fdb11a..231f9cdf27 100644 --- a/login.php +++ b/login.php @@ -35,8 +35,8 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Set module $GLOBALS['module'] = "login"; diff --git a/mailid.php b/mailid.php index 4371aad6f9..0847e7d3d6 100644 --- a/mailid.php +++ b/mailid.php @@ -35,11 +35,12 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Tell everyone we are in this module -$GLOBALS['module'] = "mailid"; $GLOBALS['output_mode'] = -1; +$GLOBALS['module'] = "mailid"; +$GLOBALS['output_mode'] = -1; // Load the required file(s) require("inc/config.php"); diff --git a/mailid_top.php b/mailid_top.php index 42c81598e8..240588bcfa 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -35,11 +35,12 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Tell everyone we are in this module -$GLOBALS['module'] = "mailid"; $GLOBALS['output_mode'] = 0; +$GLOBALS['module'] = "mailid"; +$GLOBALS['output_mode'] = 0; // Load the required file(s) require("inc/config.php"); diff --git a/modules.php b/modules.php index 0b111174af..d19dbb2c85 100644 --- a/modules.php +++ b/modules.php @@ -38,10 +38,10 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action, $startTime; $GLOBALS['startTime'] = microtime(true); $GLOBALS['output_mode'] = 0; -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; $GLOBALS['userid'] = 0; // Fix missing module to "index" diff --git a/ref.php b/ref.php index a9dc0ecc22..34fe633411 100644 --- a/ref.php +++ b/ref.php @@ -35,11 +35,12 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Set module -$GLOBALS['module'] = "ref"; $GLOBALS['output_mode'] = -1; +$GLOBALS['module'] = "ref"; +$GLOBALS['output_mode'] = -1; // Load the required file(s) require("inc/config.php"); diff --git a/show_bonus.php b/show_bonus.php index eb0060fa43..b92c0a8921 100644 --- a/show_bonus.php +++ b/show_bonus.php @@ -35,13 +35,13 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action, $startTime; $GLOBALS['startTime'] = microtime(true); $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; // Set this because we have no module in URI -$GLOBALS['module'] = "show_bonus"; $GLOBALS['output_mode'] = 0; +$GLOBALS['module'] = "show_bonus"; +$GLOBALS['output_mode'] = 0; // Load the required file(s) require("inc/config.php"); diff --git a/sponsor_confirm.php b/sponsor_confirm.php index 9ad343c377..5fb6ec5781 100644 --- a/sponsor_confirm.php +++ b/sponsor_confirm.php @@ -34,8 +34,8 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Set module $GLOBALS['module'] = "sponsor_confirm"; diff --git a/sponsor_ref.php b/sponsor_ref.php index a764d2236d..d3a6f6795e 100644 --- a/sponsor_ref.php +++ b/sponsor_ref.php @@ -34,7 +34,6 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; // Set module diff --git a/surfbar.php b/surfbar.php index 80e96057aa..5ed6a8aff7 100644 --- a/surfbar.php +++ b/surfbar.php @@ -35,10 +35,10 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action, $startTime, $SURFBAR_CACHE; -$SURFBAR_CACHE = array(); +$GLOBALS['cache_array']['surfbar'] = array(); $GLOBALS['startTime'] = microtime(true); -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Set module $GLOBALS['module'] = "surfbar"; diff --git a/view.php b/view.php index 7c311fac6f..f1d8562929 100644 --- a/view.php +++ b/view.php @@ -35,11 +35,12 @@ require("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action; -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Set module -$GLOBALS['module'] = "view"; $GLOBALS['output_mode'] = -1; +$GLOBALS['module'] = "view"; +$GLOBALS['output_mode'] = -1; // Load the required file(s) require("inc/config.php");