From: Matthias Schmidt Date: Sat, 5 Jan 2019 09:32:08 +0000 (+0100) Subject: Fix tag search if no tag is entered X-Git-Tag: 5.2.0_Alpha_1~376 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=89b0b8fb22e2b347dfba600e1010338a53111f8d;p=GitHub%2FWoltLab%2FWCF.git Fix tag search if no tag is entered See #2689 --- diff --git a/com.woltlab.wcf/templates/tagSearch.tpl b/com.woltlab.wcf/templates/tagSearch.tpl index b824483ca2..39833b9438 100644 --- a/com.woltlab.wcf/templates/tagSearch.tpl +++ b/com.woltlab.wcf/templates/tagSearch.tpl @@ -25,6 +25,15 @@
+ {if $errorField === 'tags'} + + {if $errorType == 'empty'} + {lang}wcf.global.form.error.empty{/lang} + {else} + {lang}wcf.tagging.tags.error.{$errorType}{/lang} + {/if} + + {/if} {lang}wcf.tagging.tags.description{/lang}
diff --git a/wcfsetup/install/files/lib/form/TagSearchForm.class.php b/wcfsetup/install/files/lib/form/TagSearchForm.class.php index 8595798e03..acc7d6b18b 100644 --- a/wcfsetup/install/files/lib/form/TagSearchForm.class.php +++ b/wcfsetup/install/files/lib/form/TagSearchForm.class.php @@ -82,8 +82,13 @@ class TagSearchForm extends AbstractCaptchaForm { } } - $this->tags = TagEngine::getInstance()->getTagsByName($this->tagNames, $this->languageID); - if (empty($this->tags)) { + if (!empty($this->tagNames)) { + $this->tags = TagEngine::getInstance()->getTagsByName($this->tagNames, $this->languageID); + if (empty($this->tags)) { + throw new UserInputException('tags'); + } + } + else { throw new UserInputException('tags'); } }