From b3051a6aae446e063c3b6fa4a6a600357a9f24af Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 20 Dec 2016 11:06:22 +0100 Subject: Fixes presence of empty tags for private tags and in search results * Private tags: make sure empty tags are properly filtered * Search results: * Use preg_split instead of function combination * Add normalize_spaces to remove extra whitespaces displaying empty tags search --- index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index dd9b48bd..427eb239 100644 --- a/index.php +++ b/index.php @@ -1601,8 +1601,8 @@ function renderPage($conf, $pluginManager, $LINKSDB) function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager) { // Used in templates - $searchtags = !empty($_GET['searchtags']) ? escape($_GET['searchtags']) : ''; - $searchterm = !empty($_GET['searchterm']) ? escape($_GET['searchterm']) : ''; + $searchtags = !empty($_GET['searchtags']) ? escape(normalize_spaces($_GET['searchtags'])) : ''; + $searchterm = !empty($_GET['searchterm']) ? escape(normalize_spaces($_GET['searchterm'])) : ''; // Smallhash filter if (! empty($_SERVER['QUERY_STRING']) @@ -1649,7 +1649,7 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager) } else { $link['updated_timestamp'] = ''; } - $taglist = explode(' ', $link['tags']); + $taglist = preg_split('/\s+/', $link['tags'], -1, PREG_SPLIT_NO_EMPTY); uasort($taglist, 'strcasecmp'); $link['taglist'] = $taglist; // Check for both signs of a note: starting with ? and 7 chars long. -- cgit v1.2.3