aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewtopic.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/viewtopic.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/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 1a74ad3e38..7fe4dac0bd 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -422,17 +422,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