- if ((!empty($tid)) && (!empty($fid))) {
- // Sort menu
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET `sort`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
- array(bigintval(REQUEST_GET('tid')), bigintval($fid)), __FILE__, __LINE__);
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET `sort`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
- array(bigintval(REQUEST_GET('fid')), bigintval($tid)), __FILE__, __LINE__);
- cachePurgeAdminMenu(0, '', '', $AND);
- }
- }
-
- // By default list menus
- if (!empty($SUB)) {
- // Sub menus of a main menu
- $result = SQL_QUERY_ESC("SELECT id, action, what, title, sort FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC",
- array($SUB), __FILE__, __LINE__);
- } else {
- // Main menus
- $result = SQL_QUERY("SELECT id, action, what, title, sort FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
- }
-
- $max = SQL_NUMROWS($result);
- if ($max > 0) {
- // @TODO Rewrite this constant
- define('__SUB_VALUE', $SUB);
+ // Run SQL
+ $result = SQL_QUERY("SELECT `id`, `action`, `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." ORDER BY `sort` ASC", __FILE__, __LINE__);