* show terms in quicksearch-box, when performing searches
 * use trim() after urldecode() to catch urlencoded whitespaces
 * check for empty search terms (wich occur with multiple adjacent whitespaces)
This commit is contained in:
Sarjuuk
2014-09-17 20:40:11 +02:00
parent 35ba86d191
commit 712c063cda
2 changed files with 6 additions and 5 deletions

View File

@@ -56,7 +56,7 @@ class SearchPage extends GenericPage
public function __construct($pageCall, $pageParam)
{
$this->search = urlDecode(trim($pageParam));
$this->search = trim(urlDecode($pageParam));
$this->query = strtr($this->search, '?*', '_%');
// restricted access
@@ -117,10 +117,11 @@ class SearchPage extends GenericPage
if (!$this->query)
return;
$parts = explode(' ', $this->query);
foreach ($parts as $p)
foreach (explode(' ', $this->query) as $p)
{
if ($p[0] == '-')
if (!$p) // multiple spaces
continue;
else if ($p[0] == '-')
{
if (strlen($p) < 4)
$this->invalid[] = substr($p, 1);

View File

@@ -18,7 +18,7 @@
<div class="toplinks linklist"><?php $this->brick('headerMenu'); ?></div>
<div class="toptabs" id="toptabs"></div>
<div class="topbar" id="topbar">
<div class="topbar-search"><form action="."><a href="javascript:;"></a><input name="search" size="35" value="" id="livesearch-generic" /></form></div>
<div class="topbar-search"><form action="."><a href="javascript:;"></a><input name="search" size="35" id="livesearch-generic" value="<?php echo isset($this->search) ? $this->search : ''; ?>" /></form></div>
<div class="topbar-browse" id="topbar-browse"></div>
<div class="topbar-buttons" id="topbar-buttons"></div>
</div>