From: Roland Häder Date: Sun, 4 Jul 2010 13:10:07 +0000 (+0000) Subject: More cached wrapper functions added for config entries X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b0b5a841a592386c3e21724c216db5d1f451ede7;p=mailer.git More cached wrapper functions added for config entries --- diff --git a/inc/autopurge/purge-general.php b/inc/autopurge/purge-general.php index 68b98ac435..c932ff47df 100644 --- a/inc/autopurge/purge-general.php +++ b/inc/autopurge/purge-general.php @@ -46,7 +46,7 @@ if (!defined('__SECURITY')) { return false; } -if (getConfig('auto_purge') > 0) { +if (getAutoPurge() > 0) { // Init SQLs initSqls(); diff --git a/inc/autopurge/purge-inact.php b/inc/autopurge/purge-inact.php index 4a0ef16865..d3c9b49150 100644 --- a/inc/autopurge/purge-inact.php +++ b/inc/autopurge/purge-inact.php @@ -90,7 +90,7 @@ ORDER BY // Prepare variables and constants... $useridsContent = ''; $content['since'] = (getApInactiveSince() / 60 / 60); - $content['time'] = (getConfig('ap_inactive_time') / 60 / 60); + $content['time'] = (getApInactiveTime() / 60 / 60); // Mark found accounts as inactive and send an email while ($row = SQL_FETCHARRAY($result_inactive)) { diff --git a/inc/autopurge/purge-unconfirmed.php b/inc/autopurge/purge-unconfirmed.php index 162b4f6f48..0ef7d7ef07 100644 --- a/inc/autopurge/purge-unconfirmed.php +++ b/inc/autopurge/purge-unconfirmed.php @@ -62,7 +62,7 @@ ORDER BY if (!SQL_HASZERONUMS($result_uncon)) { // Prepare variable... $userids = ''; - $content['time'] = (getConfig('ap_unconfirmed_time') / 60 / 60); + $content['time'] = (getApUnconfirmedTime() / 60 / 60); // Delete inactive accounts while ($row = SQL_FETCHARRAY($result_uncon)) { diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php index 8367a4a24e..c6768029f0 100644 --- a/inc/libs/bonus_functions.php +++ b/inc/libs/bonus_functions.php @@ -221,7 +221,7 @@ function handleBonusPoints ($mode) { if (!isBonusRallyeActive()) return; // Switch to jackpot-mode when no UID is supplied but userid-mode is selected - if ((getConfig('bonus_mode') == 'UID') && (getConfig('bonus_userid') == '0') && (isExtensionActive('jackpot'))) { + if ((getConfig('bonus_mode') == 'UID') && (getBonusUserId() == '0') && (isExtensionActive('jackpot'))) { // Update database & config updateConfiguration('bonus_mode', 'JACKPOT'); } // END - if @@ -235,15 +235,15 @@ function handleBonusPoints ($mode) { } // Check his amount first - $total = countSumTotalData(getConfig('bonus_userid'), 'user_points', 'points') - countSumTotalData(getConfig('bonus_userid'), 'user_data', 'used_points'); + $total = countSumTotalData(getBonusUserId(), 'user_points', 'points') - countSumTotalData(getBonusUserId(), 'user_data', 'used_points'); // Subtract points from... switch (getConfig('bonus_mode')) { case 'JACKPOT': // ... jackpot - if ((isExtensionActive('jackpot')) && (subtractPointsFromJackpot($points) == -1) && (isValidUserId(getConfig('bonus_userid')))) { + if ((isExtensionActive('jackpot')) && (subtractPointsFromJackpot($points) == -1) && (isValidUserId(getBonusUserId()))) { if ($total >= $points) { // Subtract points from userid's account - subtractPointsFromJackpot('bonus_payout_jackpot', getConfig('bonus_userid'), $points); + subtractPointsFromJackpot('bonus_payout_jackpot', getBonusUserId(), $points); } // END - if } // END - if break; @@ -251,7 +251,7 @@ function handleBonusPoints ($mode) { case 'UID': // ... userid's account if ($total >= $points) { // Subtract points from userid's account - subtractPoints('bonus_payout_userid', getConfig('bonus_userid'), $points); + subtractPoints('bonus_payout_userid', getBonusUserId(), $points); } elseif (isExtensionActive('jackpot')) { // Try to subtract from jackpot $dummy = subtractPointsFromJackpot($points); diff --git a/inc/modules/admin/what-config_autopurge.php b/inc/modules/admin/what-config_autopurge.php index c7d37f83f7..58fb70e04b 100644 --- a/inc/modules/admin/what-config_autopurge.php +++ b/inc/modules/admin/what-config_autopurge.php @@ -63,13 +63,13 @@ if (isFormSent()) { // Output time selection boxes $content['ap_in_since'] = createTimeSelections(getApInactiveSince() , 'ap_inactive_since' , 'MWDh'); - $content['ap_in_time'] = createTimeSelections(getConfig('ap_inactive_time') , 'ap_inactive_time' , 'MWDh'); - $content['ap_un_time'] = createTimeSelections(getConfig('ap_unconfirmed_time'), 'ap_unconfirmed_time', 'MWDh'); - $content['ap_task_time'] = createTimeSelections(getConfig('ap_tasks_time') , 'ap_tasks_time' , 'MWDh'); - $content['ap_del_mails_time'] = createTimeSelections(getConfig('ap_dm_timeout') , 'ap_dm_timeout' , 'MWDh'); + $content['ap_in_time'] = createTimeSelections(getApInactiveTime() , 'ap_inactive_time' , 'MWDh'); + $content['ap_un_time'] = createTimeSelections(getApUnconfirmedTime(), 'ap_unconfirmed_time', 'MWDh'); + $content['ap_task_time'] = createTimeSelections(getApTasksTime() , 'ap_tasks_time' , 'MWDh'); + $content['ap_del_mails_time'] = createTimeSelections(getApDmTimeout() , 'ap_dm_timeout' , 'MWDh'); // Mail confirmation links - $content['auto_purge'] = createTimeSelections(getConfig('auto_purge'), 'auto_purge', 'MWD'); + $content['auto_purge'] = createTimeSelections(getAutoPurge(), 'auto_purge', 'MWD'); // Prepare more Y/N selections foreach (array('auto_purge_active') as $entry) { diff --git a/inc/modules/admin/what-config_bonus.php b/inc/modules/admin/what-config_bonus.php index b6750d4f71..b9af8ea74b 100644 --- a/inc/modules/admin/what-config_bonus.php +++ b/inc/modules/admin/what-config_bonus.php @@ -83,7 +83,7 @@ if (isFormSent()) { $content['notify'] = translateComma(getConfig('bonus_notify_points'), false); // Transfer options to template - $content['member_selection'] = addMemberSelectionBox(getConfig('bonus_userid'), false, true, true, 'bonus_userid'); + $content['member_selection'] = addMemberSelectionBox(getBonusUserId(), false, true, true, 'bonus_userid'); // Initialize array for the points list $RANKS = explode(';', getConfig('turbo_rates')); diff --git a/inc/template-functions.php b/inc/template-functions.php index 4f1ad6f8e5..ba3588063a 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -444,12 +444,12 @@ function loadEmailTemplate ($template, $content = array(), $userid = '0') { // Is content an array? if (is_array($content)) { // Add expiration to array - if ((isConfigEntrySet('auto_purge')) && (getConfig('auto_purge') == '0')) { + if ((isConfigEntrySet('auto_purge')) && (getAutoPurge() == '0')) { // Will never expire! $content['expiration'] = '{--MAIL_WILL_NEVER_EXPIRE--}'; } elseif (isConfigEntrySet('auto_purge')) { // Create nice date string - $content['expiration'] = createFancyTime(getConfig('auto_purge')); + $content['expiration'] = createFancyTime(getAutoPurge()); } else { // Missing entry $content['expiration'] = '{--MAIL_NO_CONFIG_AUTO_PURGE--}'; diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 7b33fb59f9..770b350958 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -1526,6 +1526,162 @@ function getApInactiveSince () { return $GLOBALS['ap_inactive_since']; } +// "Getter" for user_min_confirmed +function getUserMinConfirmed () { + // Do we have cache? + if (!isset($GLOBALS['user_min_confirmed'])) { + // Determine it + $GLOBALS['user_min_confirmed'] = getConfig('user_min_confirmed'); + } // END - if + + // Return cache + return $GLOBALS['user_min_confirmed']; +} + +// "Getter" for auto_purge +function getAutoPurge () { + // Do we have cache? + if (!isset($GLOBALS['auto_purge'])) { + // Determine it + $GLOBALS['auto_purge'] = getConfig('auto_purge'); + } // END - if + + // Return cache + return $GLOBALS['auto_purge']; +} + +// "Getter" for bonus_userid +function getBonusUserid () { + // Do we have cache? + if (!isset($GLOBALS['bonus_userid'])) { + // Determine it + $GLOBALS['bonus_userid'] = getConfig('bonus_userid'); + } // END - if + + // Return cache + return $GLOBALS['bonus_userid']; +} + +// "Getter" for ap_inactive_time +function getApInactiveTime () { + // Do we have cache? + if (!isset($GLOBALS['ap_inactive_time'])) { + // Determine it + $GLOBALS['ap_inactive_time'] = getConfig('ap_inactive_time'); + } // END - if + + // Return cache + return $GLOBALS['ap_inactive_time']; +} + +// "Getter" for ap_dm_timeout +function getApDmTimeout () { + // Do we have cache? + if (!isset($GLOBALS['ap_dm_timeout'])) { + // Determine it + $GLOBALS['ap_dm_timeout'] = getConfig('ap_dm_timeout'); + } // END - if + + // Return cache + return $GLOBALS['ap_dm_timeout']; +} + +// "Getter" for ap_tasks_time +function getApTasksTime () { + // Do we have cache? + if (!isset($GLOBALS['ap_tasks_time'])) { + // Determine it + $GLOBALS['ap_tasks_time'] = getConfig('ap_tasks_time'); + } // END - if + + // Return cache + return $GLOBALS['ap_tasks_time']; +} + +// "Getter" for ap_unconfirmed_time +function getApUnconfirmedTime () { + // Do we have cache? + if (!isset($GLOBALS['ap_unconfirmed_time'])) { + // Determine it + $GLOBALS['ap_unconfirmed_time'] = getConfig('ap_unconfirmed_time'); + } // END - if + + // Return cache + return $GLOBALS['ap_unconfirmed_time']; +} + +// "Getter" for points +function getPoints () { + // Do we have cache? + if (!isset($GLOBALS['points'])) { + // Determine it + $GLOBALS['points'] = getConfig('POINTS'); + } // END - if + + // Return cache + return $GLOBALS['points']; +} + +// "Getter" for slogan +function getSlogan () { + // Do we have cache? + if (!isset($GLOBALS['slogan'])) { + // Determine it + $GLOBALS['slogan'] = getConfig('SLOGAN'); + } // END - if + + // Return cache + return $GLOBALS['slogan']; +} + +// "Getter" for copy +function getCopy () { + // Do we have cache? + if (!isset($GLOBALS['copy'])) { + // Determine it + $GLOBALS['copy'] = getConfig('COPY'); + } // END - if + + // Return cache + return $GLOBALS['copy']; +} + +// "Getter" for sql_count +function getSqlCount () { + // Do we have cache? + if (!isset($GLOBALS['sql_count'])) { + // Determine it + $GLOBALS['sql_count'] = getConfig('sql_count'); + } // END - if + + // Return cache + return $GLOBALS['sql_count']; +} + +// "Getter" for num_templates +function getNumTemplates () { + // Do we have cache? + if (!isset($GLOBALS['num_templates'])) { + // Determine it + $GLOBALS['num_templates'] = getConfig('num_templates'); + } // END - if + + // Return cache + return $GLOBALS['num_templates']; +} + +// "Getter" for dns_cache_timeout +function getDnsCacheTimeout () { + // Do we have cache? + if (!isset($GLOBALS['dns_cache_timeout'])) { + // Determine it + $GLOBALS['dns_cache_timeout'] = getConfig('dns_cache_timeout'); + } // END - if + + // Return cache + return $GLOBALS['dns_cache_timeout']; +} + // Checks wether proxy configuration is used function isProxyUsed () { // Do we have cache? diff --git a/mailid_top.php b/mailid_top.php index d7a2aa57e9..6d88d094bc 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -263,7 +263,7 @@ if ((isValidUserId($url_userid)) && (($url_mid > 0) || ($url_bid > 0)) && (!ifFa // Is an active-rallye running and this is not a notification mail? if ((isBonusRallyeActive()) && ($notify != 'Y')) { // Shall I exclude the webmaster's own userid from the active-rallye? - if ((((getConfig('bonus_userid') == $url_userid) && (getConfig('bonus_include_own') == 'Y')) || (getConfig('bonus_userid') != $url_userid)) && (getConfig('def_refid') != $url_userid)) { + if ((((getBonusUserId() == $url_userid) && (getConfig('bonus_include_own') == 'Y')) || (getBonusUserId() != $url_userid)) && (getConfig('def_refid') != $url_userid)) { // Add points and remember ranking are done in this function.... addTurboBonus($urlId, $url_userid, $type);