From aac27e92134e991eb320ce6bd08ba1b77f9ce86d Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Fri, 21 Apr 2006 19:07:47 +0000 Subject: [PATCH] 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 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/viewtopic.php | 5 ++--- 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;}
  • [Fix] Changes to random number generator code to explicitly truncate the length of the string
  • [Fix] Quoting on boards with HTML enabled
  • [Fix] Redirect to list if cancelling deletion of ranks, smilies or word censors
  • +
  • [Change] Backported more efficient highlighting code from Olympus
  • 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', '\\\\1', '\\0')", '>' . $message . '<'), 1, -1)); + // This has been back-ported from 3.0 CVS + $message = preg_replace('#(?!<.*)(?]*>)#i', '\1', $message); } //