X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-adminedit.php;h=6949d19c984204b01818f63016a322ff110fed98;hb=9e604ce404fe7d2d8dafc259a5fb8cd826aec5e6;hp=19af03ec6d25286e9987319ba5ac6e590c4cb076;hpb=5071030af40e69ca4284642f44758964e18f5be8;p=mailer.git diff --git a/inc/modules/admin/what-adminedit.php b/inc/modules/admin/what-adminedit.php index 19af03ec6d..6949d19c98 100644 --- a/inc/modules/admin/what-adminedit.php +++ b/inc/modules/admin/what-adminedit.php @@ -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 @@ -272,16 +260,16 @@ WHERE ".$AND." AND id=%s LIMIT 1", } // Fix empty elements for constant (fixes display bugs in Firefox) - if (empty($content['action'])) $content['action'] = " "; - if (empty($content['what'])) $content['what'] = " "; - if (empty($content['title'])) $content['title'] = " "; + if (empty($content['action'])) $content['action'] = ' '; + if (empty($content['what'])) $content['what'] = ' '; + if (empty($content['title'])) $content['title'] = ' '; // 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'));