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 4cee2af9..a03c2c06 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php | |||
@@ -450,29 +450,12 @@ You use the community supported version of the original Shaarli project, by Seba | |||
450 | public function filterSearch($filterRequest = array(), $casesensitive = false, $visibility = 'all') | 450 | public function filterSearch($filterRequest = array(), $casesensitive = false, $visibility = 'all') |
451 | { | 451 | { |
452 | // Filter link database according to parameters. | 452 | // Filter link database according to parameters. |
453 | $searchtags = !empty($filterRequest['searchtags']) ? escape($filterRequest['searchtags']) : ''; | 453 | $searchtags = isset($filterRequest['searchtags']) ? escape($filterRequest['searchtags']) : ''; |
454 | $searchterm = !empty($filterRequest['searchterm']) ? escape($filterRequest['searchterm']) : ''; | 454 | $searchterm = isset($filterRequest['searchterm']) ? escape($filterRequest['searchterm']) : ''; |
455 | 455 | ||
456 | // Search tags + fullsearch. | 456 | // Search tags + fullsearch - blank string parameter will return all links. |
457 | if (! empty($searchtags) && ! empty($searchterm)) { | 457 | $type = LinkFilter::$FILTER_TAG | LinkFilter::$FILTER_TEXT; |
458 | $type = LinkFilter::$FILTER_TAG | LinkFilter::$FILTER_TEXT; | 458 | $request = [$searchtags, $searchterm]; |
459 | $request = array($searchtags, $searchterm); | ||
460 | } | ||
461 | // Search by tags. | ||
462 | elseif (! empty($searchtags)) { | ||
463 | $type = LinkFilter::$FILTER_TAG; | ||
464 | $request = $searchtags; | ||
465 | } | ||
466 | // Fulltext search. | ||
467 | elseif (! empty($searchterm)) { | ||
468 | $type = LinkFilter::$FILTER_TEXT; | ||
469 | $request = $searchterm; | ||
470 | } | ||
471 | // Otherwise, display without filtering. | ||
472 | else { | ||
473 | $type = ''; | ||
474 | $request = ''; | ||
475 | } | ||
476 | 459 | ||
477 | $linkFilter = new LinkFilter($this); | 460 | $linkFilter = new LinkFilter($this); |
478 | return $linkFilter->filter($type, $request, $casesensitive, $visibility); | 461 | return $linkFilter->filter($type, $request, $casesensitive, $visibility); |