]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-transfer.php
More rewrites to make use of (cached) wrapper functions
[mailer.git] / inc / modules / member / what-transfer.php
index 8fbaab9869fddc4a752eba1ee0a20a9a96933f21..aad5bf37e2264d0ce4b92c8c92b96924e19162ce 100644 (file)
@@ -88,7 +88,7 @@ switch ($mode) {
                        $valid_reason = (isPostRequestParameterSet('reason'));
 
                        // Test if a recipient is selected
-                       $valid_recipient = (postRequestParameter('to_userid') > 0);
+                       $valid_recipient = isValidUserId(postRequestParameter('to_userid'));
 
                        // Check for nickname extension and set additional data
                        // @TODO Rewrite this to a filter
@@ -161,14 +161,14 @@ switch ($mode) {
 
                                // First send email to recipient
                                $message = loadEmailTemplate('member_transfer_recipient', $content, postRequestParameter('to_userid'));
-                               sendEmail($content['recipient']['email'], getMessage('TRANSFER_MEMBER_RECIPIENT_SUBJ') . ': ' . $SENDER, $message);
+                               sendEmail($content['recipient']['email'], '{--TRANSFER_MEMBER_RECIPIENT_SUBJECT--}' . ': ' . $SENDER, $message);
 
                                // Second send email to sender
                                $message = loadEmailTemplate('member_transfer_sender', $content, getMemberId());
-                               sendEmail($content['sender']['email'], getMessage('TRANSFER_MEMBER_SENDER_SUBJ') . ': ' . $RECIPIENT, $message);
+                               sendEmail($content['sender']['email'], '{--TRANSFER_MEMBER_SENDER_SUBJECT--}' . ': ' . $RECIPIENT, $message);
 
                                // At last send admin mail(s)
-                               $adminSubject = sprintf("%s (%s->%s)", getMessage('TRANSFER_ADMIN_SUBJECT'), $SENDER, $RECIPIENT);
+                               $adminSubject = sprintf("%s (%s->%s)", '{--TRANSFER_ADMIN_SUBJECT--}', $SENDER, $RECIPIENT);
                                sendAdminNotification($adminSubject, 'admin_transfer_points', $content);
 
                                // Transfer is completed
@@ -215,7 +215,7 @@ switch ($mode) {
                                        array(getMemberId()), __FILE__, __LINE__);
                        }
 
-                       if (SQL_NUMROWS($result) > 0) {
+                       if (!SQL_HASZERONUMS($result)) {
                                // Load list
                                $OUT  = "<select name=\"to_userid\" size=\"1\" class=\"member_select\">
        <option value=\"0\">{--SELECT_NONE--}</option>\n";
@@ -299,8 +299,8 @@ switch ($mode) {
                $result = SQL_QUERY_ESC($sql, array(getMemberId()), __FILE__, __LINE__);
 
                // Do we have entries?
-               if (SQL_NUMROWS($result) > 0) {
-                       $OUT = ''; $SW = 2;
+               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
@@ -309,7 +309,6 @@ switch ($mode) {
                                // Prepare content for template
                                // @TODO Rewrite: tid->trans_id,stamp->time_trans
                                $row = array(
-                                       'sw'       => $SW,
                                        'trans_id' => $tid,
                                        'stamp'    => generateDateTime($stamp, 3),
                                        'userid'   => $userid,
@@ -322,7 +321,6 @@ switch ($mode) {
 
                                // Add points and switch color
                                $totalPoints += $points;
-                               $SW = 3 - $SW;
                        } // END - while
 
                        // Free memory
@@ -387,19 +385,18 @@ KEY (`party_userid`)
                SQL_FREERESULT($result);
 
                $total = '0';
-               if (SQL_NUMROWS($result) > 0) {
+               if (!SQL_HASZERONUMS($result)) {
                        // Search for entries
                        $result = SQL_QUERY("SELECT `party_userid`, `trans_id`, `points`, `reason`, `time_trans`, `trans_type` FROM `{?_MYSQL_PREFIX?}_transfers_tmp` ORDER BY `time_trans` DESC",
                                __FILE__, __LINE__);
 
                        // Output rows
-                       $OUT = ''; $SW = 2;
+                       $OUT = '';
                        while ($content = SQL_FETCHARRAY($result)) {
                                // Rewrite points
                                if ($content['trans_type'] == 'OUT') $content['points'] = '-'.$content['points']."";
 
                                // Prepare content for template
-                               $content['sw']     = $SW;
                                $content['time']   = generateDateTime($content['time_trans'], 3);
                                $content['points'] = translateComma($content['points']);
 
@@ -408,7 +405,6 @@ KEY (`party_userid`)
 
                                // Add points and switch color
                                $total += $content['points'];
-                               $SW = 3 - $SW;
                        } // END - while
 
                        // Free memory