X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffix_menu.php;h=6dec7b19c795cdfb260976a180ddd12a5bdb77da;hb=82c8384907c7abfb877ac2fd57b2d3efa915173b;hp=95df315940e757a22cbf41dbc6abeae9cd86c5e6;hpb=263a089d8a499e0e26d0af9e7aa7639f88b8ca60;p=mailer.git diff --git a/inc/fix_menu.php b/inc/fix_menu.php index 95df315940..6dec7b19c7 100644 --- a/inc/fix_menu.php +++ b/inc/fix_menu.php @@ -14,11 +14,10 @@ * $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 * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2012 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -44,7 +43,7 @@ if (!defined('__SECURITY')) { // Get all menus foreach (array('guest','member','admin') as $menu) { // Query it - $result = SQL_QUERY_ESC("SELECT `action`, `what` FROM `{?_MYSQL_PREFIX?}_%s_menu` ORDER BY `action` ASC, `what` ASC", + $result = SQL_QUERY_ESC("SELECT `action`,`what` FROM `{?_MYSQL_PREFIX?}_%s_menu` ORDER BY `action` ASC,`what` ASC", array($menu), __FILE__, __LINE__); // Init array @@ -65,7 +64,7 @@ foreach (array('guest','member','admin') as $menu) { // Sub menu $entries = countSumTotalData($entry['action'], $menu . '_menu', 'action', 'action', true, sprintf(" AND `what`='%s'", $entry['what'])); } - //* DEBUG: */ print 'menu='.$menu.',action='.$entry['action'].',what='.$entry['what'].',entries='.$entries.'
'; + //* DEBUG: */ debugOutput('menu='.$menu.',action='.$entry['action'].',what='.$entry['what'].',entries='.$entries); // Only remove if we have at least 2 entries from same menu if ($entries > 1) { @@ -73,11 +72,20 @@ foreach (array('guest','member','admin') as $menu) { if (is_null($entry['what'])) { // Main menu is double SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what` IS NULL LIMIT %s", - array($menu, $entry['action'], ($entries - 1)), __FILE__, __LINE__); + array( + $menu, + $entry['action'], + ($entries - 1) + ), __FILE__, __LINE__); } else { // Sub menu is double SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what`='%s' LIMIT %s", - array($menu, $entry['action'], $entry['what'], ($entries - 1)), __FILE__, __LINE__); + array( + $menu, + $entry['action'], + $entry['what'], + ($entries - 1) + ), __FILE__, __LINE__); } } // END - if } @@ -91,11 +99,11 @@ foreach (array('guest','member','admin') as $menu) { // Now insert our unqiue key for action-what combination addSql(sprintf("ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` DROP KEY `action_what`", $menu)); - addSql(sprintf("ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` ADD UNIQUE `action_what` (`action` , `what`)", $menu)); + addSql(sprintf("ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` ADD UNIQUE INDEX `action_what` (`action`,`what`)", $menu)); // Now insert our unqiue key for what addSql(sprintf("ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` DROP KEY `what`", $menu)); - addSql(sprintf("ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` ADD UNIQUE `what` (`what`)", $menu)); + addSql(sprintf("ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` ADD UNIQUE INDEX `what` (`what`)", $menu)); // And run all runFilterChain('run_sqls');