]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-transfer.php
Some more wrappers added, code cleanups:
[mailer.git] / inc / modules / member / what-transfer.php
index 699dc3d867079e40c2422fd2b3831a396e4deb4c..85bff3a9f43dd243b03cd32f6cf0deff26d6b606 100644 (file)
@@ -62,7 +62,7 @@ if ((getUserData('opt_in') != 'Y') && ($mode == 'new')) $mode = '';
 switch ($mode) {
        case 'new': // Start new transfer
                // Get total points and subtract the balance amount from it = maximum transferable points
-               $total = countSumTotalData(getMemberId(), 'user_points', 'points')  - countSumTotalData(getMemberId(), 'user_data', 'used_points');
+               $total = getTotalPoints(getMemberId());
 
                // Remember maximum value for template
                $content['max_transferable'] = round($total - getConfig('transfer_balance') - 0.5);
@@ -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
@@ -215,15 +215,15 @@ 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";
                                // @TODO Try to rewrite his to $content = SQL_FETCHARRAY(), see some lines above for two different queries
                                while (list($userid, $nick) = SQL_FETCHROW($result)) {
                                        $OUT .= "       <option value=\"".$userid."\"";
-                                       if ((isPostRequestParameterSet(('to_userid'))) && (postRequestParameter('to_userid') == $userid)) $OUT .= ' selected="selected"';
-                                       $OUT .= ">";
+                                       if ((isPostRequestParameterSet('to_userid')) && (postRequestParameter('to_userid') == $userid)) $OUT .= ' selected="selected"';
+                                       $OUT .= '>';
                                        if (($nick != $userid) && (!empty($nick))) {
                                                // Output nickname
                                                $OUT .= $nick;
@@ -231,9 +231,9 @@ switch ($mode) {
                                                // Output userid
                                                $OUT .= $userid;
                                        }
-                                       $OUT .= "</option>\n";
+                                       $OUT .= '</option>';
                                }
-                               $OUT .= "</select>\n";
+                               $OUT .= '</select>';
                                $content['to_disabled'] = '';
 
                                // Free memory
@@ -299,7 +299,7 @@ switch ($mode) {
                $result = SQL_QUERY_ESC($sql, array(getMemberId()), __FILE__, __LINE__);
 
                // Do we have entries?
-               if (SQL_NUMROWS($result) > 0) {
+               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)) {
@@ -385,7 +385,7 @@ 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__);