aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/message_parser.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2010-03-02 01:05:39 +0100
committerNils Adermann <naderman@naderman.de>2010-03-02 01:05:39 +0100
commita45bca7c49623341ae971d4e1014ba9de38de982 (patch)
treea1f033124b14c020e850525a6ea745cb7cb3dbab /phpBB/includes/message_parser.php
parent1f3498c0d6a20a08fe17948b32fc435f85a6eff8 (diff)
parent6485d66743d55aeba95aed86fcde4a0e555e3104 (diff)
downloadforums-a45bca7c49623341ae971d4e1014ba9de38de982.tar
forums-a45bca7c49623341ae971d4e1014ba9de38de982.tar.gz
forums-a45bca7c49623341ae971d4e1014ba9de38de982.tar.bz2
forums-a45bca7c49623341ae971d4e1014ba9de38de982.tar.xz
forums-a45bca7c49623341ae971d4e1014ba9de38de982.zip
Merge commit 'release-3.0.5-RC1'
Diffstat (limited to 'phpBB/includes/message_parser.php')
-rw-r--r--phpBB/includes/message_parser.php26
1 files changed, 13 insertions, 13 deletions
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 4e350bce99..ab6fc3f4f3 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -695,6 +695,7 @@ class bbcode_firstpass extends bbcode
* [quote="[i]test[/i]"]test[/quote] (correct: parsed)
* [quote="[quote]test[/quote]"]test[/quote] (correct: parsed - Username displayed as [quote]test[/quote])
* #20735 - [quote]test[/[/b]quote] test [/quote][/quote] test - (correct: quoted: "test[/[/b]quote] test" / non-quoted: "[/quote] test" - also failed if layout distorted)
+ * #40565 - [quote="a"]a[/quote][quote="a]a[/quote] (correct: first quote tag parsed, second quote tag unparsed)
*/
$in = str_replace("\r\n", "\n", str_replace('\"', '"', trim($in)));
@@ -705,7 +706,7 @@ class bbcode_firstpass extends bbcode
}
// To let the parser not catch tokens within quote_username quotes we encode them before we start this...
- $in = preg_replace('#quote=&quot;(.*?)&quot;\]#ie', "'quote=&quot;' . str_replace(array('[', ']'), array('&#91;', '&#93;'), '\$1') . '&quot;]'", $in);
+ $in = preg_replace('#quote=&quot;(.*?)&quot;\]#ie', "'quote=&quot;' . str_replace(array('[', ']', '\\\"'), array('&#91;', '&#93;', '\"'), '\$1') . '&quot;]'", $in);
$tok = ']';
$out = '[';
@@ -858,6 +859,8 @@ class bbcode_firstpass extends bbcode
}
while ($in);
+ $out .= $buffer;
+
if (sizeof($close_tags))
{
$out .= '[' . implode('][', $close_tags) . ']';
@@ -1049,11 +1052,7 @@ class parse_message extends bbcode_firstpass
{
// Init BBCode UID
$this->bbcode_uid = substr(base_convert(unique_id(), 16, 36), 0, BBCODE_UID_LEN);
-
- if ($message)
- {
- $this->message = $message;
- }
+ $this->message = $message;
}
/**
@@ -1102,13 +1101,6 @@ class parse_message extends bbcode_firstpass
}
}
- // Check for "empty" message
- if ($mode !== 'sig' && utf8_clean_string($this->message) === '')
- {
- $this->warn_msg[] = $user->lang['TOO_FEW_CHARS'];
- return (!$update_this_message) ? $return_message : $this->warn_msg;
- }
-
// Prepare BBcode (just prepares some tags for better parsing)
if ($allow_bbcode && strpos($this->message, '[') !== false)
{
@@ -1151,6 +1143,14 @@ class parse_message extends bbcode_firstpass
}
}
+ // Check for "empty" message. We do not check here for maximum length, because bbcode, smilies, etc. can add to the length.
+ // The maximum length check happened before any parsings.
+ if ($mode !== 'sig' && utf8_clean_string($this->message) === '')
+ {
+ $this->warn_msg[] = $user->lang['TOO_FEW_CHARS'];
+ return (!$update_this_message) ? $return_message : $this->warn_msg;
+ }
+
// Check number of links
if ($config['max_' . $mode . '_urls'] && $num_urls > $config['max_' . $mode . '_urls'])
{