diff options
Diffstat (limited to 'application/LinkDB.php')
-rw-r--r-- | application/LinkDB.php | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/application/LinkDB.php b/application/LinkDB.php index 7802cc8a..8ca0fab3 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php | |||
@@ -423,29 +423,12 @@ You use the community supported version of the original Shaarli project, by Seba | |||
423 | public function filterSearch($filterRequest = array(), $casesensitive = false, $visibility = 'all') | 423 | public function filterSearch($filterRequest = array(), $casesensitive = false, $visibility = 'all') |
424 | { | 424 | { |
425 | // Filter link database according to parameters. | 425 | // Filter link database according to parameters. |
426 | $searchtags = !empty($filterRequest['searchtags']) ? escape($filterRequest['searchtags']) : ''; | 426 | $searchtags = isset($filterRequest['searchtags']) ? escape($filterRequest['searchtags']) : ''; |
427 | $searchterm = !empty($filterRequest['searchterm']) ? escape($filterRequest['searchterm']) : ''; | 427 | $searchterm = isset($filterRequest['searchterm']) ? escape($filterRequest['searchterm']) : ''; |
428 | 428 | ||
429 | // Search tags + fullsearch. | 429 | // Search tags + fullsearch - blank string parameter will return all links. |
430 | if (! empty($searchtags) && ! empty($searchterm)) { | 430 | $type = LinkFilter::$FILTER_TAG | LinkFilter::$FILTER_TEXT; |
431 | $type = LinkFilter::$FILTER_TAG | LinkFilter::$FILTER_TEXT; | 431 | $request = [$searchtags, $searchterm]; |
432 | $request = array($searchtags, $searchterm); | ||
433 | } | ||
434 | // Search by tags. | ||
435 | elseif (! empty($searchtags)) { | ||
436 | $type = LinkFilter::$FILTER_TAG; | ||
437 | $request = $searchtags; | ||
438 | } | ||
439 | // Fulltext search. | ||
440 | elseif (! empty($searchterm)) { | ||
441 | $type = LinkFilter::$FILTER_TEXT; | ||
442 | $request = $searchterm; | ||
443 | } | ||
444 | // Otherwise, display without filtering. | ||
445 | else { | ||
446 | $type = ''; | ||
447 | $request = ''; | ||
448 | } | ||
449 | 432 | ||
450 | $linkFilter = new LinkFilter($this); | 433 | $linkFilter = new LinkFilter($this); |
451 | return $linkFilter->filter($type, $request, $casesensitive, $visibility); | 434 | return $linkFilter->filter($type, $request, $casesensitive, $visibility); |