diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-02-08 20:50:18 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-02-08 20:50:18 +0000 |
commit | 39a8a832ca7bef7c97824b46c0d98479328ce770 (patch) | |
tree | dfb22bb10db7f056fcd828740573ff45b0a96839 | |
parent | 543caeaa4e4529a1ee8a0ae580f8c50e1490bb22 (diff) | |
download | forums-39a8a832ca7bef7c97824b46c0d98479328ce770.tar forums-39a8a832ca7bef7c97824b46c0d98479328ce770.tar.gz forums-39a8a832ca7bef7c97824b46c0d98479328ce770.tar.bz2 forums-39a8a832ca7bef7c97824b46c0d98479328ce770.tar.xz forums-39a8a832ca7bef7c97824b46c0d98479328ce770.zip |
Okay, let's give this highlighting preg_ a shot ...
git-svn-id: file:///svn/phpbb/trunk@2066 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r-- | phpBB/viewtopic.php | 21 |
1 files changed, 10 insertions, 11 deletions
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[] = '<span style="color:#' . $theme['fontcolor3'] . '"><b>\\1</b></span>'; + $highlight_match[] = "#\b(" . str_replace("\*", ".*?", $words[$i]) . ")(?!(.*?".">.*?<)|(.*?\">))\b#i"; + $highlight_replace[] = '<span style="color:#' . $theme['fontcolor3'] . '"><b>\1</b></span>'; } } @@ -999,15 +999,6 @@ for($i = 0; $i < $total_posts; $i++) // // - // 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 // @@ -1047,6 +1038,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 // if( count($orig_word) ) |