From 52e8a0635bd0b7c653845685c55e4e5f251375fe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 18 Feb 2008 21:54:37 +0000 Subject: [PATCH] more in naming convention applied, you should better kill inc/cache/*.cache files (not directory!) to avoid trouble with the refactured cache class --- doubler.php | 6 +- inc/db/lib-mysql3.php | 12 +- inc/doubler_send.php | 4 +- inc/extensions.php | 46 +- inc/extensions/ext-active.php | 6 +- inc/extensions/ext-autopurge.php | 30 +- inc/extensions/ext-beg.php | 38 +- inc/extensions/ext-birthday.php | 10 +- inc/extensions/ext-bonus.php | 56 +- inc/extensions/ext-cache.php | 36 +- inc/extensions/ext-doubler.php | 42 +- inc/extensions/ext-holiday.php | 10 +- inc/extensions/ext-maintenance.php | 6 +- inc/extensions/ext-mediadata.php | 8 +- inc/extensions/ext-newsletter.php | 8 +- inc/extensions/ext-nickname.php | 10 +- inc/extensions/ext-order.php | 14 +- inc/extensions/ext-other.php | 10 +- inc/extensions/ext-register.php | 6 +- inc/extensions/ext-rewrite.php | 6 +- inc/extensions/ext-sql_patches.php | 86 +-- inc/extensions/ext-top10.php | 6 +- inc/extensions/ext-transfer.php | 16 +- inc/extensions/ext-user.php | 8 +- inc/extensions/ext-wernis.php | 16 +- inc/gen_sql_patches.php | 6 +- inc/libs/admins_functions.php | 38 +- inc/libs/bonus_functions.php | 2 +- inc/libs/cache_functions.php | 639 +++++++++++------------ inc/load_cache.php | 186 +++---- inc/load_extensions.php | 56 +- inc/modules/admin/admin-inc.php | 35 +- inc/modules/admin/overview-inc.php | 14 +- inc/modules/admin/what-admins_add.php | 4 +- inc/modules/admin/what-admins_edit.php | 2 +- inc/modules/admin/what-admins_mails.php | 4 +- inc/modules/admin/what-config_admins.php | 6 +- inc/modules/admin/what-config_cache.php | 28 +- inc/modules/admin/what-config_home.php | 2 +- inc/modules/admin/what-config_mods.php | 2 +- inc/modules/admin/what-config_points.php | 10 +- inc/modules/admin/what-extensions.php | 14 +- inc/modules/admin/what-list_beg.php | 2 +- inc/modules/admin/what-list_bonus.php | 2 +- inc/modules/admin/what-maintenance.php | 2 +- inc/modules/admin/what-theme_check.php | 2 +- inc/modules/guest/action-online.php | 2 +- inc/modules/member/what-transfer.php | 4 +- inc/monthly/monthly_beg.php | 2 +- inc/monthly/monthly_bonus.php | 2 +- inc/monthly/monthly_newsletter.php | 9 +- inc/mysql-connect.php | 2 +- inc/mysql-manager.php | 105 ++-- inc/patch-system.php | 8 +- inc/pool-update.php | 28 +- inc/reset/reset_daily.php | 10 +- 56 files changed, 857 insertions(+), 867 deletions(-) diff --git a/doubler.php b/doubler.php index 214641567f..f2690ca9bd 100644 --- a/doubler.php +++ b/doubler.php @@ -146,14 +146,14 @@ if (defined('mxchange_installed') && (mxchange_installed)) // Add points to "total payed" including charge $points = $_POST['points'] - $_POST['points'] * $_CONFIG['doubler_charge']; - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET doubler_points=doubler_points+%s WHERE config='0' LIMIT 1", + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET doubler_points=doubler_points+%s WHERE config=0 LIMIT 1", array($points), __FILE__, __LINE__); $_CONFIG['doubler_points'] += $points; // Destroy cache if (GET_EXT_VERSION("cache") >= "0.1.2") { - if ($CACHE->cache_file("config", true)) $CACHE->cache_destroy(); + if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy(); } // Add second line for the referral but only when uid != refid @@ -167,7 +167,7 @@ if (defined('mxchange_installed') && (mxchange_installed)) } // Update usage counter - $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET doubler_counter=doubler_counter+1 WHERE config='0' LIMIT 1", __FILE__, __LINE__); + $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET doubler_counter=doubler_counter+1 WHERE config=0 LIMIT 1", __FILE__, __LINE__); $_CONFIG['doubler_counter']++; // Set constant diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 8dec70f75c..c0af223167 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -180,21 +180,21 @@ function SQL_SELECT_DB($DB, $link, $F, $L) // SQL close link function SQL_CLOSE($link, $F, $L) { - global $_CONFIG, $CACHE, $CFG_CACHE; - if ((GET_EXT_VERSION("cache") >= "0.0.7") && (isset($_CONFIG['db_hits'])) && (isset($_CONFIG['cache_hits'])) && (is_object($CACHE))) + global $_CONFIG, $cacheInstance, $cacheArray; + if ((GET_EXT_VERSION("cache") >= "0.0.7") && (isset($_CONFIG['db_hits'])) && (isset($_CONFIG['cache_hits'])) && (is_object($cacheInstance))) { // Update counter for db/cache - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET db_hits=%d, cache_hits=%d WHERE config='0' LIMIT 1", + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET db_hits=%d, cache_hits=%d WHERE config=0 LIMIT 1", array(bigintval($_CONFIG['db_hits']), bigintval($_CONFIG['cache_hits'])), __FILE__, __LINE__); // Update cache here if (GET_EXT_VERSION("cache") >= "0.1.2") { - if ($CACHE->cache_file("config", true)) + if ($cacheInstance->cache_file("config", true)) { // Replace data - $CACHE->cache_replace("cache_hits", $_CONFIG['cache_hits'], "0", $CFG_CACHE); - $CACHE->cache_replace("db_hits" , $_CONFIG['db_hits'] , "0", $CFG_CACHE); + $cacheInstance->cache_replace("cache_hits", $_CONFIG['cache_hits'], "0", $cacheArray); + $cacheInstance->cache_replace("db_hits" , $_CONFIG['db_hits'] , "0", $cacheArray); } } } diff --git a/inc/doubler_send.php b/inc/doubler_send.php index 9763b4e8bf..fd72454f9a 100644 --- a/inc/doubler_send.php +++ b/inc/doubler_send.php @@ -161,13 +161,13 @@ if (((SQL_NUMROWS($result_total) > 0) && ($_CONFIG['doubler_sent_all'] == 'Y')) if (!$OK) { // Add points to used doubler points - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET doubler_used=doubler_used+%s WHERE config='0' LIMIT 1", + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET doubler_used=doubler_used+%s WHERE config=0 LIMIT 1", array($points), __FILE__, __LINE__); // Destroy cache if (GET_EXT_VERSION("cache") >= "0.1.2") { - if ($CACHE->cache_file("config", true)) $CACHE->cache_destroy(); + if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy(); } } diff --git a/inc/extensions.php b/inc/extensions.php index f4a8f7fbd5..a2aeb3f1ad 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -225,7 +225,7 @@ function EXTENSION_REGISTER($ext_name, $id, $dry_run=false) // function EXTENSION_RUN_SQLS($id, $EXT_LOAD_MODE) { - global $CACHE; + global $cacheInstance; // This shall never do a non-admin user! if (!IS_ADMIN()) return false; @@ -256,16 +256,16 @@ function EXTENSION_RUN_SQLS($id, $EXT_LOAD_MODE) // Remove cache file(s) if extension is active if (EXT_IS_ACTIVE("cache")) { // Remove cache filer - if ($CACHE->cache_file("extensions", true)) $CACHE->cache_destroy(); - if ($CACHE->cache_file("mod_reg", true)) $CACHE->cache_destroy(); - if ($CACHE->cache_file("config", true)) $CACHE->cache_destroy(); + if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy(); } } } // function EXT_IS_ACTIVE ($ext_name, $ignore_admin=false, $ignore_cache=false) { - global $EXTENSIONS, $_CONFIG; + global $cacheArray, $_CONFIG; // Extensions are all inactive during installation if ((!mxchange_installed) || (mxchange_installing) || (empty($ext_name))) return false; @@ -277,10 +277,10 @@ function EXT_IS_ACTIVE ($ext_name, $ignore_admin=false, $ignore_cache=false) // Failed is the default $ret = false; - if ((!empty($EXTENSIONS['ext_active'][$ext_name])) && (!$ignore_cache)) + if ((!empty($cacheArray['extensions']['ext_active'][$ext_name])) && (!$ignore_cache)) { // Load from cache - $active = $EXTENSIONS['ext_active'][$ext_name]; + $active = $cacheArray['extensions']['ext_active'][$ext_name]; // Count cache hits if (isset($_CONFIG['cache_hits'])) $_CONFIG['cache_hits']++; @@ -299,7 +299,7 @@ function EXT_IS_ACTIVE ($ext_name, $ignore_admin=false, $ignore_cache=false) SQL_FREERESULT($result); // Write cache array - $EXTENSIONS['ext_active'][$ext_name] = $active; + $cacheArray['extensions']['ext_active'][$ext_name] = $active; } // Is this extension activated? (For admins we always have active extensions...) @@ -321,20 +321,20 @@ function EXT_IS_ACTIVE ($ext_name, $ignore_admin=false, $ignore_cache=false) } // Get version from extensions function GET_EXT_VERSION ($ext_name) { - global $EXTENSIONS, $_CONFIG, $CACHE; + global $cacheArray, $_CONFIG, $cacheInstance; $ret = false; // Extensions are all inactive during installation if ((!mxchange_installed) || (mxchange_installing)) return ""; // Is the cache written? - if (!empty($EXTENSIONS['ext_version'][$ext_name])) { + if (!empty($cacheArray['extensions']['ext_version'][$ext_name])) { // Load data from cache - $ret = $EXTENSIONS['ext_version'][$ext_name]; + $ret = $cacheArray['extensions']['ext_version'][$ext_name]; // Count cache hits if (isset($_CONFIG['cache_hits'])) $_CONFIG['cache_hits']++; else $_CONFIG['cache_hits'] = 1; - } elseif (!is_object($CACHE)) { + } elseif (!is_object($cacheInstance)) { // Load from database $result = SQL_QUERY_ESC("SELECT ext_version FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1", array($ext_name), __FILE__, __LINE__); @@ -342,7 +342,7 @@ function GET_EXT_VERSION ($ext_name) { SQL_FREERESULT($result); // Set cache - $EXTENSIONS['ext_version'][$ext_name] = $ret; + $cacheArray['extensions']['ext_version'][$ext_name] = $ret; } return $ret; } @@ -350,7 +350,7 @@ function GET_EXT_VERSION ($ext_name) { function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false) { // This shall never do a non-admin user! - global $CACHE, $_CONFIG, $NOTES; $SQLs = array(); + global $cacheInstance, $_CONFIG, $NOTES; $SQLs = array(); if ((!IS_ADMIN()) || (empty($ext))) return false; // Load extension in update mode @@ -446,9 +446,9 @@ function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false) // Update cache if (EXT_IS_ACTIVE("cache")) { - if ($CACHE->cache_file("extensions", true) == true) $CACHE->cache_destroy(); - if ($CACHE->cache_file("config", true) == true) $CACHE->cache_destroy(); - if ($CACHE->cache_file("mod_reg", true) == true) $CACHE->cache_destroy(); + if ($cacheInstance->cache_file("extensions", true) == true) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("config", true) == true) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("mod_reg", true) == true) $cacheInstance->cache_destroy(); } // Remove array @@ -516,11 +516,11 @@ function EXTENSION_VERBOSE_TABLE($SQLs, $title=ADMIN_SQLS_EXECUTED_ON_REMOVAL, $ function GET_EXT_NAME($id) { $ret = ""; - global $EXTENSIONS, $_CONFIG; - if (!empty($EXTENSIONS['ext_id'][$id])) + global $cacheArray, $_CONFIG; + if (!empty($cacheArray['extensions']['ext_id'][$id])) { // Load from cache - $ret = $EXTENSIONS['ext_id'][$id]; + $ret = $cacheArray['extensions']['ext_id'][$id]; // Count cache hits $_CONFIG['cache_hits']++; @@ -539,11 +539,11 @@ function GET_EXT_NAME($id) function GET_EXT_ID($name) { $ret = "0"; - global $EXTENSIONS, $_CONFIG; - if ((isset($EXTENSIONS['ext_id'])) && (is_array($EXTENSIONS['ext_id']))) + global $cacheArray, $_CONFIG; + if ((isset($cacheArray['extensions']['ext_id'])) && (is_array($cacheArray['extensions']['ext_id']))) { // Load from cache - $ret = array_search($name, $EXTENSIONS['ext_id']); + $ret = array_search($name, $cacheArray['extensions']['ext_id']); // Count cache hits $_CONFIG['cache_hits']++; diff --git a/inc/extensions/ext-active.php b/inc/extensions/ext-active.php index 9aac290652..0a385f601d 100644 --- a/inc/extensions/ext-active.php +++ b/inc/extensions/ext-active.php @@ -122,9 +122,9 @@ case "update": // Update an extension break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); - $_CONFIG['active_limit'] = $DUMMY['active_limit']; // Only display X most active users for today - unset($DUMMY); + $dummy = LOAD_CONFIG(); + $_CONFIG['active_limit'] = $dummy['active_limit']; // Only display X most active users for today + unset($dummy); break; } // Language file prefix diff --git a/inc/extensions/ext-autopurge.php b/inc/extensions/ext-autopurge.php index d2ea55227b..2412b2acab 100644 --- a/inc/extensions/ext-autopurge.php +++ b/inc/extensions/ext-autopurge.php @@ -257,24 +257,24 @@ case "update": // Update an extension break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); + $dummy = LOAD_CONFIG(); // Transfer all to the $_CONFIG array... - $_CONFIG['ap_inactive'] = $DUMMY['autopurge_inactive']; // Autopurge inactive accounts (yes/no) - $_CONFIG['ap_unconfirmed'] = $DUMMY['autopurge_unconfirmed']; // Autopurge unconfirmed accounts (yes/no) - $_CONFIG['ap_tasks'] = $DUMMY['autopurge_tasks']; // Autopurge out-dated tasks (yes/no) - $_CONFIG['ap_in_mail'] = $DUMMY['ap_in_notify']; // Send email to admin when purging inactive accounts (yes/no) - $_CONFIG['ap_un_mail'] = $DUMMY['ap_un_notify']; // Send email to admin when purging unconfirmed accounts (yes/no) - $_CONFIG['ap_tasks_mail'] = $DUMMY['ap_tasks_notify']; // Send email to admin when purging out-dated tasks (yes/no) - $_CONFIG['ap_in_since'] = $DUMMY['ap_inactive_since']; // Timeout for confirmed accounts when they become inactive (seconds) - $_CONFIG['ap_in_time'] = $DUMMY['ap_inactive_time']; // Timeout for inactive accounts when they are automatically deleted (seconds) - $_CONFIG['ap_un_time'] = $DUMMY['ap_unconfirmed_time']; // Timeout for unconfirmed accounts when they are automatically deleted (seconds) - $_CONFIG['ap_tasks_time'] = $DUMMY['ap_tasks_time']; // Timeout for out-dated tasks - $_CONFIG['ap_del_mails'] = $DUMMY['ap_del_mails']; // Autopurge mails from deleted users? - $_CONFIG['ap_dm_notify'] = $DUMMY['ap_dm_notify']; // Send email to admin when purging mails from deleted users (yes/no) - $_CONFIG['ap_dm_timeout'] = $DUMMY['ap_dm_timeout']; // Timeout for mails from deleted users + $_CONFIG['ap_inactive'] = $dummy['autopurge_inactive']; // Autopurge inactive accounts (yes/no) + $_CONFIG['ap_unconfirmed'] = $dummy['autopurge_unconfirmed']; // Autopurge unconfirmed accounts (yes/no) + $_CONFIG['ap_tasks'] = $dummy['autopurge_tasks']; // Autopurge out-dated tasks (yes/no) + $_CONFIG['ap_in_mail'] = $dummy['ap_in_notify']; // Send email to admin when purging inactive accounts (yes/no) + $_CONFIG['ap_un_mail'] = $dummy['ap_un_notify']; // Send email to admin when purging unconfirmed accounts (yes/no) + $_CONFIG['ap_tasks_mail'] = $dummy['ap_tasks_notify']; // Send email to admin when purging out-dated tasks (yes/no) + $_CONFIG['ap_in_since'] = $dummy['ap_inactive_since']; // Timeout for confirmed accounts when they become inactive (seconds) + $_CONFIG['ap_in_time'] = $dummy['ap_inactive_time']; // Timeout for inactive accounts when they are automatically deleted (seconds) + $_CONFIG['ap_un_time'] = $dummy['ap_unconfirmed_time']; // Timeout for unconfirmed accounts when they are automatically deleted (seconds) + $_CONFIG['ap_tasks_time'] = $dummy['ap_tasks_time']; // Timeout for out-dated tasks + $_CONFIG['ap_del_mails'] = $dummy['ap_del_mails']; // Autopurge mails from deleted users? + $_CONFIG['ap_dm_notify'] = $dummy['ap_dm_notify']; // Send email to admin when purging mails from deleted users (yes/no) + $_CONFIG['ap_dm_timeout'] = $dummy['ap_dm_timeout']; // Timeout for mails from deleted users // Save some RAM... - unset($DUMMY); + unset($dummy); // Do we have a daily-reset-run? if (defined('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) diff --git a/inc/extensions/ext-beg.php b/inc/extensions/ext-beg.php index 2da0c3fbc3..9f78549591 100644 --- a/inc/extensions/ext-beg.php +++ b/inc/extensions/ext-beg.php @@ -259,25 +259,25 @@ case "update": // Update an extension break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); - $_CONFIG['beg_timeout'] = $DUMMY['beg_timeout']; // Global timeout - $_CONFIG['beg_uid_timeout'] = $DUMMY['beg_uid_timeout']; // Timeout for one userid - $_CONFIG['beg_ip_timeout'] = $DUMMY['beg_ip_timeout']; // Timeout for one IP number - $_CONFIG['beg_points'] = $DUMMY['beg_points']; // Minimum beggable points - $_CONFIG['beg_points_max'] = $DUMMY['beg_points_max']; // Maximum beggable points - $_CONFIG['beg_uid'] = $DUMMY['beg_uid']; // Account to subtract begged points from - $_CONFIG['beg_mode'] = $DUMMY['beg_mode']; // Payment mode: direct or over referral system? - $_CONFIG['beg_month'] = $DUMMY['beg_month']; // Current month - $_CONFIG['beg_ranks'] = $DUMMY['beg_ranks']; // Maximum member who will win - $_CONFIG['beg_active'] = $DUMMY['beg_active']; // Only active members can win? - $_CONFIG['beg_rallye'] = $DUMMY['beg_rallye']; // Is the begging rallye activated? - $_CONFIG['beg_ral_en_notify'] = $DUMMY['beg_ral_en_notify']; // Notify members on enabled rallye? - $_CONFIG['beg_ral_di_notify'] = $DUMMY['beg_ral_di_notify']; // Notify members on disabled rallye? - $_CONFIG['beg_notify_bonus'] = $DUMMY['beg_notify_bonus']; // When points are > 0 and bonus extension is installed, a bonus mail with this amount of points will be send instead of an enable-notification! - $_CONFIG['beg_new_mem_notify'] = $DUMMY['beg_new_mem_notify']; // Notify members on disabled rallye? - $_CONFIG['beg_notify_wait'] = $DUMMY['beg_notify_wait']; // Time to wait in seconds for bonus mails - $_CONFIG['beg_include_own'] = $DUMMY['beg_include_own']; // Include webmaster's own userid in rallye? - unset($DUMMY); + $dummy = LOAD_CONFIG(); + $_CONFIG['beg_timeout'] = $dummy['beg_timeout']; // Global timeout + $_CONFIG['beg_uid_timeout'] = $dummy['beg_uid_timeout']; // Timeout for one userid + $_CONFIG['beg_ip_timeout'] = $dummy['beg_ip_timeout']; // Timeout for one IP number + $_CONFIG['beg_points'] = $dummy['beg_points']; // Minimum beggable points + $_CONFIG['beg_points_max'] = $dummy['beg_points_max']; // Maximum beggable points + $_CONFIG['beg_uid'] = $dummy['beg_uid']; // Account to subtract begged points from + $_CONFIG['beg_mode'] = $dummy['beg_mode']; // Payment mode: direct or over referral system? + $_CONFIG['beg_month'] = $dummy['beg_month']; // Current month + $_CONFIG['beg_ranks'] = $dummy['beg_ranks']; // Maximum member who will win + $_CONFIG['beg_active'] = $dummy['beg_active']; // Only active members can win? + $_CONFIG['beg_rallye'] = $dummy['beg_rallye']; // Is the begging rallye activated? + $_CONFIG['beg_ral_en_notify'] = $dummy['beg_ral_en_notify']; // Notify members on enabled rallye? + $_CONFIG['beg_ral_di_notify'] = $dummy['beg_ral_di_notify']; // Notify members on disabled rallye? + $_CONFIG['beg_notify_bonus'] = $dummy['beg_notify_bonus']; // When points are > 0 and bonus extension is installed, a bonus mail with this amount of points will be send instead of an enable-notification! + $_CONFIG['beg_new_mem_notify'] = $dummy['beg_new_mem_notify']; // Notify members on disabled rallye? + $_CONFIG['beg_notify_wait'] = $dummy['beg_notify_wait']; // Time to wait in seconds for bonus mails + $_CONFIG['beg_include_own'] = $dummy['beg_include_own']; // Include webmaster's own userid in rallye? + unset($dummy); // Remove old entries $OLD = $_CONFIG['beg_timeout']; diff --git a/inc/extensions/ext-birthday.php b/inc/extensions/ext-birthday.php index b28aab7e28..f1384dfc76 100644 --- a/inc/extensions/ext-birthday.php +++ b/inc/extensions/ext-birthday.php @@ -183,15 +183,15 @@ PRIMARY KEY(id) break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); + $dummy = LOAD_CONFIG(); // Copy config to main array - $_CONFIG['birthday_points'] = $DUMMY['birthday_points']; - $_CONFIG['birthday_mode'] = $DUMMY['birthday_mode']; - $_CONFIG['birthday_active'] = $DUMMY['birthday_active']; + $_CONFIG['birthday_points'] = $dummy['birthday_points']; + $_CONFIG['birthday_mode'] = $dummy['birthday_mode']; + $_CONFIG['birthday_active'] = $dummy['birthday_active']; // Save some RAM... - unset($DUMMY); + unset($dummy); if ((defined('__DAILY_RESET')) && ($_CONFIG['birthday_points'] > 0)) { diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index 14f17fa307..a03d7672f4 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -359,7 +359,7 @@ KEY userid (userid) if ($prev == "00") $prev = "12"; // Reset monthly active rallye - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_config SET last_bonus_month='".$prev."' WHERE config='0' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_config SET last_bonus_month='".$prev."' WHERE config=0 LIMIT 1"; // Update notes (these will be set as task text!) $UPDATE_NOTES = "Weitere Variablenfehler in inc/monthly_bonus.php haben dafür gesorgt, dass die monatliche Aktiv-Rallye nicht ausgeschüttet wurde. Mit diesem Update wurde die Ausschüttung initialisiert. Ihre Mitglieder bekommen voraussichtlicht nichts doppelt vergütet."; @@ -540,33 +540,33 @@ WHERE last_online < ".$mark." ORDER BY userid"; break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); - $_CONFIG['login_bonus'] = $DUMMY['login_bonus']; // Bonus points for successfull logins - $_CONFIG['turbo_bonus'] = $DUMMY['turbo_bonus']; // Bonus points for the fastest clicker, No. 1 - $_CONFIG['bonus_rates'] = $DUMMY['turbo_rates']; // Points for clicker no. 2 to x - $_CONFIG['bonus_ranks'] = $DUMMY['bonus_ranks']; // Total ranks who can win - $_CONFIG['login_timeout'] = $DUMMY['login_timeout']; // Time in seconds between two logins - $_CONFIG['bonus_month'] = $DUMMY['last_bonus_month']; // Last month where click-bonus are "paid" - $_CONFIG['bonus_mode'] = $DUMMY['bonus_mode']; // Mode for adding points for login/click bonus - $_CONFIG['bonus_uid'] = $DUMMY['bonus_uid']; // Member account to take points from - $_CONFIG['bonus_lines'] = $DUMMY['bonus_lines']; // Number of lines to display in show_bonus.php - $_CONFIG['bonus_timeout'] = $DUMMY['bonus_timeout']; // Auto-Purge timeout for bonus lines in mxchange_bonus_turbo - $_CONFIG['bonus_order'] = $DUMMY['bonus_order']; // Bonus points for ordering mails - $_CONFIG['bonus_ref'] = $DUMMY['bonus_ref']; // Bonus points for "making" a referral - $_CONFIG['bonus_stats'] = $DUMMY['bonus_stats']; // Bonus points for 100% clickrate in mail stats - $_CONFIG['bonus_active'] = $DUMMY['bonus_active']; // De/activate bonus active rallye - $_CONFIG['bonus_order_yn'] = $DUMMY['bonus_order_yn']; // Include order bonus in analysis? - $_CONFIG['bonus_ref_yn'] = $DUMMY['bonus_ref_yn']; // Include referral bonus in analysis? - $_CONFIG['bonus_stats_yn'] = $DUMMY['bonus_stats_yn']; // Include statistics bonus in analysis? - $_CONFIG['bonus_login_yn'] = $DUMMY['bonus_login_yn']; // Include login bonus in analysis? - $_CONFIG['bonus_click_yn'] = $DUMMY['bonus_click_yn']; // Include "mailid" bonus in analysis? - $_CONFIG['bonus_en_notify'] = $DUMMY['bonus_en_notify']; // Notify members about enabled active rallye? - $_CONFIG['bonus_di_notify'] = $DUMMY['bonus_di_notify']; // Notify members about disabled active rallye? - $_CONFIG['bonus_new_mem_notify'] = $DUMMY['bonus_new_mem_notify']; // Notify members about disabled active rallye? - $_CONFIG['bonus_notify_points'] = $DUMMY['bonus_notify_points']; // Bonus points for the enable-notification mail? 0 = disable! - $_CONFIG['bonus_notify_wait'] = $DUMMY['bonus_notify_wait']; // Time to wait in seconds for bonus mails - $_CONFIG['bonus_include_own'] = $DUMMY['bonus_include_own']; // Include webmaster's own userid in active rallye? - unset($DUMMY); + $dummy = LOAD_CONFIG(); + $_CONFIG['login_bonus'] = $dummy['login_bonus']; // Bonus points for successfull logins + $_CONFIG['turbo_bonus'] = $dummy['turbo_bonus']; // Bonus points for the fastest clicker, No. 1 + $_CONFIG['bonus_rates'] = $dummy['turbo_rates']; // Points for clicker no. 2 to x + $_CONFIG['bonus_ranks'] = $dummy['bonus_ranks']; // Total ranks who can win + $_CONFIG['login_timeout'] = $dummy['login_timeout']; // Time in seconds between two logins + $_CONFIG['bonus_month'] = $dummy['last_bonus_month']; // Last month where click-bonus are "paid" + $_CONFIG['bonus_mode'] = $dummy['bonus_mode']; // Mode for adding points for login/click bonus + $_CONFIG['bonus_uid'] = $dummy['bonus_uid']; // Member account to take points from + $_CONFIG['bonus_lines'] = $dummy['bonus_lines']; // Number of lines to display in show_bonus.php + $_CONFIG['bonus_timeout'] = $dummy['bonus_timeout']; // Auto-Purge timeout for bonus lines in mxchange_bonus_turbo + $_CONFIG['bonus_order'] = $dummy['bonus_order']; // Bonus points for ordering mails + $_CONFIG['bonus_ref'] = $dummy['bonus_ref']; // Bonus points for "making" a referral + $_CONFIG['bonus_stats'] = $dummy['bonus_stats']; // Bonus points for 100% clickrate in mail stats + $_CONFIG['bonus_active'] = $dummy['bonus_active']; // De/activate bonus active rallye + $_CONFIG['bonus_order_yn'] = $dummy['bonus_order_yn']; // Include order bonus in analysis? + $_CONFIG['bonus_ref_yn'] = $dummy['bonus_ref_yn']; // Include referral bonus in analysis? + $_CONFIG['bonus_stats_yn'] = $dummy['bonus_stats_yn']; // Include statistics bonus in analysis? + $_CONFIG['bonus_login_yn'] = $dummy['bonus_login_yn']; // Include login bonus in analysis? + $_CONFIG['bonus_click_yn'] = $dummy['bonus_click_yn']; // Include "mailid" bonus in analysis? + $_CONFIG['bonus_en_notify'] = $dummy['bonus_en_notify']; // Notify members about enabled active rallye? + $_CONFIG['bonus_di_notify'] = $dummy['bonus_di_notify']; // Notify members about disabled active rallye? + $_CONFIG['bonus_new_mem_notify'] = $dummy['bonus_new_mem_notify']; // Notify members about disabled active rallye? + $_CONFIG['bonus_notify_points'] = $dummy['bonus_notify_points']; // Bonus points for the enable-notification mail? 0 = disable! + $_CONFIG['bonus_notify_wait'] = $dummy['bonus_notify_wait']; // Time to wait in seconds for bonus mails + $_CONFIG['bonus_include_own'] = $dummy['bonus_include_own']; // Include webmaster's own userid in active rallye? + unset($dummy); if (defined('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) { diff --git a/inc/extensions/ext-cache.php b/inc/extensions/ext-cache.php index 99d4cd47a6..ad0f624a9b 100644 --- a/inc/extensions/ext-cache.php +++ b/inc/extensions/ext-cache.php @@ -99,7 +99,7 @@ case "update": // Update an extension if (EXT_IS_ACTIVE("cache")) { // Check for cache when extension is already installed - if ($CACHE->cache_file("extensions", true)) $CACHE->cache_destroy(); + if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy(); } $UPDATE_NOTES = "Spalte "keep_active" ist hinzugefügt. Cache wurde reinitialisiert."; break; @@ -184,29 +184,29 @@ case "update": // Update an extension break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); + $dummy = LOAD_CONFIG(); // Load config and destroy dummy array - $_CONFIG['cache_update'] = $DUMMY['cache_update']; // Last time the cache files are been re-created - $_CONFIG['cache_path'] = $DUMMY['cache_path']; // Relative path for the cache files to 'inc/' - $_CONFIG['cache_tested'] = $DUMMY['cache_tested']; // Says if cache path is tested or not - $_CONFIG['db_hits'] = $DUMMY['db_hits']; // Counted hits on the database (all!) - $_CONFIG['cache_hits'] = $DUMMY['cache_hits']; // Counted hits on the cache arrays in memory - $_CONFIG['cache_admins'] = $DUMMY['cache_admins']; // Is the table '_admins' cacheable? - $_CONFIG['cache_acls'] = $DUMMY['cache_acls']; // Is the table '_admins_acls' cacheable? - $_CONFIG['cache_exts'] = $DUMMY['cache_exts']; // Is the table '_extensions' cacheable? - $_CONFIG['cache_config'] = $DUMMY['cache_config']; // Is the table '_config' cacheable? - $_CONFIG['cache_modreg'] = $DUMMY['cache_modreg']; // Is the table '_mod_reg' cacheable? - $_CONFIG['cache_refdepth'] = $DUMMY['cache_refdepth']; // Is the table '_refdepths' cacheable? - $_CONFIG['cache_refsys'] = $DUMMY['cache_refsys']; // Is the table '_refsystem' cacheable? - unset($DUMMY); + $_CONFIG['cache_update'] = $dummy['cache_update']; // Last time the cache files are been re-created + $_CONFIG['cache_path'] = $dummy['cache_path']; // Relative path for the cache files to 'inc/' + $_CONFIG['cache_tested'] = $dummy['cache_tested']; // Says if cache path is tested or not + $_CONFIG['db_hits'] = $dummy['db_hits']; // Counted hits on the database (all!) + $_CONFIG['cache_hits'] = $dummy['cache_hits']; // Counted hits on the cache arrays in memory + $_CONFIG['cache_admins'] = $dummy['cache_admins']; // Is the table '_admins' cacheable? + $_CONFIG['cache_acls'] = $dummy['cache_acls']; // Is the table '_admins_acls' cacheable? + $_CONFIG['cache_exts'] = $dummy['cache_exts']; // Is the table '_extensions' cacheable? + $_CONFIG['cache_config'] = $dummy['cache_config']; // Is the table '_config' cacheable? + $_CONFIG['cache_modreg'] = $dummy['cache_modreg']; // Is the table '_mod_reg' cacheable? + $_CONFIG['cache_refdepth'] = $dummy['cache_refdepth']; // Is the table '_refdepths' cacheable? + $_CONFIG['cache_refsys'] = $dummy['cache_refsys']; // Is the table '_refsystem' cacheable? + unset($dummy); // Create instance on class - if ($CACHE_FILE != "init") + if ($cacheMode != "init") { // Initialize cache system only when it's needed - $CACHE = new mxchange_cache($_CONFIG['cache_update'], PATH."inc/".$_CONFIG['cache_path'], $_CONFIG['cache_tested']); - if ($CACHE->ret != "done") + $cacheInstance = new mxchange_cache($_CONFIG['cache_update'], PATH."inc/".$_CONFIG['cache_path'], $_CONFIG['cache_tested']); + if ($cacheInstance->ret != "done") { // Failed to initialize cache sustem ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_CANNOT_INITIALIZE); diff --git a/inc/extensions/ext-doubler.php b/inc/extensions/ext-doubler.php index 58402cb588..0f4b83d7e5 100644 --- a/inc/extensions/ext-doubler.php +++ b/inc/extensions/ext-doubler.php @@ -239,27 +239,27 @@ WHERE d.completed='N'"; break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); - $_CONFIG['doubler_charge'] = $DUMMY['doubler_charge']; - $_CONFIG['doubler_jackpot'] = $DUMMY['doubler_jackpot']; - $_CONFIG['doubler_own'] = $DUMMY['doubler_own']; - $_CONFIG['doubler_uid'] = $DUMMY['doubler_uid']; - $_CONFIG['doubler_points'] = $DUMMY['doubler_points']; - $_CONFIG['doubler_used'] = $DUMMY['doubler_used']; - $_CONFIG['doubler_send_mode'] = $DUMMY['doubler_send_mode']; - $_CONFIG['doubler_timeout'] = $DUMMY['doubler_timeout']; - $_CONFIG['doubler_display_new'] = $DUMMY['doubler_display_new']; - $_CONFIG['doubler_display_pay'] = $DUMMY['doubler_display_pay']; - $_CONFIG['doubler_display_old'] = $DUMMY['doubler_display_old']; - $_CONFIG['doubler_ref'] = $DUMMY['doubler_ref']; - $_CONFIG['doubler_min'] = $DUMMY['doubler_min']; - $_CONFIG['doubler_max'] = $DUMMY['doubler_max']; - $_CONFIG['doubler_left'] = $DUMMY['doubler_left']; - $_CONFIG['doubler_counter'] = $DUMMY['doubler_counter']; - $_CONFIG['doubler_max_sent'] = $DUMMY['doubler_max_sent']; - $_CONFIG['doubler_group_sent'] = $DUMMY['doubler_group_sent']; - $_CONFIG['doubler_sent_all'] = $DUMMY['doubler_sent_all']; - unset($DUMMY); + $dummy = LOAD_CONFIG(); + $_CONFIG['doubler_charge'] = $dummy['doubler_charge']; + $_CONFIG['doubler_jackpot'] = $dummy['doubler_jackpot']; + $_CONFIG['doubler_own'] = $dummy['doubler_own']; + $_CONFIG['doubler_uid'] = $dummy['doubler_uid']; + $_CONFIG['doubler_points'] = $dummy['doubler_points']; + $_CONFIG['doubler_used'] = $dummy['doubler_used']; + $_CONFIG['doubler_send_mode'] = $dummy['doubler_send_mode']; + $_CONFIG['doubler_timeout'] = $dummy['doubler_timeout']; + $_CONFIG['doubler_display_new'] = $dummy['doubler_display_new']; + $_CONFIG['doubler_display_pay'] = $dummy['doubler_display_pay']; + $_CONFIG['doubler_display_old'] = $dummy['doubler_display_old']; + $_CONFIG['doubler_ref'] = $dummy['doubler_ref']; + $_CONFIG['doubler_min'] = $dummy['doubler_min']; + $_CONFIG['doubler_max'] = $dummy['doubler_max']; + $_CONFIG['doubler_left'] = $dummy['doubler_left']; + $_CONFIG['doubler_counter'] = $dummy['doubler_counter']; + $_CONFIG['doubler_max_sent'] = $dummy['doubler_max_sent']; + $_CONFIG['doubler_group_sent'] = $dummy['doubler_group_sent']; + $_CONFIG['doubler_sent_all'] = $dummy['doubler_sent_all']; + unset($dummy); if ((defined('__DAILY_RESET')) && ($_CONFIG['doubler_send_mode'] == "RESET")) { diff --git a/inc/extensions/ext-holiday.php b/inc/extensions/ext-holiday.php index 121d196a74..b26919897f 100644 --- a/inc/extensions/ext-holiday.php +++ b/inc/extensions/ext-holiday.php @@ -224,12 +224,12 @@ case "update": // Update an extension break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); + $dummy = LOAD_CONFIG(); // Copy data to config array - $_CONFIG['holiday_max'] = $DUMMY['holiday_max']; // Maximum days for holiday - $_CONFIG['holiday_lock'] = $DUMMY['holiday_lock']; // Lock deactivation in member area for X seconds - $_CONFIG['holiday_mode'] = $DUMMY['holiday_mode']; // Mode for activating holiday - unset($DUMMY); + $_CONFIG['holiday_max'] = $dummy['holiday_max']; // Maximum days for holiday + $_CONFIG['holiday_lock'] = $dummy['holiday_lock']; // Lock deactivation in member area for X seconds + $_CONFIG['holiday_mode'] = $dummy['holiday_mode']; // Mode for activating holiday + unset($dummy); // Do we have a daily-reset-run? if (((defined('__DAILY_RESET')) && ($_CONFIG['holiday_mode'] == "RESET")) || ($_CONFIG['holiday_mode'] == "DIRECT")) diff --git a/inc/extensions/ext-maintenance.php b/inc/extensions/ext-maintenance.php index 0640332e3d..32e7bba2e3 100644 --- a/inc/extensions/ext-maintenance.php +++ b/inc/extensions/ext-maintenance.php @@ -110,9 +110,9 @@ case "update": // Update an extension break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); - $_CONFIG['maintenance'] = $DUMMY['maintenance']; - unset($DUMMY); + $dummy = LOAD_CONFIG(); + $_CONFIG['maintenance'] = $dummy['maintenance']; + unset($dummy); break; } // Language file prefix diff --git a/inc/extensions/ext-mediadata.php b/inc/extensions/ext-mediadata.php index 0ba2e0c321..b002b6cdca 100644 --- a/inc/extensions/ext-mediadata.php +++ b/inc/extensions/ext-mediadata.php @@ -129,10 +129,10 @@ Bitte stellen Sie diesen derzeit manuell unter = "0.1.1")) { // Reset mail order values - $result_ext = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET mail_orders='0' WHERE mail_orders > 0", __FILE__, __LINE__); + $result_ext = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET mail_orders=0 WHERE mail_orders > 0", __FILE__, __LINE__); } break; } diff --git a/inc/extensions/ext-other.php b/inc/extensions/ext-other.php index c3b1848ec7..019523e693 100644 --- a/inc/extensions/ext-other.php +++ b/inc/extensions/ext-other.php @@ -178,11 +178,11 @@ case "update": // Update an extension break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); - $_CONFIG['max_comma'] = $DUMMY['max_comma']; // Maximum numbers behind commata - $_CONFIG['reject_url'] = $DUMMY['reject_url']; // Default rejection URL - define('__CURRENCY', $DUMMY['currency']); // This is the currency for fees! They shall normally remain in real money currencies... - unset($DUMMY); + $dummy = LOAD_CONFIG(); + $_CONFIG['max_comma'] = $dummy['max_comma']; // Maximum numbers behind commata + $_CONFIG['reject_url'] = $dummy['reject_url']; // Default rejection URL + define('__CURRENCY', $dummy['currency']); // This is the currency for fees! They shall normally remain in real money currencies... + unset($dummy); break; } // Language file prefix diff --git a/inc/extensions/ext-register.php b/inc/extensions/ext-register.php index a4df053cdf..06604e03ae 100644 --- a/inc/extensions/ext-register.php +++ b/inc/extensions/ext-register.php @@ -323,10 +323,10 @@ PRIMARY KEY(id) break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); + $dummy = LOAD_CONFIG(); // Copy data to config array - $_CONFIG['register_default'] = $DUMMY['register_default']; // Is Yes/No the default selection in category selection? - unset($DUMMY); + $_CONFIG['register_default'] = $dummy['register_default']; // Is Yes/No the default selection in category selection? + unset($dummy); break; } diff --git a/inc/extensions/ext-rewrite.php b/inc/extensions/ext-rewrite.php index 1af60af4a4..7152b16295 100644 --- a/inc/extensions/ext-rewrite.php +++ b/inc/extensions/ext-rewrite.php @@ -136,9 +136,9 @@ case "update": // Update an extension break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); - $_CONFIG['rewrite_skipped_mods'] = $DUMMY['rewrite_skip']; - unset($DUMMY); + $dummy = LOAD_CONFIG(); + $_CONFIG['rewrite_skipped_mods'] = $dummy['rewrite_skip']; + unset($dummy); break; } // Language file prefix diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index 3000330904..2b232dd8b5 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -477,7 +477,7 @@ PRIMARY KEY (id) $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD rand_no bigint(20) not null default '0'"; $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD file_hash varchar(255) not null default ''"; $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD master_salt varchar(255) not null default ''"; - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_config SET rand_no=(ROUND(RAND() * 99999) + 100000) WHERE config='0' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_config SET rand_no=(ROUND(RAND() * 99999) + 100000) WHERE config=0 LIMIT 1"; $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_mod_reg ADD has_menu enum('Y', 'N') NOT NULL default 'N'"; $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET has_menu='Y' WHERE module='admin' OR module='index' OR module='login' LIMIT 3"; @@ -525,43 +525,43 @@ PRIMARY KEY (id) break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); + $dummy = LOAD_CONFIG(); // When the sql_patches is not installed we cannot load it's configuration... *sigh* if (GET_EXT_VERSION("sql_patches") != "") { - $_CONFIG['ext_autopurge'] = $DUMMY['ext_autopurge']; - $_CONFIG['mails_page'] = $DUMMY['mails_page']; - $_CONFIG['index_home'] = $DUMMY['index_home']; - $_CONFIG['verbose_sql'] = $DUMMY['verbose_sql']; - $_CONFIG['middot'] = $DUMMY['menu_blur_spacer']; - $_CONFIG['reg_points_mode'] = $DUMMY['reg_points_mode']; - $_CONFIG['index_delay'] = $DUMMY['index_delay']; - $_CONFIG['index_cookie'] = $DUMMY['index_cookie']; - $_CONFIG['def_refid'] = $DUMMY['def_refid']; - $_CONFIG['refid_target'] = $DUMMY['refid_target']; - $_CONFIG['default_theme'] = $DUMMY['default_theme']; - $_CONFIG['title_decoration'] = $DUMMY['enable_title_deco']; - $_CONFIG['title_mod_show'] = $DUMMY['enable_mod_title']; - $_CONFIG['title_what_show'] = $DUMMY['enable_what_title']; - $_CONFIG['title_left'] = $DUMMY['title_left']; - $_CONFIG['title_middle'] = $DUMMY['title_middle']; - $_CONFIG['title_right'] = $DUMMY['title_right']; - $_CONFIG['mad_counter'] = $DUMMY['mad_count']; - $_CONFIG['last_mad'] = $DUMMY['mad_timestamp']; - $_CONFIG['css_php'] = $DUMMY['css_php']; - $_CONFIG['guest_menu'] = $DUMMY['guest_menu']; - $_CONFIG['member_menu'] = $DUMMY['member_menu']; - $_CONFIG['youre_here'] = $DUMMY['youre_here']; - $_CONFIG['img_type'] = $DUMMY['img_type']; - $_CONFIG['stats_limit'] = $DUMMY['stats_limit']; - $_CONFIG['admin_menu'] = $DUMMY['admin_menu']; - $_CONFIG['admin_menu_sorter'] = $DUMMY['admin_menu_sorter']; - $_CONFIG['salt_length'] = $DUMMY['salt_length']; - $_CONFIG['pass_scramble'] = trim($DUMMY['pass_scramble']); - $_CONFIG['file_hash'] = trim($DUMMY['file_hash']); - $_CONFIG['master_salt'] = trim($DUMMY['master_salt']); + $_CONFIG['ext_autopurge'] = $dummy['ext_autopurge']; + $_CONFIG['mails_page'] = $dummy['mails_page']; + $_CONFIG['index_home'] = $dummy['index_home']; + $_CONFIG['verbose_sql'] = $dummy['verbose_sql']; + $_CONFIG['middot'] = $dummy['menu_blur_spacer']; + $_CONFIG['reg_points_mode'] = $dummy['reg_points_mode']; + $_CONFIG['index_delay'] = $dummy['index_delay']; + $_CONFIG['index_cookie'] = $dummy['index_cookie']; + $_CONFIG['def_refid'] = $dummy['def_refid']; + $_CONFIG['refid_target'] = $dummy['refid_target']; + $_CONFIG['default_theme'] = $dummy['default_theme']; + $_CONFIG['title_decoration'] = $dummy['enable_title_deco']; + $_CONFIG['title_mod_show'] = $dummy['enable_mod_title']; + $_CONFIG['title_what_show'] = $dummy['enable_what_title']; + $_CONFIG['title_left'] = $dummy['title_left']; + $_CONFIG['title_middle'] = $dummy['title_middle']; + $_CONFIG['title_right'] = $dummy['title_right']; + $_CONFIG['mad_counter'] = $dummy['mad_count']; + $_CONFIG['last_mad'] = $dummy['mad_timestamp']; + $_CONFIG['css_php'] = $dummy['css_php']; + $_CONFIG['guest_menu'] = $dummy['guest_menu']; + $_CONFIG['member_menu'] = $dummy['member_menu']; + $_CONFIG['youre_here'] = $dummy['youre_here']; + $_CONFIG['img_type'] = $dummy['img_type']; + $_CONFIG['stats_limit'] = $dummy['stats_limit']; + $_CONFIG['admin_menu'] = $dummy['admin_menu']; + $_CONFIG['admin_menu_sorter'] = $dummy['admin_menu_sorter']; + $_CONFIG['salt_length'] = $dummy['salt_length']; + $_CONFIG['pass_scramble'] = trim($dummy['pass_scramble']); + $_CONFIG['file_hash'] = trim($dummy['file_hash']); + $_CONFIG['master_salt'] = trim($dummy['master_salt']); $_CONFIG['secret_key'] = ""; - $_CONFIG['show_timings'] = $DUMMY['show_timings']; + $_CONFIG['show_timings'] = $dummy['show_timings']; // Read key from secret file if ((empty($_CONFIG['file_hash'])) || (empty($_CONFIG['master_salt'])) || (empty($_CONFIG['pass_scramble']))) @@ -574,8 +574,8 @@ default: // Do stuff when extension is loaded // Remove extensions and mod_reg cache file require_once(PATH."inc/libs/cache_functions.php"); require_once(PATH."inc/extensions/ext-cache.php"); - if ($CACHE->cache_file("extensions", true)) $CACHE->cache_destroy(); - if ($CACHE->cache_file("mod_reg", true)) $CACHE->cache_destroy(); + if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy(); } } @@ -590,16 +590,16 @@ default: // Do stuff when extension is loaded else { // Cannot read secret file! - die("Cannot read secret file!"); + mxchange_die("Cannot read secret file!"); } } // Transfer words/numbers to constants - define('POINTS' , $DUMMY['points_word']); - define('MT_WORD' , $DUMMY['mt_word']); - define('MT_WORD2', $DUMMY['mt_word2']); - define('MT_WORD3', $DUMMY['mt_word3']); - define('_MAX' , $DUMMY['rand_no']); + define('POINTS' , $dummy['points_word']); + define('MT_WORD' , $dummy['mt_word']); + define('MT_WORD2', $dummy['mt_word2']); + define('MT_WORD3', $dummy['mt_word3']); + define('_MAX' , $dummy['rand_no']); } else { // Set some lame ;-) default settings $_CONFIG['def_refid'] = 0; @@ -613,7 +613,7 @@ default: // Do stuff when extension is loaded } // Remove dummy config array - unset($DUMMY); + unset($dummy); break; } diff --git a/inc/extensions/ext-top10.php b/inc/extensions/ext-top10.php index 4c01f92d9d..19ac12ced0 100644 --- a/inc/extensions/ext-top10.php +++ b/inc/extensions/ext-top10.php @@ -142,9 +142,9 @@ case "update": // Update an extension break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); - $_CONFIG['top10_max'] = $DUMMY['top10_max']; - unset($DUMMY); + $dummy = LOAD_CONFIG(); + $_CONFIG['top10_max'] = $dummy['top10_max']; + unset($dummy); break; } diff --git a/inc/extensions/ext-transfer.php b/inc/extensions/ext-transfer.php index 9f8f0731b5..612671f595 100644 --- a/inc/extensions/ext-transfer.php +++ b/inc/extensions/ext-transfer.php @@ -283,20 +283,20 @@ case "update": // Update an extension break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); + $dummy = LOAD_CONFIG(); // Maximum of listed transfers for out- and in-transfers - $_CONFIG['transfer_max'] = $DUMMY['transfer_max']; + $_CONFIG['transfer_max'] = $dummy['transfer_max']; // Age in seconds - $_CONFIG['transfer_age'] = $DUMMY['transfer_age']; + $_CONFIG['transfer_age'] = $dummy['transfer_age']; // Lock timeout for member settings - $_CONFIG['transfer_timeout'] = $DUMMY['transfer_timeout']; + $_CONFIG['transfer_timeout'] = $dummy['transfer_timeout']; // Balance after points transfer - $_CONFIG['transfer_balance'] = $DUMMY['transfer_balance']; + $_CONFIG['transfer_balance'] = $dummy['transfer_balance']; // Length of touring code - $_CONFIG['transfer_code'] = $DUMMY['transfer_code']; + $_CONFIG['transfer_code'] = $dummy['transfer_code']; // Length of touring code - $_CONFIG['ap_transfer'] = $DUMMY['ap_transfer']; - unset($DUMMY); + $_CONFIG['ap_transfer'] = $dummy['ap_transfer']; + unset($dummy); if ((defined('__DAILY_RESET')) && ($_CONFIG['ap_transfer'] == 'Y')) { diff --git a/inc/extensions/ext-user.php b/inc/extensions/ext-user.php index 54cfda5d11..b0eb28ec9c 100644 --- a/inc/extensions/ext-user.php +++ b/inc/extensions/ext-user.php @@ -214,10 +214,10 @@ case "update": // Update an extension break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); - $_CONFIG['user_limit'] = $DUMMY['user_limit']; - $_CONFIG['user_alpha'] = $DUMMY['user_alpha']; - unset($DUMMY); + $dummy = LOAD_CONFIG(); + $_CONFIG['user_limit'] = $dummy['user_limit']; + $_CONFIG['user_alpha'] = $dummy['user_alpha']; + unset($dummy); break; } // Language file prefix diff --git a/inc/extensions/ext-wernis.php b/inc/extensions/ext-wernis.php index bde8ccb19d..cce98ab27b 100644 --- a/inc/extensions/ext-wernis.php +++ b/inc/extensions/ext-wernis.php @@ -103,14 +103,14 @@ case "update": // Update an extension break; default: // Do stuff when extension is loaded - $DUMMY = LOAD_CONFIG("0"); - $_CONFIG['wernis_min_payout'] = $DUMMY['wernis_min_payout']; - $_CONFIG['wernis_min_withdraw'] = $DUMMY['wernis_min_withdraw']; - $_CONFIG['wernis_api_id'] = $DUMMY['wernis_api_id']; - $_CONFIG['wernis_api_md5'] = $DUMMY['wernis_api_md5']; - $_CONFIG['wernis_api_url'] = $DUMMY['wernis_api_url']; - $_CONFIG['wernis_refid'] = $DUMMY['wernis_refid']; - unset($DUMMY); + $dummy = LOAD_CONFIG(); + $_CONFIG['wernis_min_payout'] = $dummy['wernis_min_payout']; + $_CONFIG['wernis_min_withdraw'] = $dummy['wernis_min_withdraw']; + $_CONFIG['wernis_api_id'] = $dummy['wernis_api_id']; + $_CONFIG['wernis_api_md5'] = $dummy['wernis_api_md5']; + $_CONFIG['wernis_api_url'] = $dummy['wernis_api_url']; + $_CONFIG['wernis_refid'] = $dummy['wernis_refid']; + unset($dummy); break; } // Language file prefix diff --git a/inc/gen_sql_patches.php b/inc/gen_sql_patches.php index c638eb4b5a..dd6aace8f9 100644 --- a/inc/gen_sql_patches.php +++ b/inc/gen_sql_patches.php @@ -48,7 +48,7 @@ if (empty($_CONFIG['pass_scramble'])) $scrambleString = genScrambleString(40); // ... and store it there for future usage - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET pass_scramble='%s' WHERE config='0' LIMIT 1", + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET pass_scramble='%s' WHERE config=0 LIMIT 1", array($scrambleString), __FILE__, __LINE__); // Also remember it in config @@ -64,7 +64,7 @@ if (empty($_CONFIG['master_salt'])) $masterSalt = scrambleString(substr(generateHash(GEN_PASS(rand(128, 256))), 0, -40)); // ... and store it there for future usage - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET master_salt='%s' WHERE config='0' LIMIT 1", + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET master_salt='%s' WHERE config=0 LIMIT 1", array($masterSalt), __FILE__, __LINE__); // Also remember it in config @@ -101,7 +101,7 @@ if (empty($_CONFIG['file_hash'])) //* DEBUG: */ die("Secret-Key: ".$secretKey."
Cookie: ".$_SESSION['u_hash']."
Test: ".$test); // Write $file_hash to database - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET file_hash='%s' WHERE config='0' LIMIT 1", + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET file_hash='%s' WHERE config=0 LIMIT 1", array($file_hash), __FILE__, __LINE__); // Also create .htaccess file diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index b168a75d47..210d88a805 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -40,7 +40,7 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) // Check ACL for menu combination function ADMINS_CHECK_ACL($act, $wht) { - global $ADMINS, $ADMINS_ACLS, $_CONFIG, $CACHE; + global $cacheArray, $_CONFIG, $cacheInstance; // If action is login or logout allow allways! $default = "allow"; if (($act == "login") || ($act == "logout")) return true; @@ -49,13 +49,13 @@ function ADMINS_CHECK_ACL($act, $wht) { $ret = false; // Get admin's defult access right - if (!empty($ADMINS['def_acl'][$_SESSION['admin_login']])) { + if (!empty($cacheArray['admins']['def_acl'][$_SESSION['admin_login']])) { // Load from cache - $default = $ADMINS['def_acl'][$_SESSION['admin_login']]; + $default = $cacheArray['admins']['def_acl'][$_SESSION['admin_login']]; // Count cache hits $_CONFIG['cache_hits']++; - } elseif (!is_object($CACHE)) { + } elseif (!is_object($cacheInstance)) { // Load from database $result = SQL_QUERY_ESC("SELECT default_acl FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1", array($_SESSION['admin_login']), __FILE__, __LINE__); @@ -82,19 +82,19 @@ function ADMINS_CHECK_ACL($act, $wht) { $lines = 0; $acl_mode = "failed"; if (GET_EXT_VERSION("cache") >= "0.1.2") { // Load only from array when there are lines! - if (count($ADMINS_ACLS) > 0) { + if (count($cacheArray['admin_acls']) > 0) { // Load ACL from array - foreach ($ADMINS_ACLS['admin_id'] as $id=>$aid_acls) { + foreach ($cacheArray['admin_acls']['admin_id'] as $id=>$aid_acls) { if ($aid == $aid_acls) { // Okay, one line was found! - if ((!empty($act)) && ($ADMINS_ACLS['action_menu'][$id] == $act)) { + if ((!empty($act)) && ($cacheArray['admin_acls']['action_menu'][$id] == $act)) { // Main menu line found - $acl_mode = $ADMINS_ACLS['access_mode'][$id]; + $acl_mode = $cacheArray['admin_acls']['access_mode'][$id]; $lines = 1; } - elseif ((!empty($wht)) && ($ADMINS_ACLS['what_menu'][$id] == $wht)) { + elseif ((!empty($wht)) && ($cacheArray['admin_acls']['what_menu'][$id] == $wht)) { // Check sub menu - $acl_mode = $ADMINS_ACLS['access_mode'][$id]; + $acl_mode = $cacheArray['admin_acls']['access_mode'][$id]; $lines = 1; } if ($lines == 1) { @@ -175,10 +175,10 @@ WHERE email='%s'".$locked." LIMIT 1", // Change a lot admin account function ADMINS_CHANGE_ADMIN_ACCOUNT($POST) { - global $CACHE; + global $cacheInstance; // Begin the update - $CACHE_UPDATE = "0"; + $cacheInstance_UPDATE = "0"; foreach ($POST['login'] as $id=>$login) { // Secure ID number $id = bigintval($id); @@ -186,7 +186,7 @@ function ADMINS_CHANGE_ADMIN_ACCOUNT($POST) { // When both passwords match update admin account if ($POST['pass1'][$id] == $POST['pass2'][$id]) { // Save only when both passwords are the same (also when they are empty) - $ADD = ""; $CACHE_UPDATE = "1"; + $ADD = ""; $cacheInstance_UPDATE = "1"; // Generate hash $hash = generateHash($POST['pass1'][$id]); @@ -248,8 +248,8 @@ WHERE id=%d LIMIT 1", } // Remove cache file - if ((EXT_IS_ACTIVE("cache")) && ($CACHE_UPDATE == "1")) { - if ($CACHE->cache_file("admins", true)) $CACHE->cache_destroy(); + if ((EXT_IS_ACTIVE("cache")) && ($cacheInstance_UPDATE == "1")) { + if ($cacheInstance->cache_file("admins", true)) $cacheInstance->cache_destroy(); } } @@ -333,7 +333,7 @@ function ADMINS_DELETE_ADMIN_ACCOUNTS ($POST) { // Remove the given accounts function ADMINS_REMOVE_ADMIN_ACCOUNTS ($POST) { // Begin removal - $CACHE_UPDATE = "0"; + $cacheInstance_UPDATE = "0"; foreach ($POST['sel'] as $id=>$del) { // Secure ID number $id = bigintval($id); @@ -348,13 +348,13 @@ function ADMINS_REMOVE_ADMIN_ACCOUNTS ($POST) { $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admins WHERE id=%d LIMIT 1", array($id), __FILE__, __LINE__); - $CACHE_UPDATE = "1"; + $cacheInstance_UPDATE = "1"; } } // Remove cache if cache system is activated - if ((EXT_IS_ACTIVE("cache")) && ($CACHE_UPDATE == "1")) { - if ($CACHE->cache_file("admins", true)) $CACHE->cache_destroy(); + if ((EXT_IS_ACTIVE("cache")) && ($cacheInstance_UPDATE == "1")) { + if ($cacheInstance->cache_file("admins", true)) $cacheInstance->cache_destroy(); } } diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php index c52b7a9bbd..1310396b97 100644 --- a/inc/libs/bonus_functions.php +++ b/inc/libs/bonus_functions.php @@ -245,7 +245,7 @@ function BONUS_POINTS_HANDLER($MODE) else { // Try to subtract from jackpot - $DUMMY = SUB_JACKPOT($points); + $dummy = SUB_JACKPOT($points); } break; } diff --git a/inc/libs/cache_functions.php b/inc/libs/cache_functions.php index 19cebed629..2e42b1dd95 100644 --- a/inc/libs/cache_functions.php +++ b/inc/libs/cache_functions.php @@ -34,332 +34,327 @@ // Some security stuff... if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) { - $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; - require($INC); + $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; + require($INC); } // Caching class class mxchange_cache { - // Define variables - var $update_interval = 0; - var $ret = "init"; - var $cache_path = ""; - var $cache_inc = ""; - var $cache_ctime = 0; - var $cache_pointer = false; - - // Constructor - function mxchange_cache($interval, $path, $tested) { - // Remember interval in class - $this->update_interval=$interval; - - // Remeber path - $this->cache_path=$path; - - // Check if path exists - if ((file_exists($path)) && (is_dir($path)) && (!$tested)) - { - // Check if we can create a file inside the path - @touch($path."dummy.tmp", 'w'); - if (file_exists($path."dummy.tmp")) - { - // Yes, we can do. So let's remove it - unlink($path."dummy.tmp"); - - // Is there a .htaccess file? - if (file_exists($path.".htaccess")) - { - // Update database that we have tested it - $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET cache_tested='1' WHERE config='0' LIMIT 1", __FILE__, __LINE__); - $this->ret="done"; - - // All done! - return "done"; - } - else - { - // Stop! Set a .htaccess file first - $this->ret="htaccess"; - return "htaccess"; - } - } - } - elseif ($tested) - { - // System already tested - $this->ret="done"; - return "done"; - } - - // Something goes wrong here! - $this->ret="failed"; - return "failed"; - } - - function cache_file($file, $ignore_ctime=false) - { - global $INC; - // Construct FQFN (full qualified file name) - $inc = $this->cache_path.$file.".cache"; - - // Rember it + filename in class - $this->cache_inc = $inc; - - // Check if file exists - $status = (file_exists($inc) && (is_readable($inc)) && (is_writeable($inc))); - if ($status) - { - // Yes, it does. So let's get it's last changed date/time - $ctime = filectime($inc); - } - else - { - // No, it doesn't. Zero date/time - $ctime = "0"; - } - - // Remember change date/time in class - $this->cache_ctime = $ctime; - - // Is the cache file outdated? - if (((time() - $ctime) >= $this->update_interval) && (!$ignore_ctime)) - { - // Ok, we need an update! - $status = false; - } - return $status; - } - - function cache_init($array) - { - // This will destory an existing cache file! - if ($this->ret == "done") - { - // Create file - if (file_exists($this->cache_inc)) @chmod($this->cache_inc, 0666); - $fp = @fopen($this->cache_inc, 'w') or mxchange_die("Cannot write to cache ".$this->cache_inc." !"); - - // Begin of cache file - fwrite($fp, "\$ARRAY = \"".$array."\";\n\n"); - - // Remember file pointer - $this->cache_pointer = $fp; - } - else - { - // Cannot create file - ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED); - } - } - - function add_row($data) - { - if ($this->cache_pointer) - { - // Write every array element to cache file - foreach ($data as $k=>$v) - { - @fwrite($this->cache_pointer, "\$CACHE['".$k."'][] = \"".$v."\";\n"); - } - } - else - { - // Cannot create file - ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED); - } - } - - function cache_close() - { - // Quit function when no pointer is set - if (empty($this->cache_pointer)) return; - if ($this->cache_pointer) - { - // Close file add destroy handler - @fclose($this->cache_pointer); - - // Set rights - if (file_exists($this->cache_inc)) @chmod($this->cache_inc, 0666); - - // Remove pointer - unset($this->cache_pointer); - } - else - { - // Cannot create file - ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED); - } - } - - function cache_load() - { - if ((file_exists($this->cache_inc)) && (is_readable($this->cache_inc))) - { - // Prepare temporay array - $CACHE = array(); - // Load cache file - $cache = implode("", file($this->cache_inc)); - // Execute cache file - eval($cache); - if (is_array($CACHE)) - { - return $CACHE; - } - else - { - // Cache problem detected! - $this->cache_destroy(); - } - } - else - { - // Cache file not found or not readable - ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_CANNOT_LOAD_1.$this->cache_inc.CACHE_CANNOT_LOAD_2); - } - } - - function cache_destroy() - { - if (file_exists($this->cache_inc)) - { - // Remove cache file from system - @unlink($this->cache_inc); - if (!file_exists($this->cache_inc)) - { - // Close cache automatically (we don't need it anymore!) - $this->cache_close(); - } - else - { - // Not removed! - ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_CANNOT_UNLINK_1.$this->cache_inc.CACHE_CANNOT_UNLINK_2); - } - } - else - { - // Does not exist! - ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_CANNOT_UNLINK_1.$this->cache_inc.CACHE_CANNOT_UNLINK_2); - } - } - - function cache_remove($search, $data, $array) - { - global $ARRAY; - if ((file_exists($this->cache_inc)) && (is_writeable($this->cache_inc))) - { - // Load cache into dummy array - $DUMMY = $this->cache_load(); - - // Search for key in array - $key = array_search($data, $DUMMY[$search]); - if (!empty($key)) - { - // Key (hopefully) found? - foreach ($array as $a) - { - // So we can remove all elements as requested - unset($DUMMY[$a][$key]); - } - - // Flush array to cache file - $fp = fopen($this->cache_inc, 'w'); - fwrite($fp, "\$ARRAY = \"".$ARRAY."\";\n"); - foreach ($DUMMY as $k=>$v) - { - if (is_array($v)) - { - // Multi line(s) found - $LINE = ""; - foreach($v as $k2=>$v2) - { - // Put every array element in a row... - $LINE .= "\$CACHE['".$k."'][] = \"".$v2."\";\n"; - } - } - else - { - // Single line found - $LINE = "\$CACHE['".$k."'] = \"".$v."\";\n"; - } - - // Write line(s) - fwrite($fp, $LINE); - } - - // Close cache file - fclose($fp); - } - } - else - { - // Cannot write to cache! - ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED); - } - } - - function cache_replace($search, $replace, $search_key, $array) - { - global $ARRAY; - if ((file_exists($this->cache_inc)) && (is_writeable($this->cache_inc))) - { - // Load cache into dummy array - $DUMMY = $this->cache_load(); - - // Check if $DUMMY is valid (prevents some errors) - if ((is_array($DUMMY)) && (is_array($DUMMY[$search]))) - { - // Search for key in array - $key_found = array_key_exists($search_key, $DUMMY[$search]); - if ($key_found == true) - { - $key = $search_key; - // Key (hopefully) found? - foreach ($DUMMY as $a=>$v) - { - // So we can update all entries - if ($a == $search) - { - // Update now... - $DUMMY[$a][$search_key] = $replace; - } - } - - // Flush array to cache file - $fp = fopen($this->cache_inc, 'w'); - fwrite($fp, "\$DUMMY = \"".$ARRAY."\";\n"); - foreach ($DUMMY as $k=>$v) - { - if (is_array($v)) - { - // Multi line(s) found - $LINE = ""; - foreach($v as $k2=>$v2) - { - // Put every array element in a row... - $LINE .= "\$CACHE['".$k."'][] = \"".$v2."\";\n"; - } - } - else - { - // Single line found - $LINE = "\$CACHE['".$k."'] = \"".$v."\";\n"; - } - - // Write line(s) - fwrite($fp, $LINE); - } - - // Close cache file - fclose($fp); - } - } - } - else - { - // Cannot write to cache! - ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED); - } - } + // Define variables + var $update_interval = 0; + var $ret = "init"; + var $cache_path = ""; + var $cache_inc = ""; + var $cache_ctime = 0; + var $cache_pointer = false; + + // Constructor + function mxchange_cache($interval, $path, $tested) { + // Remember interval in class + $this->update_interval=$interval; + + // Remeber path + $this->cache_path=$path; + + // Check if path exists + if ((file_exists($path)) && (is_dir($path)) && (!$tested)) + { + // Check if we can create a file inside the path + @touch($path."dummy.tmp", 'w'); + if (file_exists($path."dummy.tmp")) + { + // Yes, we can do. So let's remove it + unlink($path."dummy.tmp"); + + // Is there a .htaccess file? + if (file_exists($path.".htaccess")) + { + // Update database that we have tested it + $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET cache_tested='1' WHERE config=0 LIMIT 1", __FILE__, __LINE__); + $this->ret="done"; + + // All done! + return "done"; + } + else + { + // Stop! Set a .htaccess file first + $this->ret="htaccess"; + return "htaccess"; + } + } + } + elseif ($tested) + { + // System already tested + $this->ret="done"; + return "done"; + } + + // Something goes wrong here! + $this->ret="failed"; + return "failed"; + } + + function cache_file($file, $ignore_ctime=false) + { + global $INC; + // Construct FQFN (full qualified file name) + $inc = $this->cache_path.$file.".cache"; + + // Rember it + filename in class + $this->cache_inc = $inc; + + // Check if file exists + $status = (file_exists($inc) && (is_readable($inc)) && (is_writeable($inc))); + if ($status) + { + // Yes, it does. So let's get it's last changed date/time + $ctime = filectime($inc); + } + else + { + // No, it doesn't. Zero date/time + $ctime = "0"; + } + + // Remember change date/time in class + $this->cache_ctime = $ctime; + + // Is the cache file outdated? + if (((time() - $ctime) >= $this->update_interval) && (!$ignore_ctime)) + { + // Ok, we need an update! + $status = false; + } + return $status; + } + + function cache_init($array) + { + // This will destory an existing cache file! + if ($this->ret == "done") + { + // Create file + if (file_exists($this->cache_inc)) @chmod($this->cache_inc, 0666); + $fp = @fopen($this->cache_inc, 'w') or mxchange_die("Cannot write to cache ".$this->cache_inc." !"); + + // Begin of cache file + fwrite($fp, "\$ARRAY = \"".$array."\";\n\n"); + + // Remember file pointer + $this->cache_pointer = $fp; + } + else + { + // Cannot create file + ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED); + } + } + + function add_row($data) { + if (is_resource($this->cache_pointer)) { + // Write every array element to cache file + foreach ($data as $k=>$v) { + @fwrite($this->cache_pointer, "\$data['".$k."'][] = \"".$v."\";\n"); + } + } else { + // Cannot create file + ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED); + } + } + + function cache_close() + { + // Quit function when no pointer is set + if (empty($this->cache_pointer)) return; + if ($this->cache_pointer) + { + // Close file add destroy handler + @fclose($this->cache_pointer); + + // Set rights + if (file_exists($this->cache_inc)) @chmod($this->cache_inc, 0666); + + // Remove pointer + unset($this->cache_pointer); + } + else + { + // Cannot create file + ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED); + } + } + + function cache_load() + { + if ((file_exists($this->cache_inc)) && (is_readable($this->cache_inc))) + { + // Prepare temporary array + $data = array(); + + // Load cache file + $cache = implode("", file($this->cache_inc)); + + // Execute cache file + eval($cache); + if (is_array($data)) { + // Return cache + return $data; + } else { + // Cache problem detected! + $this->cache_destroy(); + } + } + else + { + // Cache file not found or not readable + ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_CANNOT_LOAD_1.$this->cache_inc.CACHE_CANNOT_LOAD_2); + } + } + + function cache_destroy() + { + if (file_exists($this->cache_inc)) + { + // Remove cache file from system + @unlink($this->cache_inc); + if (!file_exists($this->cache_inc)) + { + // Close cache automatically (we don't need it anymore!) + $this->cache_close(); + } + else + { + // Not removed! + ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_CANNOT_UNLINK_1.$this->cache_inc.CACHE_CANNOT_UNLINK_2); + } + } + else + { + // Does not exist! + ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_CANNOT_UNLINK_1.$this->cache_inc.CACHE_CANNOT_UNLINK_2); + } + } + + function cache_remove($search, $data, $array) + { + global $ARRAY; + if ((file_exists($this->cache_inc)) && (is_writeable($this->cache_inc))) + { + // Load cache into dummy array + $dummy = $this->cache_load(); + + // Search for key in array + $key = array_search($data, $dummy[$search]); + if (!empty($key)) + { + // Key (hopefully) found? + foreach ($array as $a) + { + // So we can remove all elements as requested + unset($dummy[$a][$key]); + } + + // Flush array to cache file + $fp = fopen($this->cache_inc, 'w'); + fwrite($fp, "\$ARRAY = \"".$ARRAY."\";\n"); + foreach ($dummy as $k=>$v) + { + if (is_array($v)) + { + // Multi line(s) found + $LINE = ""; + foreach($v as $k2=>$v2) + { + // Put every array element in a row... + $LINE .= "\$cacheInstance['".$k."'][] = \"".$v2."\";\n"; + } + } + else + { + // Single line found + $LINE = "\$cacheInstance['".$k."'] = \"".$v."\";\n"; + } + + // Write line(s) + fwrite($fp, $LINE); + } + + // Close cache file + fclose($fp); + } + } + else + { + // Cannot write to cache! + ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED); + } + } + + function cache_replace($search, $replace, $search_key, $array) + { + global $ARRAY; + if ((file_exists($this->cache_inc)) && (is_writeable($this->cache_inc))) + { + // Load cache into dummy array + $dummy = $this->cache_load(); + + // Check if $dummy is valid (prevents some errors) + if ((is_array($dummy)) && (isset($dummy[$search])) && (is_array($dummy[$search]))) + { + // Search for key in array + $key_found = array_key_exists($search_key, $dummy[$search]); + if ($key_found == true) + { + $key = $search_key; + // Key (hopefully) found? + foreach ($dummy as $a=>$v) + { + // So we can update all entries + if ($a == $search) + { + // Update now... + $dummy[$a][$search_key] = $replace; + } + } + + // Flush array to cache file + $fp = fopen($this->cache_inc, 'w'); + fwrite($fp, "\$dummy = \"".$ARRAY."\";\n"); + foreach ($dummy as $k=>$v) + { + if (is_array($v)) + { + // Multi line(s) found + $LINE = ""; + foreach($v as $k2=>$v2) + { + // Put every array element in a row... + $LINE .= "\$cacheInstance['".$k."'][] = \"".$v2."\";\n"; + } + } + else + { + // Single line found + $LINE = "\$cacheInstance['".$k."'] = \"".$v."\";\n"; + } + + // Write line(s) + fwrite($fp, $LINE); + } + + // Close cache file + fclose($fp); + } + } + } + else + { + // Cannot write to cache! + ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED); + } + } } // ?> diff --git a/inc/load_cache.php b/inc/load_cache.php index d31cf3a766..165bf9cca3 100644 --- a/inc/load_cache.php +++ b/inc/load_cache.php @@ -38,69 +38,69 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) { } // Let's start with the admins table... -if (($CACHE->cache_file("admins", true) == true)) { +if (($cacheInstance->cache_file("admins", true) == true)) { // Load cache - global $ADMINS; - $ADMINS = $CACHE->cache_load(); + global $cacheArray; + $cacheArray['admins'] = $cacheInstance->cache_load(); // Check if valid - if ((is_array($ADMINS['login'])) && (is_array($ADMINS['aid']))) { + if ((is_array($cacheArray['admins']['login'])) && (is_array($cacheArray['admins']['aid']))) { // Check count - if (count($ADMINS['login']) == count($ADMINS['aid'])) { + if (count($cacheArray['admins']['login']) == count($cacheArray['admins']['aid'])) { //* DEBUG: */ echo "
";
-			//* DEBUG: */ print_r($ADMINS);
+			//* DEBUG: */ print_r($cacheArray['admins']);
 
 			// The cache file seems to be fine
-			foreach ($ADMINS['login'] as $k=>$login) {
+			foreach ($cacheArray['admins']['login'] as $k=>$login) {
 				// Rewrite default_acl
-				$ADMINS['aid'][$login]      = $ADMINS['aid'][$k];
-				$ADMINS['password'][$login] = $ADMINS['password'][$k];
-				$ADMINS['email'][$login]    = $ADMINS['email'][$k];
+				$cacheArray['admins']['aid'][$login]      = $cacheArray['admins']['aid'][$k];
+				$cacheArray['admins']['password'][$login] = $cacheArray['admins']['password'][$k];
+				$cacheArray['admins']['email'][$login]    = $cacheArray['admins']['email'][$k];
 
 				// Some extra data depening on version
 				if (GET_EXT_VERSION("admins") >= "0.3") {
-					$ADMINS['def_acl'][$login]  = $ADMINS['def_acl'][$k];
+					$cacheArray['admins']['def_acl'][$login]  = $cacheArray['admins']['def_acl'][$k];
 					if (GET_EXT_VERSION("admins") >= "0.6.7") {
-						$ADMINS['la_mode'][$login]  = $ADMINS['la_mode'][$k];
+						$cacheArray['admins']['la_mode'][$login]  = $cacheArray['admins']['la_mode'][$k];
 					}
 				}
 
-				//* DEBUG: */ print_r($ADMINS);
+				//* DEBUG: */ print_r($cacheArray['admins']);
 
 				// Clear array
-				if (isset($ADMINS['aid'][$k])) 		unset($ADMINS['aid'][$k]);
-				if (isset($ADMINS['def_acl'][$k]))	unset($ADMINS['def_acl'][$k]);
-				if (isset($ADMINS['la_mode'][$k]))	unset($ADMINS['la_mode'][$k]);
-				if (isset($ADMINS['password'][$k]))	unset($ADMINS['password'][$k]);
-				if (isset($ADMINS['email'][$k]))	unset($ADMINS['email'][$k]);
+				if (isset($cacheArray['admins']['aid'][$k])) 		unset($cacheArray['admins']['aid'][$k]);
+				if (isset($cacheArray['admins']['def_acl'][$k]))	unset($cacheArray['admins']['def_acl'][$k]);
+				if (isset($cacheArray['admins']['la_mode'][$k]))	unset($cacheArray['admins']['la_mode'][$k]);
+				if (isset($cacheArray['admins']['password'][$k]))	unset($cacheArray['admins']['password'][$k]);
+				if (isset($cacheArray['admins']['email'][$k]))	unset($cacheArray['admins']['email'][$k]);
 			}
 
-			//* DEBUG: */ print_r($ADMINS);
+			//* DEBUG: */ print_r($cacheArray['admins']);
 
 			// Rewrite Login
-			foreach ($ADMINS['login'] as $k=>$login) {
-				$ADMINS['login'][$ADMINS['aid'][$login]] = $login;
-				if (!in_array($k, $ADMINS['aid'])) {
-					unset($ADMINS['login'][$k]);
+			foreach ($cacheArray['admins']['login'] as $k=>$login) {
+				$cacheArray['admins']['login'][$cacheArray['admins']['aid'][$login]] = $login;
+				if (!in_array($k, $cacheArray['admins']['aid'])) {
+					unset($cacheArray['admins']['login'][$k]);
 				}
 			}
 
 			//* DEBUG: */ echo "****\n";
-			//* DEBUG: */ print_r($ADMINS);
+			//* DEBUG: */ print_r($cacheArray['admins']);
 			//* DEBUG: */ echo "
"; //* DEBUG: */ die(); } else { // Nope, cache file is corrupted! - $CACHE->cache_destroy(); + $cacheInstance->cache_destroy(); } } else { // Nope, cache file is corrupted! - $CACHE->cache_destroy(); - unset($ADMINS); + $cacheInstance->cache_destroy(); + unset($cacheArray['admins']); } } elseif (($_CONFIG['cache_admins'] == 'Y') && ($CSS != "1") && ($CSS != "-1")) { // Create cache file - $CACHE->cache_init("ADMINS"); + $cacheInstance->cache_init("ADMINS"); // Load every data from DB to cache file $ADD = ", id, id"; @@ -113,7 +113,7 @@ FROM "._MYSQL_PREFIX."_admins ORDER BY login", __FILE__, __LINE__); while($dummy = SQL_FETCHARRAY($result_admins)) { // Save row - $CACHE->add_row($dummy); + $cacheInstance->add_row($dummy); } // Free memory @@ -121,51 +121,51 @@ ORDER BY login", __FILE__, __LINE__); } // Close file -$CACHE->cache_close(); +$cacheInstance->cache_close(); // Next cached table is the module registry (mod_reg)... -if ($CACHE->cache_file("mod_reg", true) == true) { +if ($cacheInstance->cache_file("mod_reg", true) == true) { // Load cache - global $MODULES; - $MODULES = $CACHE->cache_load(); + global $cacheArray; + $cacheArray['modules'] = $cacheInstance->cache_load(); // Valid cache file $CNT = 0; - foreach ($MODULES as $k=>$array) { + foreach ($cacheArray['modules'] as $k=>$array) { $CNT += count($array); } // When there is a period (.) in the result this test will fail and so the cache file is // damaged/corrupted $TEST = "failed"; - if (count($MODULES) > 0 ) $TEST = ($CNT / (count($MODULES))); + if (count($cacheArray['modules']) > 0 ) $TEST = ($CNT / (count($cacheArray['modules']))); if ($TEST != bigintval($TEST)) { // Cache file is corrupted! - $CACHE->cache_destroy(); - unset($MODULES); + $cacheInstance->cache_destroy(); + unset($cacheArray['modules']); } else { // Rewrite module cache - $MOD = $MODULES; - foreach ($MODULES['module'] as $key=>$mod) { - $MODULES['id'][$mod] = $MODULES['id'][$key]; - unset($MODULES['id'][$key]); - $MODULES['title'][$mod] = $MODULES['title'][$key]; - unset($MODULES['title'][$key]); - $MODULES['locked'][$mod] = $MODULES['locked'][$key]; - unset($MODULES['locked'][$key]); - $MODULES['hidden'][$mod] = $MODULES['hidden'][$key]; - unset($MODULES['hidden'][$key]); - $MODULES['admin_only'][$mod] = $MODULES['admin_only'][$key]; - unset($MODULES['admin_only'][$key]); - $MODULES['mem_only'][$mod] = $MODULES['mem_only'][$key]; - unset($MODULES['mem_only'][$key]); - $MODULES['has_menu'][$mod] = $MODULES['has_menu'][$key]; - unset($MODULES['has_menu'][$key]); + $MOD = $cacheArray['modules']; + foreach ($cacheArray['modules']['module'] as $key=>$mod) { + $cacheArray['modules']['id'][$mod] = $cacheArray['modules']['id'][$key]; + unset($cacheArray['modules']['id'][$key]); + $cacheArray['modules']['title'][$mod] = $cacheArray['modules']['title'][$key]; + unset($cacheArray['modules']['title'][$key]); + $cacheArray['modules']['locked'][$mod] = $cacheArray['modules']['locked'][$key]; + unset($cacheArray['modules']['locked'][$key]); + $cacheArray['modules']['hidden'][$mod] = $cacheArray['modules']['hidden'][$key]; + unset($cacheArray['modules']['hidden'][$key]); + $cacheArray['modules']['admin_only'][$mod] = $cacheArray['modules']['admin_only'][$key]; + unset($cacheArray['modules']['admin_only'][$key]); + $cacheArray['modules']['mem_only'][$mod] = $cacheArray['modules']['mem_only'][$key]; + unset($cacheArray['modules']['mem_only'][$key]); + $cacheArray['modules']['has_menu'][$mod] = $cacheArray['modules']['has_menu'][$key]; + unset($cacheArray['modules']['has_menu'][$key]); } } } elseif (($_CONFIG['cache_modreg'] == 'Y') && ($CSS != "1") && ($CSS != "-1")) { // Create cache file here - $CACHE->cache_init("MODULES"); + $cacheInstance->cache_init("MODULES"); // Load all modules and their data if (GET_EXT_VERSION("sql_patches") >= "0.3.6") { @@ -179,7 +179,7 @@ FROM "._MYSQL_PREFIX."_mod_reg ORDER BY id", __FILE__, __LINE__); } while ($DATA = SQL_FETCHARRAY($result)) { // Add row to cache file - $CACHE->add_row($DATA); + $cacheInstance->add_row($DATA); } // Free memory @@ -187,38 +187,44 @@ FROM "._MYSQL_PREFIX."_mod_reg ORDER BY id", __FILE__, __LINE__); } // Close file -$CACHE->cache_close(); +$cacheInstance->cache_close(); // Next cached table is the configuration (config)... -if ($CACHE->cache_file("config", true) == true) { +if ($cacheInstance->cache_file("config", true) == true) { // Load config from cache - global $CFG_CACHE; - $CFG_CACHE = $CACHE->cache_load(); + global $cacheArray; + $cacheArray = $cacheInstance->cache_load(); // Valid cache file - $CNT = 0; - foreach ($CFG_CACHE as $k=>$array) { + $CNT = 0; $newCache = array(); + foreach ($cacheArray as $key=>$array) { + foreach ($array as $key2=>$value) { + $newCache[$key2][$key] = $value; + } $CNT += count($array); } + // Overwrite the config with the cache version + $cacheArray['config'] = $newCache; + // When there is a period (.) in the result this test will fail and so the cache file is // damaged/corrupted $TEST = "failed"; - if (count($CFG_CACHE) > 0 ) $TEST = ($CNT / (count($CFG_CACHE))); + if (count($cacheArray) > 0 ) $TEST = ($CNT / (count($cacheArray))); if ($TEST != bigintval($TEST)) { // Cache file is corrupted! - $CACHE->cache_destroy(); - unset($CFG_CACHE); + $cacheInstance->cache_destroy(); + unset($cacheArray); } } elseif (($_CONFIG['cache_config'] == 'Y') && ($CSS != "1") && ($CSS != "-1")) { // Create cache file here - $CACHE->cache_init("CONFIG"); + $cacheInstance->cache_init("CONFIG"); // Load all modules and their data $result = SQL_QUERY("SELECT * FROM "._MYSQL_PREFIX."_config ORDER BY config", __FILE__, __LINE__); while ($DATA = SQL_FETCHARRAY($result)) { // Add row to cache file - $CACHE->add_row($DATA); + $cacheInstance->add_row($DATA); } // Free memory @@ -226,13 +232,13 @@ if ($CACHE->cache_file("config", true) == true) { } // Close file -$CACHE->cache_close(); +$cacheInstance->cache_close(); // Next cached table is the referral system (refsystem)... -if ($CACHE->cache_file("refsystem", true) == true) { +if ($cacheInstance->cache_file("refsystem", true) == true) { // Load referral system from cache global $REF_SYSTEM; - $REF_SYSTEM = $CACHE->cache_load(); + $REF_SYSTEM = $cacheInstance->cache_load(); // Valid cache file $CNT = 0; @@ -246,18 +252,18 @@ if ($CACHE->cache_file("refsystem", true) == true) { if (count($REF_SYSTEM) > 0 ) $TEST = ($CNT / (count($REF_SYSTEM))); if ($TEST != bigintval($TEST)) { // Cache file is corrupted! - $CACHE->cache_destroy(); + $cacheInstance->cache_destroy(); unset($REF_SYSTEM); } } elseif (($_CONFIG['cache_refsys'] == 'Y') && ($CSS != "1") && ($CSS != "-1")) { // Create cache file here - $CACHE->cache_init("REFSYSTEM"); + $cacheInstance->cache_init("REFSYSTEM"); // Load all modules and their data $result = SQL_QUERY("SELECT id, userid, level, counter FROM "._MYSQL_PREFIX."_refsystem ORDER BY userid, level", __FILE__, __LINE__); while ($DATA = SQL_FETCHARRAY($result)) { // Add row to cache file - $CACHE->add_row($DATA); + $cacheInstance->add_row($DATA); } // Free memory @@ -265,13 +271,13 @@ if ($CACHE->cache_file("refsystem", true) == true) { } // Close file -$CACHE->cache_close(); +$cacheInstance->cache_close(); // Next cached table is the referral system (refdepths)... -if ($CACHE->cache_file("refdepths", true) == true) { +if ($cacheInstance->cache_file("refdepths", true) == true) { // Load referral system from cache global $REF_DEPTHS; - $REF_DEPTHS = $CACHE->cache_load(); + $REF_DEPTHS = $cacheInstance->cache_load(); // Valid cache file $CNT = 0; @@ -285,18 +291,18 @@ if ($CACHE->cache_file("refdepths", true) == true) { if (count($REF_DEPTHS) > 0 ) $TEST = ($CNT / (count($REF_DEPTHS))); if ($TEST != bigintval($TEST)) { // Cache file is corrupted! - $CACHE->cache_destroy(); + $cacheInstance->cache_destroy(); unset($REF_DEPTHS); } } elseif (($_CONFIG['cache_refdepth'] == 'Y') && ($CSS != "1") && ($CSS != "-1")) { // Create cache file here - $CACHE->cache_init("REFDEPTHS"); + $cacheInstance->cache_init("REFDEPTHS"); // Load all modules and their data $result = SQL_QUERY("SELECT id, level, percents FROM "._MYSQL_PREFIX."_refdepths ORDER BY level", __FILE__, __LINE__); while ($DATA = SQL_FETCHARRAY($result)) { // Add row to cache file - $CACHE->add_row($DATA); + $cacheInstance->add_row($DATA); } // Free memory @@ -304,42 +310,42 @@ if ($CACHE->cache_file("refdepths", true) == true) { } // Close file -$CACHE->cache_close(); +$cacheInstance->cache_close(); // Next cached table is the referral system (admins_acls)... if (GET_EXT_VERSION("admins") >= "0.3") { // Check for cache file - if ($CACHE->cache_file("admins_acls", true) == true) { + if ($cacheInstance->cache_file("admins_acls", true) == true) { // Load referral system from cache - global $ADMINS_ACLS; - $ADMINS_ACLS = $CACHE->cache_load(); + global $cacheArray; + $cacheArray['admin_acls'] = $cacheInstance->cache_load(); // Valid cache file $CNT = 0; - foreach ($ADMINS_ACLS as $k=>$array) { + foreach ($cacheArray['admin_acls'] as $k=>$array) { $CNT += count($array); } // When there is a period (.) in the result this test will fail and so the cache file is // damaged/corrupted - if (count($ADMINS_ACLS) > 0) { + if (count($cacheArray['admin_acls']) > 0) { $TEST = "failed"; - if (count($ADMINS_ACLS) > 0 ) $TEST = ($CNT / (count($ADMINS_ACLS))); + if (count($cacheArray['admin_acls']) > 0 ) $TEST = ($CNT / (count($cacheArray['admin_acls']))); if ($TEST != bigintval($TEST)) { // Cache file is corrupted! - $CACHE->cache_destroy(); - unset($ADMINS_ACLS); + $cacheInstance->cache_destroy(); + unset($cacheArray['admin_acls']); } } } elseif (($_CONFIG['cache_acls'] == 'Y') && ($CSS != "1") && ($CSS != "-1")) { // Create cache file here - $CACHE->cache_init("ADMINS_ACLS"); + $cacheInstance->cache_init("ADMINS_ACLS"); // Load all modules and their data $result = SQL_QUERY("SELECT id, admin_id, action_menu, what_menu, access_mode FROM "._MYSQL_PREFIX."_admins_acls ORDER BY admin_id, action_menu, what_menu", __FILE__, __LINE__); while ($DATA = SQL_FETCHARRAY($result)) { // Add row to cache file - $CACHE->add_row($DATA); + $cacheInstance->add_row($DATA); } // Free memory @@ -347,7 +353,7 @@ if (GET_EXT_VERSION("admins") >= "0.3") { } // Close file - $CACHE->cache_close(); + $cacheInstance->cache_close(); } // diff --git a/inc/load_extensions.php b/inc/load_extensions.php index 8c469bd3c0..0f35a1acfd 100644 --- a/inc/load_extensions.php +++ b/inc/load_extensions.php @@ -51,12 +51,12 @@ if (file_exists(PATH."inc/extensions/ext-sql_patches.php") && is_readable(PATH." // Load it... $EXT_LOAD_MODE = ""; require_once(PATH."inc/extensions/ext-sql_patches.php"); - $KEEP_ACTIVE = array('sql_patches' => 'Y'); // KEEP THIS ALWAYS ACTIVE! + $cacheArray['active_extensions'] = array('sql_patches' => 'Y'); // KEEP THIS ALWAYS ACTIVE! } else { // Initialize array for "always keep active extensions" - $KEEP_ACTIVE = array(); + $cacheArray['active_extensions'] = array(); } // @@ -66,35 +66,35 @@ if (EXT_IS_ACTIVE("cache")) { // Load cache extension alone include_once(PATH."inc/libs/cache_functions.php"); - $CACHE_FILE = ""; + $cacheMode = ""; include_once(PATH."inc/extensions/ext-cache.php"); - switch($CACHE->cache_file("extensions", true)) + switch($cacheInstance->cache_file("extensions", true)) { - case true : $CACHE_FILE = "load"; break; - case false: $CACHE_FILE = "init"; break; + case true : $cacheMode = "load"; break; + case false: $cacheMode = "init"; break; } // Do not recreate cache file when it's switched off! - if (($CACHE_FILE == "init") && ($_CONFIG['cache_exts'] == 'N')) $CACHE_FILE = "skip"; + if (($cacheMode == "init") && ($_CONFIG['cache_exts'] == 'N')) $cacheMode = "skip"; // Load language - if ($CACHE_FILE == "load") include(PATH."inc/language/cache_".GET_LANGUAGE().".php"); + if ($cacheMode == "load") include(PATH."inc/language/cache_".GET_LANGUAGE().".php"); } else { - $CACHE_FILE = "no"; + $cacheMode = "no"; } -if ($CACHE_FILE == "load") +if ($cacheMode == "load") { // Load more cache files (like admins) require_once(PATH."inc/load_cache.php"); // Re-initialize handler - $CACHE->cache_file("extensions", true); + $cacheInstance->cache_file("extensions", true); // Load extension data from cache file - $EXT_DUMMY = $CACHE->cache_load(); + $EXT_DUMMY = $cacheInstance->cache_load(); foreach ($EXT_DUMMY['ext_name'] as $k=>$name) { // Load functions file @@ -123,7 +123,7 @@ if ($CACHE_FILE == "load") unset($EXT_DUMMY['ext_active'][$k]); $EXT_DUMMY['ext_menu'][$name] = $EXT_DUMMY['ext_menu'][$k]; unset($EXT_DUMMY['ext_menu'][$k]); - $KEEP_ACTIVE['$name'] = $EXT_DUMMY['ext_keep'][$k]; + $cacheArray['active_extensions']['$name'] = $EXT_DUMMY['ext_keep'][$k]; unset($EXT_DUMMY['ext_keep'][$k]); $k2 = $EXT_DUMMY['ext_id'][$k]; $EXT_DUMMY['ext_id'][$k2] = $name; @@ -136,14 +136,14 @@ if ($CACHE_FILE == "load") } // Close cache file - $CACHE->cache_close(); + $cacheInstance->cache_close(); // Loading cache is done so let's free some memory! unset($EXT_DUMMY['ext_lang']); unset($EXT_DUMMY['ext_keep']); unset($EXT_DUMMY['ext_css']); unset($EXT_DUMMY['ext_funcs']); - $EXTENSIONS = $EXT_DUMMY; + $cacheArray['extensions'] = $EXT_DUMMY; unset($EXT_DUMMY); // No database load needed @@ -175,13 +175,13 @@ ORDER BY ext_name", __FILE__, __LINE__); $DEL = array(); // At least one found? -if ((SQL_NUMROWS($res_ext_crt) > 0) && (($CACHE_FILE == "init") || ($CACHE_FILE == "no")) && ($CSS != "1") && ($CSS != "-1")) +if ((SQL_NUMROWS($res_ext_crt) > 0) && (($cacheMode == "init") || ($cacheMode == "no")) && ($CSS != "1") && ($CSS != "-1")) { // Load theme management require_once(PATH."inc/theme-manager.php"); // If we need to init the cache init it now - if ($CACHE_FILE == "init") $CACHE->cache_init("EXTENSIONS"); + if ($cacheMode == "init") $cacheInstance->cache_init("EXTENSIONS"); // Extensions are registered so we load them while (list($EXT_ID, $name, $lang, $css, $active, $version) = SQL_FETCHROW($res_ext_crt)) @@ -264,9 +264,9 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && (($CACHE_FILE == "init") || ($CACHE_FILE } // Add cache row - if ($CACHE_FILE == "init") + if ($cacheMode == "init") { - $CACHE->add_row(array( + $cacheInstance->add_row(array( 'ext_id' => $EXT_ID, 'ext_name' => $name, 'ext_lang' => $lang, @@ -278,10 +278,10 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && (($CACHE_FILE == "init") || ($CACHE_FILE 'ext_keep' => $EXT_ALWAYS_ACTIVE, )); } - elseif ($CACHE_FILE == "no") + elseif ($cacheMode == "no") { // Remember this value for later usage - $KEEP_ACTIVE[$name] = $EXT_ALWAYS_ACTIVE; + $cacheArray['active_extensions'][$name] = $EXT_ALWAYS_ACTIVE; } } elseif (!file_exists($file1)) @@ -291,10 +291,10 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && (($CACHE_FILE == "init") || ($CACHE_FILE } } - if ($CACHE_FILE == "init") + if ($cacheMode == "init") { // Close cache file - $CACHE->cache_close(); + $cacheInstance->cache_close(); // Load more cache files (like admins) require_once(PATH."inc/load_cache.php"); @@ -304,16 +304,6 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && (($CACHE_FILE == "init") || ($CACHE_FILE // Free memory SQL_FREERESULT($res_ext_crt); -// Compile configuration system -/** - * Commented out... - * - *foreach ($_CONFIG as $k=>$v) - *{ - * $_CONFIG[$k] = COMPILE_CODE($v); - *} - */ - // Load include files if (!empty($INC_POOL[0])) { diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index c2a5e24458..3d31335d5f 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -64,12 +64,12 @@ function REGISTER_ADMIN ($user, $md5) // Only be executed on login procedure! function CHECK_ADMIN_LOGIN ($admin_login, $password) { - global $ADMINS, $_CONFIG, $CACHE; + global $cacheArray, $_CONFIG, $cacheInstance; $ret = "404"; $pass = ""; - if (!empty($ADMINS['aid'][$admin_login])) + if (!empty($cacheArray['admins']['aid'][$admin_login])) { // Get password from cache - $pass = $ADMINS['password'][$admin_login]; + $pass = $cacheArray['admins']['password'][$admin_login]; $ret = "pass"; $_CONFIG['cache_hits']++; } @@ -111,9 +111,9 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password) array($pass, $admin_login), __FILE__, __LINE__); // Shall I remove the cache file? - if ((EXT_IS_ACTIVE("cache")) && ($CACHE != false)) + if ((EXT_IS_ACTIVE("cache")) && ($cacheInstance != false)) { - if ($CACHE->cache_file("admins", true)) $CACHE->cache_destroy(); + if ($cacheInstance->cache_file("admins", true)) $cacheInstance->cache_destroy(); } // Password matches! @@ -128,11 +128,11 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password) } // Only be executed on cookie checking function CHECK_ADMIN_COOKIES ($admin_login, $password) { - global $ADMINS, $_CONFIG; + global $cacheArray, $_CONFIG; $ret = "404"; $pass = ""; - if (!empty($ADMINS['aid'][$admin_login])) { + if (!empty($cacheArray['admins']['aid'][$admin_login])) { // Get password from cache - $pass = $ADMINS['password'][$admin_login]; + $pass = $cacheArray['admins']['password'][$admin_login]; $ret = "pass"; $_CONFIG['cache_hits']++; } else { @@ -221,12 +221,12 @@ function admin_WriteData ($file, $comment, $prefix, $suffix, $DATA, $seek=0) // function ADMIN_DO_ACTION($wht) { - global $menuDesription, $menuTitle, $_CONFIG, $EXTENSIONS, $link, $DATA; + global $menuDesription, $menuTitle, $_CONFIG, $cacheArray, $link, $DATA; //* DEBUG: */ echo __LINE__."*".$wht."/".$GLOBALS['module']."/".$GLOBALS['action']."/".$GLOBALS['what']."*
\n"; if (EXT_IS_ACTIVE("cache")) { // Include cache instance - global $CACHE; + global $cacheInstance; } // Remove any spaces from variable @@ -300,7 +300,7 @@ LIMIT 1", array($act, $wht, $wht), __FILE__, __LINE__); // function ADD_ADMIN_MENU($act, $wht,$return=false) { - global $_GET, $menuDesription, $menuTitle, $link; + global $menuDesription, $menuTitle, $link; $SUB = false; // Menu descriptions @@ -453,7 +453,6 @@ function ADD_ADMIN_MENU($act, $wht,$return=false) // function ADD_MEMBER_SELECTION_BOX($add_all = false, $return = false, $none = false, $def = "0") { - global $_GET; // Output selection form with all confirmed user accounts listed $result = SQL_QUERY("SELECT userid, surname, family FROM "._MYSQL_PREFIX."_user_data ORDER BY userid", __FILE__, __LINE__); $OUT = ""; @@ -520,7 +519,7 @@ function ADMIN_MENU_SELECTION($MODE, $default="", $defid="") // function ADMIN_SAVE_SETTINGS (&$POST, $tableName="_config", $whereStatement="config=0", $translateComma = array(), $alwaysAdd=false) { - global $_CONFIG, $CFG_CACHE, $CACHE; + global $_CONFIG, $cacheArray, $cacheInstance; $DATA = array(); $skip = false; $TEST2 = ""; foreach ($POST as $id=>$val) { @@ -622,8 +621,8 @@ function ADMIN_SAVE_SETTINGS (&$POST, $tableName="_config", $whereStatement="con // Is the config table updated and the cache extension installed? if ((GET_EXT_VERSION("cache") >= "0.1.2") && ($tableName == "_config")) { // Remove it here... - if ($CACHE->cache_file("config", true)) $CACHE->cache_destroy(); - unset($CFG_CACHE); + if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy(); + unset($cacheArray); } // Settings saved @@ -675,16 +674,16 @@ function ADMIN_USER_PROFILE_LINK($uid, $title="", $wht="list_user") // function ADMIN_CHECK_MENU_MODE() { - global $_CONFIG, $ADMINS, $_SESSION; + global $_CONFIG, $cacheArray; // Set the global mode as the mode for all admins $MODE = $_CONFIG['admin_menu']; $ADMIN = $MODE; // Check individual settings of current admin - if (isset($ADMINS['la_mode'][$_SESSION['admin_login']])) + if (isset($cacheArray['admins']['la_mode'][$_SESSION['admin_login']])) { // Load from cache - $ADMIN = $ADMINS['la_mode'][$_SESSION['admin_login']]; + $ADMIN = $cacheArray['admins']['la_mode'][$_SESSION['admin_login']]; $_CONFIG['cache_hits']++; } elseif (GET_EXT_VERSION("admins") >= "0.6.7") diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index bea4c69967..f9314a45c5 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -40,7 +40,7 @@ if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN())) function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) { - global $EXTENSIONS, $KEEP_ACTIVE; + global $cacheArray, $cacheArray; // First check for solved and not assigned tasks and assign them to current admin $result_task = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET assigned_admin='%s' WHERE assigned_admin < 1 AND status != 'NEW'", @@ -60,15 +60,15 @@ function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) // Check if extension is installed or not $ext_ver = ""; - if ((!is_array($EXTENSIONS['ext_version'])) || (empty($EXTENSIONS['ext_version'][$ext]))) { + if ((!is_array($cacheArray['extensions']['ext_version'])) || (empty($cacheArray['extensions']['ext_version'][$ext]))) { // Load data from database $result = SQL_QUERY_ESC("SELECT id, ext_version FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1", array($ext), __FILE__, __LINE__); } else { // Load version from cache - if (!empty($EXTENSIONS['ext_version'][$ext])) { + if (!empty($cacheArray['extensions']['ext_version'][$ext])) { // Extension is installed so we can get it's version number - $ext_ver = $EXTENSIONS['ext_version'][$ext]; + $ext_ver = $cacheArray['extensions']['ext_version'][$ext]; } else { // Extension is not installed so no version number was found $ext_ver = ""; @@ -126,7 +126,7 @@ VALUES ('%s', '0', 'NEW', 'EXTENSION', '%s', '%s', UNIX_TIMESTAMP())", else { // Maybe we want to update? - if ((empty($EXTENSIONS['ext_version'][$ext])) && (SQL_NUMROWS($result) == 1)) + if ((empty($cacheArray['extensions']['ext_version'][$ext])) && (SQL_NUMROWS($result) == 1)) { list($dummy, $ext_ver) = SQL_FETCHROW($result); SQL_FREERESULT($result); @@ -135,10 +135,10 @@ VALUES ('%s', '0', 'NEW', 'EXTENSION', '%s', '%s', UNIX_TIMESTAMP())", // Update extension if (!empty($ext_ver)) EXTENSION_UPDATE($file, $ext, $ext_ver); - if (!empty($KEEP_ACTIVE[$ext])) + if (!empty($cacheArray['active_extensions'][$ext])) { // Maybe we want to keept the current extension active? - if (($KEEP_ACTIVE[$ext] == 'Y') && (!EXT_IS_ACTIVE($ext, true, true))) + if (($cacheArray['active_extensions'][$ext] == 'Y') && (!EXT_IS_ACTIVE($ext, true, true))) { // Reactivate this extension! $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_active='Y' WHERE ext_name='%s' LIMIT 1", diff --git a/inc/modules/admin/what-admins_add.php b/inc/modules/admin/what-admins_add.php index bb740c380e..2a842c6144 100644 --- a/inc/modules/admin/what-admins_add.php +++ b/inc/modules/admin/what-admins_add.php @@ -40,7 +40,7 @@ if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN())) // Add description as navigation point ADD_DESCR("admin", basename(__FILE__)); -global $CACHE; +global $cacheInstance; // Display form is default $FORM = true; @@ -63,7 +63,7 @@ if ((isset($_POST['add'])) && (!empty($_POST['login'])) && (!empty($_POST['email // Remove cache file if (EXT_IS_ACTIVE("cache")) { - if ($CACHE->cache_file("admins", true)) $CACHE->cache_destroy(); + if ($cacheInstance->cache_file("admins", true)) $cacheInstance->cache_destroy(); } } else diff --git a/inc/modules/admin/what-admins_edit.php b/inc/modules/admin/what-admins_edit.php index 7bf777273a..6b54b36c2a 100644 --- a/inc/modules/admin/what-admins_edit.php +++ b/inc/modules/admin/what-admins_edit.php @@ -41,7 +41,7 @@ if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN())) ADD_DESCR("admin", basename(__FILE__)); // Instance for the cache extension -global $CACHE; +global $cacheInstance; // Set selection data to empty array when it is empty if (empty($_POST['sel'])) $_POST['sel'] = array(); diff --git a/inc/modules/admin/what-admins_mails.php b/inc/modules/admin/what-admins_mails.php index 34ed0fc551..d10136d258 100644 --- a/inc/modules/admin/what-admins_mails.php +++ b/inc/modules/admin/what-admins_mails.php @@ -47,7 +47,7 @@ if (isset($_POST['edit'])) if ($SEL > 0) { // Add option for userlog - $ADMINS = ADD_OPTION_LINES("admins", "id", "login", "", "email"); + $cacheArray['admins'] = ADD_OPTION_LINES("admins", "id", "login", "", "email"); $SW = 2; $rowNameS = ""; foreach ($_POST['sel'] as $template=>$sel) { @@ -80,7 +80,7 @@ if (isset($_POST['edit'])) 'id' => $id, 'id2' => $id2, 'tpl' => $template, - 'admins' => $ADMINS + 'admins' => $cacheArray['admins'] ); if ($aid2 > 0) diff --git a/inc/modules/admin/what-config_admins.php b/inc/modules/admin/what-config_admins.php index 27cce72684..c20a8c4f8f 100644 --- a/inc/modules/admin/what-config_admins.php +++ b/inc/modules/admin/what-config_admins.php @@ -95,7 +95,7 @@ if ((isset($_POST['edit'])) && ($SEL > 0)) // Update cache when installed if (EXT_IS_ACTIVE("cache")) { - if ($CACHE->cache_file("admins_acls", true) == true) $CACHE->cache_destroy(); + if ($cacheInstance->cache_file("admins_acls", true) == true) $cacheInstance->cache_destroy(); } // Entries changed @@ -163,7 +163,7 @@ if ((isset($_POST['edit'])) && ($SEL > 0)) // Update cache when installed if (EXT_IS_ACTIVE("cache")) { - if ($CACHE->cache_file("admins_acls", true) == true) $CACHE->cache_destroy(); + if ($cacheInstance->cache_file("admins_acls", true) == true) $cacheInstance->cache_destroy(); } // Entries deleted @@ -210,7 +210,7 @@ VALUES ('%s', '%s', '%s', '%s')", // Update cache when installed if (EXT_IS_ACTIVE("cache")) { - if ($CACHE->cache_file("admins_acls", true) == true) $CACHE->cache_destroy(); + if ($cacheInstance->cache_file("admins_acls", true) == true) $cacheInstance->cache_destroy(); } } else diff --git a/inc/modules/admin/what-config_cache.php b/inc/modules/admin/what-config_cache.php index 9b1851bdd7..39c3a15f82 100644 --- a/inc/modules/admin/what-config_cache.php +++ b/inc/modules/admin/what-config_cache.php @@ -53,33 +53,33 @@ if (isset($_POST['ok'])) } // Delete deactivated cache files - if (($_POST['cache_admins'] == 'N') && ($CACHE->cache_file("admins", true))) + if (($_POST['cache_admins'] == 'N') && ($cacheInstance->cache_file("admins", true))) { - $CACHE->cache_destroy(); + $cacheInstance->cache_destroy(); } - if (($_POST['cache_acls'] == 'N') && ($CACHE->cache_file("acls", true))) + if (($_POST['cache_acls'] == 'N') && ($cacheInstance->cache_file("acls", true))) { - $CACHE->cache_destroy(); + $cacheInstance->cache_destroy(); } - if (($_POST['cache_exts'] == 'N') && ($CACHE->cache_file("extensions", true))) + if (($_POST['cache_exts'] == 'N') && ($cacheInstance->cache_file("extensions", true))) { - $CACHE->cache_destroy(); + $cacheInstance->cache_destroy(); } - if (($_POST['cache_config'] == 'N') && ($CACHE->cache_file("config", true))) + if (($_POST['cache_config'] == 'N') && ($cacheInstance->cache_file("config", true))) { - $CACHE->cache_destroy(); + $cacheInstance->cache_destroy(); } - if (($_POST['cache_modreg'] == 'N') && ($CACHE->cache_file("modreg", true))) + if (($_POST['cache_modreg'] == 'N') && ($cacheInstance->cache_file("modreg", true))) { - $CACHE->cache_destroy(); + $cacheInstance->cache_destroy(); } - if (($_POST['cache_refdepth'] == 'N') && ($CACHE->cache_file("refdepth", true))) + if (($_POST['cache_refdepth'] == 'N') && ($cacheInstance->cache_file("refdepth", true))) { - $CACHE->cache_destroy(); + $cacheInstance->cache_destroy(); } - if (($_POST['cache_refsys'] == 'N') && ($CACHE->cache_file("refsys", true))) + if (($_POST['cache_refsys'] == 'N') && ($cacheInstance->cache_file("refsys", true))) { - $CACHE->cache_destroy(); + $cacheInstance->cache_destroy(); } // Save configuration diff --git a/inc/modules/admin/what-config_home.php b/inc/modules/admin/what-config_home.php index 6ce223e313..2f52640474 100644 --- a/inc/modules/admin/what-config_home.php +++ b/inc/modules/admin/what-config_home.php @@ -71,7 +71,7 @@ case "target": // Set which what-file will be placed in home-page (only modules. if (isset($_GET['home'])) { // Set new home - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET index_home='%s' WHERE config='0' LIMIT 1", array($_GET['home']), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET index_home='%s' WHERE config=0 LIMIT 1", array($_GET['home']), __FILE__, __LINE__); $_CONFIG['index_home'] = $_GET['home']; } diff --git a/inc/modules/admin/what-config_mods.php b/inc/modules/admin/what-config_mods.php index b0785007ea..8878c9ad5a 100644 --- a/inc/modules/admin/what-config_mods.php +++ b/inc/modules/admin/what-config_mods.php @@ -106,7 +106,7 @@ if (isset($_POST['edit'])) // Remove cache file if version matches if (GET_EXT_VERSION("cache") >= "0.1.2") { - if ($CACHE->cache_file("mod_reg", true)) $CACHE->cache_destroy(); + if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy(); } // Entries updated diff --git a/inc/modules/admin/what-config_points.php b/inc/modules/admin/what-config_points.php index 8930f895b5..7d4abc3768 100644 --- a/inc/modules/admin/what-config_points.php +++ b/inc/modules/admin/what-config_points.php @@ -78,7 +78,7 @@ if (isset($_POST['ok'])) switch ($_GET['sub']) { case "points": - $SQL[] = "UPDATE "._MYSQL_PREFIX."_config SET points_register='".$_POST['points_register']."', points_ref='".$_POST['points_ref']."' WHERE config='0' LIMIT 1"; + $SQL[] = "UPDATE "._MYSQL_PREFIX."_config SET points_register='".$_POST['points_register']."', points_ref='".$_POST['points_ref']."' WHERE config=0 LIMIT 1"; break; case "ref": @@ -114,7 +114,7 @@ if (isset($_POST['ok'])) // Update cache file if (GET_EXT_VERSION("cache") >= "0.1.2") { - if ($CACHE->cache_file("refdepths", true)) $CACHE->cache_destroy(); + if ($cacheInstance->cache_file("refdepths", true)) $cacheInstance->cache_destroy(); } break; @@ -124,7 +124,7 @@ if (isset($_POST['ok'])) allow_direct_pay='%s', reg_points_mode='%s', ref_payout='%d' -WHERE config='0' LIMIT 1", +WHERE config=0 LIMIT 1", $_POST['allow_direct_pay'], $_POST['reg_points_mode'], $REF @@ -165,8 +165,8 @@ WHERE mails_confirmed < %d", $REF, $REF); // Destroy config cache file here... if (GET_EXT_VERSION("cache") >= "0.1.2") { - if ($CACHE->cache_file("config", true)) $CACHE->cache_destroy(); - unset($CFG_CACHE); + if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy(); + unset($cacheArray); } } else diff --git a/inc/modules/admin/what-extensions.php b/inc/modules/admin/what-extensions.php index 0bff9ad22c..4bb2f5481b 100644 --- a/inc/modules/admin/what-extensions.php +++ b/inc/modules/admin/what-extensions.php @@ -40,7 +40,7 @@ if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN())) { // Add description as navigation point ADD_DESCR("admin", basename(__FILE__)); -global $CACHE, $KEEP_ACTIVE, $CACHE_FILE; +global $cacheInstance, $cacheArray, $cacheMode; // Normally we want the overview of all registered extensions $do = "overview"; @@ -55,7 +55,7 @@ if (!empty($_GET['reg_ext'])) { // De-/activate extensions foreach ($_POST['sel'] as $id=>$active) { // Shall we keep the extension always active? - if ((isset($KEEP_ACTIVE[GET_EXT_NAME($id)])) && ($KEEP_ACTIVE[GET_EXT_NAME($id)] == 'Y') && ($active == 'N')) { + if ((isset($cacheArray['active_extensions'][GET_EXT_NAME($id)])) && ($cacheArray['active_extensions'][GET_EXT_NAME($id)] == 'Y') && ($active == 'N')) { // Keep this extension active! } else { // De/activate extension @@ -72,7 +72,7 @@ if (!empty($_GET['reg_ext'])) { // Change settings like CSS file load if (isset($_POST['modify'])) { // Change entries - $CACHE_UPDATE = "0"; + $cacheInstance_UPDATE = "0"; foreach ($_POST['sel'] as $id=>$sel) { // Secure ID $id = bigintval($id); @@ -193,7 +193,7 @@ if (!empty($_GET['reg_ext'])) { $do = "delete"; } elseif ((isset($_POST['remove'])) && ($SEL > 0) && (!IS_DEMO())) { // Remove extensions from DB (you have to delete all files manually!) - $CACHE_UPDATE = "0"; + $cacheInstance_UPDATE = "0"; foreach ($_POST['sel'] as $id=>$active) { // Secure ID number $id = bigintval($id); @@ -297,7 +297,7 @@ case "register": // Register new extension SQL_FREERESULT($result); // Disable cache update by default - $CACHE_UPDATE = "0"; + $cacheInstance_UPDATE = "0"; if (!empty($subj)) { // Extract extension's name from subject... $ext_name = trim(substr($subj, 1, strpos($subj, ":") - 1)); @@ -309,9 +309,9 @@ case "register": // Register new extension LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_EXTENSION_REGISTERED); // Do we need to update cache file? - if ((EXT_IS_ACTIVE("cache")) && ($CACHE_FILE != "no")) { + if ((EXT_IS_ACTIVE("cache")) && ($cacheMode != "no")) { // Remove cache file (will be auto-created again!) - if ($CACHE->cache_file("extensions", true)) $CACHE->cache_destroy(); + if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy(); } } else { // Motify the admin that we have a problem here... diff --git a/inc/modules/admin/what-list_beg.php b/inc/modules/admin/what-list_beg.php index cbb750f414..8bf3d0ed03 100644 --- a/inc/modules/admin/what-list_beg.php +++ b/inc/modules/admin/what-list_beg.php @@ -48,7 +48,7 @@ if ($_CONFIG['beg_rallye'] == 'Y') // Okay, let's prepare... $curr = date("m", time()) - 1; if (strlen($curr) == 1) $curr = "0".$curr; - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET beg_month='%s' WHERE config='0' LIMIT 1", + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET beg_month='%s' WHERE config=0 LIMIT 1", array($curr), __FILE__, __LINE__); LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BEG_WITHDRAW_PREPARED); OUTPUT_HTML("
"); diff --git a/inc/modules/admin/what-list_bonus.php b/inc/modules/admin/what-list_bonus.php index cfb0d79e68..4a0e5d28a0 100644 --- a/inc/modules/admin/what-list_bonus.php +++ b/inc/modules/admin/what-list_bonus.php @@ -48,7 +48,7 @@ if ($_CONFIG['bonus_active'] == 'Y') // Okay, let's prepare... $curr = date("m", time()) - 1; if (strlen($curr) == 1) $curr = "0".$curr; - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET last_bonus_month='%s' WHERE config='0' LIMIT 1", + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET last_bonus_month='%s' WHERE config=0 LIMIT 1", array($curr), __FILE__, __LINE__); LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BONUS_WITHDRAW_PREPARED); OUTPUT_HTML("
"); diff --git a/inc/modules/admin/what-maintenance.php b/inc/modules/admin/what-maintenance.php index 2935c41363..9d272d8a9e 100644 --- a/inc/modules/admin/what-maintenance.php +++ b/inc/modules/admin/what-maintenance.php @@ -57,7 +57,7 @@ if (isset($_POST['ok'])) } // Update config - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET maintenance='%s' WHERE config='0' LIMIT 1", + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET maintenance='%s' WHERE config=0 LIMIT 1", array($target_mode), __FILE__, __LINE__); // Load template diff --git a/inc/modules/admin/what-theme_check.php b/inc/modules/admin/what-theme_check.php index 04caa4616b..2fb556ecc0 100644 --- a/inc/modules/admin/what-theme_check.php +++ b/inc/modules/admin/what-theme_check.php @@ -40,7 +40,7 @@ if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN())) // Add description as navigation point ADD_DESCR("admin", basename(__FILE__)); -global $CACHE, $KEEP_ACTIVE, $CACHE_FILE; +global $cacheInstance, $cacheArray, $cacheMode; // Normally we want the overview of all registered theme_check $mode = "overview"; diff --git a/inc/modules/guest/action-online.php b/inc/modules/guest/action-online.php index d621a1a7c2..83a4079d60 100644 --- a/inc/modules/guest/action-online.php +++ b/inc/modules/guest/action-online.php @@ -54,7 +54,7 @@ if ($_CONFIG['mad_counter'] < $total) // Update counter $_CONFIG['mad_counter'] = $total; $_CONFIG['last_mad'] = time(); - $result_mad = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET mad_timestamp=%d, mad_count='%s' WHERE config='0' LIMIT 1", + $result_mad = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET mad_timestamp=%d, mad_count='%s' WHERE config=0 LIMIT 1", array($_CONFIG['last_mad'], $_CONFIG['mad_counter']), __FILE__, __LINE__); // Destroy cache diff --git a/inc/modules/member/what-transfer.php b/inc/modules/member/what-transfer.php index ced8ed41a7..48ad51e059 100644 --- a/inc/modules/member/what-transfer.php +++ b/inc/modules/member/what-transfer.php @@ -431,7 +431,7 @@ case "list_out": // List only outgoing transactions break; case "list_all": // List all transactions - // We fill a temporay table with data from both tables. This is much easier + // We fill a temporary table with data from both tables. This is much easier // to code and unstand by you as sub-SELECT queries. I know this is not the // fastest way but it shall be fine for now. // @@ -530,7 +530,7 @@ array($GLOBALS['userid'], $_CONFIG['transfer_max']), __FILE__, __LINE__); // Load final template LOAD_TEMPLATE("member_transfer_list"); - // At the end we don't need a temporay table in memory + // At the end we don't need a temporary table in memory $result = SQL_QUERY("DROP TABLE IF EXISTS "._MYSQL_PREFIX."_transfers_tmp", __FILE__, __LINE__); // Free some memory... diff --git a/inc/monthly/monthly_beg.php b/inc/monthly/monthly_beg.php index c0ff859804..ed17e83ac9 100644 --- a/inc/monthly/monthly_beg.php +++ b/inc/monthly/monthly_beg.php @@ -116,7 +116,7 @@ SET points=points+%s WHERE ref_depth=0 AND userid=%d LIMIT 1", // Finally update database and config array $_CONFIG['beg_month'] = $curr; - $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET beg_month='%s' WHERE config='0' LIMIT 1", + $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET beg_month='%s' WHERE config=0 LIMIT 1", array($curr), __FILE__, __LINE__); // Destroy cache diff --git a/inc/monthly/monthly_bonus.php b/inc/monthly/monthly_bonus.php index 689b1462a4..e425c8f1ac 100644 --- a/inc/monthly/monthly_bonus.php +++ b/inc/monthly/monthly_bonus.php @@ -129,7 +129,7 @@ SET turbo_bonus=0, login_bonus=0, bonus_order=0, bonus_stats=0, bonus_ref=0", __ // Finally update database and config array $_CONFIG['bonus_month'] = $curr; - $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET last_bonus_month='%s' WHERE config='0' LIMIT 1", + $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET last_bonus_month='%s' WHERE config=0 LIMIT 1", array($curr), __FILE__, __LINE__); // Destroy cache diff --git a/inc/monthly/monthly_newsletter.php b/inc/monthly/monthly_newsletter.php index 262fc2da82..fdbfd59054 100644 --- a/inc/monthly/monthly_newsletter.php +++ b/inc/monthly/monthly_newsletter.php @@ -67,12 +67,9 @@ if ($_CONFIG['nl_month'] != $curr) SEND_EMAIL($uid, NL_MEMBER_RESET_SUBJECT, $msg); // Send email to admin - if (GET_EXT_VERSION("admins") >= "0.4.1") - { + if (GET_EXT_VERSION("admins") >= "0.4.1") { SEND_ADMIN_EMAILS_PRO(NL_ADMIN_SUBJECT, "admin_newsletter_reset", "", $GLOBALS['userid']); - } - else - { + } else { $msg = LOAD_EMAIL_TEMPLATE("admin_newsletter_reset", true, bigintval($uid)); SEND_ADMIN_EMAILS(NL_ADMIN_SUBJECT, $msg); } @@ -82,7 +79,7 @@ if ($_CONFIG['nl_month'] != $curr) SQL_FREERESULT($result); // Update last month - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET nl_month='%s' WHERE config='0' LIMIT 1", + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET nl_month='%s' WHERE config=0 LIMIT 1", array($curr), __FILE__, __LINE__); // Destroy cache diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index 5cb91d0103..3a53518b75 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -100,7 +100,7 @@ if ((!mxchange_installing) && (mxchange_installed)) // Is it a valid resource? if ($db === true) { // Load configuration stuff - $result = SQL_QUERY("SELECT pass_len, points_register, points_ref, least_cats, check_double_email, check_double_pass, admin_notify, url_tlock, test_text, max_tlength, test_subj, autosend_active, max_send, url_blacklist, auto_purge, auto_purge_active, last_update, unconfirmed, profile_lock, online_timeout, mad_timestamp, mad_count, profile_update, send_prof_update, resend_profile_update, code_length, patch_level, patch_ctime, guest_stats, ref_payout, activate_xchange, order_multi_page, display_refid, ip_timeout, allow_direct_pay, config FROM "._MYSQL_PREFIX."_config WHERE config='0' LIMIT 1", __FILE__, __LINE__); + $result = SQL_QUERY("SELECT pass_len, points_register, points_ref, least_cats, check_double_email, check_double_pass, admin_notify, url_tlock, test_text, max_tlength, test_subj, autosend_active, max_send, url_blacklist, auto_purge, auto_purge_active, last_update, unconfirmed, profile_lock, online_timeout, mad_timestamp, mad_count, profile_update, send_prof_update, resend_profile_update, code_length, patch_level, patch_ctime, guest_stats, ref_payout, activate_xchange, order_multi_page, display_refid, ip_timeout, allow_direct_pay, config FROM "._MYSQL_PREFIX."_config WHERE config=0 LIMIT 1", __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Load data when previous SQL query did not fail diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index bbd581d8a0..34132e388b 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -41,15 +41,15 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) // function ADD_MODULE_TITLE($mod) { - global $MODULES, $_CONFIG; + global $cacheArray, $_CONFIG; $name = ""; $result = false; // Load title if (!mxchange_installing) { - if ((GET_EXT_VERSION("cache") >= "0.1.2") && (is_array($MODULES['module'])) && (isset($MODULES['module'][$mod]))) + if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($cacheArray['modules']['module'])) && (is_array($cacheArray['modules']['module'])) && (isset($cacheArray['modules']['module'][$mod]))) { // Load from cache - $name = $MODULES['title'][$mod]; + $name = $cacheArray['modules']['title'][$mod]; // Update cache hits $_CONFIG['cache_hits']++; @@ -82,7 +82,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 $MODULES, $_CONFIG, $CACHE; + global $cacheArray, $_CONFIG, $cacheInstance; // Filter module name (names with low chars and underlines are fine!) $mod = preg_replace("/[^a-z_]/", "", $mod); @@ -108,14 +108,14 @@ function CHECK_MODULE($mod) { // Check if cache is latest version $locked = 'Y'; $hidden = 'N'; $admin = 'N'; $mem = 'N'; $found = false; - if ((GET_EXT_VERSION("cache") >= "0.1.2") && (is_array($MODULES['module']))) { + if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($cacheArray['modules']['module'])) && (is_array($cacheArray['modules']['module']))) { // Is the module cached? - if (isset($MODULES['locked'][$mod_chk])) { + if (isset($cacheArray['modules']['locked'][$mod_chk])) { // Check cache - $locked = $MODULES['locked'][$mod_chk]; - $hidden = $MODULES['hidden'][$mod_chk]; - $admin = $MODULES['admin_only'][$mod_chk]; - $mem = $MODULES['mem_only'][$mod_chk]; + $locked = $cacheArray['modules']['locked'][$mod_chk]; + $hidden = $cacheArray['modules']['hidden'][$mod_chk]; + $admin = $cacheArray['modules']['admin_only'][$mod_chk]; + $mem = $cacheArray['modules']['mem_only'][$mod_chk]; // Update cache hits $_CONFIG['cache_hits']++; @@ -178,8 +178,8 @@ function CHECK_MODULE($mod) { // Destroy cache here if (GET_EXT_VERSION("cache") >= "0.1.2") { - if ($CACHE->cache_file("mod_reg", true)) $CACHE->cache_destroy(); - unset($MODULES); + if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy(); + unset($cacheArray['modules']); } // And reload data @@ -235,8 +235,8 @@ function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true) } break; } - $DUMMY = substr($search, 0, -4); - $AND .= " AND action='".GET_ACTION($ACC_LVL, $DUMMY)."'"; + $dummy = substr($search, 0, -4); + $AND .= " AND action='".GET_ACTION($ACC_LVL, $dummy)."'"; } elseif (($ACC_LVL == "sponsor") || ($ACC_LVL == "engine")) { // Sponsor / engine menu $type = "what"; @@ -389,7 +389,7 @@ 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 $_SESSION, $ADMINS, $_CONFIG; + global $cacheArray, $_CONFIG; $ret = false; $passCookie = ""; $valPass = ""; //* DEBUG: */ echo __LINE__."ADMIN:".$admin."
"; @@ -401,13 +401,13 @@ function IS_ADMIN($admin="") //* DEBUG: */ echo __LINE__."ADMIN:".$admin."/".$passCookie."
"; // Search in array for entry - if ((!empty($passCookie)) && (isset($ADMINS['password'][$admin])) && (!empty($admin))) + if ((!empty($passCookie)) && (isset($cacheArray['admins']['password'][$admin])) && (!empty($admin))) { // Count cache hits $_CONFIG['cache_hits']++; // Login data is valid or not? - $valPass = generatePassString($ADMINS['password'][$admin]); + $valPass = generatePassString($cacheArray['admins']['password'][$admin]); } elseif (!empty($admin)) { @@ -1130,7 +1130,7 @@ function ADD_POINTS_REFSYSTEM($uid, $points, $send_notify=false, $rid="0", $lock // function UPDATE_REF_COUNTER($uid) { - global $REF_LVL, $link, $CACHE; + global $REF_LVL, $link, $cacheInstance; // Make it sure referral level zero (member him-/herself) is at least selected if (empty($REF_LVL)) $REF_LVL = "0"; @@ -1163,7 +1163,7 @@ function UPDATE_REF_COUNTER($uid) elseif ((($ref == $uid) || ($ref == 0)) && (GET_EXT_VERSION("cache") >= "0.1.2")) { // Remove cache here - if ($CACHE->cache_file("refsystem", true)) $CACHE->cache_destroy(); + if ($cacheInstance->cache_file("refsystem", true)) $cacheInstance->cache_destroy(); } } // @@ -1233,9 +1233,8 @@ WHERE sid='%s' LIMIT 1", } // Purge old entries - $TIMEOUT = time() - $_CONFIG['online_timeout']; - $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_online WHERE timestamp <= %d", - array($TIMEOUT), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_online WHERE timestamp <= (UNIX_TIMESTAMP() - %d)", + array($_CONFIG['online_timeout']), __FILE__, __LINE__); } // OBSULETE: Sends out mail to all administrators function SEND_ADMIN_EMAILS($subj, $msg) @@ -1251,12 +1250,12 @@ function SEND_ADMIN_EMAILS($subj, $msg) // Get ID number from administrator's login name function GET_ADMIN_ID($login) { - global $ADMINS; + global $cacheArray; $ret = "-1"; - if (!empty($ADMINS['aid'][$login])) + if (!empty($cacheArray['admins']['aid'][$login])) { // Check cache - $ret = $ADMINS['aid'][$login]; + $ret = $cacheArray['admins']['aid'][$login]; if (empty($ret)) $ret = "-1"; } else @@ -1276,12 +1275,12 @@ function GET_ADMIN_ID($login) // Get password hash from administrator's login name function GET_ADMIN_HASH($login) { - global $ADMINS; + global $cacheArray; $ret = "-1"; - if (!empty($ADMINS['password'][$login])) + if (!empty($cacheArray['admins']['password'][$login])) { // Check cache - $ret = $ADMINS['password'][$login]; + $ret = $cacheArray['admins']['password'][$login]; if (empty($ret)) $ret = "-1"; } else @@ -1300,12 +1299,12 @@ function GET_ADMIN_HASH($login) // function GET_ADMIN_LOGIN($aid) { - global $ADMINS; + global $cacheArray; $ret = "***"; - if (!empty($ADMINS['login']['aid'])) + if (!empty($cacheArray['admins']['login']['aid'])) { // Check cache - if (!empty($ADMINS['login'][$aid])) $ret = $ADMINS['login'][$aid]; + if (!empty($cacheArray['admins']['login'][$aid])) $ret = $cacheArray['admins']['login'][$aid]; if (empty($ret)) $ret = "***"; } else @@ -1388,7 +1387,7 @@ function activateExchange() { $SQLs = array( "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='N', hidden='N', mem_only='Y' WHERE module='order' LIMIT 1", "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='N' WHERE what='order' OR what='unconfirmed' LIMIT 2", - "UPDATE "._MYSQL_PREFIX."_config SET activate_xchange='0' WHERE config='0' LIMIT 1" + "UPDATE "._MYSQL_PREFIX."_config SET activate_xchange='0' WHERE config=0 LIMIT 1" ); // Run SQLs @@ -1516,28 +1515,32 @@ function IS_DEMO() // function LOAD_CONFIG($no="0") { - global $CFG_CACHE, $_CONFIG; - $CFG_DUMMY = false; + global $cacheArray; + $CFG_DUMMY = array(); + // Check for cache extension, cache-array and if the requested configuration is in cache - if ((is_array($CFG_CACHE)) && (isset($CFG_CACHE['config'][$no]))) - { + if ((is_array($cacheArray)) && (isset($cacheArray['config'][$no])) && (is_array($cacheArray['config'][$no]))) { // Load config from cache - $CFG_DUMMY = array(); - foreach ($CFG_CACHE as $element=>$cfgs) - { - $CFG_DUMMY[$element] = $cfgs[$no]; + //* DEBUG: */ echo gettype($cacheArray['config'][$no])."
\n"; + foreach ($cacheArray['config'][$no] as $key=>$value) { + $CFG_DUMMY[$key] = $value; } // Count cache hits - $_CONFIG['cache_hits']++; - } - else - { + $CFG_DUMMY['cache_hits']++; + } else { // Load config from DB - $result_config = SQL_QUERY_ESC("SELECT * FROM "._MYSQL_PREFIX."_config WHERE config='%d' LIMIT 1", - array(bigintval($no)), __FILE__, __LINE__); + $result_config = SQL_QUERY_ESC("SELECT * FROM "._MYSQL_PREFIX."_config WHERE config=%d LIMIT 1", + array(bigintval($no)), __FILE__, __LINE__); + + // Get config from database $CFG_DUMMY = SQL_FETCHARRAY($result_config); + + // Free result SQL_FREERESULT($result_config); + + // Remember this config in the array + $cacheArray['config'][$no] = $CFG_DUMMY; } // Return config array @@ -1570,22 +1573,22 @@ function GET_WHAT($MOD_CHECK) // function MODULE_HAS_MENU($mod) { - global $EXTENSIONS, $MODULES, $_CONFIG; + global $cacheArray, $_CONFIG; // All is false by default $ret = false; if (GET_EXT_VERSION("cache") >= "0.1.2") { - if (isset($MODULES['has_menu'][$mod])) + if (isset($cacheArray['modules']['has_menu'][$mod])) { // Check module cache and count hit - if ($MODULES['has_menu'][$mod] == 'Y') $ret = true; + if ($cacheArray['modules']['has_menu'][$mod] == 'Y') $ret = true; $_CONFIG['cache_hits']++; } - elseif (isset($EXTENSIONS['ext_menu'][$mod])) + elseif (isset($cacheArray['extensions']['ext_menu'][$mod])) { // Check cache and count hit - if ($EXTENSIONS['ext_menu'][$mod] == 'Y') $ret = true; + if ($cacheArray['extensions']['ext_menu'][$mod] == 'Y') $ret = true; $_CONFIG['cache_hits']++; } } diff --git a/inc/patch-system.php b/inc/patch-system.php index 1e26908232..984103c8b0 100644 --- a/inc/patch-system.php +++ b/inc/patch-system.php @@ -42,7 +42,7 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) if (CURR_PATCH_LEVEL > $_CONFIG['patch_level']) { // Update database and CONFIG array - $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET patch_level='".CURR_PATCH_LEVEL."', patch_ctime=UNIX_TIMESTAMP() WHERE config='0' LIMIT 1", + $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET patch_level='".CURR_PATCH_LEVEL."', patch_ctime=UNIX_TIMESTAMP() WHERE config=0 LIMIT 1", __FILE__, __LINE__); $_CONFIG['patch_level'] = CURR_PATCH_LEVEL; $_CONFIG['patch_ctime'] = time(); @@ -50,11 +50,11 @@ if (CURR_PATCH_LEVEL > $_CONFIG['patch_level']) // Destroy cache if (GET_EXT_VERSION("cache") >= "0.1.2") { - if ($CACHE->cache_file("config", true)) + if ($cacheInstance->cache_file("config", true)) { // Replace data - $CACHE->cache_replace("patch_level", $_CONFIG['patch_level'], "0", $CFG_CACHE); - $CACHE->cache_replace("patch_ctime", $_CONFIG['patch_ctime'], "0", $CFG_CACHE); + $cacheInstance->cache_replace("patch_level", $_CONFIG['patch_level'], "0", $cacheArray); + $cacheInstance->cache_replace("patch_ctime", $_CONFIG['patch_ctime'], "0", $cacheArray); } } } diff --git a/inc/pool-update.php b/inc/pool-update.php index 9949cc9e16..1c06e7fa6b 100644 --- a/inc/pool-update.php +++ b/inc/pool-update.php @@ -86,7 +86,7 @@ if (SQL_NUMROWS($result_main) > 0) // No users left $RECEIVERS = array("0"); } - $DUMMY = $RECEIVERS; + $dummy = $RECEIVERS; // Now, if we are good little boys and girls Santa left us some user-ids. // We can now send mails to them... @@ -131,8 +131,8 @@ if (SQL_NUMROWS($result_main) > 0) SQL_FREERESULT($result_stats); // Mark this user as "spammed" ;-) And place a line for him... - //* DEBUG: */ echo "?L:".__LINE__."/".$DUMMY."/".$key."/".$uid."(".$DATA[1].")/".$DATA[0]."/".$stats_id."?
"; - switch (REMOVE_RECEIVER($DUMMY, $key, bigintval($uid), bigintval($DATA[0]), bigintval($stats_id))) + //* DEBUG: */ echo "?L:".__LINE__."/".$dummy."/".$key."/".$uid."(".$DATA[1].")/".$DATA[0]."/".$stats_id."?
"; + switch (REMOVE_RECEIVER($dummy, $key, bigintval($uid), bigintval($DATA[0]), bigintval($stats_id))) { case "done": // Prepare the mail @@ -238,7 +238,7 @@ if (SQL_NUMROWS($result_main) > 0) $ADD = ""; if ($cnt <= $DATA[8]) $ADD = ", target_send=target_send-".$cnt; $result_queue = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_pool SET data_type='NEW', receivers='%s'".$ADD." WHERE id=%d LIMIT 1", - array(implode(";", $DUMMY), bigintval($DATA[0])), __FILE__, __LINE__); + array(implode(";", $dummy), bigintval($DATA[0])), __FILE__, __LINE__); //* DEBUG: */ echo"*EXIT/L:".__LINE__."*
"; break; @@ -276,11 +276,11 @@ if (SQL_NUMROWS($result_main) > 0) $cnt_back[$DATA[1]]++; } // Remove entry from list - unset($DUMMY[$key]); + unset($dummy[$key]); // Update receivers $result_queue = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_pool SET receivers='%s' WHERE id=%d LIMIT 1", - array(implode(";", $DUMMY), bigintval($DATA[0])), __FILE__, __LINE__); + array(implode(";", $dummy), bigintval($DATA[0])), __FILE__, __LINE__); } } } @@ -374,7 +374,7 @@ if ((EXT_IS_ACTIVE("bonus") && ($cnt < $_CONFIG['max_send']))) // No users left $RECEIVERS = array("0"); } - $DUMMY = $RECEIVERS; + $dummy = $RECEIVERS; // Now, if we are good little boys and girls Santa left us some user-ids. // We can now send mails to them... @@ -393,7 +393,7 @@ if ((EXT_IS_ACTIVE("bonus") && ($cnt < $_CONFIG['max_send']))) //* DEBUG: */ echo "OK!/L:".__LINE__."
"; // Mark this user as "spammed" ;-) And place a line for him... - if (REMOVE_RECEIVER($DUMMY, $key, $uid, $DATA[0], $DATA[0], true) == "done") + if (REMOVE_RECEIVER($dummy, $key, $uid, $DATA[0], $DATA[0], true) == "done") { // Prepare the mail $msg = LOAD_EMAIL_TEMPLATE("bonus-mail", $DATA[2], $uid); @@ -402,7 +402,7 @@ if ((EXT_IS_ACTIVE("bonus") && ($cnt < $_CONFIG['max_send']))) SEND_EMAIL($email, $DATA[1], $msg, $DATA[11]); // Count one up and remove entry from dummy array - $cnt++; unset($DUMMY[$key]); + $cnt++; unset($dummy[$key]); if (GET_EXT_VERSION("user") >= "0.1.4") { @@ -412,7 +412,7 @@ if ((EXT_IS_ACTIVE("bonus") && ($cnt < $_CONFIG['max_send']))) } // Do we have send maximum mails? - if (($cnt >= $_CONFIG['max_send']) || (SELECTION_COUNT($DUMMY) == 0)) + if (($cnt >= $_CONFIG['max_send']) || (SELECTION_COUNT($dummy) == 0)) { // Yes, we have //* DEBUG: */ echo "*EXIT/L:".__LINE__."
"; @@ -436,8 +436,8 @@ if ((EXT_IS_ACTIVE("bonus") && ($cnt < $_CONFIG['max_send']))) } // Close sending system - //* DEBUG: */ echo "-L:".__LINE__."/".SELECTION_COUNT($DUMMY)."-
"; - if (SELECTION_COUNT($DUMMY) == 0) + //* DEBUG: */ echo "-L:".__LINE__."/".SELECTION_COUNT($dummy)."-
"; + if (SELECTION_COUNT($dummy) == 0) { // Queue reached! $result_done = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET data_type='SEND', target_send='0', receivers='' WHERE id=%d LIMIT 1", @@ -456,9 +456,9 @@ if ((EXT_IS_ACTIVE("bonus") && ($cnt < $_CONFIG['max_send']))) { // Update bonus pool $result_done = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET data_type='NEW', target_send=%d, receivers='%s' WHERE id=%d LIMIT 1", - array(SELECTION_COUNT($DUMMY), implode(";", $DUMMY), bigintval($DATA[0])), __FILE__, __LINE__); + array(SELECTION_COUNT($dummy), implode(";", $dummy), bigintval($DATA[0])), __FILE__, __LINE__); //* DEBUG: */ echo "*L:".__LINE__."
";
-				//* DEBUG: */ print_r($DUMMY);
+				//* DEBUG: */ print_r($dummy);
 				//* DEBUG: */ echo "
\n!!!
"; break; } diff --git a/inc/reset/reset_daily.php b/inc/reset/reset_daily.php index c3b99df313..9768fbb59c 100644 --- a/inc/reset/reset_daily.php +++ b/inc/reset/reset_daily.php @@ -41,14 +41,14 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) // Update user profiles if (GET_EXT_VERSION("order") >= "0.1.1") { // Latest version - $result_daily = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET receive_mails=max_mails, mail_orders='0' WHERE receive_mails != max_mails", __FILE__, __LINE__); + $result_daily = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET receive_mails=max_mails, mail_orders=0 WHERE receive_mails != max_mails", __FILE__, __LINE__); } else { // Obsolete version $result_daily = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET receive_mails=max_mails WHERE receive_mails != max_mails", __FILE__, __LINE__); } // Transfer points from locked_points to points -$result_daily = SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE ref_payout='0' AND status='CONFIRMED' ORDER BY userid", __FILE__, __LINE__); +$result_daily = SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE ref_payout=0 AND status='CONFIRMED' ORDER BY userid", __FILE__, __LINE__); if (SQL_NUMROWS($result_daily) > 0) { @@ -89,14 +89,14 @@ $_CONFIG['last_update'] = time(); // Update database $result_daily = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET last_update=UNIX_TIMESTAMP() -WHERE config='0' AND last_update != UNIX_TIMESTAMP() LIMIT 1", __FILE__, __LINE__); +WHERE config=0 AND last_update != UNIX_TIMESTAMP() LIMIT 1", __FILE__, __LINE__); // Destroy cache if ((GET_EXT_VERSION("cache") >= "0.1.2") && (SQL_AFFECTEDROWS() == 1)) { - if ($CACHE->cache_file("config", true)) + if ($cacheInstance->cache_file("config", true)) { - $CACHE->cache_replace("last_update", time(), "0", $CFG_CACHE); + $cacheInstance->cache_replace("last_update", time(), "0", $cacheArray); } } -- 2.39.5