]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-adminedit.php
Rewritten handling of menu weightning and updating/deleting menu entries except admin...
[mailer.git] / inc / modules / admin / what-adminedit.php
index 874fa092f56376d3aa4da2598166701c2597d25c..3e7c9680cc2b57ef806f3e724b3493c84ab874aa 100644 (file)
@@ -14,8 +14,6 @@
  * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
@@ -40,7 +38,7 @@
 // Some security stuff...
 if ((!defined('__SECURITY')) || (!isAdmin())) {
        die();
-}
+} // END - if
 
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
@@ -58,7 +56,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
        // @TODO Kill all constants in this file
        $content['sub'] = $SUB;
        $content['chk'] = countPostSelection();
-       $cnt = '0';
+       $cnt = '0'; $OUT = '';
        foreach (postRequestParameter('sel') as $sel => $confirm) {
                if ($confirm == 1) {
                        $cnt++;
@@ -100,7 +98,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
 
        // Load template
        loadTemplate('admin_edit_admin_menu_form', false, $content);
-} elseif ((isFormSent('del')) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
+} elseif ((isFormSent('delete')) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
        // Prepare misc content
        $content['sub'] = $SUB;
        $content['chk'] = countPostSelection();
@@ -122,7 +120,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
                                        'cnt'  => $cnt,
                                        'sel'  => $sel,
                                );
-                               $OUT .= loadTemplate('admin_del_admin_menu_row', true, $data);
+                               $OUT .= loadTemplate('admin_delete_admin_menu_row', true, $data);
                        } else {
                                // Entry not found?
                                $data = array(
@@ -137,7 +135,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
        $content['cnt'] = $cnt;
 
        // Load template
-       loadTemplate('admin_del_admin_menu', false, $content);
+       loadTemplate('admin_delete_admin_menu', false, $content);
 } elseif ((isFormSent()) && (!isDemoModeActive())) {
        // An action is done...
        switch (postRequestParameter('ok')) {
@@ -171,7 +169,7 @@ LIMIT 1",
                        loadTemplate('admin_settings_saved', false, '{--SETTINGS_SAVED--}');
                        break;
 
-               case 'del': // Delete menu
+               case 'delete': // Delete menu
                        foreach (postRequestParameter('sel') as $sel => $menu) {
                                SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
                                        array(bigintval($sel)), __FILE__, __LINE__);
@@ -187,57 +185,8 @@ LIMIT 1",
                        break;
        }
 } else {
-       if ((isGetRequestParameterSet('act')) && (isGetRequestParameterSet('tid')) && (isGetRequestParameterSet('fid'))) {
-               // Get ids
-               if (isGetRequestParameterSet('w')) {
-                       // Sub menus selected
-                       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." AND `what` != '%s' AND `sort`=%s LIMIT 1",
-                               array(
-                                       getRequestParameter('w'),
-                                       bigintval(getRequestParameter('tid'))
-                               ), __FILE__, __LINE__);
-                       list($tid) = SQL_FETCHROW($result);
-                       SQL_FREERESULT($result);
-                       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." AND `what`='%s' AND `sort`=%s LIMIT 1",
-                               array(
-                                       getRequestParameter('w'),
-                                       bigintval(getRequestParameter('fid'))
-                               ), __FILE__, __LINE__);
-                       list($fid) = SQL_FETCHROW($result);
-                       SQL_FREERESULT($result);
-               } else {
-                       // Main menu selected
-                       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action` != %s AND ".$AND." AND `sort`=%s LIMIT 1",
-                               array(
-                                       getRequestParameter('act'),
-                                       bigintval(getRequestParameter('tid'))
-                               ), __FILE__, __LINE__);
-                       list($tid) = SQL_FETCHROW($result);
-                       SQL_FREERESULT($result);
-                       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`=%s AND ".$AND." AND `sort`=%s LIMIT 1",
-                               array(
-                                       getRequestParameter('act'),
-                                       bigintval(getRequestParameter('fid'))
-                               ), __FILE__, __LINE__);
-                       list($fid) = SQL_FETCHROW($result);
-                       SQL_FREERESULT($result);
-               }
-
-               // Do we have entries found?
-               if ((!empty($tid)) && (!empty($fid))) {
-                       // Sort menu
-                       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `sort`=%s WHERE ".$AND." AND `id`=%s LIMIT 1",
-                               array(
-                                       bigintval(getRequestParameter('tid')),
-                                       bigintval($fid)
-                               ), __FILE__, __LINE__);
-                       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `sort`=%s WHERE ".$AND." AND `id`=%s LIMIT 1",
-                               array(
-                                       bigintval(getRequestParameter('fid')),
-                                       bigintval($tid)
-                               ), __FILE__, __LINE__);
-               } // END - if
-       } // END - if
+       // Handle weightning
+       doAdminProcessMenuWeightning('guest');
 
        // Run SQL
        $result = SQL_QUERY("SELECT id, action, what, title, sort FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." ORDER BY `sort` ASC", __FILE__, __LINE__);