]> git.mxchange.org Git - mailer.git/commitdiff
New wrapper function getTransferCode() introduced, double-quotes to single-quotes...
authorRoland Häder <roland@mxchange.org>
Sat, 29 Jan 2011 17:52:25 +0000 (17:52 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 29 Jan 2011 17:52:25 +0000 (17:52 +0000)
inc/libs/transfer_functions.php
inc/modules/member/what-transfer.php

index e91581f03fd92096ab1abb2511100a1f9d7ce33a..ea23ae765c51c2f648618a18489d6def1422af1b 100644 (file)
@@ -80,5 +80,21 @@ function autoPurgeTransfers ($max, $age) {
        } // END - if
 }
 
+// ---------------------------------------------------------------------------
+//                              Wrapper functions
+// ---------------------------------------------------------------------------
+
+// Wrapper function for transfer_code
+function getTransferCode () {
+       // Is cache set?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Get config entry
+               $GLOBALS[__FUNCTION__] = getConfig('transfer_code');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
 // [EOF]
 ?>
index 10cc4218b662b24025c93d14ddbd17c0a5629454..0bdd10de82f6abad6011ab6ffcb1cc939b39c6e1 100644 (file)
@@ -71,9 +71,9 @@ switch ($mode) {
 
                if (isFormSent()) {
                        // Add new transfer
-                       if (getConfig('transfer_code') > 0) {
+                       if (getTransferCode() > 0) {
                                // Check for code
-                               $code = generateRandomCode(getConfig('transfer_code'), postRequestParameter('code_chk'), getMemberId(), $content['max_transferable']);
+                               $code = generateRandomCode(getTransferCode(), postRequestParameter('code_chk'), getMemberId(), $content['max_transferable']);
                                $valid_code = ($code == postRequestParameter('code'));
                        } else {
                                // Zero length (= disabled) is always valid!
@@ -250,12 +250,12 @@ switch ($mode) {
                        $content['userid_selection'] = $OUT;
 
                        // Generate Code
-                       if (getConfig('transfer_code') > 0) {
+                       if (getTransferCode() > 0) {
                                // Generate random number
                                $rand = mt_rand(0, 99999);
 
                                // Generate CAPTCHA code
-                               $code = generateRandomCode(getConfig('transfer_code'), $rand, getMemberId(), $content['max_transferable']);
+                               $code = generateRandomCode(getTransferCode(), $rand, getMemberId(), $content['max_transferable']);
 
                                // Generate image (HTML code)
                                $img = generateImageOrCode($code, false);
@@ -289,14 +289,14 @@ switch ($mode) {
                $nothingMessage = '';
                switch ($mode) {
                        case 'list_in':
-                               $sql = "SELECT `trans_id`, `from_userid` AS party_userid, `points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE `userid`=%s ORDER BY `time_trans` DESC LIMIT {?transfer_max?}";
+                               $sql = 'SELECT `trans_id`, `from_userid` AS party_userid, `points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE `userid`=%s ORDER BY `time_trans` DESC LIMIT {?transfer_max?}';
                                $nothingMessage     = '{--TRANSFER_NO_INCOMING_TRANSFERS--}';
                                $content['balance'] = '{--TRANSFER_TOTAL_INCOMING--}';
                                $content['title']   = '{--TRANSFER_LIST_INCOMING--}';
                                break;
 
                        case 'list_out':
-                               $sql = "SELECT `trans_id`, `to_userid` AS party_userid, `points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE `userid`=%s ORDER BY `time_trans` DESC LIMIT {?transfer_max?}";
+                               $sql = 'SELECT `trans_id`, `to_userid` AS party_userid, `points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE `userid`=%s ORDER BY `time_trans` DESC LIMIT {?transfer_max?}';
                                $nothingMessage     = '{--TRANSFER_NO_OUTGOING_TRANSFERS--}';
                                $content['balance'] = '{--TRANSFER_TOTAL_OUTGOING--}';
                                $content['title']   = '{--TRANSFER_LIST_OUTGOING--}';