X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffix_menu.php;h=b576f4c8423db93abe5d31f3514594e88b2e0d81;hb=d44a7739c860ef0f30e29167b0fea0d2141ebce6;hp=8c1193861403f2303f031f7fca3ddd5d9d846e78;hpb=0f3a135204757cc8750262871c8e62c42300acb4;p=mailer.git diff --git a/inc/fix_menu.php b/inc/fix_menu.php index 8c11938614..b576f4c842 100644 --- a/inc/fix_menu.php +++ b/inc/fix_menu.php @@ -10,14 +10,9 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Repariert doppelte Eintraege in filters-Tabelle * * -------------------------------------------------------------------- * - * $Revision:: $ * - * $Date:: $ * - * $Tag:: 0.2.1-FINAL $ * - * $Author:: $ * - * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2013 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 * @@ -43,14 +38,14 @@ 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 = sqlQueryEscaped("SELECT `action`, `what` FROM `{?_MYSQL_PREFIX?}_%s_menu` ORDER BY `action` ASC,`what` ASC", array($menu), __FILE__, __LINE__); // Init array $menus = array(); // Load all entries - while ($entry = SQL_FETCHARRAY($result)) { + while ($entry = sqlFetchArray($result)) { // Is the menu entry set? if (!isset($menus['menu'][$entry['action']][$entry['what']])) { // Not found @@ -59,10 +54,10 @@ foreach (array('guest','member','admin') as $menu) { // Double entry, so get count if (is_null($entry['what'])) { // Main menu - $entries = countSumTotalData($entry['action'], $menu . '_menu', 'action', 'action', true, " AND `what` IS NULL"); + $entries = countSumTotalData($entry['action'], $menu . '_menu', 'action', 'action', TRUE, ' AND `what` IS NULL'); } else { // Sub menu - $entries = countSumTotalData($entry['action'], $menu . '_menu', 'action', 'action', true, sprintf(" AND `what`='%s'", $entry['what'])); + $entries = countSumTotalData($entry['action'], $menu . '_menu', 'action', 'action', TRUE, sprintf(" AND `what`='%s'", $entry['what'])); } //* DEBUG: */ debugOutput('menu='.$menu.',action='.$entry['action'].',what='.$entry['what'].',entries='.$entries); @@ -71,7 +66,7 @@ foreach (array('guest','member','admin') as $menu) { // Remove all except one 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", + sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what` IS NULL LIMIT %s", array( $menu, $entry['action'], @@ -79,7 +74,7 @@ foreach (array('guest','member','admin') as $menu) { ), __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", + sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `what`='%s' LIMIT %s", array( $menu, $entry['action'], @@ -92,18 +87,18 @@ foreach (array('guest','member','admin') as $menu) { } // END - while // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); // Init sqls initSqls(); // 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` DROP INDEX `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` DROP INDEX `what`', $menu)); + addSql(sprintf('ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` ADD UNIQUE INDEX `what` (`what`)', $menu)); // And run all runFilterChain('run_sqls');