// 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;
// 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);
'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;
}
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
}
// 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
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'));