// 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
}
// 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
// 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);
}
}
}
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();
}
}
//
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;
// 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;
// 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']++;
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...)
}
// 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__);
SQL_FREERESULT($result);
// Set cache
- $EXTENSIONS['ext_version'][$ext_name] = $ret;
+ $cacheArray['extensions']['ext_version'][$ext_name] = $ret;
}
return $ret;
}
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
// 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
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']++;
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']++;
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
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))
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'];
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))
{
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 <STRONG>inc/monthly_bonus.php</STRONG> 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.";
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))
{
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;
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);
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"))
{
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"))
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
break;
default: // Do stuff when extension is loaded
- $DUMMY = LOAD_CONFIG("0");
- $_CONFIG['mt_start'] = $DUMMY['mt_start'];
- $_CONFIG['mt_stage'] = $DUMMY['mt_stage'];
- unset($DUMMY);
+ $dummy = LOAD_CONFIG();
+ $_CONFIG['mt_start'] = $dummy['mt_start'];
+ $_CONFIG['mt_stage'] = $dummy['mt_stage'];
+ unset($dummy);
break;
}
break;
default: // Do stuff when extension is loaded
- $DUMMY = LOAD_CONFIG("0");
- $_CONFIG['nl_charge'] = $DUMMY['nl_charge']; // Charge for your members to switch off the newsletter
- $_CONFIG['nl_month'] = $DUMMY['nl_month']; // Last month of check interval
- unset($DUMMY);
+ $dummy = LOAD_CONFIG();
+ $_CONFIG['nl_charge'] = $dummy['nl_charge']; // Charge for your members to switch off the newsletter
+ $_CONFIG['nl_month'] = $dummy['nl_month']; // Last month of check interval
+ unset($dummy);
// URL ends which are used to indentify the end of an URL or email link
// Don't use these chars in links... ;-)
break;
default: // Do stuff when extension is loaded
- $DUMMY = LOAD_CONFIG("0");
- define('__NICKNAME_LANG_CHARS', $DUMMY['nickname_chars']);
- define('__NICKNAME_LENGTH' , $DUMMY['nickname_len']);
- define('__NICKNAME_PATTERN' , $DUMMY['nickname_pattern']);
- unset($DUMMY);
+ $dummy = LOAD_CONFIG();
+ define('__NICKNAME_LANG_CHARS', $dummy['nickname_chars']);
+ define('__NICKNAME_LENGTH' , $dummy['nickname_len']);
+ define('__NICKNAME_PATTERN' , $dummy['nickname_pattern']);
+ unset($dummy);
break;
}
// Language file prefix
break;
default: // Do stuff when extension is loaded
- $DUMMY = LOAD_CONFIG("0");
- $_CONFIG['order_min'] = $DUMMY['order_min']; // Order at least X mails
- $_CONFIG['order_max'] = $DUMMY['order_max_full']; // Ordering mode: as much as possible or as much as the user want's to receive
- $_CONFIG['order_select'] = $DUMMY['order_select']; // Sorting mode for selecting users while looking some up for mail delivery
- $_CONFIG['order_mode'] = $DUMMY['order_mode']; // Ascending or descending sort order for above
- unset($DUMMY);
+ $dummy = LOAD_CONFIG();
+ $_CONFIG['order_min'] = $dummy['order_min']; // Order at least X mails
+ $_CONFIG['order_max'] = $dummy['order_max_full']; // Ordering mode: as much as possible or as much as the user want's to receive
+ $_CONFIG['order_select'] = $dummy['order_select']; // Sorting mode for selecting users while looking some up for mail delivery
+ $_CONFIG['order_mode'] = $dummy['order_mode']; // Ascending or descending sort order for above
+ unset($dummy);
// Do daily reset only when installed and extension version is at least 0.1.1
if ((defined('__DAILY_RESET')) && (!mxchange_installing) && (mxchange_installed) && (admin_registered) && (GET_EXT_VERSION("order") >= "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;
}
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
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;
}
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
$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";
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'])))
// 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();
}
}
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;
}
// Remove dummy config array
- unset($DUMMY);
+ unset($dummy);
break;
}
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;
}
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'))
{
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
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
$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
$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
//* DEBUG: */ die("Secret-Key: ".$secretKey."<br>Cookie: ".$_SESSION['u_hash']."<br>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
// 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;
$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__);
$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) {
// 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);
// 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]);
}
// 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();
}
}
// 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);
$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();
}
}
else
{
// Try to subtract from jackpot
- $DUMMY = SUB_JACKPOT($points);
+ $dummy = SUB_JACKPOT($points);
}
break;
}
// 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);
+ }
+ }
}
//
?>
}
// 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 "<PRE>";
- //* 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 "</PRE>";
//* 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";
ORDER BY login", __FILE__, __LINE__);
while($dummy = SQL_FETCHARRAY($result_admins)) {
// Save row
- $CACHE->add_row($dummy);
+ $cacheInstance->add_row($dummy);
}
// Free memory
}
// 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") {
}
while ($DATA = SQL_FETCHARRAY($result)) {
// Add row to cache file
- $CACHE->add_row($DATA);
+ $cacheInstance->add_row($DATA);
}
// Free memory
}
// 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
}
// 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;
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
}
// 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;
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
}
// 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
}
// Close file
- $CACHE->cache_close();
+ $cacheInstance->cache_close();
}
//
// 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();
}
//
{
// 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
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;
}
// 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
$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))
}
// 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,
'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))
}
}
- 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");
// 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]))
{
// 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']++;
}
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!
}
// 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 {
//
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']."*<br />\n";
if (EXT_IS_ACTIVE("cache"))
{
// Include cache instance
- global $CACHE;
+ global $cacheInstance;
}
// Remove any spaces from variable
//
function ADD_ADMIN_MENU($act, $wht,$return=false)
{
- global $_GET, $menuDesription, $menuTitle, $link;
+ global $menuDesription, $menuTitle, $link;
$SUB = false;
// Menu descriptions
//
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 = "";
//
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) {
// 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
//
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")
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'",
// 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 = "";
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);
// 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",
// Add description as navigation point
ADD_DESCR("admin", basename(__FILE__));
-global $CACHE;
+global $cacheInstance;
// Display form is default
$FORM = true;
// 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
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();
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)
{
'id' => $id,
'id2' => $id2,
'tpl' => $template,
- 'admins' => $ADMINS
+ 'admins' => $cacheArray['admins']
);
if ($aid2 > 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
// 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
// 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
}
// 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
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'];
}
// 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
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":
// 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;
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
// 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
// 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";
// 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
// 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);
$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);
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));
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...
// 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("<br />");
// 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("<br />");
}
// 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
// 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";
// 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
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.
//
// 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...
// 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
// 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
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);
}
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
// 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
//
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']++;
// 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);
// 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']++;
// 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
}
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";
// 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."<br />";
//* DEBUG: */ echo __LINE__."ADMIN:".$admin."/".$passCookie."<br />";
// 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))
{
//
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";
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();
}
}
//
}
// 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)
// 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
// 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
//
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
$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
//
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])."<br />\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
//
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']++;
}
}
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();
// 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);
}
}
}
// 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...
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."?<br />";
- 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."?<br />";
+ switch (REMOVE_RECEIVER($dummy, $key, bigintval($uid), bigintval($DATA[0]), bigintval($stats_id)))
{
case "done":
// Prepare the mail
$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__."*<br />";
break;
$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__);
}
}
}
// 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...
//* DEBUG: */ echo "OK!/L:".__LINE__."<br />";
// 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);
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")
{
}
// 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__."<br />";
}
// Close sending system
- //* DEBUG: */ echo "-L:".__LINE__."/".SELECTION_COUNT($DUMMY)."-<br />";
- if (SELECTION_COUNT($DUMMY) == 0)
+ //* DEBUG: */ echo "-L:".__LINE__."/".SELECTION_COUNT($dummy)."-<br />";
+ 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",
{
// 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__."<PRE>";
- //* DEBUG: */ print_r($DUMMY);
+ //* DEBUG: */ print_r($dummy);
//* DEBUG: */ echo "</PRE>\n!!!<br />";
break;
}
// 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)
{
// 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);
}
}