From: Roland Häder Date: Mon, 5 Jul 2010 06:24:05 +0000 (+0000) Subject: Wrapper function isBegRallyeEnabled() introduced, rewrites to make usage of isExtensi... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f585bb39812d6f027725b87fa9f845e0dfe3b306;p=mailer.git Wrapper function isBegRallyeEnabled() introduced, rewrites to make usage of isExtensionInstalledAndNewer() --- diff --git a/inc/extensions/ext-beg.php b/inc/extensions/ext-beg.php index 214f330e5a..bff1c14f4a 100644 --- a/inc/extensions/ext-beg.php +++ b/inc/extensions/ext-beg.php @@ -292,7 +292,7 @@ PRIMARY KEY (id) $result_ext = SQL_QUERY("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_beg_ips` WHERE `timeout` < (UNIX_TIMESTAMP() - ".($OLD + 60*60).")", __FILE__, __LINE__); // Check for beg rallye is active and send mails out - if ((getConfig('beg_rallye') == 'Y') && (getExtensionVersion('beg') >= '0.2.8') && (getConfig('beg_new_member_notify') == 'Y')) { + if ((isBegRallyeEnabled()) && (getConfig('beg_new_member_notify') == 'Y')) { // Include file for sending out mails addIncludeToPool('notify', 'inc/mails/beg_mails.php'); } // END - if diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index e7d2cf60ec..b579393960 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -579,7 +579,7 @@ WHERE `last_online` < ".$mark." ORDER BY `userid` ASC"); case 'init': // Do stuff when extension is initialized // Check for bonus rallye is active and send mails out - if ((getExtensionVersion('bonus') >= '0.9.1') && (isBonusRallyeActive()) && (getConfig('bonus_new_member_notify') == 'Y')) { + if ((isExtensionInstalledAndNewer('bonus', '0.9.1')) && (isBonusRallyeActive()) && (getConfig('bonus_new_member_notify') == 'Y')) { // Include file for sending out mails addIncludeToPool('notify', 'inc/mails/bonus_mails.php'); } // END - if diff --git a/inc/libs/beg_functions.php b/inc/libs/beg_functions.php index d85a405b13..9cd94d10eb 100644 --- a/inc/libs/beg_functions.php +++ b/inc/libs/beg_functions.php @@ -40,12 +40,12 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} +} // END - if // Add points to user or begging rallye account function addPointsBeg ($userid, $points) { // Is begging rallye active? - if (getConfig('beg_rallye') == 'Y') { + if (isBegRallyeEnabled()) { // Add points to rallye account SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_points`=`beg_points`+%s WHERE `userid`=%s LIMIT 1", array($points, $userid), __FUNCTION__, __LINE__); @@ -67,5 +67,17 @@ function addPointsBeg ($userid, $points) { } // END - if } +// Checks wether beg_rallye is enabled +function isBegRallyeEnabled () { + // Do we have cache? + if (!isset($GLOBALS['is_beg_rallye_enabled'])) { + // Determine it + $GLOBALS['is_beg_rallye_enabled'] = ((isExtensionInstalledAndNewer('beg', '0.2.8')) && (getConfig('beg_rallye') == 'Y')); + } // END - if + + // Return cache + return $GLOBALS['is_beg_rallye_enabled']; +} + // [EOF] ?> diff --git a/inc/loader/load_cache-modules.php b/inc/loader/load_cache-modules.php index f0f48d8326..cdace7bce7 100644 --- a/inc/loader/load_cache-modules.php +++ b/inc/loader/load_cache-modules.php @@ -65,7 +65,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('modules')) && ($GLOBALS['cache_i $entries = array('id','title','locked','hidden','admin_only','mem_only'); // Is ext-sql_patches newer or equal 0.3.6? - if ((isExtensionInstalled('sql_patches')) && (getExtensionVersion('sql_patches') >= '0.3.6')) { + if (isExtensionInstalledAndNewer('sql_patches', '0.3.6')) { // Add 'has_menu' $entries[] = 'has_menu'; } // END - if diff --git a/inc/modules/admin/what-list_beg.php b/inc/modules/admin/what-list_beg.php index 51281d1a6f..5c68a0418d 100644 --- a/inc/modules/admin/what-list_beg.php +++ b/inc/modules/admin/what-list_beg.php @@ -40,12 +40,12 @@ // Some security stuff... if ((!defined('__SECURITY')) || (!isAdmin())) { die(); -} +} // END - if // Add description as navigation point addMenuDescription('admin', __FILE__); -if (getConfig('beg_rallye') == 'Y') { +if (isBegRallyeEnabled()) { // Shall I withdraw now? if (isPostRequestParameterSet('withdraw')) { // Okay, let's prepare... diff --git a/inc/monthly/monthly_beg.php b/inc/monthly/monthly_beg.php index c74ea9f6c5..386bcb9b15 100644 --- a/inc/monthly/monthly_beg.php +++ b/inc/monthly/monthly_beg.php @@ -43,7 +43,7 @@ if (!defined('__SECURITY')) { } elseif ((getScriptOutputMode() == 1) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; -} elseif ((!isExtensionActive('beg')) || (getConfig('beg_rallye') != 'Y')) { +} elseif ((!isExtensionActive('beg')) || (!isBegRallyeEnabled())) { logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.'); return; } diff --git a/inc/reset/reset_beg.php b/inc/reset/reset_beg.php index b5b7fda7ed..a629fb122f 100644 --- a/inc/reset/reset_beg.php +++ b/inc/reset/reset_beg.php @@ -43,7 +43,7 @@ if (!defined('__SECURITY')) { } elseif ((getScriptOutputMode() != 0) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; -} elseif ((!isExtensionActive('beg')) || (getConfig('beg_rallye') == 'Y')) { +} elseif ((!isExtensionActive('beg')) || (!isBegRallyeEnabled())) { logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.'); return; } diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 6eb8cf1e40..748a49a34a 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -1687,7 +1687,7 @@ function isProxyUsed () { // Do we have cache? if (!isset($GLOBALS['is_proxy_used'])) { // Determine it - $GLOBALS['is_proxy_used'] = ((getExtensionVersion('sql_patches') >= '0.4.3') && (getConfig('proxy_host') != '') && (getConfig('proxy_port') > 0)); + $GLOBALS['is_proxy_used'] = ((isExtensionInstalledAndNewer('sql_patches', '0.4.3')) && (getConfig('proxy_host') != '') && (getConfig('proxy_port') > 0)); } // END - if // Return cache