From 8e297a038c6dfed7ca892d8799cfbdb010cc0911 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 27 Nov 2006 18:00:41 +0000 Subject: [PATCH] hopefully fixed bug #5644 while also retaining the fix for bug #3572 testing this is appreciated. git-svn-id: file:///svn/phpbb/trunk@6673 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/message_parser.php | 39 +++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index f0982ca12b..c2c700e1c5 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -664,14 +664,7 @@ class bbcode_firstpass extends bbcode else { $end_tag = array_pop($end_tags); - if ($end_tag != $tag) - { - $error = true; - } - else - { - $error = false; - } + $error = ($end_tag != $tag) ? true : false; } } @@ -704,9 +697,35 @@ class bbcode_firstpass extends bbcode } else { +/** +* Old quote code working fine, but having errors listed in bug #3572 +* +* $out .= $buffer . $tok; +* $tok = ($tok == '[') ? ']' : '[]'; +* $buffer = ''; +*/ + $out .= $buffer . $tok; - // $tok = ($tok == '[') ? ']' : '[]'; - $tok = '[]'; + + if ($tok == '[') + { + // Search the text for the next tok... if an ending quote comes first, then change tok to [] + $pos1 = strpos($in, '[/quote'); + $pos2 = strpos($in, ']'); + + if ($pos1 !== false && ($pos2 === false || $pos1 < $pos2)) + { + $tok = '[]'; + } + else + { + $tok = ']'; + } + } + else + { + $tok = '[]'; + } $buffer = ''; } }