From e6c65030461574197e7ff31f37da5cd0bfcb717c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 16 Aug 2011 19:24:53 +0000 Subject: [PATCH] Use 'sub' to identify whether to update an 'action' menu entry or a 'what' menu entry --- inc/modules/admin/admin-inc.php | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 161865e8ae..bcc4c3c163 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -1799,7 +1799,8 @@ function adminProcessMenuEditForm ($type, $subMenu) { switch (postRequestElement('ok')) { case 'edit': // Edit menu - if (postRequestElement('sel_what', $sel) == '') { + // Shall we update a menu or sub menu? + if (!isGetRequestElementSet('sub')) { // Update with 'what'=null SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_%s_menu` SET `title`='%s',`action`='%s',`what`=NULL WHERE ".$AND." AND `id`=%s LIMIT 1", array( @@ -1807,7 +1808,7 @@ function adminProcessMenuEditForm ($type, $subMenu) { $menu, postRequestElement('sel_action', $sel), $sel - ), __FILE__, __LINE__); + ), __FUNCTION__, __LINE__); } else { // Update with selected 'what' SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_%s_menu` SET `title`='%s',`action`='%s',`what`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1", @@ -1817,22 +1818,30 @@ function adminProcessMenuEditForm ($type, $subMenu) { postRequestElement('sel_action', $sel), postRequestElement('sel_what', $sel), $sel - ), __FILE__, __LINE__); + ), __FUNCTION__, __LINE__); } break; case 'delete': // Delete menu SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE ".$AND." AND `id`=%s LIMIT 1", - array($type, $sel), __FILE__, __LINE__); + array( + $type, + $sel + ), __FUNCTION__, __LINE__); break; case 'status': // Change status of menus SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_%s_menu` SET `visible`='%s',`locked`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1", - array($type, postRequestElement('visible', $sel), postRequestElement('locked', $sel), $sel), __FILE__, __LINE__); + array( + $type, + postRequestElement('visible', $sel), + postRequestElement('locked', $sel), + $sel + ), __FUNCTION__, __LINE__); break; default: // Unexpected action - logDebugMessage(__FILE__, __LINE__, sprintf("Unsupported action %s detected.", postRequestElement('ok'))); + logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unsupported action %s detected.", postRequestElement('ok'))); displayMessage('{%message,ADMIN_UNKNOWN_OKAY=' . postRequestElement('ok') . '%}'); break; } // END - switch @@ -1857,7 +1866,7 @@ function doAdminProcessMenuWeightning ($type, $AND) { $type, getRequestElement('act'), bigintval(getRequestElement('tid')) - ), __FILE__, __LINE__); + ), __FUNCTION__, __LINE__); list($tid) = SQL_FETCHROW($result); SQL_FREERESULT($result); $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `sort`=%s LIMIT 1", @@ -1865,7 +1874,7 @@ function doAdminProcessMenuWeightning ($type, $AND) { $type, getRequestElement('act'), bigintval(getRequestElement('fid')) - ), __FILE__, __LINE__); + ), __FUNCTION__, __LINE__); list($fid) = SQL_FETCHROW($result); SQL_FREERESULT($result); } else { @@ -1874,14 +1883,14 @@ function doAdminProcessMenuWeightning ($type, $AND) { array( $type, bigintval(getRequestElement('tid')) - ), __FILE__, __LINE__); + ), __FUNCTION__, __LINE__); list($tid) = SQL_FETCHROW($result); SQL_FREERESULT($result); $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`=%s LIMIT 1", array( $type, bigintval(getRequestElement('fid')) - ), __FILE__, __LINE__); + ), __FUNCTION__, __LINE__); list($fid) = SQL_FETCHROW($result); SQL_FREERESULT($result); } @@ -1893,13 +1902,13 @@ function doAdminProcessMenuWeightning ($type, $AND) { $type, bigintval(getRequestElement('tid')), bigintval($fid) - ), __FILE__, __LINE__); + ), __FUNCTION__, __LINE__); SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_%s_menu` SET `sort`=%s WHERE ".$AND." AND `id`=%s LIMIT 1", array( $type, bigintval(getRequestElement('fid')), bigintval($tid) - ), __FILE__, __LINE__); + ), __FUNCTION__, __LINE__); } // END - if } // END - if } -- 2.39.5