]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-adminedit.php
Several more constants rewritten to getConfig()
[mailer.git] / inc / modules / admin / what-adminedit.php
index 19af03ec6d25286e9987319ba5ac6e590c4cb076..8d6aa9f0e1ffd7564a7122e66bbf9eccda0215a5 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");
-} elseif ((IS_FORM_SENT()) && (!IS_DEMO())) {
+       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
@@ -262,26 +250,26 @@ WHERE ".$AND." AND id=%s LIMIT 1",
                        $content['navi'] = '';
                        if (($content['sort'] == 0) || (($content['sort'] == 1) && (!empty($SUB)))) {
                                // Is highest position
-                               $content['navi'] = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$content['action']."&amp;w=".$content['what']."&amp;tid=".($content['sort']+1)."&amp;fid=".$content['sort']."\">{--LOWER--}</a>";
+                               $content['navi'] = "<a href=\"{?URL?}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$content['action']."&amp;w=".$content['what']."&amp;tid=".($content['sort']+1)."&amp;fid=".$content['sort']."\">{--LOWER--}</a>";
                        } elseif ($cnt == $max) {
                                // Is lowest position
-                               $content['navi'] = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$content['action']."&amp;w=".$content['what']."&amp;tid=".($content['sort']-1)."&amp;fid=".$content['sort']."\">{--HIGHER--}</a>";
+                               $content['navi'] = "<a href=\"{?URL?}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$content['action']."&amp;w=".$content['what']."&amp;tid=".($content['sort']-1)."&amp;fid=".$content['sort']."\">{--HIGHER--}</a>";
                        } elseif ($content['sort'] > 0) {
                                // Anything else between highest and lowest
-                               $content['navi'] = "<a href=\"{!URL!}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$content['action']."&amp;w=".$content['what']."&amp;tid=".($content['sort']-1)."&amp;fid=".$content['sort']."\">{--HIGHER--}</a>/<a href=\"{!URL!}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$content['action']."&amp;w=".$content['what']."&amp;tid=".($content['sort']+1)."&amp;fid=".$content['sort']."\">{--LOWER--}</a>";
+                               $content['navi'] = "<a href=\"{?URL?}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$content['action']."&amp;w=".$content['what']."&amp;tid=".($content['sort']-1)."&amp;fid=".$content['sort']."\">{--HIGHER--}</a>/<a href=\"{?URL?}/modules.php?module=admin&amp;what=adminedit&amp;sub={!__SUB_VALUE!}&amp;act=".$content['action']."&amp;w=".$content['what']."&amp;tid=".($content['sort']+1)."&amp;fid=".$content['sort']."\">{--LOWER--}</a>";
                        }
 
                        // Fix empty elements for constant (fixes display bugs in Firefox)
-                       if (empty($content['action'])) $content['action'] = "&nbsp;";
-                       if (empty($content['what']))   $content['what']   = "&nbsp;";
-                       if (empty($content['title']))  $content['title']  = "&nbsp;";
+                       if (empty($content['action'])) $content['action'] = '&nbsp;';
+                       if (empty($content['what']))   $content['what']   = '&nbsp;';
+                       if (empty($content['title']))  $content['title']  = '&nbsp;';
 
                        // Add more data to $content
                        $content['sw']   = $SW;
                        $content['mode'] = 'admin';
 
                        // Load row template and switch colors
-                       $OUT .= LOAD_TEMPLATE("admin_menu_overview_row", true, $content);
+                       $OUT .= LOAD_TEMPLATE('admin_menu_overview_row', true, $content);
                        $SW = 3 - $SW;
                } // END - switch
 
@@ -292,7 +280,7 @@ WHERE ".$AND." AND id=%s LIMIT 1",
                define('__MENU_ROWS', $OUT);
 
                // Load template
-               LOAD_TEMPLATE("admin_amenu_edit");
+               LOAD_TEMPLATE('admin_amenu_edit');
        } else {
                // Menu entries are missing... (???)
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NO_MENUS_FOUND'));