aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/message_parser.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/message_parser.php')
-rw-r--r--phpBB/includes/message_parser.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 311c75b410..f7ae685e95 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -674,7 +674,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 +688,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 = '[';
@@ -745,7 +752,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 +774,7 @@ class bbcode_firstpass extends bbcode
if ($error)
{
- $username = str_replace('[', '[', str_replace(']', ']', $m[1]));
+ $username = $m[1];
}
$out .= 'quote="' . $username . '":' . $this->bbcode_uid . ']';
@@ -1073,7 +1082,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;