]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/rallye_functions.php
Our convention says if(-else) blocks should not be put in one line
[mailer.git] / inc / libs / rallye_functions.php
index a840198c4ae9428c0e0b755f4a919e831f852312..ca7e60fb54485d1b44931d4c2fcb8de472c457bd 100644 (file)
@@ -177,8 +177,8 @@ WHERE
 function addReferalRallyePrices ($rallye, $mode = 'email') {
        // Output mode
        switch($mode) {
-               case 'email': $mode = "\n";       break;
-               case 'html' : $mode = "<br />\n"; break;
+               case 'email': $mode = "\n";     break;
+               case 'html' : $mode = '<br />'; break;
        } // END - switch
 
        // Load prices
@@ -293,7 +293,11 @@ LIMIT 1",
 
                // List only users with at least one ref!
                //* DEBUG: */ debugOutput('*'.$cnt.'/'.$content['userid'].'/'.$content['curr_points'].'/'.$refpoints.'*');
-               if (($cnt > 0) && ($refpoints > $content['curr_points'])) { $userid = $content['userid']; } else { $cnt = ''; }
+               if (($cnt > 0) && ($refpoints > $content['curr_points'])) {
+                       $userid = $content['userid'];
+               } else {
+                       $cnt = '';
+               }
 
                // Save values to array
                $DATA['userid'][]   = $userid;
@@ -700,10 +704,7 @@ LIMIT 1",
 // @TODO This function does not load min_users, min_prices, please encapsulate loading rallye data with e.g. getRallyeDataFromId()
 function addReferalRallyeWinners ($rallye, $default=0) {
        // First check how many prices are set
-       $result_prices = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s ORDER BY `price_level` ASC",
-               array(bigintval($rallye)), __FUNCTION__, __LINE__);
-       $prices = SQL_NUMROWS($result_prices);
-       SQL_FREERESULT($result_prices);
+       $prices = countSumTotalData(bigintval($rallye), 'rallye_prices', 'id', 'rallye_id', true);
 
        // Load data
        $DATA = getArrayFromReferalRallyeUsers($rallye);