]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-adminedit.php
Fix for broken SQL
[mailer.git] / inc / modules / admin / what-adminedit.php
index 70448b0315556cd71a55b624d41fb7485aadd186..d6d95ec5a3d29d0a25bfed0500564dd9f5a79ac8 100644 (file)
@@ -18,6 +18,7 @@
  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -52,12 +53,12 @@ if (isGetRequestParameterSet('sub')) {
 } // END - if
 
 // List all menu points and make them editable
-if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
+if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
        // Edit menu entries
        // @TODO Kill all constants in this file
        $content['sub'] = $SUB;
        $content['chk'] = countPostSelection();
-       $cnt = '0'; $SW = 2;
+       $cnt = '0';
        foreach (postRequestParameter('sel') as $sel => $confirm) {
                if ($confirm == 1) {
                        $cnt++;
@@ -71,7 +72,6 @@ if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0) && (!isDem
                                $data = array(
                                        'action' => adminAddMenuSelectionBox('admin', 'action', 'sel_action[' . $sel . ']', $data['action']),
                                        'what'   => adminAddMenuSelectionBox('admin', 'what'  , 'sel_what['   . $sel . ']', $data['what']),
-                                       'sw'     => $SW,
                                        'sel'    => $sel,
                                        'menu'   => $data['title'],
                                        'descr'  => $data['descr'],
@@ -83,7 +83,6 @@ if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0) && (!isDem
                        } else {
                                // Entry not found?
                                $data = array(
-                                       'sw'  => $SW,
                                        'sel' => $sel
                                );
 
@@ -93,7 +92,6 @@ if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0) && (!isDem
 
                        // Free result and switch color
                        SQL_FREERESULT($result);
-                       $SW = 3 - $SW;
                } // END - if
        } // END - foreach
 
@@ -102,13 +100,13 @@ if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0) && (!isDem
 
        // Load template
        loadTemplate('admin_amenu_edit_form', false, $content);
-} elseif ((isPostRequestParameterSet('del')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
+} elseif ((isFormSent('del')) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
        // Prepare misc content
        $content['sub'] = $SUB;
        $content['chk'] = countPostSelection();
 
        // Del menu entries with or without confirmation
-       $SW = 2; $cnt = '0'; $OUT = '';
+       $cnt = '0'; $OUT = '';
        foreach (postRequestParameter('sel') as $sel => $confirm) {
                if ($confirm == 1) {
                        $cnt++;
@@ -123,21 +121,18 @@ if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0) && (!isDem
                                        'menu' => $data['title'],
                                        'cnt'  => $cnt,
                                        'sel'  => $sel,
-                                       'sw'   => $SW
                                );
                                $OUT .= loadTemplate('admin_amenu_delete_row', true, $data);
                        } else {
                                // Entry not found?
                                $data = array(
-                                       'sw'  => $SW,
                                        'sel' => $sel
                                );
                                $OUT .= loadTemplate('admin_menu_404_row', true, $data);
                        }
                        SQL_FREERESULT($result);
-                       $SW = 3 - $SW;
-               }
-       }
+               } // END - if
+       } // END - switch
        $content['rows'] = $OUT;
        $content['cnt'] = $cnt;
 
@@ -168,7 +163,7 @@ WHERE ".$AND." AND `id`=%s LIMIT 1",
                        }
 
                        // Load template
-                       loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
+                       loadTemplate('admin_settings_saved', false, '{--SETTINGS_SAVED--}');
                        break;
 
                case 'del': // Delete menu
@@ -178,7 +173,7 @@ WHERE ".$AND." AND `id`=%s LIMIT 1",
                        } // END - foreach
 
                        // Load template
-                       loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
+                       loadTemplate('admin_settings_saved', false, '{--SETTINGS_SAVED--}');
                        break;
 
                default: // Unexpected action
@@ -236,7 +231,7 @@ WHERE ".$AND." AND `id`=%s LIMIT 1",
                $content['sub'] = $SUB;
 
                // Init variables
-               $OUT = ''; $SW  = 2; $cnt = '0';
+               $OUT = ''; $cnt = '0';
 
                // Process all entries
                while ($data = SQL_FETCHARRAY($result)) {
@@ -256,18 +251,11 @@ WHERE ".$AND." AND `id`=%s LIMIT 1",
                                $data['navi'] = '<a href="{%url=modules.php?module=admin&amp;what=adminedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']-1) . '&amp;fid=' . $data['sort'] . '%}">{--HIGHER--}</a>/<a href="{%url=modules.php?module=admin&amp;what=adminedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']+1) . '&amp;fid=' . $data['sort'] . '%}">{--LOWER--}</a>';
                        }
 
-                       // Fix empty elements for constant (fixes display bugs in Firefox)
-                       if (empty($data['action'])) $data['action'] = '&nbsp;';
-                       if (empty($data['what']))   $data['what']   = '&nbsp;';
-                       if (empty($data['title']))  $data['title']  = '&nbsp;';
-
                        // Add more data to $data
-                       $data['sw']   = $SW;
                        $data['mode'] = 'admin';
 
                        // Load row template and switch colors
                        $OUT .= loadTemplate('admin_menu_overview_row', true, $data);
-                       $SW = 3 - $SW;
                } // END - switch
 
                // Remember all rows
@@ -280,7 +268,7 @@ WHERE ".$AND." AND `id`=%s LIMIT 1",
                loadTemplate('admin_amenu_edit', false, $content);
        } else {
                // Menu entries are missing... (???)
-               loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NO_MENUS_FOUND'));
+               loadTemplate('admin_settings_saved', false, '{--ADMIN_NO_MENUS_FOUND--}');
        }
 }