diff options
| author | Nils Adermann <naderman@naderman.de> | 2010-03-02 01:05:37 +0100 |
|---|---|---|
| committer | Nils Adermann <naderman@naderman.de> | 2010-03-02 01:05:37 +0100 |
| commit | aa4495b8ad0cf90c2b3f655441ccfee49701282d (patch) | |
| tree | e70cd18c1f03e6a0219bd0fbe41d896b350e974e /phpBB/includes/message_parser.php | |
| parent | 8a3c323933cbdadd302ed49b5769f90c3f622cdc (diff) | |
| parent | 0aef1e57a73ef4c7086cf24ed154e8d5bbbac679 (diff) | |
| download | forums-aa4495b8ad0cf90c2b3f655441ccfee49701282d.tar forums-aa4495b8ad0cf90c2b3f655441ccfee49701282d.tar.gz forums-aa4495b8ad0cf90c2b3f655441ccfee49701282d.tar.bz2 forums-aa4495b8ad0cf90c2b3f655441ccfee49701282d.tar.xz forums-aa4495b8ad0cf90c2b3f655441ccfee49701282d.zip | |
Merge commit 'release-3.0-RC8'
Diffstat (limited to 'phpBB/includes/message_parser.php')
| -rw-r--r-- | phpBB/includes/message_parser.php | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 311c75b410..6e601e1499 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -208,6 +208,12 @@ class bbcode_firstpass extends bbcode return '[size=' . $stx . ']' . $in . '[/size]'; } + // Do not allow size=0 + if ($stx <= 0) + { + return '[size=' . $stx . ']' . $in . '[/size]'; + } + return '[size=' . $stx . ':' . $this->bbcode_uid . ']' . $in . '[/size:' . $this->bbcode_uid . ']'; } @@ -674,7 +680,11 @@ class bbcode_firstpass extends bbcode /** * If you change this code, make sure the cases described within the following reports are still working: - * #3572, #14667 + * #3572 - [quote="[test]test"]test [ test[/quote] - (correct: parsed) + * #14667 - [quote]test[/quote] test ] and [ test [quote]test[/quote] (correct: parsed) + * #14770 - [quote="["]test[/quote] (correct: parsed) + * [quote="[i]test[/i]"]test[/quote] (correct: parsed) + * [quote="[quote]test[/quote]"]test[/quote] (correct: NOT parsed) */ $in = str_replace("\r\n", "\n", str_replace('\"', '"', trim($in))); @@ -684,6 +694,9 @@ class bbcode_firstpass extends bbcode return ''; } + // To let the parser not catch tokens within quote_username quotes we encode them before we start this... + $in = preg_replace('#quote="(.*?)"\]#ie', "'quote="' . str_replace(array('[', ']'), array('[', ']'), '\$1') . '"]'", $in); + $tok = ']'; $out = '['; @@ -709,7 +722,7 @@ class bbcode_firstpass extends bbcode if ($tok == ']') { - if ($buffer == '/quote' && sizeof($close_tags) && substr($out, -1, 1) == '[') + if (strtolower($buffer) == '/quote' && sizeof($close_tags) && substr($out, -1, 1) == '[') { // we have found a closing tag $out .= array_pop($close_tags) . ']'; @@ -745,7 +758,9 @@ class bbcode_firstpass extends bbcode if (isset($m[1]) && $m[1]) { - $username = preg_replace('#\[(?!b|i|u|color|url|email|/b|/i|/u|/color|/url|/email)#iU', '[$1', $m[1]); + $username = str_replace(array('[', ']'), array('[', ']'), $m[1]); + $username = preg_replace('#\[(?!b|i|u|color|url|email|/b|/i|/u|/color|/url|/email)#iU', '[$1', $username); + $end_tags = array(); $error = false; @@ -765,7 +780,7 @@ class bbcode_firstpass extends bbcode if ($error) { - $username = str_replace('[', '[', str_replace(']', ']', $m[1])); + $username = $m[1]; } $out .= 'quote="' . $username . '":' . $this->bbcode_uid . ']'; @@ -805,7 +820,7 @@ class bbcode_firstpass extends bbcode if ($tok == '[') { // Search the text for the next tok... if an ending quote comes first, then change tok to [] - $pos1 = strpos($in, '[/quote'); + $pos1 = stripos($in, '[/quote'); // If the token ] comes first, we change it to ] $pos2 = strpos($in, ']'); // If the token [ comes first, we change it to [ @@ -1073,7 +1088,7 @@ class parse_message extends bbcode_firstpass } // Check for "empty" message - if (!utf8_clean_string($this->message)) + if ($mode !== 'sig' && !utf8_clean_string($this->message)) { $this->warn_msg[] = $user->lang['TOO_FEW_CHARS']; return $this->warn_msg; |
