From 1c3cf7c8bd60ea09a2b268e37a2cb2d0ee0cdeef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 30 Oct 2009 05:30:47 +0000 Subject: [PATCH] Fixes for menu system (still SQL is broken) --- inc/modules/admin/what-admin_add.php | 8 +-- inc/modules/admin/what-guest_add.php | 66 ++++++++++++-------- inc/modules/admin/what-guestedit.php | 11 ++-- inc/modules/admin/what-mem_add.php | 2 +- templates/de/html/admin/admin_member_add.tpl | 2 +- 5 files changed, 53 insertions(+), 36 deletions(-) diff --git a/inc/modules/admin/what-admin_add.php b/inc/modules/admin/what-admin_add.php index ef768ff913..fa3a6012ab 100644 --- a/inc/modules/admin/what-admin_add.php +++ b/inc/modules/admin/what-admin_add.php @@ -45,7 +45,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { addMenuDescription('admin', __FILE__); // Check if the admin has entered title and what-php file name... -if (((!isPostRequestElementSet('title')) || (!isPostRequestElementSet(('menu'))) || (!isPostRequestElementSet(('descr')))) && (isFormSent())) { +if (((!isPostRequestElementSet('title')) || (!isPostRequestElementSet('menu')) || (!isPostRequestElementSet(('descr')))) && (isFormSent())) { unsetPostRequestElement('ok'); } // END - if @@ -92,7 +92,7 @@ if (!isFormSent()) { // Load sub menus :) foreach ($menus as $key_main => $value_main) { - $result = SQL_QUERY_ESC("SELECT what, title, sort FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`", + $result = SQL_QUERY_ESC("SELECT `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`", array($value_main), __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { // Init arrays @@ -134,7 +134,7 @@ if (!isFormSent()) { } } $OUT = " - "; + "; foreach ($below as $key => $m) { if (is_array($m)) { foreach ($m as $key2 => $m2) { @@ -167,25 +181,25 @@ WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`", loadTemplate('admin_guest_add', false, $content); } elseif (!isDemoModeActive()) { // Insert new menu entry - if (isPostRequestElementSet(('menu'))) { + if (isPostRequestElementSet('menu')) { SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('%s','%s','%s','%s','%s','%s')", - array( - postRequestElement('menu'), - postRequestElement('name'), - postRequestElement('title'), - bigintval(postRequestElement('sort')), - postRequestElement('visible'), - postRequestElement('active'), - ), __FILE__, __LINE__); + array( + postRequestElement('menu'), + postRequestElement('name'), + postRequestElement('title'), + bigintval(postRequestElement('sort')), + postRequestElement('visible'), + postRequestElement('active'), + ), __FILE__, __LINE__); } else { - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (action, title, sort, visible, locked) VALUES ('%s','%s','%s','%s','%s')", - array( - postRequestElement('name'), - postRequestElement('title'), - bigintval(postRequestElement('sort')), - postRequestElement('visible'), - postRequestElement('active'), - ), __FILE__, __LINE__); + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`, `title`, `sort`, `visible`, `locked`) VALUES ('%s','%s','%s','%s','%s')", + array( + postRequestElement('name'), + postRequestElement('title'), + bigintval(postRequestElement('sort')), + postRequestElement('visible'), + postRequestElement('active'), + ), __FILE__, __LINE__); } loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED')); } else { @@ -193,5 +207,5 @@ WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`", loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_NOT_SAVED')); } -// +// [EOF] ?> diff --git a/inc/modules/admin/what-guestedit.php b/inc/modules/admin/what-guestedit.php index a49c13b302..52a632c92e 100644 --- a/inc/modules/admin/what-guestedit.php +++ b/inc/modules/admin/what-guestedit.php @@ -306,10 +306,10 @@ if ((isPostRequestElementSet('edit')) && ($chk > 0) && (!isDemoModeActive())) { // Prepapre content $row = array( 'sw' => $SW, - 'id' => $row['id'], - 'action' => $row['action'], - 'what' => $row['what'], - 'title' => $row['title'], + 'id' => $data['id'], + 'action' => $data['action'], + 'what' => $data['what'], + 'title' => $data['title'], 'navi' => $NAVI, 'mode' => 'guest' ); @@ -319,6 +319,9 @@ if ((isPostRequestElementSet('edit')) && ($chk > 0) && (!isDemoModeActive())) { $SW = 3 - $SW; } // END - while + // Add rows + $content['rows'] = $OUT; + // Free memory SQL_FREERESULT($result); diff --git a/inc/modules/admin/what-mem_add.php b/inc/modules/admin/what-mem_add.php index 1762487215..6fe006f2cd 100644 --- a/inc/modules/admin/what-mem_add.php +++ b/inc/modules/admin/what-mem_add.php @@ -109,7 +109,7 @@ if (!isFormSent()) { // Read menu structure while ($content = SQL_FETCHARRAY($result)) { // Menu actions - $menus[$value_main][] = $content['action']; + $menus[$value_main][] = $content['what']; // Menu titles $titles[$value_main][] = $content['title']; diff --git a/templates/de/html/admin/admin_member_add.tpl b/templates/de/html/admin/admin_member_add.tpl index 240e0f3bbb..06133bbf51 100644 --- a/templates/de/html/admin/admin_member_add.tpl +++ b/templates/de/html/admin/admin_member_add.tpl @@ -86,7 +86,7 @@   - + -- 2.39.2