From 3aee1ad40b8688bf9d92d3b56aaed5a982870aad Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Wed, 18 Jan 2006 21:25:38 +0000 Subject: [PATCH] Some further changes to HTML Previous comments still stand git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@5473 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_post.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_post.php b/phpBB/includes/functions_post.php index 1075b7f569..82ff42c64c 100644 --- a/phpBB/includes/functions_post.php +++ b/phpBB/includes/functions_post.php @@ -57,7 +57,9 @@ function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid { $tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $end_html + 1, ($start_html - $end_html - 1))); - $element = addslashes(preg_replace('#^((?:"[^"]*"|\'[^\']*\'|`[^`]*`|[^>`\'"])+>).*#', '\1', stripslashes(substr($message, $start_html + 1, strlen($message) - $start_html)))); + $matches = array(); + preg_match('#^(/?\w+(?:\s+\w+=(?:\w+|"[^"]*"|\'[^\']*\'|`[^`]*`))*\s*?/?>)#', stripslashes(substr($message, $start_html + 1, strlen($message) - $start_html)), $matches); + $element = addslashes($matches[1]); $end_html = $start_html + strlen($element); if ($end_html != $start_html) @@ -65,7 +67,9 @@ function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid $length = $end_html - $start_html + 1; $hold_string = substr($message, $start_html, $length); - $short_hold_string = preg_replace('#.*(<(?:"[^"]*"|\'[^\']*\'|`[^`]*`|[^<>`\'"])+>)$#', '\1', $hold_string); + $matches = array(); + preg_match('#()$#', stripslashes($hold_string), $matches); + $short_hold_string = addslashes($matches[1]); if (strlen($short_hold_string) < $length) {