|
From: Jonathan H. <the...@us...> - 2002-01-08 15:51:47
|
Update of /cvsroot/phpbb/phpBB2/includes
In directory usw-pr-cvs1:/tmp/cvs-serv31695
Modified Files:
bbcode.php
Log Message:
Fix for bug #496944 "quotes with usernames containing "]"
Index: bbcode.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/includes/bbcode.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** bbcode.php 2001/12/11 09:13:04 1.19
--- bbcode.php 2002/01/08 15:51:43 1.20
***************
*** 168,172 ****
$text = str_replace("[/quote:$uid]", $bbcode_tpl['quote_close'], $text);
! $text = preg_replace("/\[quote:$uid=\"?(.*?)\"?\]/si", $bbcode_tpl['quote_username_open'], $text);
// [b] and [/b] for bolding text.
--- 168,175 ----
$text = str_replace("[/quote:$uid]", $bbcode_tpl['quote_close'], $text);
! // Do this line first to catch "quoted" usernames
! $text = preg_replace("/\[quote:$uid=\"(.*?)\"\]/si", $bbcode_tpl['quote_username_open'], $text);
! // Then do this line to catch the old style unquoted usernames..
! $text = preg_replace("/\[quote:$uid=(.*?)\]/si", $bbcode_tpl['quote_username_open'], $text);
// [b] and [/b] for bolding text.
***************
*** 382,386 ****
--- 385,402 ----
$possible_start = substr($text, $curr_pos, strpos($text, "]", $curr_pos + 1) - $curr_pos + 1);
+ //
+ // We're going to try and catch usernames with "[' characters.
+ //
+ if( preg_match('/\[quote\=\\\\"/si', $possible_start) && !preg_match('/\[quote=\\\\"[^"]*\\\\"\]/si', $possible_start) )
+ {
+ //
+ // OK we are in a quote tag that probably contains a ] bracket.
+ // Grab a bit more of the string to hopefully get all of it..
+ //
+ $possible_start = substr($text, $curr_pos, strpos($text, "\"]", $curr_pos + 1) - $curr_pos + 2);
+ }
+ //
// Now compare, either using regexp or not.
+
if ($open_is_regexp)
{
|