]> git.mxchange.org Git - mailer.git/commitdiff
Use 'sub' to identify whether to update an 'action' menu entry or a 'what' menu entry
authorRoland Häder <roland@mxchange.org>
Tue, 16 Aug 2011 19:24:53 +0000 (19:24 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 16 Aug 2011 19:24:53 +0000 (19:24 +0000)
inc/modules/admin/admin-inc.php

index 161865e8aeead83d04ff75560eb51fcf00c14ca0..bcc4c3c16334030989c6cc12e64d9e7cb3085ba4 100644 (file)
@@ -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
 }