aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/search.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-04-15 23:23:44 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-04-15 23:23:44 +0200
commitd1f96aa03601536c6e191328183ac2dd0068aed7 (patch)
treee0a45c989dbd165a364e24874f6402979a0f47e1 /phpBB/search.php
parentc63b5275d858a3ec11674d20d1d2479e5c7477b5 (diff)
parent675cef9c2e9ea571606415fb3228b5f2c73769d9 (diff)
downloadforums-d1f96aa03601536c6e191328183ac2dd0068aed7.tar
forums-d1f96aa03601536c6e191328183ac2dd0068aed7.tar.gz
forums-d1f96aa03601536c6e191328183ac2dd0068aed7.tar.bz2
forums-d1f96aa03601536c6e191328183ac2dd0068aed7.tar.xz
forums-d1f96aa03601536c6e191328183ac2dd0068aed7.zip
Merge branch 'develop-olympus' into develop-ascraeus
* develop-olympus: [ticket/10423] Replace foreach with function in viewtopic.php [ticket/10423] Remove unnecessary include in test [ticket/10423] Match multiple wildcards [ticket/10423] Move code into a function and add tests for it [ticket/10423] Remove * from search or highlight string
Diffstat (limited to 'phpBB/search.php')
-rw-r--r--phpBB/search.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/phpBB/search.php b/phpBB/search.php
index 4756a941f5..44335e2927 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -561,9 +561,9 @@ if ($keywords || $author || $author_id || $search_id || $submit)
}
// define some vars for urls
- $hilit = implode('|', explode(' ', preg_replace('#\s+#u', ' ', str_replace(array('+', '-', '|', '(', ')', '&quot;'), ' ', $keywords))));
- // Do not allow *only* wildcard being used for hilight
- $hilit = (strspn($hilit, '*') === strlen($hilit)) ? '' : $hilit;
+ // A single wildcard will make the search results look ugly
+ $hilit = phpbb_clean_search_string(str_replace(array('+', '-', '|', '(', ')', '&quot;'), ' ', $keywords));
+ $hilit = str_replace(' ', '|', $hilit);
$u_hilit = urlencode(htmlspecialchars_decode(str_replace('|', ' ', $hilit)));
$u_show_results = '&amp;sr=' . $show_results;
@@ -850,7 +850,8 @@ if ($keywords || $author || $author_id || $search_id || $submit)
$hilit_array = array_filter(explode('|', $hilit), 'strlen');
foreach ($hilit_array as $key => $value)
{
- $hilit_array[$key] = str_replace('\*', '\w*?', preg_quote($value, '#'));
+ $hilit_array[$key] = phpbb_clean_search_string($value);
+ $hilit_array[$key] = str_replace('\*', '\w*?', preg_quote($hilit_array[$key], '#'));
$hilit_array[$key] = preg_replace('#(^|\s)\\\\w\*\?(\s|$)#', '$1\w+?$2', $hilit_array[$key]);
}
$hilit = implode('|', $hilit_array);