]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/refback_functions.php
Heacy rewrite/cleanup:
[mailer.git] / inc / libs / refback_functions.php
index 05819eb73ab2a6259672e74cda235fa878d301b6..6a882d10ac458941536208aa3c3a0aaeb39fcec5 100644 (file)
@@ -242,14 +242,8 @@ ORDER BY
        if (!ifSqlHasZeroNums($result)) {
                // Fetch all entries
                while ($row = sqlFetchArray($result)) {
-                       // Init click rate
-                       $row['click_rate'] = '0';
-
-                       // Does he have received some mails?
-                       if ($row['emails_received'] > 0) {
-                               // Calculate click rate
-                               $row['click_rate'] = ($row['mails_confirmed'] / $row['emails_received'] * 100);
-                       } // END - if
+                       // Calculate click rate
+                       $row['click_rate'] = calculatePercentageRate($row['mails_confirmed'], $row['emails_received']);
 
                        // Add row
                        $refs[$row['id']] = $row;
@@ -316,7 +310,7 @@ function updateMemberRefbackPercents ($id, $percents, $note) {
        $content = getArrayFromUserRefbackData($id);
 
        // Is this valid?
-       if (count($content) == 0) {
+       if (!isFilledArray($content)) {
                // id does not belong to user!
                $status['message'] = 'MEMBER_REFBACK_ERROR_ID_MISMATCH';
                return $status;