]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-adminedit.php
Code cleanup:
[mailer.git] / inc / modules / admin / what-adminedit.php
index f5743113d5bb30a99e885bb65a90cacafb7d7466..6db7d6964761b7e2f9fedfb265cbd6d430b54091 100644 (file)
@@ -47,11 +47,10 @@ ADD_DESCR('admin', __FILE__);
 
 // Do we edit/delete/change main menus or sub menus?
 $AND = "(`what` = '' OR `what` IS NULL)"; $SUB = '';
-if (REQUEST_ISSET_GET('sub'))
-{
+if (REQUEST_ISSET_GET('sub')) {
        $AND = sprintf("`action`='%s' AND `what` IS NOT NULL", REQUEST_GET('sub'));
        $SUB = REQUEST_GET('sub');
-}
+} // END - if
 
 // Get count of (maybe) selected menu points
 $chk = 0;
@@ -60,67 +59,59 @@ if (REQUEST_ISSET_POST('sel')) $chk = countPostSelection();
 // List all menu points and make them editable
 if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) {
        // Edit menu entries
+       // @TODO Kill all constants in this file
        define('__SUB_VALUE', $SUB);
        define('__CHK_VALUE', $chk);
        $cnt = 0; $SW = 2;
-       foreach (REQUEST_POST('sel') as $sel => $confirm)
-       {
-               if ($confirm == 1)
-               {
+       foreach (REQUEST_POST('sel') as $sel => $confirm) {
+               if ($confirm == 1) {
                        $cnt++;
                        $result = SQL_QUERY_ESC("SELECT title, action, what, descr FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE ".$AND." AND id=%s LIMIT 1",
                        array(bigintval($sel)), __FILE__, __LINE__);
-                       if (SQL_NUMROWS($result) == 1)
-                       {
+                       if (SQL_NUMROWS($result) == 1) {
                                // Entry found so we load the stuff...
                                list($menu, $act, $wht, $descr) = SQL_FETCHROW($result);
                                SQL_FREERESULT($result);
 
                                // Prepare data for the row template
                                $content = array(
-                                       'action' => ADMIN_MAKE_MENU_SELECTION('admin', "action", "sel_action[".$sel."]", $act),
-                                       'what'   => ADMIN_MAKE_MENU_SELECTION('admin', "what", "sel_what[".$sel."]", $wht),
+                                       'action' => ADMIN_MAKE_MENU_SELECTION('admin', 'action', 'sel_action[' . $sel . ']', $act),
+                                       'what'   => ADMIN_MAKE_MENU_SELECTION('admin', 'what', 'sel_what[' . $sel . ']', $wht),
                                        'sw'     => $SW,
                                        'sel'    => $sel,
                                        'menu'   => $menu,
                                        'descr'  => $descr,
                                        'cnt'    => $cnt,
                                );
-                               $OUT .= LOAD_TEMPLATE("admin_amenu_edit_row", true, $content);
-                       }
-                       else
-                       {
+                               $OUT .= LOAD_TEMPLATE('admin_amenu_edit_row', true, $content);
+                       } else {
                                // Entry not found?
                                $content = array(
                                        'sw'  => $SW,
                                        'sel' => $sel
                                );
-                               $OUT .= LOAD_TEMPLATE("admin_menu_404_row", true, $content);
+                               $OUT .= LOAD_TEMPLATE('admin_menu_404_row', true, $content);
                        }
                        $SW = 3 - $SW;
-               }
-       }
+               } // END - if
+       } // END - foreach
+
        define('__MENU_ROWS', $OUT);
        define('__CNT_VALUE', $cnt);
 
        // Load template
-       LOAD_TEMPLATE("admin_amenu_edit_form");
-}
-elseif ((REQUEST_ISSET_POST('del')) && (!IS_DEMO()))
-{
+       LOAD_TEMPLATE('admin_amenu_edit_form');
+} elseif ((REQUEST_ISSET_POST('del')) && (!IS_DEMO())) {
        define('__SUB_VALUE', $SUB);
        define('__CHK_VALUE', $chk);
        // Del menu entries with or without confirmation
        $SW = 2; $cnt = 0; $OUT = '';
-       foreach (REQUEST_POST('sel') as $sel => $confirm)
-       {
-               if ($confirm == 1)
-               {
+       foreach (REQUEST_POST('sel') as $sel => $confirm) {
+               if ($confirm == 1) {
                        $cnt++;
                        $result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE ".$AND." AND id=%s LIMIT 1",
                        array(bigintval($sel)), __FILE__, __LINE__);
-                       if (SQL_NUMROWS($result) == 1)
-                       {
+                       if (SQL_NUMROWS($result) == 1) {
                                // Entry found so we load the stuff...
                                list($menu) = SQL_FETCHROW($result);
                                SQL_FREERESULT($result);
@@ -132,16 +123,14 @@ elseif ((REQUEST_ISSET_POST('del')) && (!IS_DEMO()))
                                        'sel'  => $sel,
                                        'sw'   => $SW
                                );
-                               $OUT .= LOAD_TEMPLATE("admin_amenu_delete_row", true, $content);
-                       }
-                       else
-                       {
+                               $OUT .= LOAD_TEMPLATE('admin_amenu_delete_row', true, $content);
+                       } else {
                                // Entry not found?
                                $content = array(
                                        'sw'  => $SW,
                                        'sel' => $sel
                                );
-                               $OUT .= LOAD_TEMPLATE("admin_menu_404_row", true, $content);
+                               $OUT .= LOAD_TEMPLATE('admin_menu_404_row', true, $content);
                        }
                        $SW = 3 - $SW;
                }
@@ -150,11 +139,10 @@ elseif ((REQUEST_ISSET_POST('del')) && (!IS_DEMO()))
        define('__CNT_VALUE', $cnt);
 
        // Load template
-       LOAD_TEMPLATE("admin_amenu_delete");
+       LOAD_TEMPLATE('admin_amenu_delete');
 } elseif ((isFormSent()) && (!IS_DEMO())) {
        // An action is done...
-       switch (REQUEST_POST('ok'))
-       {
+       switch (REQUEST_POST('ok')) {
                case 'edit': // Edit menu
                        foreach (REQUEST_POST('sel') as $sel => $menu) {
                                // Secure ID