aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/search.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/search.php')
-rw-r--r--phpBB/search.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/phpBB/search.php b/phpBB/search.php
index 4bb233872a..3475f33bb6 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -658,7 +658,15 @@ if ($keywords || $author || $search_id || $submit)
if ($hilit)
{
- $row['post_text'] = preg_replace('#(?!<.*)(?<!\w)(' . preg_quote($hilit, '#') . ')(?!\w|[^<>]*>)#i', '<span class="posthilit">$1</span>', $row['post_text']);
+ // Remove bad highlights
+ $hilit_array = array_filter(explode('|', $hilit), 'strlen');
+ foreach ($hilit_array as $key => $value)
+ {
+ $hilit_array[$key] = preg_quote($value, '#');
+ }
+ $hilit = implode('|', $hilit_array);
+
+ $row['post_text'] = preg_replace('#(?!<.*)(?<!\w)(' . $hilit . ')(?!\w|[^<>]*>)#i', '<span class="posthilit">$1</span>', $row['post_text']);
}
$row['post_text'] = smiley_text($row['post_text']);