Introduced more wrappers
authorRoland Häder <roland@mxchange.org>
Sun, 25 Nov 2012 13:34:45 +0000 (13:34 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 25 Nov 2012 13:34:45 +0000 (13:34 +0000)
inc/daily/daily_100_bonus.php
inc/libs/bonus_functions.php
inc/libs/holiday_functions.php
inc/libs/user_functions.php
inc/mails/bonus_mails.php
inc/modules/admin/what-unlock_emails.php
inc/modules/guest/what-top10.php
inc/modules/member/what-holiday.php
inc/wrapper-functions.php
index.php
mailid_top.php

index 59f5c9b0d47c8033fb177097803c2d034f236ef2..6d7c5c05caf2b3e8cb36fc19e620da808cacdc87 100644 (file)
@@ -86,7 +86,7 @@ if (!SQL_HASZERONUMS($result_bonus)) {
        } // END - while
 
        // Handle bonus points
-       handleBonusPoints(getConfig('bonus_stats'), $content['userid']);
+       handleBonusPoints(getBonusStats(), $content['userid']);
 } // END - if
 
 // Free memory
index a9175e22d9f603c4d02e7885c7483d69fb7975fb..cdd11a792da40483bd4781e4db835c5f18f666d1 100644 (file)
@@ -285,7 +285,7 @@ function isBonusRallyeActive () {
        // Is there cache?
        if (!isset($GLOBALS['bonus_rallye_active'])) {
                // Just determine it
-               $GLOBALS['bonus_rallye_active'] = (getConfig('bonus_active') == 'Y');
+               $GLOBALS['bonus_rallye_active'] = (getBonusActive() == 'Y');
        } // END - if
 
        // Return cache
@@ -297,7 +297,7 @@ function isBonusNewMemberNotifyEnabled () {
        // Is there cache?
        if (!isset($GLOBALS['bonus_new_member_notify_active'])) {
                // Just determine it
-               $GLOBALS['bonus_new_member_notify_active'] = (getConfig('bonus_new_member_notify') == 'Y');
+               $GLOBALS['bonus_new_member_notify_active'] = (getBonusNewMemberNotify() == 'Y');
        } // END - if
 
        // Return cache
@@ -388,5 +388,113 @@ function getBonusUserid () {
        return $GLOBALS[__FUNCTION__];
 }
 
+// Getter for bonus_active
+function getBonusActive () {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('bonus_active');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// Getter for bonus_notify_points
+function getBonusNotifyPoints () {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('bonus_notify_points');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// Getter for bonus_new_member_notify
+function getBonusNewMemberNotify () {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('bonus_new_member_notify');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// Getter for bonus_stats
+function getBonusStats () {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('bonus_stats');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// Getter for bonus_order
+function getBonusOrder () {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('bonus_order');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// Getter for bonus_lines
+function getBonusLines () {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('bonus_lines');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// Getter for bonus_include_own
+function getBonusIncludeOwn () {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('bonus_include_own');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// Getter for bonus_disable_notify
+function getBonusDisableNotify () {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('bonus_disable_notify');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
+// Getter for bonus_enable_notify
+function getBonusEnableNotify () {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('bonus_enable_notify');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
 // [EOF]
 ?>
index 40f9e68cbe3b5ca2c10de8b5a320063297b27d7b..8b5c02d71124dbfad78f178bb7cbb9788a08b3d6 100644 (file)
@@ -104,5 +104,21 @@ LIMIT 1",
        SQL_FREERESULT($result_stop);
 }
 
+// ----------------------------------------------------------------------------
+//                 Wrapper functions for configuration entries
+// ----------------------------------------------------------------------------
+
+// Getter for user_alpha
+function getHolidayLock () {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('holiday_lock');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
 // [EOF]
 ?>
index 64e03f1a5cc01b151a4c7edf242a1649d51f9209..255ad5ce4c0b24c5ff9f2c690ce4563c10a1896b 100644 (file)
@@ -339,7 +339,7 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p
                                } // END - if
 
                                // Is the timeout reached?
-                               if ($probe >= getConfig('login_timeout')) {
+                               if ($probe >= getLoginTimeout()) {
                                        // Add login bonus to user's account
                                        $add = ',`login_bonus`=`login_bonus`+{?login_bonus?}';
                                        $GLOBALS['bonus_payed'] = TRUE;
@@ -625,7 +625,7 @@ LIMIT 1",
                                                        array(bigintval($refid)), __FILE__, __LINE__);
 
                                                // Subtract points from system
-                                               handleBonusPoints(getConfig('bonus_ref'), $refid);
+                                               handleBonusPoints(getBonusRef(), $refid);
                                        } // END - if
 
                                        // Add one-time referral bonus over referral system or directly
index 2493a25e5918252d47ce4df5b82ce225b31d2b8f..ef465e5c1c573fa970a20a66d8de374df0d7f4dd 100644 (file)
@@ -52,9 +52,9 @@ $sql = ''; $mode = '';
 
 // Shall I sent activation or deactivation mail?
 $sql = "SELECT `userid`, `email` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE (`bonus_rallye_enable_notify` ";
-switch (getConfig('bonus_active')) {
+switch (getBonusActive()) {
        case 'Y': // Active rallye is activated
-               if (getConfig('bonus_enable_notify') == 'Y') {
+               if (getBonusEnableNotify() == 'Y') {
                        // Okay, let's check for member accounts
                        $sql .= '= 0 OR (`bonus_rallye_enable_notify` > 0 AND `bonus_rallye_enable_notify` < `bonus_rallye_disable_notify`)';
                        $mode = 'enable';
@@ -65,7 +65,7 @@ switch (getConfig('bonus_active')) {
                break;
 
        case 'N': // Active rallye is deactivated
-               if (getConfig('bonus_disable_notify') == 'Y') {
+               if (getBonusDisableNotify() == 'Y') {
                        // Okay, let's check for member accounts
                        $sql .= ' > 0 AND `bonus_rallye_disable_notify` < `bonus_rallye_enable_notify`';
                        $mode = 'disable';
@@ -81,7 +81,7 @@ if (!empty($sql)) {
        $sql .= ')' . runFilterChain('user_exclusion_sql', " AND `status`='CONFIRMED'") . ' ORDER BY `last_online` ASC';
 
        // Normal notification mails or bonus mails?
-       $sentBonusMails = ((getConfig('bonus_notify_points') > 0) && ($mode == 'enable') && (isExtensionActive('bonus')));
+       $sentBonusMails = ((getBonusNotifyPoints() > 0) && ($mode == 'enable') && (isExtensionActive('bonus')));
 
        // Load message body for bonus mails
        $message = loadEmailTemplate('bonus_enable_notify_body', '', '{PER}userid{PER}');
@@ -125,7 +125,7 @@ LIMIT 1",
                        $url = 'modules.php?module=index&amp;what=login';
 
                        // Insert mail
-                       addBonusMailToQueue('{--MEMBER_BONUS_RALLYE_' . strtoupper($mode) . '_SUBJECT--}', $message, $receiver, getConfig('bonus_notify_points'), getConfig('bonus_notify_wait'), $url, 0, 'normal', SQL_NUMROWS($result_main));
+                       addBonusMailToQueue('{--MEMBER_BONUS_RALLYE_' . strtoupper($mode) . '_SUBJECT--}', $message, $receiver, getBonusNotifyPoints(), getConfig('bonus_notify_wait'), $url, 0, 'normal', SQL_NUMROWS($result_main));
                } // END - if
        } // END - if
 
index 76bc73be566b066b7a200670776184d9eec21538..a9145f11b7dd957ee4abb9976a0303fb68c14ed8 100644 (file)
@@ -105,7 +105,7 @@ LIMIT 1',
                                                        array(bigintval($content['sender'])), __FILE__, __LINE__);
 
                                                // Subtract bonus points from system
-                                               handleBonusPoints(getConfig('bonus_order'), $content['sender']);
+                                               handleBonusPoints(getBonusOrder(), $content['sender']);
                                        } // END - if
 
                                        // Load email template
index 190bfd144dd30df195ebc541b5a0e2246d542248..e6e836228f41d42707c0e53d4a34e9396c8b6165 100644 (file)
@@ -81,9 +81,9 @@ while ($content = SQL_FETCHARRAY($result)) {
        $count++;
 } // END - while
 
-if ($count < getConfig('top10_max')) {
+if ($count < getTop10Max()) {
        // Add more "blank" rows
-       for ($i = $count; $i <= getConfig('top10_max'); $i++) {
+       for ($i = $count; $i <= getTop10Max(); $i++) {
                // Prepare data for template
                $content = array(
                        'index' => $i
@@ -135,9 +135,9 @@ while ($content = SQL_FETCHARRAY($result)) {
        $count++;
 } // END - while
 
-if ($count < getConfig('top10_max')) {
+if ($count < getTop10Max()) {
        // Add more "blank" rows
-       for ($i = $count; $i <= getConfig('top10_max'); $i++) {
+       for ($i = $count; $i <= getTop10Max(); $i++) {
                // Prepare data for template
                $content = array(
                        'index' => $i
@@ -193,9 +193,9 @@ while ($content = SQL_FETCHARRAY($result)) {
        $count++;
 } // END - while
 
-if ($count < getConfig('top10_max')) {
+if ($count < getTop10Max()) {
        // Add more "blank" rows
-       for ($i = $count; $i <= getConfig('top10_max'); $i++) {
+       for ($i = $count; $i <= getTop10Max(); $i++) {
                // Prepare data for template
                $content = array(
                        'index' => $i
index e1b6872cff5cec7351aa1fc30a4d1929112dd5a1..95e3f651d5b0c615c89c3a84d3b5d444422dc4ab 100644 (file)
@@ -84,12 +84,12 @@ if ((SQL_NUMROWS($result1) == 1) || (SQL_NUMROWS($result2) == 1)) {
        if (empty($content['timestamp'])) $content['timestamp'] = '0';
        if (empty($content['timestamp_ordered'])) $content['timestamp_ordered'] = '0';
 
-       if ((($content['timestamp'] + getConfig('holiday_lock')) > time()) || (($content['timestamp_ordered'] + getConfig('holiday_lock')) > time())) {
+       if ((($content['timestamp'] + getHolidayLock()) > time()) || (($content['timestamp_ordered'] + getHolidayLock()) > time())) {
                // Mail order is to close away!
                unsetPostRequestElement('ok');
                unsetPostRequestElement('stop');
 
-               if (($content['timestamp'] + getConfig('holiday_lock')) > time()) {
+               if (($content['timestamp'] + getHolidayLock()) > time()) {
                        // Mail found in pool
                        $stamp = $content['timestamp'];
                } else {
@@ -120,7 +120,12 @@ if (isFormSent()) {
        } else {
                // Everything went okay so let's store his request and send mails
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_holidays` (`userid`, `holiday_start`, `holiday_end`, `comments`) VALUES ('%s','%s','%s','%s')",
-                       array(getMemberId(), $START, $content['holiday_end'], postRequestElement('comments')), __FILE__, __LINE__);
+                       array(
+                               getMemberId(),
+                               $START,
+                               $content['holiday_end'],
+                               postRequestElement('comments')
+                       ), __FILE__, __LINE__);
 
                // Activate holiday system
                SQL_QUERY_ESC("UPDATE
@@ -174,7 +179,7 @@ LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
                // Merge arrays
                $content = merge_array($content, SQL_FETCHARRAY($result));
 
-               if (($content['holiday_active'] == 'Y') && (($content['holiday_activated'] + getConfig('holiday_lock')) < time())) {
+               if (($content['holiday_active'] == 'Y') && (($content['holiday_activated'] + getHolidayLock()) < time())) {
                        // Load data
                        $result2 = SQL_QUERY_ESC("SELECT
        `holiday_start`,
@@ -251,7 +256,7 @@ LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
        SQL_FREERESULT($result);
 
        // Check for lock
-       if (($content['holiday_activated'] + getConfig('holiday_lock')) < time()) {
+       if (($content['holiday_activated'] + getHolidayLock()) < time()) {
                // User can deactivate his holiday request
                switch ($content['holiday_active']) {
                        case 'Y': // Display deactivation form
index 2e500b1617efa3bfb7f4a79d87fb0319d5fb6bb0..3d3e6ebc9b75a32ca44ad96b1942437da8018146 100644 (file)
@@ -2498,6 +2498,18 @@ function getApServerName () {
        return $GLOBALS[__FUNCTION__];
 }
 
+// Getter for 'index_delay'
+function getIndexDelay () {
+       // Is the cache entry set?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // No, so determine it
+               $GLOBALS[__FUNCTION__] = getConfig('index_delay');
+       } // END - if
+
+       // Return cached entry
+       return $GLOBALS[__FUNCTION__];
+}
+
 // Checks whether 'ap_server_name' is 'Y'
 function isApServerNameEnabled () {
        // Is the cache entry set?
index f0683ecff1c5a97b3276f847a8954d9130821d8c..7b7d2f15f48755f2c78892a96967301823f1814f 100644 (file)
--- a/index.php
+++ b/index.php
@@ -67,7 +67,7 @@ if ((isExtensionInstalledAndNewer('sql_patches', '0.8.3')) && (isDisplayHomeInIn
 //////////////////////////////////////////////////
 
 // Check for cookies
-if ((isSessionVariableSet('visited')) || (getConfig('index_delay') > -1)) {
+if ((isSessionVariableSet('visited')) || (getIndexDelay() > -1)) {
        // Set content type
        setContentType('text/html');
 
@@ -87,9 +87,9 @@ if ((isSessionVariableSet('visited')) || (getConfig('index_delay') > -1)) {
        loadTemplate('index');
 
        // Shall I insert an automated forward?
-       if (getConfig('index_delay') > 0) {
+       if (getIndexDelay() > 0) {
                // This will be a JavaScript-redirect!
-               $content['delay']  = (getConfig('index_delay') * 1000 + 500);
+               $content['delay']  = (getIndexDelay() * 1000 + 500);
                $content['module'] = 'index';
 
                // Load template
index 87db810c76bdfd6e5de4bab753de7581d9a067cc..11b984d145a4bc9e7a36b1b8886eb1b23fc31be8 100644 (file)
@@ -282,7 +282,7 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr
                                                                                        // Is an active-rallye running and this is not a notification mail?
                                                                                        if ((isBonusRallyeActive()) && ($data['is_notify'] != 'Y')) {
                                                                                                // Shall I exclude the webmaster's own userid from the active-rallye?
-                                                                                               if ((((getBonusUserid() == $userId) && (getConfig('bonus_include_own') == 'Y')) || (getBonusUserid() != $userId)) && (getDefRefid() != $userId)) {
+                                                                                               if ((((getBonusUserid() == $userId) && (getBonusIncludeOwn() == 'Y')) || (getBonusUserid() != $userId)) && (getDefRefid() != $userId)) {
                                                                                                        // Add points and remember ranking are done in this function....
                                                                                                        addTurboBonus($urlId, $userId, $type);