A lot while() conditions rewritten to SQL_FETCHARRAY(), see bug #107, @TODO tags...
[mailer.git] / inc / modules / member / what-order.php
index bb66ac1a9ff039e70c84c14c69463e35c01b4d0f..6cf97e29943c9c8f07cc4826610bde9625b9334f 100644 (file)
@@ -38,7 +38,7 @@ if (!defined('__SECURITY')) {
 } elseif (!IS_MEMBER()) {
        LOAD_URL("modules.php?module=index");
 } elseif ((!EXT_IS_ACTIVE("order")) && (!IS_ADMIN())) {
-       addFatalMessage(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), "order");
+       addFatalMessage(__FILE__, __LINE__, getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), "order");
        return;
 }
 
@@ -86,7 +86,7 @@ $TOTAL = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL
 
 if (($HOLIDAY == "Y") && (GET_EXT_VERSION("holiday") >= "0.1.3")) {
        // Holiday is active!
-       LOAD_TEMPLATE("admin_settings_saved", false, HOLIDAY_ORDER_NOT_POSSIBLE);
+       LOAD_TEMPLATE("admin_settings_saved", false, getMessage('HOLIDAY_ORDER_NOT_POSSIBLE'));
 } elseif ((REQUEST_ISSET_POST(('frametester'))) && ($ALLOWED > 0) && (REQUEST_POST('receiver') > 0)) {
        // Continue with the frametester, we first need to store the data temporary in the pool
        //
@@ -218,21 +218,21 @@ ORDER BY d.%s %s",
 
                        // Load receivers from database
                        $TEST = array(); $cnt = 0;
-                       while (list($REC) = SQL_FETCHROW($result)) {
+                       while ($content = SQL_FETCHARRAY($result)) {
                                if ($HOLIDAY) {
                                        // Check for his holiday status
                                        $result_holiday = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_holidays`
 WHERE userid=%s AND holiday_start < UNIX_TIMESTAMP() AND holiday_end > UNIX_TIMESTAMP() LIMIT 1",
- array(bigintval($REC)), __FILE__, __LINE__);
-                                       if (SQL_NUMROWS($result_holiday) == 1) $REC = 0; // Exclude user who are in holiday
+ array(bigintval($content['userid'])), __FILE__, __LINE__);
+                                       if (SQL_NUMROWS($result_holiday) == 1) $content['userid'] = 0; // Exclude user who are in holiday
 
                                        // Free memory
                                        SQL_FREERESULT($result_holiday);
                                } // END - if
 
-                               if ($REC > 0) {
+                               if ($content['userid'] > 0) {
                                        // Add receiver
-                                       $TEST[] = $REC;
+                                       $TEST[] = $content['userid'];
                                        $cnt++;
                                } // END - if
                        } // END - while
@@ -411,13 +411,13 @@ array(
                        } // END - if
 
                        // ... and begin loading stuff
-                       while (list($id, $cat) = SQL_FETCHROW($result_cats)) {
-                               $CATS['id'][]   = bigintval($id);
-                               $CATS['name'][] = $cat;
+                       while ($content = SQL_FETCHARRAY($result_cats)) {
+                               $CATS['id'][]   = bigintval($content['id']);
+                               $CATS['name'][] = $content['cat'];
 
                                // Select users in current category
                                $result_uids = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE cat_id=%s AND userid != '%s' ORDER BY userid",
-                                       array(bigintval($id), $GLOBALS['userid']), __FILE__, __LINE__);
+                                       array(bigintval($content['id']), $GLOBALS['userid']), __FILE__, __LINE__);
 
                                $uid_cnt = 0;
                                while (list($ucat) = SQL_FETCHROW($result_uids)) {
@@ -601,10 +601,10 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
 
                                if (SQL_NUMROWS($result) == 1) {
                                        // Old order found
-                                       list($subject, $text, $payment, $tstamp, $url, $target, $cat, $zip) = SQL_FETCHROW($result);
+                                       list($subject, $text, $payment, $tstamp, $url, $target, $content['cat'], $zip) = SQL_FETCHROW($result);
 
                                        // Fix max receivers when it is too much
-                                       if ((isset($CATS['uids'][$cat])) && ($target > $CATS['uids'][$cat])) $target = $CATS['uids'][$cat];
+                                       if ((isset($CATS['uids'][$content['cat']])) && ($target > $CATS['uids'][$content['cat']])) $target = $CATS['uids'][$content['cat']];
 
                                        // Old order is grabbed
                                        $OLD_ORDER = true;
@@ -622,7 +622,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                        $CAT = "";
                                        foreach ($CATS['id'] as $key => $value) {
                                                $CAT .= "      <option value=\"".$value."\"";
-                                               if (($OLD_ORDER) && ($cat == $value)) $CAT .= " selected=\"selected\"";
+                                               if (($OLD_ORDER) && ($content['cat'] == $value)) $CAT .= " selected=\"selected\"";
                                                $CAT .= ">".$CATS['name'][$key]." (".$CATS['uids'][$key]." {--USER_IN_CAT--})</option>\n";
                                        } // END - foreach