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(
$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",
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
$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",
$type,
getRequestElement('act'),
bigintval(getRequestElement('fid'))
- ), __FILE__, __LINE__);
+ ), __FUNCTION__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
} else {
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);
}
$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
}