Wrapper function isBegRallyeEnabled() introduced, rewrites to make usage of isExtensi...
authorRoland Häder <roland@mxchange.org>
Mon, 5 Jul 2010 06:24:05 +0000 (06:24 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 5 Jul 2010 06:24:05 +0000 (06:24 +0000)
inc/extensions/ext-beg.php
inc/extensions/ext-bonus.php
inc/libs/beg_functions.php
inc/loader/load_cache-modules.php
inc/modules/admin/what-list_beg.php
inc/monthly/monthly_beg.php
inc/reset/reset_beg.php
inc/wrapper-functions.php

index 214f330e5a4c45486328a9b09e5ec7fe71258a28..bff1c14f4a49cf0b68a97a4c15f399b923829d49 100644 (file)
@@ -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
                $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
                        // Include file for sending out mails
                        addIncludeToPool('notify', 'inc/mails/beg_mails.php');
                } // END - if
index e7d2cf60ecb5441bd7d3fa164bd97605d820a1d1..b579393960212367969961a2707ae23ced0c8e08 100644 (file)
@@ -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
 
        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
                        // Include file for sending out mails
                        addIncludeToPool('notify', 'inc/mails/bonus_mails.php');
                } // END - if
index d85a405b133d9affcf6893bc813c165b62385ca3..9cd94d10eb7c8620257de35fe44c4ad0833feda5 100644 (file)
 // Some security stuff...
 if (!defined('__SECURITY')) {
        die();
 // 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?
 
 // 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__);
                // 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
 }
 
        } // 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]
 ?>
 // [EOF]
 ?>
index f0f48d8326f287e9dd43f5d0977ac4ee9ed62aa4..cdace7bce7b4b6ad00e96f0cd5624db440de152b 100644 (file)
@@ -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?
                $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
                        // Add 'has_menu'
                        $entries[] = 'has_menu';
                } // END - if
index 51281d1a6f9c9244d1939482c81ce24f6b6e7596..5c68a0418d5a84fdfbe7ad090ee9c2c4bffaeeb0 100644 (file)
 // Some security stuff...
 if ((!defined('__SECURITY')) || (!isAdmin())) {
        die();
 // Some security stuff...
 if ((!defined('__SECURITY')) || (!isAdmin())) {
        die();
-}
+} // END - if
 
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
 
 
 // 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...
        // Shall I withdraw now?
        if (isPostRequestParameterSet('withdraw')) {
                // Okay, let's prepare...
index c74ea9f6c53734e8dce632f95b73aa27fff4b620..386bcb9b1540ce4727a45b5b5c40720b8e953180 100644 (file)
@@ -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 ((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;
 }
        logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.');
        return;
 }
index b5b7fda7edfaf52b132fcebc66f9bf74adacbaad..a629fb122f0960fd71e6b529c1e7b302d2947bc6 100644 (file)
@@ -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 ((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;
 }
        logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.');
        return;
 }
index 6eb8cf1e401e233c5f6fe0a784dcd61cb2300216..748a49a34a14b1ed9f8e8aa380f320ab1e43b1e8 100644 (file)
@@ -1687,7 +1687,7 @@ function isProxyUsed () {
        // Do we have cache?
        if (!isset($GLOBALS['is_proxy_used'])) {
                // Determine it
        // 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
        } // END - if
 
        // Return cache