aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid M <davidmj@users.sourceforge.net>2005-12-27 13:59:15 +0000
committerDavid M <davidmj@users.sourceforge.net>2005-12-27 13:59:15 +0000
commit5bf738d345ff5f874e7d302d95663ffed56751e2 (patch)
treee130da2b58bc998ce6179d4ec9e4143de7e4ccc8
parenteb45360c02fabbb743a1a977c5fa94555469e547 (diff)
downloadforums-5bf738d345ff5f874e7d302d95663ffed56751e2.tar
forums-5bf738d345ff5f874e7d302d95663ffed56751e2.tar.gz
forums-5bf738d345ff5f874e7d302d95663ffed56751e2.tar.bz2
forums-5bf738d345ff5f874e7d302d95663ffed56751e2.tar.xz
forums-5bf738d345ff5f874e7d302d95663ffed56751e2.zip
- Replaced the old 2.0.x highlight code with much nicer code :-)
git-svn-id: file:///svn/phpbb/trunk@5381 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/search.php4
-rw-r--r--phpBB/viewtopic.php4
2 files changed, 2 insertions, 6 deletions
diff --git a/phpBB/search.php b/phpBB/search.php
index 0e5437b27c..e2c68409c3 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -528,9 +528,7 @@ if ($keywords || $author || $search_id || $search_session_id)
if ($hilit)
{
- // This was shamelessly 'borrowed' from volker at multiartstudio dot de
- // via php.net's annotated manual
- $row['post_text'] = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace('#\b(" . str_replace('\\', '\\\\', $hilit) . ")\b#i', '<span class=\"posthilit\">\\\\1</span>', '\\0')", '>' . $row['post_text'] . '<'), 1, -1));
+ $row['post_text'] = preg_replace('#(?!<.*)(?<!\w)(' . $hilit . ')(?!\w|[^<>]*>)#i', '<span class="posthilit">\1</span>', $row['post_text']);
}
$row['post_text'] = smiley_text($row['post_text']);
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 52c2c2c128..b9bd6810ab 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1171,9 +1171,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
// Highlight active words (primarily for search)
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 class=\"posthilit\">\\\\1</span>', '\\0')", '>' . $message . '<'), 1, -1));
+ $message = preg_replace('#(?!<.*)(?<!\w)(' . $highlight_match . ')(?!\w|[^<>]*>)#i', '<span class="posthilit">\1</span>', $message);
}
if ($row['enable_html'] && $auth->acl_get('f_html', $forum_id))