]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-transfer.php
Table user_book renamed to user_booking, isExtensionOlder() should not be used, inste...
[mailer.git] / inc / modules / member / what-transfer.php
index cf59a6ec085b1d732f7878ac92bb44136dfd5e51..b535b08da2b5d221aa5556052c2877c02baa576a 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -46,7 +46,7 @@ if (!defined('__SECURITY')) {
 addYouAreHereLink('member', __FILE__);
 
 if ((!isExtensionActive('transfer')) && (!isAdmin())) {
-       loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('transfer'));
+       displayMessage(generateExtensionInactiveNotInstalledMessage('transfer'));
        return;
 } // END - if
 
@@ -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!
@@ -142,9 +142,8 @@ switch ($mode) {
                                        } // END - if
                                } // END - if
 
-                               // Remember transfer reason and fancy date/time in constants
-                               $content['reason']  = secureString(postRequestParameter('reason'));
-                               $content['expires'] = '{%config,createFancyTime=transfer_age%}';
+                               // Remember transfer reason
+                               $content['reason']  = postRequestParameter('reason');
 
                                // Generate tranafer id
                                $content['trans_id'] = bigintval(generateRandomCode('10', mt_rand(0, 99999), getMemberId(), postRequestParameter('reason')));
@@ -174,7 +173,7 @@ switch ($mode) {
                                sendAdminNotification($adminSubject, 'admin_transfer_points', $content);
 
                                // Transfer is completed
-                               loadTemplate('admin_settings_saved', false, '<div>{--TRANSFER_COMPLETED--}' . '</div><div><a href="{%url=modules.php?module=login&amp;what=transfer%}">{--TRANSFER_CONTINUE_OVERVIEW--}</a></div>');
+                               displayMessage('<div>{--TRANSFER_COMPLETED--}' . '</div><div><a href="{%url=modules.php?module=login&amp;what=transfer%}">{--TRANSFER_CONTINUE_OVERVIEW--}</a></div>');
                        } elseif ($valid_code === false) {
                                // Invalid Touring code!
                                loadTemplate('admin_settings_unsaved', false, '{--TRANSFER_INVALID_CODE--}');
@@ -242,7 +241,7 @@ switch ($mode) {
                                SQL_FREERESULT($result);
                        } else {
                                // No one else is opt-in
-                               $OUT = loadTemplate('admin_settings_saved', true, '{--TRANSFER_NO_ONE_ELSE_OPT_IN--}');
+                               $OUT = displayMessage('{--TRANSFER_NO_ONE_ELSE_OPT_IN--}', true);
                                $content['to_disabled'] = ' disabled="disabled"';
                        }
 
@@ -250,12 +249,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);
@@ -264,7 +263,7 @@ switch ($mode) {
                                $content['captcha_code'] = '<input type="hidden" name="code_chk" value="' . $rand . '" /><input type="text" name="code" class="form_field" size="5" maxlength="7"' . $content['to_disabled'] . ' />&nbsp;' . $img;
                        } else {
                                $code = '00000';
-                               $content['captcha_code'] = loadTemplate('admin_settings_saved', true, '{--TRANSFER_NO_CODE--}');
+                               $content['captcha_code'] = displayMessage('{--TRANSFER_NO_CODE--}', true);
                        }
 
                        // Init points/reason
@@ -289,14 +288,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--}';
@@ -332,7 +331,7 @@ switch ($mode) {
                        // Nothing for in or out
                        $OUT = '<tr>
   <td colspan="5" align="center" class="bottom">
-    ' . loadTemplate('admin_settings_saved', true, $nothingMessage) . '
+    ' . displayMessage($nothingMessage, true) . '
   </td>
 </tr>';
                }
@@ -341,7 +340,7 @@ switch ($mode) {
                $content['rows'] = $OUT;
 
                // Remeber total amount
-               $content['total'] = $totalPoints;
+               $content['total_points'] = $totalPoints;
 
                // Load final template
                loadTemplate('member_transfer_list', false, $content);
@@ -363,7 +362,7 @@ switch ($mode) {
 `time_trans` VARCHAR(10) NOT NULL DEFAULT 0,
 `trans_type` ENUM('IN','OUT') NOT NULL DEFAULT 'IN',
 KEY (`party_userid`)
-) TYPE=HEAP", array(getMemberId()), __FILE__, __LINE__);
+) TYPE = HEAP COMMENT = 'Temporary transfer table'", array(getMemberId()), __FILE__, __LINE__);
 
                // Let's begin with the incoming list
                $result = SQL_QUERY_ESC("SELECT `trans_id`, `from_userid`, `points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE `userid`=%s ORDER BY `id` ASC LIMIT {?transfer_max?}",
@@ -416,7 +415,7 @@ KEY (`party_userid`)
                        // Nothing for in and out
                        $OUT = '<tr>
   <td colspan="5" align="center" class="bottom">
-    ' . loadTemplate('admin_settings_saved', true, '{--TRANSFER_NO_INOUT_TRANSFERS--}') . '
+    ' . displayMessage('{--TRANSFER_NO_INOUT_TRANSFERS--}', true) . '
   </td>
 </tr>';
                }
@@ -428,7 +427,7 @@ KEY (`party_userid`)
                $content['rows'] =  $OUT;
 
                // Remeber total amount
-               $content['total'] = $total;
+               $content['total_points'] = $total;
 
                // Set title
                $content['title'] = '{--TRANSFER_LIST_ALL--}';
@@ -477,7 +476,7 @@ KEY (`party_userid`)
                                array(postRequestParameter('opt_in'), getMemberId()), __FILE__, __LINE__);
 
                        // "Settings saved..."
-                       loadTemplate('admin_settings_saved', false, '{--SETTINGS_SAVED--}');
+                       displayMessage('{--SETTINGS_SAVED--}');
                } // END - if
 
                // Init entries
@@ -505,7 +504,7 @@ KEY (`party_userid`)
 FROM
        `{?_MYSQL_PREFIX?}_user_transfers_out`
 WHERE
-       `time_trans` > (UNIX_TIMESTAMP() - {?transfer_timeout?}) AND
+       (UNIX_TIMESTAMP() - `time_trans`) >= {?transfer_timeout?} AND
        `userid`=%s
 ORDER BY
        `time_trans` DESC