A lot while() conditions rewritten to SQL_FETCHARRAY(), see bug #107, @TODO tags...
[mailer.git] / inc / modules / admin / what-config_email.php
index 8b94f531202370ec89873612baab54e2bcb673c5..83d061b736cb1770ecbe81573a3e68654831f813 100644 (file)
@@ -95,7 +95,7 @@ if (REQUEST_ISSET_POST(('add_max'))) {
        }
 } elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
        // Delete entries
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        foreach (REQUEST_POST('sel') as $id => $value)
        {
                // Load data
@@ -122,7 +122,7 @@ if (REQUEST_ISSET_POST(('add_max'))) {
        LOAD_TEMPLATE("admin_config_email_del");
 } elseif ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
        // Edit entries
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        foreach (REQUEST_POST('sel') as $id => $value) {
                // Load data
                $result = SQL_QUERY_ESC("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE id=%s LIMIT 1",
@@ -147,23 +147,19 @@ if (REQUEST_ISSET_POST(('add_max'))) {
        // Load main template
        LOAD_TEMPLATE("admin_config_email_edit");
 } else {
-       $result = SQL_QUERY("SELECT id, value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` ORDER BY value", __FILE__, __LINE__);
+       $result = SQL_QUERY("SELECT id, value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` ORDER BY value",
+               __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // List already existing entries for editing
-               $SW = 2; $OUT = "";
-               while (list($id, $value, $comment) = SQL_FETCHROW($result)) {
+               $OUT = ""; $SW = 2;
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Prepare data for the row template
-                       $content = array(
-                               'sw'      => $SW,
-                               'id'      => $id,
-                               'value'   => $value,
-                               'comment' => $comment,
-                       );
+                       $content['sw'] = $SW;
 
                        // Load row template and switch color
                        $OUT .= LOAD_TEMPLATE("admin_config_email_row", true, $content);
                        $SW = 3 - $SW;
-               }
+               } // END - while
 
                // Free memory
                SQL_FREERESULT($result);
@@ -171,7 +167,7 @@ if (REQUEST_ISSET_POST(('add_max'))) {
 
                // Load main template
                LOAD_TEMPLATE("admin_config_email");
-       }
+       } // END - if
 
        // Display form
        LOAD_TEMPLATE("admin_add_max");