************************************************************************/
// Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
-{
+if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
}
+
// Add description as navigation point
ADD_DESCR("admin", basename(__FILE__));
// Do we edit/delete/change main menus or sub menus?
-$AND = "what = ''"; $SUB = "";
+$AND = "(what = '' OR what IS NULL)"; $SUB = "";
if (!empty($_GET['sub']))
{
$AND = sprintf("action='%s'", SQL_ESCAPE($_GET['sub']));
define('__SUB_VALUE', $SUB);
define('__CHK_VALUE', $chk);
$cnt = 0; $SW = 2;
- foreach ($_POST['sel'] as $sel=>$confirm)
+ foreach ($_POST['sel'] as $sel => $confirm)
{
if ($confirm == 1)
{
define('__CHK_VALUE', $chk);
// Del menu entries with or without confirmation
$SW = 2; $cnt = 0; $OUT = "";
- foreach ($_POST['sel'] as $sel=>$confirm)
+ foreach ($_POST['sel'] as $sel => $confirm)
{
if ($confirm == 1)
{
switch ($_POST['ok'])
{
case "edit": // Edit menu
- foreach ($_POST['sel'] as $sel=>$menu)
+ foreach ($_POST['sel'] as $sel => $menu)
{
// Secure ID
$sel = bigintval($sel);
$sel,
), __FILE__, __LINE__);
}
+ CACHE_PURGE_ADMIN_MENU(0, $_POST['sel_action'][$sel], $_POST['sel_what'][$sel]);
LOAD_TEMPLATE("admin_data_saved");
break;
case "del": // Delete menu
- foreach ($_POST['sel'] as $sel=>$menu)
+ foreach ($_POST['sel'] as $sel => $menu)
{
$result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE ".$AND." AND id=%s LIMIT 1",
array(bigintval($sel)), __FILE__, __LINE__);
+ CACHE_PURGE_ADMIN_MENU(0, "", "", $AND);
}
LOAD_TEMPLATE("admin_data_saved");
break;
array(bigintval($_GET['tid']), bigintval($fid)), __FILE__, __LINE__);
$result_sort = 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);
}
}
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 != '' 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