]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-memedit.php
Extension 'debug' introduced (dummy!), fix for guest/member menu sorting, typos fixed
[mailer.git] / inc / modules / admin / what-memedit.php
index b63cc394456526b1db0a64ac483b6e799eca24f7..8e9fb5466c1e703973efde30988520823beaac84 100644 (file)
  ************************************************************************/
 
 // 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__));
+ADD_DESCR("admin", __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']))
 {
@@ -60,12 +60,12 @@ if ((isset($_POST['edit'])) && ($chk > 0) && (!IS_DEMO()))
        define('__SUB_VALUE', $SUB);
        define('__CHK_VALUE', $chk);
        $SW = 2; $cnt = 0; $OUT = "";
-       foreach ($_POST['sel'] as $sel=>$confirm)
+       foreach ($_POST['sel'] as $sel => $confirm)
        {
                if ($confirm == 1)
                {
                        $cnt++;
-                       $result = SQL_QUERY_ESC("SELECT title, action, what, descr FROM "._MYSQL_PREFIX."_member_menu WHERE ".$AND." AND id=%s LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT title, action, what FROM "._MYSQL_PREFIX."_member_menu WHERE ".$AND." AND id=%s LIMIT 1",
                         array(bigintval($sel)), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result) == 1)
                        {
@@ -107,7 +107,7 @@ if ((isset($_POST['edit'])) && ($chk > 0) && (!IS_DEMO()))
        define('__SUB_VALUE', $SUB);
        define('__CHK_VALUE', $chk);
        $SW = 2; $cnt = 0; $OUT = "";
-       foreach ($_POST['sel'] as $sel=>$confirm)
+       foreach ($_POST['sel'] as $sel => $confirm)
        {
                if ($confirm == 1)
                {
@@ -149,7 +149,7 @@ if ((isset($_POST['edit'])) && ($chk > 0) && (!IS_DEMO()))
        define('__SUB_VALUE', $SUB);
        define('__CHK_VALUE', $chk);
        $SW = 2; $cnt = 0; $OUT = "";
-       foreach ($_POST['sel'] as $sel=>$confirm)
+       foreach ($_POST['sel'] as $sel => $confirm)
        {
                if ($confirm == 1)
                {
@@ -193,16 +193,16 @@ if ((isset($_POST['edit'])) && ($chk > 0) && (!IS_DEMO()))
  elseif ((isset($_POST['ok'])) && (!IS_DEMO()))
 {
        // An act is done...
-       foreach ($_POST['sel'] as $sel=>$menu)
+       foreach ($_POST['sel'] as $sel => $menu)
        {
-               $AND = "what = ''";
+               $AND = "(what = '' OR what IS NULL)";
                $sel = bigintval($sel);
                if (!empty($SUB)) $AND = "action='".$SUB."'";
                switch ($_POST['ok'])
                {
                case "edit": // Edit menu
-                       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_member_menu SET title='%s', action='%s', what='%s', descr='%s' WHERE ".$AND." AND id=%s LIMIT 1",
-                        array($menu, $_POST['sel_act'][$sel], $_POST['sel_what'][$sel], $_POST['sel_descr'][$sel], $sel), __FILE__, __LINE__);
+                       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_member_menu SET title='%s', action='%s', what='%s' WHERE ".$AND." AND id=%s LIMIT 1",
+                        array($menu, $_POST['sel_act'][$sel], $_POST['sel_what'][$sel], $sel), __FILE__, __LINE__);
                        break;
 
                case "del": // Delete menu
@@ -262,7 +262,7 @@ if ((isset($_POST['edit'])) && ($chk > 0) && (!IS_DEMO()))
        if (!empty($SUB))
        {
                // Edit sub menus
-               $result = SQL_QUERY("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_member_menu WHERE ".$AND." AND what != '' ORDER BY sort ASC", __FILE__, __LINE__);
+               $result = SQL_QUERY("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_member_menu WHERE ".$AND." AND what != '' AND what IS NOT NULL ORDER BY sort ASC", __FILE__, __LINE__);
        }
         else
        {