diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 5c117953dd..6aa6914265 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -458,8 +458,8 @@ if( isset($HTTP_GET_VARS['highlight']) ) { if( trim($words[$i]) != "" ) { - $highlight_match[] = "#\b(" . str_replace("\*", ".*?", phpbb_preg_quote($words[$i], "#")) . ")(?!.*?<\/a>)(?!.*?\[/url\])(?!.*?<\/span>)\b#i"; - $highlight_replace[] = '\\1'; + $highlight_match[] = "#\b(" . str_replace("\*", ".*?", $words[$i]) . ")(?!(.*?".">.*?<)|(.*?\">))\b#i"; + $highlight_replace[] = '\1'; } } @@ -998,15 +998,6 @@ for($i = 0; $i < $total_posts; $i++) // output // - // - // Highlight active words (primarily for search) - // - if( $highlight_active ) - { - $message = preg_replace($highlight_match, $highlight_replace, $message); - } - - // // If the board has HTML off but the post has HTML // on then we process it, else leave it alone @@ -1046,6 +1037,14 @@ for($i = 0; $i < $total_posts; $i++) } $message = make_clickable($message); + // + // Highlight active words (primarily for search) + // + if( $highlight_active ) + { + $message = preg_replace($highlight_match, $highlight_replace, $message); + } + // // Replace naughty words //