- if ((isGetRequestElementSet('act')) && (isGetRequestElementSet('tid')) && (isGetRequestElementSet('fid'))) {
- // Get ids
- if (isGetRequestElementSet('w')) {
- // Sub menus selected
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
- array(getRequestElement('act'), bigintval(getRequestElement('tid'))), __FILE__, __LINE__);
- list($tid) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
- array(getRequestElement('act'), bigintval(getRequestElement('fid'))), __FILE__, __LINE__);
- list($fid) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- } else {
- // Main menu selected
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
- array(bigintval(getRequestElement('tid'))), __FILE__, __LINE__);
- list($tid) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
- array(bigintval(getRequestElement('fid'))), __FILE__, __LINE__);
- list($fid) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- }
-
- if ((!empty($tid)) && (!empty($fid))) {
- // Sort menu
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `sort`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1",
- array(bigintval(getRequestElement('tid')), bigintval($fid)), __FILE__, __LINE__);
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `sort`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1",
- array(bigintval(getRequestElement('fid')), bigintval($tid)), __FILE__, __LINE__);
- } // END - if
- } // END - if