More cached wrapper functions added for config entries
authorRoland Häder <roland@mxchange.org>
Sun, 4 Jul 2010 13:10:07 +0000 (13:10 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 4 Jul 2010 13:10:07 +0000 (13:10 +0000)
inc/autopurge/purge-general.php
inc/autopurge/purge-inact.php
inc/autopurge/purge-unconfirmed.php
inc/libs/bonus_functions.php
inc/modules/admin/what-config_autopurge.php
inc/modules/admin/what-config_bonus.php
inc/template-functions.php
inc/wrapper-functions.php
mailid_top.php

index 68b98ac43524d0510fb1c02395d827cbb4d4b386..c932ff47df0686a215b28a140b73e8e01c362744 100644 (file)
@@ -46,7 +46,7 @@ if (!defined('__SECURITY')) {
        return false;
 }
 
-if (getConfig('auto_purge') > 0) {
+if (getAutoPurge() > 0) {
        // Init SQLs
        initSqls();
 
index 4a0ef168653731e83a6832201ed8177eec766721..d3c9b49150e6029b551c22b2e6a877e23358b1f2 100644 (file)
@@ -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)) {
index 162b4f6f48a8b3bbf0a750d72d96fc9fc68cb49f..0ef7d7ef076f4be944d909190634f9704862de8f 100644 (file)
@@ -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)) {
index 8367a4a24ec5a38fb50eb569d931a30267d5d0c8..c6768029f0219a4162909c4c336b4cbefb002ffc 100644 (file)
@@ -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);
index c7d37f83f73b0e62f37cfeb7b85bf726000b4ff1..58fb70e04b564106544307d075b1caed3cf622cc 100644 (file)
@@ -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) {
index b6750d4f71e8a31feae45dd461f4efd3a3a30220..b9af8ea74b9c12e3be2ecb6f379b4deb6bcfa489 100644 (file)
@@ -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'));
index 4f1ad6f8e579e628c059c798fbcd3054698332f3..ba3588063aef2e71c416d33e56150c515db62a76 100644 (file)
@@ -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--}';
index 7b33fb59f93df62ae0994bfaf2460d6aa45dccaf..770b3509585fdb111f792e0487125e39f5fba83d 100644 (file)
@@ -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?
index d7a2aa57e958bbaf2c6b497adc23a9786a19b223..6d88d094bc08544fb870e7d070ec94103ad194c0 100644 (file)
@@ -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);