]> git.mxchange.org Git - mailer.git/blobdiff - inc/fix_menu.php
MINOR: Small code improvements
[mailer.git] / inc / fix_menu.php
index 1fb3d21da5556be767ecd2a2966a4f7f15ce687f..62515a9601d59ffc30c07a971e2d54fcd65c65de 100644 (file)
  * $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                    *
- * 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 *
@@ -45,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
@@ -61,12 +59,12 @@ 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: */ print 'menu='.$menu.',action='.$entry['action'].',what='.$entry['what'].',entries='.$entries.'<br />';
+                       //* 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) {
@@ -100,12 +98,12 @@ foreach (array('guest','member','admin') as $menu) {
        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');