From 5cf3e8fb22b0308c81367b7533826624a5e1cc6a Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Fri, 30 May 2014 15:09:58 +0200 Subject: [PATCH] Improved ACP search function --- .../acp/MenuItemACPSearchResultProvider.class.php | 2 +- .../acp/OptionACPSearchResultProvider.class.php | 13 ++----------- .../acp/PackageACPSearchResultProvider.class.php | 2 +- ...UserGroupOptionACPSearchResultProvider.class.php | 13 ++----------- 4 files changed, 6 insertions(+), 24 deletions(-) diff --git a/wcfsetup/install/files/lib/system/search/acp/MenuItemACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/MenuItemACPSearchResultProvider.class.php index 9149eead50..a0438ae5a4 100644 --- a/wcfsetup/install/files/lib/system/search/acp/MenuItemACPSearchResultProvider.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/MenuItemACPSearchResultProvider.class.php @@ -23,7 +23,6 @@ class MenuItemACPSearchResultProvider extends AbstractACPSearchResultProvider im // search by language item $conditions = new PreparedStatementConditionBuilder(); $conditions->add("languageID = ?", array(WCF::getLanguage()->languageID)); - $conditions->add("languageItemValue LIKE ?", array($query.'%')); // filter by language item $languageItemsConditions = ''; @@ -34,6 +33,7 @@ class MenuItemACPSearchResultProvider extends AbstractACPSearchResultProvider im $languageItemsParameters[] = $abbreviation; } $conditions->add("(".$languageItemsConditions.")", $languageItemsParameters); + $conditions->add("languageItemValue LIKE ?", array('%'.$query.'%')); $sql = "SELECT languageItem, languageItemValue FROM wcf".WCF_N."_language_item diff --git a/wcfsetup/install/files/lib/system/search/acp/OptionACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/OptionACPSearchResultProvider.class.php index 93ef14f9f4..a8820ae18c 100644 --- a/wcfsetup/install/files/lib/system/search/acp/OptionACPSearchResultProvider.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/OptionACPSearchResultProvider.class.php @@ -29,17 +29,8 @@ class OptionACPSearchResultProvider extends AbstractCategorizedACPSearchResultPr // search by language item $conditions = new PreparedStatementConditionBuilder(); $conditions->add("languageID = ?", array(WCF::getLanguage()->languageID)); - $conditions->add("languageItemValue LIKE ?", array($query.'%')); - - // filter by language item - $languageItemsConditions = ''; - $languageItemsParameters = array(); - foreach (ACPSearchHandler::getInstance()->getAbbreviations('.acp.option.%') as $abbreviation) { - if (!empty($languageItemsConditions)) $languageItemsConditions .= " OR "; - $languageItemsConditions .= "languageItem LIKE ?"; - $languageItemsParameters[] = $abbreviation; - } - $conditions->add("(".$languageItemsConditions.")", $languageItemsParameters); + $conditions->add("languageItem LIKE ?", array('wcf.acp.option.%')); + $conditions->add("languageItemValue LIKE ?", array('%'.$query.'%')); $sql = "SELECT languageItem, languageItemValue FROM wcf".WCF_N."_language_item diff --git a/wcfsetup/install/files/lib/system/search/acp/PackageACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/PackageACPSearchResultProvider.class.php index b063169df9..6a9f8b54bc 100644 --- a/wcfsetup/install/files/lib/system/search/acp/PackageACPSearchResultProvider.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/PackageACPSearchResultProvider.class.php @@ -29,7 +29,7 @@ class PackageACPSearchResultProvider implements IACPSearchResultProvider { $conditions = new PreparedStatementConditionBuilder(); $conditions->add("languageID = ?", array(WCF::getLanguage()->languageID)); $conditions->add("languageItem LIKE ?", array('wcf.acp.package.packageName.package%')); - $conditions->add("languageItemValue LIKE ?", array($query.'%')); + $conditions->add("languageItemValue LIKE ?", array('%'.$query.'%')); $sql = "SELECT languageItem FROM wcf".WCF_N."_language_item diff --git a/wcfsetup/install/files/lib/system/search/acp/UserGroupOptionACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/UserGroupOptionACPSearchResultProvider.class.php index 78833c099b..59ead1c296 100644 --- a/wcfsetup/install/files/lib/system/search/acp/UserGroupOptionACPSearchResultProvider.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/UserGroupOptionACPSearchResultProvider.class.php @@ -29,17 +29,8 @@ class UserGroupOptionACPSearchResultProvider extends AbstractCategorizedACPSearc // search by language item $conditions = new PreparedStatementConditionBuilder(); $conditions->add("languageID = ?", array(WCF::getLanguage()->languageID)); - $conditions->add("languageItemValue LIKE ?", array($query.'%')); - - // filter by language item - $languageItemsConditions = ''; - $languageItemsParameters = array(); - foreach (ACPSearchHandler::getInstance()->getAbbreviations('.acp.group.option.%') as $abbreviation) { - if (!empty($languageItemsConditions)) $languageItemsConditions .= " OR "; - $languageItemsConditions .= "languageItem LIKE ?"; - $languageItemsParameters[] = $abbreviation; - } - $conditions->add("(".$languageItemsConditions.")", $languageItemsParameters); + $conditions->add("languageItem LIKE ?", array('wcf.acp.group.option.%')); + $conditions->add("languageItemValue LIKE ?", array('%'.$query.'%')); $sql = "SELECT languageItem, languageItemValue FROM wcf".WCF_N."_language_item -- 2.20.1