diff options
author | the_systech <the_systech@users.sourceforge.net> | 2002-01-08 15:51:43 +0000 |
---|---|---|
committer | the_systech <the_systech@users.sourceforge.net> | 2002-01-08 15:51:43 +0000 |
commit | 004b0c9ad443ff956b03f8c1ae071b20ef82f83d (patch) | |
tree | 3683149c14f876f306ca334bdc7694d757b72f5b /phpBB/includes/bbcode.php | |
parent | 9589e01f43b2f491a6c93d4238ff86fa18a3843f (diff) | |
download | forums-004b0c9ad443ff956b03f8c1ae071b20ef82f83d.tar forums-004b0c9ad443ff956b03f8c1ae071b20ef82f83d.tar.gz forums-004b0c9ad443ff956b03f8c1ae071b20ef82f83d.tar.bz2 forums-004b0c9ad443ff956b03f8c1ae071b20ef82f83d.tar.xz forums-004b0c9ad443ff956b03f8c1ae071b20ef82f83d.zip |
Fix for bug #496944 "quotes with usernames containing "]"
git-svn-id: file:///svn/phpbb/trunk@1818 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/bbcode.php')
-rw-r--r-- | phpBB/includes/bbcode.php | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 22dbd79b91..cb96937e0f 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -167,7 +167,10 @@ function bbencode_second_pass($text, $uid) $text = str_replace("[quote:$uid]", $bbcode_tpl['quote_open'], $text); $text = str_replace("[/quote:$uid]", $bbcode_tpl['quote_close'], $text); - $text = preg_replace("/\[quote:$uid=\"?(.*?)\"?\]/si", $bbcode_tpl['quote_username_open'], $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. $text = str_replace("[b:$uid]", $bbcode_tpl['b_open'], $text); @@ -381,7 +384,20 @@ function bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_ // Grab everything until the first "]"... $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) { $match_result = array(); |