From: ArthurHoaro Date: Sun, 3 Jan 2016 14:29:15 +0000 (+0100) Subject: Fixes #426 - Do not filter with blank tags. X-Git-Tag: v0.6.3~13^2~1 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=2c75f8e780e674ddb42c935b54ed6c39925ba07c;hp=822bffced8212e7f34bcb2ad063b31a78bd57bdb;p=github%2Fshaarli%2FShaarli.git Fixes #426 - Do not filter with blank tags. --- diff --git a/application/LinkDB.php b/application/LinkDB.php index be7d9016..16848519 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php @@ -351,7 +351,7 @@ You use the community supported version of the original Shaarli project, by Seba */ public function filter($type, $request, $casesensitive = false, $privateonly = false) { $requestFilter = is_array($request) ? implode(' ', $request) : $request; - return $this->linkFilter->filter($type, $requestFilter, $casesensitive, $privateonly); + return $this->linkFilter->filter($type, trim($requestFilter), $casesensitive, $privateonly); } /** diff --git a/index.php b/index.php index 1664c01b..2815f02e 100644 --- a/index.php +++ b/index.php @@ -1298,12 +1298,14 @@ function renderPage() if (isset($params['searchtags'])) { $tags = explode(' ', $params['searchtags']); - $tags=array_diff($tags, array($_GET['removetag'])); // Remove value from array $tags. - if (count($tags)==0) { + // Remove value from array $tags. + $tags = array_diff($tags, array($_GET['removetag'])); + $params['searchtags'] = implode(' ',$tags); + + if (empty($params['searchtags'])) { unset($params['searchtags']); - } else { - $params['searchtags'] = implode(' ',$tags); } + unset($params['page']); // We also remove page (keeping the same page has no sense, since the results are different) } header('Location: ?'.http_build_query($params));