summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Eames <grahamje@users.sourceforge.net>2006-04-21 19:07:47 +0000
committerGraham Eames <grahamje@users.sourceforge.net>2006-04-21 19:07:47 +0000
commitaac27e92134e991eb320ce6bd08ba1b77f9ce86d (patch)
tree3603f312140e1869c13e019ee6b219b2e6fb3a93
parentSome initial prep and listing what's changed so far. (diff)
downloadphpbb-aac27e92134e991eb320ce6bd08ba1b77f9ce86d.tar.gz
phpbb-aac27e92134e991eb320ce6bd08ba1b77f9ce86d.tar.bz2
phpbb-aac27e92134e991eb320ce6bd08ba1b77f9ce86d.zip
Backport of David's more efficient code for highlighting
Report any issues where this changes the behaviour of the highlight to the bug tracker git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@5812 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/docs/CHANGELOG.html1
-rw-r--r--phpBB/viewtopic.php5
2 files changed, 3 insertions, 3 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 2df55d067b..3ab9e9802b 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -72,6 +72,7 @@ p,ul,td {font-size:10pt;}
<li>[Fix] Changes to random number generator code to explicitly truncate the length of the string</li>
<li>[Fix] Quoting on boards with HTML enabled</li>
<li>[Fix] Redirect to list if cancelling deletion of ranks, smilies or word censors</li>
+<li>[Change] Backported more efficient highlighting code from Olympus</li>
</ul>
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 344a475478..ee564418ec 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1103,9 +1103,8 @@ for($i = 0; $i < $total_posts; $i++)
//
if ($highlight_match)
{
- // This was shamelessly 'borrowed' from volker at multiartstudio dot de
- // via php.net's annotated manual
- $message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace('#\b(" . str_replace('\\', '\\\\', addslashes($highlight_match)) . ")\b#i', '<span style=\"color:#" . $theme['fontcolor3'] . "\"><b>\\\\1</b></span>', '\\0')", '>' . $message . '<'), 1, -1));
+ // This has been back-ported from 3.0 CVS
+ $message = preg_replace('#(?!<.*)(?<!\w)(' . $highlight_match . ')(?!\w|[^<>]*>)#i', '<b style="color:#'.$theme['fontcolor3'].'">\1</b>', $message);
}
//