Fixes for menu system (still SQL is broken)
[mailer.git] / inc / modules / admin / what-admin_add.php
index ef768ff913c9c45a137e6517073bbf5ec602d83b..fa3a6012ab9b7b0271e47b70ae7152a0ec572e75 100644 (file)
@@ -45,7 +45,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 addMenuDescription('admin', __FILE__);
 
 // Check if the admin has entered title and what-php file name...
-if (((!isPostRequestElementSet('title')) || (!isPostRequestElementSet(('menu'))) || (!isPostRequestElementSet(('descr')))) && (isFormSent())) {
+if (((!isPostRequestElementSet('title')) || (!isPostRequestElementSet('menu')) || (!isPostRequestElementSet(('descr')))) && (isFormSent())) {
        unsetPostRequestElement('ok');
 } // END - if
 
@@ -92,7 +92,7 @@ if (!isFormSent()) {
 
                // Load sub menus :)
                foreach ($menus as $key_main => $value_main) {
-                       $result = SQL_QUERY_ESC("SELECT what, title, sort FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
+                       $result = SQL_QUERY_ESC("SELECT `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
                        array($value_main), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result) > 0) {
                                // Init arrays
@@ -134,7 +134,7 @@ if (!isFormSent()) {
                }
        }
        $OUT = "    <select class=\"admin_select\" name=\"sort\" size=\"1\">
-      <option value=\"0\">".IS_FIRST_MENU."</option>\n";
+      <option value=\"0\">{--IS_FIRST_MENU--}</option>\n";
        foreach ($below as $key => $m) {
                if (is_array($m)) {
                        foreach ($m as $key2 => $m2) {
@@ -163,7 +163,7 @@ if (!isFormSent()) {
        loadTemplate('admin_admin_add', false, $content);
 } elseif (!isDemoModeActive()) {
        // Insert new menu entry
-       if (isPostRequestElementSet(('menu'))) {
+       if (isPostRequestElementSet('menu')) {
                // Add sub menu
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('%s','%s','%s','%s','%s')",
                        array(