// Get IDs
if (!empty($_GET['w'])) {
// Sub menus selected
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE action='%s' AND sort='%s' LIMIT 1",
- array($_GET['act'], bigintval($_GET['tid'])), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
+ array($_GET['act'], bigintval($_GET['tid'])), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- $result = SQL_QUERY("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE action='%s' AND sort='%s' LIMIT 1",
- array($_GET['act'], bigintval($_GET['fid'])), __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
+ array($_GET['act'], bigintval($_GET['fid'])), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- }
- else
- {
+ } else {
// Main menu selected
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (what='' OR `what` IS NULL) AND sort='%s' LIMIT 1",
- array(bigintval($_GET['tid'])), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (what='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ array(bigintval($_GET['tid'])), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (what='' OR `what` IS NULL) AND sort='%s' LIMIT 1",
- array(bigintval($_GET['fid'])), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (what='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ array(bigintval($_GET['fid'])), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
}
- if ((!empty($tid)) && (!empty($fid)))
- {
+ 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",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET `sort`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
array(bigintval($_GET['tid']), bigintval($fid)), __FILE__, __LINE__);
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET sort='%s' WHERE ".$AND." AND id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET `sort`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
array(bigintval($_GET['fid']), bigintval($tid)), __FILE__, __LINE__);
CACHE_PURGE_ADMIN_MENU(0, "", "", $AND);
}
}
// By default list menus
- if (!empty($SUB))
- {
+ 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",
+ $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
- {
+ } 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)
- {
+ if ($max > 0) {
define('__SUB_VALUE', $SUB);
- $SW = 2; $cnt = 0; $OUT = "";
- while (list($id, $act, $wht, $title, $sort) = SQL_FETCHROW($result))
- {
+ $SW = 2;
+ $cnt = 0;
+ $OUT = "";
+ while (list($id, $act, $wht, $title, $sort) = SQL_FETCHROW($result)) {
$cnt++;
- if (($sort == 0) || (($sort == 1) && (!empty($SUB))))
- {
+ if (($sort == 0) || (($sort == 1) && (!empty($SUB)))) {
// Is highest position
- $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=adminedit&sub=".$SUB."&act=".$act."&w=".$wht."&tid=".($sort+1)."&fid=".$sort."\">{!LOWER!}</a>";
- }
- elseif ($cnt == $max)
- {
+ $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=adminedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort+1)."&fid=".$sort."\">{--LOWER--}</a>";
+ } elseif ($cnt == $max) {
// Is lowest position
- $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=adminedit&sub=".$SUB."&act=".$act."&w=".$wht."&tid=".($sort-1)."&fid=".$sort."\">{!HIGHER!}</a>";
- }
- elseif ($sort > 0)
- {
+ $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=adminedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort-1)."&fid=".$sort."\">{--HIGHER--}</a>";
+ } elseif ($sort > 0) {
// Anything else between highest and lowest
- $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=adminedit&sub=".$SUB."&act=".$act."&w=".$wht."&tid=".($sort-1)."&fid=".$sort."\">{!HIGHER!}</a>/<a href=\"{!URL!}/modules.php?module=admin&what=adminedit&sub=".$SUB."&act=".$act."&w=".$wht."&tid=".($sort+1)."&fid=".$sort."\">{!LOWER!}</a>";
+ $NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=adminedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort-1)."&fid=".$sort."\">{--HIGHER--}</a>/<a href=\"{!URL!}/modules.php?module=admin&what=adminedit&sub={!__SUB_VALUE!}&act=".$act."&w=".$wht."&tid=".($sort+1)."&fid=".$sort."\">{--LOWER--}</a>";
}
- if (empty($act)) $act = " ";
+ if (empty($act)) $act = " ";
if (empty($wht)) $wht = " ";
- if (empty($title)) $title = " ";
+ if (empty($title)) $title = " ";
$content = array(
'sw' => $SW,
'navi' => $NAVI,
'mode' => "admin",
);
+
$OUT .= LOAD_TEMPLATE("admin_menu_overview_row", true, $content);
$SW = 3 - $SW;
}
// Load template
LOAD_TEMPLATE("admin_amenu_edit");
- }
- else
- {
+ } else {
// Menu entries are missing... (???)
LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_NO_MENUS_FOUND'));
}