From c5a105210d0c3bafc06493a4b4904d70d32f25f9 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 25 Dec 2012 19:36:18 +0100 Subject: [PATCH] Page menu items are now properly parsed See #998 --- .../page/menu/item/PageMenuItem.class.php | 20 ++++++++++++------- .../builder/PageMenuCacheBuilder.class.php | 3 +-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/wcfsetup/install/files/lib/data/page/menu/item/PageMenuItem.class.php b/wcfsetup/install/files/lib/data/page/menu/item/PageMenuItem.class.php index adb7879e23..9a477ad7ec 100644 --- a/wcfsetup/install/files/lib/data/page/menu/item/PageMenuItem.class.php +++ b/wcfsetup/install/files/lib/data/page/menu/item/PageMenuItem.class.php @@ -1,10 +1,10 @@ getAbbreviation($this->packageID); - - $parameters = array(); - if ($abbreviation) { - $parameters['application'] = $abbreviation; + // external link + if ($this->menuItemController === null) { + return WCF::getLanguage()->get($this->menuItemLink); } - return LinkHandler::getInstance()->getLink(null, $parameters, WCF::getLanguage()->get($this->menuItemLink)); + // resolve application and controller + $parts = explode('\\', $this->menuItemController); + $abbreviation = array_shift($parts); + $controller = array_pop($parts); + + // drop controller suffix + $controller = Regex::compile('(Action|Form|Page)$')->replace($controller, ''); + + return LinkHandler::getInstance()->getLink($controller, array('application' => $abbreviation), WCF::getLanguage()->get($this->menuItemLink)); } /** diff --git a/wcfsetup/install/files/lib/system/cache/builder/PageMenuCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/PageMenuCacheBuilder.class.php index 2c1949614b..fe2d8917d2 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/PageMenuCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/PageMenuCacheBuilder.class.php @@ -37,8 +37,7 @@ class PageMenuCacheBuilder implements ICacheBuilder { $conditions->add("menu_item.menuItemID IN (?)", array($itemIDs)); $conditions->add("menu_item.isDisabled = ?", array(0)); - $sql = "SELECT menuItemID, menuItem, parentMenuItem, menuItemLink, - permissions, options, menuPosition, className + $sql = "SELECT * FROM wcf".WCF_N."_page_menu_item menu_item ".$conditions." ORDER BY showOrder ASC"; -- 2.20.1