]> git.mxchange.org Git - mailer.git/commitdiff
Fixes for menu system (still SQL is broken)
authorRoland Häder <roland@mxchange.org>
Fri, 30 Oct 2009 05:30:47 +0000 (05:30 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 30 Oct 2009 05:30:47 +0000 (05:30 +0000)
inc/modules/admin/what-admin_add.php
inc/modules/admin/what-guest_add.php
inc/modules/admin/what-guestedit.php
inc/modules/admin/what-mem_add.php
templates/de/html/admin/admin_member_add.tpl

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(
index f23636efd305a9b921f88c0ee0f8564dc417c357..8db69b86c711ad8452f8e7aff5d15d2368e86c99 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')))) && (isFormSent())) {
+if (((!isPostRequestElementSet('title')) || (!isPostRequestElementSet('menu'))) && (isFormSent())) {
        // Abort adding the menu entry
        unsetPostRequestElement('ok');
 } // END - if
@@ -55,7 +55,14 @@ if (!isFormSent()) {
        $menus = array(); $titles = array(); $below = array();
 
        // Get all available main menus
-       $result = SQL_QUERY("SELECT action, title, sort FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort`", __FILE__, __LINE__);
+       $result = SQL_QUERY("SELECT
+       `action`, `title`, `sort`
+FROM
+       `{?_MYSQL_PREFIX?}_guest_menu`
+WHERE
+       (`what`='' OR `what` IS NULL)
+ORDER BY
+       `sort` ASC", __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // Read menu structure
                // @TODO Cant this be rewritten?
@@ -93,10 +100,17 @@ if (!isFormSent()) {
 
                // Load sub menus :)
                foreach ($menus as $key_main => $value_main) {
-                       $result = SQL_QUERY_ESC("SELECT what, title, sort
-FROM `{?_MYSQL_PREFIX?}_guest_menu`
-WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
-                       array($value_main), __FILE__, __LINE__);
+                       // Query for sub menus
+                       $result = SQL_QUERY_ESC("SELECT
+       `what`, `title`, `sort`
+FROM
+       `{?_MYSQL_PREFIX?}_guest_menu`
+WHERE
+       `action`='%s' AND
+       `what` != '' AND
+       `what` IS NOT NULL
+ORDER BY `sort` ASC",
+                               array($value_main), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result) > 0) {
                                // Initialize arrays
                                $menus[$value_main] = array();
@@ -106,7 +120,7 @@ WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
                                // Read menu structure
                                while ($content = SQL_FETCHARRAY($result)) {
                                        // Menu actions
-                                       $menus[$value_main][] = $content['action'];
+                                       $menus[$value_main][] = $content['what'];
 
                                        // Menu titles
                                        $titles[$value_main][] = $content['title'];
@@ -140,7 +154,7 @@ WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
        }
 
        $OUT = "    <select class=\"admin_select\" name=\"sort\" size=\"1\">
-      <option value=\"0\">".IS_FIRST_MENU."</option>";
+      <option value=\"0\">{--IS_FIRST_MENU--}</option>";
        foreach ($below as $key => $m) {
                if (is_array($m)) {
                        foreach ($m as $key2 => $m2) {
@@ -167,25 +181,25 @@ WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
        loadTemplate('admin_guest_add', false, $content);
 } elseif (!isDemoModeActive()) {
        // Insert new menu entry
-       if (isPostRequestElementSet(('menu'))) {
+       if (isPostRequestElementSet('menu')) {
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('%s','%s','%s','%s','%s','%s')",
-               array(
-               postRequestElement('menu'),
-               postRequestElement('name'),
-               postRequestElement('title'),
-               bigintval(postRequestElement('sort')),
-               postRequestElement('visible'),
-               postRequestElement('active'),
-               ), __FILE__, __LINE__);
+                       array(
+                               postRequestElement('menu'),
+                               postRequestElement('name'),
+                               postRequestElement('title'),
+                               bigintval(postRequestElement('sort')),
+                               postRequestElement('visible'),
+                               postRequestElement('active'),
+                       ), __FILE__, __LINE__);
        } else {
-               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (action, title, sort, visible, locked) VALUES ('%s','%s','%s','%s','%s')",
-               array(
-               postRequestElement('name'),
-               postRequestElement('title'),
-               bigintval(postRequestElement('sort')),
-               postRequestElement('visible'),
-               postRequestElement('active'),
-               ), __FILE__, __LINE__);
+               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`, `title`, `sort`, `visible`, `locked`) VALUES ('%s','%s','%s','%s','%s')",
+                       array(
+                               postRequestElement('name'),
+                               postRequestElement('title'),
+                               bigintval(postRequestElement('sort')),
+                               postRequestElement('visible'),
+                               postRequestElement('active'),
+                       ), __FILE__, __LINE__);
        }
        loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
 } else {
@@ -193,5 +207,5 @@ WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
        loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_NOT_SAVED'));
 }
 
-//
+// [EOF]
 ?>
index a49c13b302473b63b34ccf4982a5699ec7ff0645..52a632c92e015008e67b3acac49f40f8734ae863 100644 (file)
@@ -306,10 +306,10 @@ if ((isPostRequestElementSet('edit')) && ($chk > 0) && (!isDemoModeActive())) {
                        // Prepapre content
                        $row = array(
                                'sw'     => $SW,
-                               'id'     => $row['id'],
-                               'action' => $row['action'],
-                               'what'   => $row['what'],
-                               'title'  => $row['title'],
+                               'id'     => $data['id'],
+                               'action' => $data['action'],
+                               'what'   => $data['what'],
+                               'title'  => $data['title'],
                                'navi'   => $NAVI,
                                'mode'   => 'guest'
                        );
@@ -319,6 +319,9 @@ if ((isPostRequestElementSet('edit')) && ($chk > 0) && (!isDemoModeActive())) {
                        $SW = 3 - $SW;
                } // END - while
 
+               // Add rows
+               $content['rows'] = $OUT;
+
                // Free memory
                SQL_FREERESULT($result);
 
index 176248721514b6e35b3630790859f3dc1e4c1298..6fe006f2cde1c62ac7ce77f32273275c8789bbd8 100644 (file)
@@ -109,7 +109,7 @@ if (!isFormSent()) {
                                // Read menu structure
                                while ($content = SQL_FETCHARRAY($result)) {
                                        // Menu actions
-                                       $menus[$value_main][] = $content['action'];
+                                       $menus[$value_main][] = $content['what'];
 
                                        // Menu titles
                                        $titles[$value_main][] = $content['title'];
index 240e0f3bbb617f63694b53143380ccfd329526f2..06133bbf51d85f12597ddc480e67b2f629aad4c8 100644 (file)
@@ -86,7 +86,7 @@
        </tr>
        <tr>
                <td class="admin_table" width="10">&nbsp;</td>
-               <td align="center" class="admin_table colspan="3">
+               <td align="center" class="admin_table" colspan="3">
                        <input type="reset" class="admin_reset" value="{--CLEAR_FORM--}" />
                        <input type="submit" class="admin_submit" name="ok" value="{--ADMIN_ADD_MENU--}" />
                </td>