aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-05-25 15:54:20 +0200
committerGitHub <noreply@github.com>2017-05-25 15:54:20 +0200
commit3e395a6bc63cba16b0772a382f6cbac0ce4ab906 (patch)
tree220eaf3400aeeea821b7e150855a1d44f1b5bfe9 /index.php
parentb2e2aa42e288e0becaa95bf9cc3be679743fc98e (diff)
parent7d86f40bdb2135655b5b4fe8cbcc1ac102114f86 (diff)
downloadShaarli-3e395a6bc63cba16b0772a382f6cbac0ce4ab906.tar.gz
Shaarli-3e395a6bc63cba16b0772a382f6cbac0ce4ab906.tar.zst
Shaarli-3e395a6bc63cba16b0772a382f6cbac0ce4ab906.zip
Merge pull request #841 from ArthurHoaro/feature/search-no-tag
Empty tag search will look for not tagged links
Diffstat (limited to 'index.php')
-rw-r--r--index.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/index.php b/index.php
index 61b71129..92eb443b 100644
--- a/index.php
+++ b/index.php
@@ -1622,7 +1622,15 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history)
1622function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager) 1622function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager)
1623{ 1623{
1624 // Used in templates 1624 // Used in templates
1625 $searchtags = !empty($_GET['searchtags']) ? escape(normalize_spaces($_GET['searchtags'])) : ''; 1625 if (isset($_GET['searchtags'])) {
1626 if (! empty($_GET['searchtags'])) {
1627 $searchtags = escape(normalize_spaces($_GET['searchtags']));
1628 } else {
1629 $searchtags = false;
1630 }
1631 } else {
1632 $searchtags = '';
1633 }
1626 $searchterm = !empty($_GET['searchterm']) ? escape(normalize_spaces($_GET['searchterm'])) : ''; 1634 $searchterm = !empty($_GET['searchterm']) ? escape(normalize_spaces($_GET['searchterm'])) : '';
1627 1635
1628 // Smallhash filter 1636 // Smallhash filter
@@ -1637,7 +1645,11 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager)
1637 } else { 1645 } else {
1638 // Filter links according search parameters. 1646 // Filter links according search parameters.
1639 $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all'; 1647 $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all';
1640 $linksToDisplay = $LINKSDB->filterSearch($_GET, false, $visibility); 1648 $request = [
1649 'searchtags' => $searchtags,
1650 'searchterm' => $searchterm,
1651 ];
1652 $linksToDisplay = $LINKSDB->filterSearch($request, false, $visibility);
1641 } 1653 }
1642 1654
1643 // ---- Handle paging. 1655 // ---- Handle paging.
@@ -1684,7 +1696,7 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager)
1684 } 1696 }
1685 1697
1686 // Compute paging navigation 1698 // Compute paging navigation
1687 $searchtagsUrl = empty($searchtags) ? '' : '&searchtags=' . urlencode($searchtags); 1699 $searchtagsUrl = $searchtags === '' ? '' : '&searchtags=' . urlencode($searchtags);
1688 $searchtermUrl = empty($searchterm) ? '' : '&searchterm=' . urlencode($searchterm); 1700 $searchtermUrl = empty($searchterm) ? '' : '&searchterm=' . urlencode($searchterm);
1689 $previous_page_url = ''; 1701 $previous_page_url = '';
1690 if ($i != count($keys)) { 1702 if ($i != count($keys)) {