1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-08 08:35:31 +02:00

Okay, let's give this highlighting preg_ a shot ...

git-svn-id: file:///svn/phpbb/trunk@2066 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-02-08 20:50:18 +00:00
parent 543caeaa4e
commit 39a8a832ca

View File

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