aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewtopic.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-04-15 23:23:26 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-04-15 23:23:26 +0200
commit675cef9c2e9ea571606415fb3228b5f2c73769d9 (patch)
tree4e47ae4209af12763265d69fddf90ad8b93ed021 /phpBB/viewtopic.php
parente64c2326bdf36ac071f07881d4ca5aba202e6249 (diff)
parentf3cd7f73e1ed3acbf1a319331e2f99ea27d5fe2d (diff)
downloadforums-675cef9c2e9ea571606415fb3228b5f2c73769d9.tar
forums-675cef9c2e9ea571606415fb3228b5f2c73769d9.tar.gz
forums-675cef9c2e9ea571606415fb3228b5f2c73769d9.tar.bz2
forums-675cef9c2e9ea571606415fb3228b5f2c73769d9.tar.xz
forums-675cef9c2e9ea571606415fb3228b5f2c73769d9.zip
Merge pull request #2195 from Elsensee/ticket/10423
[ticket/10423] Remove * from search or highlight string * Elsensee/ticket/10423: [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/viewtopic.php')
-rw-r--r--phpBB/viewtopic.php16
1 files changed, 5 insertions, 11 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index e08d6e1ef5..f52e04e1a8 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -471,17 +471,11 @@ else
$highlight_match = $highlight = '';
if ($hilit_words)
{
- foreach (explode(' ', trim($hilit_words)) as $word)
- {
- if (trim($word))
- {
- $word = str_replace('\*', '\w+?', preg_quote($word, '#'));
- $word = preg_replace('#(^|\s)\\\\w\*\?(\s|$)#', '$1\w+?$2', $word);
- $highlight_match .= (($highlight_match != '') ? '|' : '') . $word;
- }
- }
-
- $highlight = urlencode($hilit_words);
+ $highlight_match = phpbb_clean_search_string($hilit_words);
+ $highlight = urlencode($highlight_match);
+ $highlight_match = str_replace('\*', '\w+?', preg_quote($highlight_match, '#'));
+ $highlight_match = preg_replace('#(?<=^|\s)\\\\w\*\?(?=\s|$)#', '\w+?', $highlight_match);
+ $highlight_match = str_replace(' ', '|', $highlight_match);
}
// Make sure $start is set to the last page if it exceeds the amount