Empty module added, 2 internal TODOs closed
[mailer.git] / inc / modules / member / what-transfer.php
index b080851b85a29c6751f1d77a16d675529fd4e003..b5b2ad477255d063c15f57abbf4acf313f994b77 100644 (file)
@@ -123,7 +123,7 @@ switch ($mode) {
                                $TEST_NICK_REC    = $content['recipient']['nickname'];
 
                                // Default is userids for subject line
-                               $SENDER = getMemberId();
+                               $SENDER    = getMemberId();
                                $RECIPIENT = bigintval(postRequestParameter('to_userid'));
 
                                // If nickname is installed we can set the nickname
@@ -131,28 +131,28 @@ switch ($mode) {
                                if (isExtensionActive('nickname')) {
                                        if (($TEST_NICK_SENDER != getMemberId()) && (!empty($TEST_NICK_SENDER))) {
                                                $SENDER = $content['sender']['nickname'];
-                                       }
+                                       } // END - if
 
                                        if (($TEST_NICK_REC != postRequestParameter('to_userid')) && (!empty($TEST_NICK_REC))) {
                                                $RECIPIENT = $content['recipient']['nickname'];
-                                       }
+                                       } // END - if
                                } // END - if
 
                                // Remember transfer reason and fancy date/time in constants
                                $content['reason']  = secureString(postRequestParameter('reason'));
-                               $content['expires'] = createFancyTime(getConfig('transfer_age'));
+                               $content['expires'] = '{%config,createFancyTime=transfer_age%}';
 
                                // Generate tranafer id
                                $content['trans_id'] = bigintval(generateRandomCode('10', mt_rand(0, 99999), getMemberId(), postRequestParameter('reason')));
 
                                // Add entries to both tables
-                               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_transfers_in` (`userid`, `from_userid`, `points`, `reason`, `time_trans`, `trans_id`) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP(),'%s')",
+                               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_transfers_in` (`userid`, `from_userid`, `points`, `reason`, `time_trans`, `trans_id`) VALUES (%s,%s,%s,'%s', UNIX_TIMESTAMP(),%s)",
                                        array(bigintval(postRequestParameter('to_userid')), getMemberId(), bigintval(postRequestParameter('points')), postRequestParameter('reason'), $content['trans_id']), __FILE__, __LINE__);
-                               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_transfers_out` (`userid`, `to_userid`, `points`, `reason`, `time_trans`, `trans_id`) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP(),'%s')",
+                               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_transfers_out` (`userid`, `to_userid`, `points`, `reason`, `time_trans`, `trans_id`) VALUES (%s,%s,%s,'%s', UNIX_TIMESTAMP(),%s)",
                                        array(getMemberId(), bigintval(postRequestParameter('to_userid')), bigintval(postRequestParameter('points')), postRequestParameter('reason'), $content['trans_id']), __FILE__, __LINE__);
 
                                // Add points to account *directly* ...
-                               addPointsDirectly('member_transfer', bigintval(postRequestParameter('to_userid')), bigintval(postRequestParameter('points')));
+                               addPointsDirectly('transfer', bigintval(postRequestParameter('to_userid')), bigintval(postRequestParameter('points')));
 
                                // ... and add it to current user's used points
                                subtractPoints('transfer', getMemberId(), postRequestParameter('points'));
@@ -299,26 +299,20 @@ switch ($mode) {
                // Do we have entries?
                if (!SQL_HASZERONUMS($result)) {
                        $OUT = '';
-                       // @TODO This should be somehow rewritten to $row = SQL_FETCHARRAY(), see switch() block above for SQL queries
-                       while (list($tid, $userid, $points, $reason, $stamp) = SQL_FETCHROW($result)) {
-                               // Rewrite points
-                               if ($type == 'OUT') $points = $points . '-';
+                       while ($content = SQL_FETCHARRAY($result)) {
+                               // Rewrite points, out is subtracted
+                               if ($type == 'OUT') {
+                                       $content['points'] = $content['points'] * -1;
+                               } // END - if
 
                                // Prepare content for template
-                               // @TODO Rewrite: tid->trans_id,stamp->time_trans
-                               $row = array(
-                                       'trans_id' => $tid,
-                                       'stamp'    => generateDateTime($stamp, 3),
-                                       'userid'   => $userid,
-                                       'reason'   => $reason,
-                                       'points'   => $points
-                               );
+                               $$content['time_trans'] = generateDateTime($content['time_trans'], 3);
 
                                // Load row template
-                               $OUT .= loadTemplate('member_transfer_row2', true, $row);
+                               $OUT .= loadTemplate('member_transfer_row2', true, $content);
 
                                // Add points and switch color
-                               $totalPoints += $points;
+                               $totalPoints += $content['points'];
                        } // END - while
 
                        // Free memory
@@ -336,7 +330,7 @@ switch ($mode) {
                $content['rows'] = $OUT;
 
                // Remeber total amount
-               $content['total'] = translateComma($totalPoints);
+               $content['total'] = $totalPoints;
 
                // Load final template
                loadTemplate('member_transfer_list', false, $content);
@@ -396,7 +390,6 @@ KEY (`party_userid`)
 
                                // Prepare content for template
                                $content['time']   = generateDateTime($content['time_trans'], 3);
-                               $content['points'] = translateComma($content['points']);
 
                                // Load row template
                                $OUT .= loadTemplate('member_transfer_row', true, $content);
@@ -420,7 +413,7 @@ KEY (`party_userid`)
                $content['rows'] =  $OUT;
 
                // Remeber total amount
-               $content['total'] = translateComma($total);
+               $content['total'] = $total;
 
                // Set title
                $content['title'] = '{--TRANSFER_LIST_ALL--}';