]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-config_register.php
Major cleanup of old-school HTML-mess...
[mailer.git] / inc / modules / admin / what-config_register.php
index 41ab4b8dfe87263b16ba339621972acf54822539..f416374aee0e34332e74b27b9f7a94bdf42d2dc4 100644 (file)
 // Some security stuff...
 if ((!defined('__SECURITY')) || (!isAdmin())) {
        die();
 // Some security stuff...
 if ((!defined('__SECURITY')) || (!isAdmin())) {
        die();
-}
+} // END - if
 
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
 
 // Do we want to save changes?
 if (isFormSent()) {
 
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
 
 // Do we want to save changes?
 if (isFormSent()) {
+       // Begin counting
+       $cnt = 0;
+
+       // Update all entries
        foreach (postRequestParameter('sel') as $id => $value) {
        foreach (postRequestParameter('sel') as $id => $value) {
-               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_must_register` SET field_required='%s' WHERE `id`=%s AND field_required != '%s' LIMIT 1",
-               array($value, bigintval($id), $value),__FILE__, __LINE__);
-       }
-       loadTemplate('admin_settings_saved', false, getMessage('REGISTER_ADMIN_CHANGES_SAVED'));
-}
+               // Update database
+               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_must_register` SET `field_required`='%s' WHERE `id`=%s AND `field_required` != '%s' LIMIT 1",
+                       array($value, bigintval($id), $value),__FILE__, __LINE__);
+
+               // Get affected rows
+               $cnt += SQL_AFFECTEDROWS();
+       } // END - foreach
+
+       // Output message for updated entries
+       loadTemplate('admin_settings_saved', false, getMaskedMessage('REGISTER_ADMIN_CHANGES_SAVED', $cnt));
+} // END - if
 
 // List all register values
 
 // List all register values
-$result = SQL_QUERY("SELECT id, field_name, field_required FROM `{?_MYSQL_PREFIX?}_must_register` ORDER BY `id` ASC", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT `id`, `field_name`, `field_required` FROM `{?_MYSQL_PREFIX?}_must_register` ORDER BY `id` ASC", __FILE__, __LINE__);
 $OUT = ''; $SW = 2;
 while ($content = SQL_FETCHARRAY($result)) {
        // Get language string
 $OUT = ''; $SW = 2;
 while ($content = SQL_FETCHARRAY($result)) {
        // Get language string
@@ -66,16 +76,16 @@ while ($content = SQL_FETCHARRAY($result)) {
 
        // @TODO Move this HTML code into a template
        $OUT .= "<tr>
 
        // @TODO Move this HTML code into a template
        $OUT .= "<tr>
-  <td align=\"center\" class=\"switch_sw".$content['sw']." bottom right\">".$content['id']."</td>
-  <td class=\"switch_sw".$content['sw']." bottom right\">&nbsp;&nbsp;".$content['field_name']."</td>
-  <td align=\"center\" class=\"switch_sw".$content['sw']." bottom right\">
-    ".$content['selection']."
-  </td>
+       <td align=\"center\" class=\"switch_sw".$content['sw']." bottom right\">".$content['id']."</td>
+       <td class=\"switch_sw".$content['sw']." bottom right\">".$content['field_name']."</td>
+       <td align=\"center\" class=\"switch_sw".$content['sw']." bottom right\">
+               ".$content['selection']."
+       </td>
 </tr>\n";
 
        // Switch color
        $SW = 3 - $SW;
 </tr>\n";
 
        // Switch color
        $SW = 3 - $SW;
-}
+} // END - while
 
 // Free memory
 SQL_FREERESULT($result);
 
 // Free memory
 SQL_FREERESULT($result);