From 3b7577d3b3e6522d8898ed1799031b6de696accc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 20 Dec 2008 10:54:11 +0000 Subject: [PATCH] Global removed on many places, rewritten to use incrementConfigEntry() --- inc/databases.php | 2 +- inc/extensions.php | 22 +++++----- inc/functions.php | 57 +++++++++++--------------- inc/libs/admins_functions.php | 4 +- inc/libs/rallye_functions.php | 19 ++++----- inc/libs/theme_functions.php | 12 +++--- inc/modules/admin/admin-inc.php | 17 ++++---- inc/mysql-manager.php | 72 ++++++++++++++------------------- 8 files changed, 88 insertions(+), 117 deletions(-) diff --git a/inc/databases.php b/inc/databases.php index ccf528d3b3..62ecf0d997 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -115,7 +115,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // Current SVN revision -define('CURR_SVN_REVISION', "689"); +define('CURR_SVN_REVISION', "690"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/extensions.php b/inc/extensions.php index 0e49343d0a..5abc6756d5 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -329,7 +329,7 @@ function EXTENSION_RUN_SQLS ($ext_id, $load_mode) { // Check if given extension is active function EXT_IS_ACTIVE ($ext_name) { - global $cacheArray, $_CONFIG; + global $cacheArray; // Extensions are all inactive during installation if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing')) || (empty($ext_name))) return false; @@ -344,7 +344,7 @@ function EXT_IS_ACTIVE ($ext_name) { $active = $cacheArray['extensions']['ext_active'][$ext_name]; // Count cache hits - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif (($ext_name == "cache") || (GET_EXT_VERSION("cache") == "")) { //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "DB! ext_name={$ext_name}"); // Load from database @@ -377,7 +377,7 @@ function EXT_IS_ACTIVE ($ext_name) { } // Get version from extensions function GET_EXT_VERSION ($ext_name) { - global $cacheArray, $_CONFIG, $cacheInstance; + global $cacheArray, $cacheInstance; $ext_ver = false; // Extensions are all inactive during installation @@ -391,7 +391,7 @@ function GET_EXT_VERSION ($ext_name) { $ext_ver = $cacheArray['extensions']['ext_version'][$ext_name]; // Count cache hits - if (getConfig('cache_hits') > 0) $_CONFIG['cache_hits']++; else $_CONFIG['cache_hits'] = 1; + incrementConfigEntry('cache_hits'); } elseif (!is_object($cacheInstance)) { // Load from database $result = SQL_QUERY_ESC("SELECT ext_version FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1", @@ -575,7 +575,7 @@ function EXTENSION_VERBOSE_TABLE ($queries = array(), $title = ADMIN_SQLS_EXECUT // Get extension name from id function GET_EXT_NAME ($ext_id) { - global $cacheArray, $_CONFIG; + global $cacheArray; // Init extension name $ret = ""; @@ -586,7 +586,7 @@ function GET_EXT_NAME ($ext_id) { $ret = $cacheArray['extensions']['ext_name'][$ext_id]; // Count cache hits - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif (!EXT_IS_ACTIVE("cache")) { // Load from database $result = SQL_QUERY_ESC("SELECT ext_name FROM "._MYSQL_PREFIX."_extensions WHERE id=%s LIMIT 1", @@ -599,7 +599,7 @@ function GET_EXT_NAME ($ext_id) { // Get extension id from name function GET_EXT_ID ($ext_name) { - global $cacheArray, $_CONFIG; + global $cacheArray; // Init ID number $ret = 0; @@ -608,7 +608,7 @@ function GET_EXT_ID ($ext_name) { $ret = $cacheArray['extensions']['ext_id'][$ext_name]; // Count cache hits - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif (!EXT_IS_ACTIVE("cache")) { // Load from database $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1", @@ -734,7 +734,7 @@ 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, $_CONFIG; + global $cacheArray; // All is false by default $ret = false; @@ -744,11 +744,11 @@ function MODULE_HAS_MENU ($mod, $forceDb = false) { if (isset($cacheArray['modules']['has_menu'][$mod])) { // Check module cache and count hit $ret = ($cacheArray['modules']['has_menu'][$mod] == "Y"); - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif (isset($cacheArray['extensions']['ext_menu'][$mod])) { // Check cache and count hit $ret = ($cacheArray['extensions']['ext_menu'][$mod] == "Y"); - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif ((IS_ADMIN()) && ($mod == "admin")) { // Admin module has always a menu! $ret = true; diff --git a/inc/functions.php b/inc/functions.php index 67a149808f..d26f28da5f 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -530,8 +530,8 @@ function SEND_RAW_EMAIL ($to, $subject, $msg, $from) { // // Generate a password in a specified length or use default password length -function GEN_PASS($LEN = 0) { - global $_CONFIG; +function GEN_PASS ($LEN = 0) { + // Auto-fix invalid length of zero if ($LEN == 0) $LEN = getConfig('pass_len'); // Initialize array with all allowed chars @@ -748,8 +748,6 @@ function GET_LANGUAGE() { } // function SET_LANGUAGE($lang) { - global $_CONFIG; - // Accept only first 2 chars! $lang = substr(SQL_ESCAPE(strip_tags($lang)), 0, 2); @@ -758,7 +756,7 @@ function SET_LANGUAGE($lang) { } // function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") { - global $DATA, $_CONFIG, $REPLACER; + global $DATA, $REPLACER; // Make sure all template names are lowercase! $template = strtolower($template); @@ -923,7 +921,7 @@ function MAKE_TIME($H, $M, $S, $stamp) { } // function LOAD_URL($URL, $addUrlData=true) { - global $CSS, $_CONFIG, $footer; + global $CSS, $footer; // Compile out URI codes $URL = COMPILE_CODE($URL); @@ -1105,7 +1103,7 @@ function array_pk_sort(&$array, $a_sort, $primary_key = 0, $order = -1, $nums = } // function ADD_SELECTION($type, $DEFAULT, $prefix="", $id="0") { - global $MONTH_DESCR, $_CONFIG; + global $MONTH_DESCR; $OUT = ""; if ($type == "yn") { @@ -1233,8 +1231,6 @@ function TRANSLATE_YESNO($yn) // Optional : $DATA // function GEN_RANDOM_CODE($length, $code, $uid, $DATA="") { - global $_CONFIG; - // Fix missing _MAX constant if (!defined('_MAX')) define('_MAX', 15235); @@ -1309,8 +1305,6 @@ function bigintval($num, $castValue = true) { } // Insert the code in $img_code into jpeg or PNG image function GENERATE_IMAGE($img_code, $header=true) { - global $_CONFIG; - if ((strlen($img_code) > 6) || (empty($img_code)) || (getConfig('code_length') == 0)) { // Stop execution of function here because of over-sized code length return; @@ -1360,8 +1354,6 @@ function GENERATE_IMAGE($img_code, $header=true) { } // Create selection box or array of splitted timestamp function CREATE_TIME_SELECTIONS ($timestamp, $prefix="", $display="", $align="center", $return_array=false) { - global $_CONFIG; - // Calculate 2-seconds timestamp $stamp = round($timestamp); //* DEBUG: */ print("*".$stamp."/".$timestamp."*
"); @@ -1553,8 +1545,8 @@ function CREATE_TIME_SELECTIONS ($timestamp, $prefix="", $display="", $align="ce return $OUT; } // -function CREATE_TIMESTAMP_FROM_SELECTIONS($prefix, $POST) { - global $_CONFIG; +function CREATE_TIMESTAMP_FROM_SELECTIONS ($prefix, $POST) { + // Initial return value $ret = 0; // Do we have a leap year? @@ -1814,8 +1806,6 @@ function POST_URL ($script, $postData) { // Sends a raw request to another host function SEND_RAW_REQUEST ($host, $request) { - global $_CONFIG; - // Initialize array $response = array("", "", ""); @@ -2025,7 +2015,7 @@ function CREATE_EMAIL_LINK ($email, $table = "admins") { } // Generate a hash for extra-security for all passwords function generateHash ($plainText, $salt = "") { - global $_CONFIG, $_SERVER; + global $_SERVER; // Is the required extension "sql_patches" there and a salt is not given? if (((EXT_VERSION_IS_OLDER("sql_patches", "0.3.6")) || (!EXT_IS_ACTIVE("sql_patches"))) && (empty($salt))) { @@ -2077,8 +2067,6 @@ function generateHash ($plainText, $salt = "") { } // function scrambleString($str) { - global $_CONFIG; - // Init $scrambled = ""; @@ -2110,7 +2098,6 @@ function scrambleString($str) { } // function descrambleString($str) { - global $_CONFIG; // Scramble only 40 chars long strings if (strlen($str) != 40) return $str; @@ -2158,8 +2145,8 @@ function genScrambleString($len) { } // Append data like session ID or referal ID to the given URL which would // normally be stored in cookies -function ADD_URL_DATA($URL) { - global $_CONFIG; +function ADD_URL_DATA ($URL) { + // Init add $ADD = ""; // Determine URL binder @@ -2194,8 +2181,6 @@ function ADD_URL_DATA($URL) { } // Generate an PGP-like encrypted hash of given hash for e.g. cookies function generatePassString($passHash) { - global $_CONFIG; - // Return vanilla password hash $ret = $passHash; @@ -2263,8 +2248,6 @@ function mxchange_die ($msg) { // Display parsing time and number of SQL queries in footer function DISPLAY_PARSING_TIME_FOOTER() { - global $_CONFIG; - // Is the timer started? if (!isset($GLOBALS['startTime'])) { // Abort here @@ -2467,8 +2450,6 @@ function GET_DIR_AS_ARRAY ($baseDir, $prefix) { } // Load more reset scripts function RESET_ADD_INCLUDES () { - global $_CONFIG; - // Is the reset set or old sql_patches? if ((!defined('__DAILY_RESET')) || (EXT_VERSION_IS_OLDER("sql_patches", "0.4.5"))) { // Then abort here @@ -2629,7 +2610,7 @@ function HANDLE_LOGIN_FAILTURES ($accessLevel) { } // Rebuild cache function REBUILD_CACHE ($cache, $inc="") { - global $cacheInstance, $_CONFIG, $CSS; + global $cacheInstance, $CSS; // Shall I remove the cache file? if ((EXT_IS_ACTIVE("cache")) && (is_object($cacheInstance))) { @@ -2786,7 +2767,7 @@ function ADD_NEW_BONUS_MAIL ($data, $mode="", $output=true) { } // Determines referal id and sets it function DETERMINE_REFID () { - global $_CONFIG, $CLICK, $_SERVER; + global $CLICK, $_SERVER; // Check if refid is set if ((!empty($_GET['user'])) && ($CLICK == 1) && (basename($_SERVER['PHP_SELF']) == "click.php")) { @@ -2889,7 +2870,7 @@ function getMessage ($messageId) { // Get current theme name function GET_CURR_THEME() { - global $INC_POOL, $_CONFIG, $CSS, $cacheArray; + global $INC_POOL, $CSS, $cacheArray; // The default theme is 'default'... ;-) $ret = "default"; @@ -2942,7 +2923,7 @@ function GET_CURR_THEME() { // Get id from theme function THEME_GET_ID ($name) { - global $cacheArray, $_CONFIG; + global $cacheArray; // Is the extension "theme" installed? if (!EXT_IS_ACTIVE("theme")) { @@ -2959,7 +2940,7 @@ function THEME_GET_ID ($name) { $id = $cacheArray['themes']['id'][$name]; // Count up - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif (GET_EXT_VERSION("cache") != "0.1.8") { // Check if current theme is already imported or not $result = SQL_QUERY_ESC("SELECT id FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' LIMIT 1", @@ -2979,6 +2960,14 @@ function THEME_GET_ID ($name) { return $id; } +// Increment or init with 1 the given config entry +function incrementConfigEntry ($configEntry) { + global $_CONFIG; + + // Increment it if set or init it with 1 + if (getConfig($configEntry) > 0) { $_CONFIG[$configEntry]++; } else { $_CONFIG[$configEntry] = 1; } +} + ////////////////////////////////////////////////// // // // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS // diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index b792bbbb4f..403c32150c 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -39,7 +39,7 @@ if (!defined('__SECURITY')) { // Check ACL for menu combination function ADMINS_CHECK_ACL($act, $wht) { - global $cacheArray, $_CONFIG, $cacheInstance; + global $cacheArray, $cacheInstance; // If action is login or logout allow allways! $default = "allow"; if (($act == "login") || ($act == "logout")) return true; @@ -87,7 +87,7 @@ function ADMINS_CHECK_ACL($act, $wht) { } if ($lines == 1) { // Count cache hits - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); break; } } diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index 9e096a317e..c313fa7389 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -42,7 +42,7 @@ function RALLYE_AUTOSTART_RALLYES($result) { // Global data array for LOAD_EMAIL_TEMPLATE() $DATA = array(); - global $DATA, $_CONFIG; + global $DATA; // Load all rallyes (usally we have only one rallye active per time! list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result); @@ -184,8 +184,6 @@ function RALLYE_ADD_PRICES($rallye,$mode="email") // function RALLYE_ADD_TOPUSERS($rallye,$default=0) { - global $_CONFIG; - // First check how many prices are set $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_prices WHERE rallye_id=%s ORDER BY price_level", array(bigintval($rallye)), __FILE__, __LINE__); @@ -348,7 +346,7 @@ VALUES ('%s','%s','0')", // function RALLYE_EXPIRE_RALLYES($result) { - global $DATA, $_CONFIG; + global $DATA; // Load rallye data list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result); @@ -650,7 +648,7 @@ function RALLYE_LIST_WINNERS($rallye,$default=0) // function RALLYE_DELETE_EXPIRED_RALLYES() { - global $DATA, $_CONFIG; + global $DATA; // Check for expired rallyes $EXPIRE = getConfig('one_day') * 3; // @TODO The hard-coded value... @@ -739,7 +737,7 @@ function RALLYE_TEMPLATE_SELECTION($name="template", $default="") } // function RALLYE_GET_REFCOUNT($uid, $old=0) { - global $_CONFIG, $cacheArray; + global $cacheArray; // Check current refs if (GET_EXT_VERSION("cache") >= "0.1.2") { @@ -773,7 +771,7 @@ function RALLYE_GET_REFCOUNT($uid, $old=0) { if ($cnt > 0) { // Count cache hits - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); // Remove old refs //* DEBUG: */ echo "+".$cnt."/".$old."+
"; @@ -788,12 +786,9 @@ ON s.level=d.level WHERE s.userid=%s AND s.level=1", array(bigintval($uid)), __FILE__, __LINE__); list($cnt) = SQL_FETCHROW($result_ref); SQL_FREERESULT($result_ref); - if (empty($cnt)) - { + if (empty($cnt)) { $cnt = 0; - } - else - { + } else { $cnt -= $old; } } diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php index db1eb19ee1..0169427c73 100644 --- a/inc/libs/theme_functions.php +++ b/inc/libs/theme_functions.php @@ -81,7 +81,7 @@ function THEME_SELECTION_BOX($mod, $act, $wht, $result) { // Get version from name function THEME_GET_VERSION ($name) { - global $cacheArray, $_CONFIG; + global $cacheArray; // Is the extension "theme" installed? if (!EXT_IS_ACTIVE("theme")) { @@ -98,7 +98,7 @@ function THEME_GET_VERSION ($name) { $cver = $cacheArray['themes']['theme_ver'][$name]; // Count up - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif (GET_EXT_VERSION("cache") != "0.1.8") { // Load version from database $result = SQL_QUERY_ESC("SELECT theme_ver FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' LIMIT 1", @@ -126,7 +126,7 @@ function THEME_CHECK_EXIST ($name) { // Checks if a theme is active function THEME_IS_ACTIVE ($name) { - global $cacheArray, $_CONFIG; + global $cacheArray; // Is the extension "theme" installed? if (!EXT_IS_ACTIVE("theme")) { @@ -143,7 +143,7 @@ function THEME_IS_ACTIVE ($name) { $active = ($cacheArray['themes']['theme_active'][$name] == "Y"); // Count up - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif (GET_EXT_VERSION("cache") != "0.1.8") { // Check if current theme is already imported or not $result = SQL_QUERY_ESC("SELECT theme_active FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' AND theme_active='Y' LIMIT 1", @@ -162,7 +162,7 @@ function THEME_IS_ACTIVE ($name) { // Gets current human-readable theme name function GET_CURR_THEME_NAME () { - global $cacheArray, $_CONFIG; + global $cacheArray; // Is the extension "theme" installed? if (!EXT_IS_ACTIVE("theme")) { @@ -179,7 +179,7 @@ function GET_CURR_THEME_NAME () { $name = $cacheArray['themes']['theme_name'][$name]; // Count up - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif (GET_EXT_VERSION("cache") != "0.1.8") { // Check if current theme is already imported or not $result = SQL_QUERY_ESC("SELECT theme_name FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' AND theme_active='Y' LIMIT 1", diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 38bd814274..5965d8f394 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -59,7 +59,7 @@ function REGISTER_ADMIN ($user, $md5, $email=WEBMASTER) } // Only be executed on login procedure! function CHECK_ADMIN_LOGIN ($admin_login, $password) { - global $cacheArray, $_CONFIG, $cacheInstance; + global $cacheArray, $cacheInstance; // By default no admin is found $ret = "404"; @@ -75,7 +75,7 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password) { // Get password from cache $data['password'] = $cacheArray['admins']['password'][$aid]; $ret = "pass"; - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); // Include more admins data? if (GET_EXT_VERSION("admins") >= "0.7.0") { @@ -212,7 +212,7 @@ function LOGIN_ADMIN ($adminLogin, $passHash) { // Only be executed on cookie checking function CHECK_ADMIN_COOKIES ($admin_login, $password) { - global $cacheArray, $_CONFIG; + global $cacheArray; $ret = "404"; $pass = ""; // Get hash @@ -303,7 +303,7 @@ function admin_WriteData ($file, $comment, $prefix, $suffix, $DATA, $seek=0) { // function ADMIN_DO_ACTION($wht) { - global $menuDesription, $menuTitle, $_CONFIG, $cacheArray, $DATA; + global $menuDesription, $menuTitle, $cacheArray, $DATA; //* DEBUG: */ echo __LINE__."*".$wht."/".$GLOBALS['module']."/".$GLOBALS['action']."/".$GLOBALS['what']."*
\n"; if (EXT_IS_ACTIVE("cache")) { @@ -373,7 +373,7 @@ LIMIT 1", array($act, $wht, $wht), __FILE__, __LINE__); } // function ADD_ADMIN_MENU($act, $wht, $return=false) { - global $menuDesription, $menuTitle, $cacheInstance, $_CONFIG; + global $menuDesription, $menuTitle, $cacheInstance; // Init variables $SUB = false; @@ -773,7 +773,7 @@ function ADMIN_USER_PROFILE_LINK ($uid, $title="", $wht="list_user") { } // function ADMIN_CHECK_MENU_MODE() { - global $_CONFIG, $cacheArray; + global $cacheArray; // Set the global mode as the mode for all admins $MODE = getConfig('admin_menu'); @@ -786,7 +786,7 @@ function ADMIN_CHECK_MENU_MODE() { if (isset($cacheArray['admins']['la_mode'][$aid])) { // Load from cache $ADMIN = $cacheArray['admins']['la_mode'][$aid]; - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif (GET_EXT_VERSION("admins") >= "0.6.7") { // Load from database when version of "admins" is enough $result = SQL_QUERY_ESC("SELECT la_mode FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1", @@ -808,7 +808,6 @@ function ADMIN_CHECK_MENU_MODE() { } // Change activation status function ADMIN_CHANGE_ACTIVATION_STATUS ($IDs, $table, $row, $idRow = "id") { - global $_CONFIG; $cnt = 0; $newStatus = "Y"; if ((is_array($IDs)) && (count($IDs) > 0)) { // "Walk" all through and count them @@ -887,7 +886,6 @@ function ADMIN_SEND_BUILD_MAILS ($mode, $table, $content, $id, $subjectPart="") } // Build a special template list function ADMIN_BUILD_LIST ($listType, $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn) { - global $_CONFIG; $OUT = ""; $SW = 2; // "Walk" through all entries @@ -1207,7 +1205,6 @@ function ADMIN_TEST_PROXY_SETTINGS ($settingsArray) { } // Sends out a link to the given email adress so the admin can reset his/her password function ADMIN_SEND_PASSWORD_RESET_LINK ($email) { - global $_CONFIG; // Init output $OUT = ""; diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 3e3b5124a4..ef9e1cc911 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -39,7 +39,7 @@ if (!defined('__SECURITY')) { // function ADD_MODULE_TITLE($mod) { - global $cacheArray, $_CONFIG; + global $cacheArray; $name = ""; $result = false; // Is the script installed? @@ -50,7 +50,7 @@ function ADD_MODULE_TITLE($mod) { $name = $cacheArray['modules']['title'][$mod]; // Update cache hits - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif (!EXT_IS_ACTIVE("cache")) { // Load from database $result = SQL_QUERY_ESC("SELECT title FROM "._MYSQL_PREFIX."_mod_reg WHERE module='%s' LIMIT 1", array($mod), __FILE__, __LINE__); @@ -79,7 +79,7 @@ function ADD_MODULE_TITLE($mod) { // Check validity of a given module name (no file extension) function CHECK_MODULE ($mod) { // We need them now here... - global $cacheArray, $_CONFIG, $cacheInstance; + global $cacheArray, $cacheInstance; // Filter module name (names with low chars and underlines are fine!) $mod = preg_replace("/[^a-z_]/", "", $mod); @@ -115,7 +115,7 @@ function CHECK_MODULE ($mod) { $mem = $cacheArray['modules']['mem_only'][$mod_chk]; // Update cache hits - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); $found = true; } else { // No, then we have to update it! @@ -202,8 +202,8 @@ function CHECK_MODULE ($mod) { } // Add menu description pending on given file name (without path!) -function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true) { - global $NAV_DEPTH, $_CONFIG; +function ADD_DESCR ($ACC_LVL, $file, $return = false, $output = true) { + global $NAV_DEPTH; // Use only filename of the file ;) $file = basename($file); @@ -297,7 +297,6 @@ function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true) { // Can we close the you-are-here navigation? //* DEBUG: */ echo __LINE__."*".$type."/".$GLOBALS['what']."*
\n"; - //* DEBUG: */ die("
".print_r($_CONFIG, true)."
"); if (($type == "what") || (($type == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview")))) { //* DEBUG: */ echo __LINE__."+".$type."+
\n"; // Add closing div and br-tag @@ -324,9 +323,7 @@ function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true) { } } // -function ADD_MENU($MODE, $act, $wht) { - global $_CONFIG; - +function ADD_MENU ($MODE, $act, $wht) { // Init some variables $main_cnt = 0; $AND = ""; @@ -441,9 +438,10 @@ function ADD_MENU($MODE, $act, $wht) { } } // This patched function will reduce many SELECT queries for the specified or current admin login -function IS_ADMIN($admin="") -{ - global $cacheArray, $_CONFIG; +function IS_ADMIN ($admin="") { + global $cacheArray; + + // Init variables $ret = false; $passCookie = ""; $valPass = ""; //* DEBUG: */ echo __LINE__."ADMIN:".$admin."
"; @@ -461,7 +459,7 @@ function IS_ADMIN($admin="") $valPass = $cacheArray['admin_hash']; } elseif ((!empty($passCookie)) && (isset($cacheArray['admins']['password'][$admin])) && (!empty($admin))) { // Count cache hits - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); // Login data is valid or not? $valPass = generatePassString($cacheArray['admins']['password'][$admin]); @@ -735,9 +733,8 @@ function GET_MOD_DESCR($MODE, $wht, $column="what") return $ret; } // -function SEND_MODE_MAILS($mod, $modes) -{ - global $_CONFIG, $DATA; +function SEND_MODE_MAILS($mod, $modes) { + global $DATA; // Load hash $result_main = SQL_QUERY_ESC("SELECT password FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1", @@ -867,9 +864,9 @@ function COUNT_MODULE($mod) { } // END - if } // Get action value from mode (admin/guest/member) and what-value -function GET_ACTION ($MODE, &$wht) -{ - global $ret, $_CONFIG; +function GET_ACTION ($MODE, &$wht) { + global $ret; + // @DEPRECATED Init status $ret = ""; @@ -1062,7 +1059,7 @@ function GET_TOTAL_DATA ($search, $tableName, $lookFor, $whereStatement="userid" } // "Getter fro ref level percents function GET_REF_LEVEL_PERCENTS ($level) { - global $cacheInstance, $_CONFIG, $cacheArray; + global $cacheInstance, $cacheArray; // Default is zero $per = 0; @@ -1076,7 +1073,7 @@ function GET_REF_LEVEL_PERCENTS ($level) { $per = $cacheArray['ref_depths']['percents'][$key]; // Count cache hit - if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } } elseif (!EXT_IS_ACTIVE("cache")) { // Get referal data @@ -1111,7 +1108,7 @@ function GET_REF_LEVEL_PERCENTS ($level) { */ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid="0", $locked=false, $add_mode="ref") { //* DEBUG: */ print "----------------------- ".__FUNCTION__." - ENTRY ------------------------