1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 19:24:01 +02:00

[ticket/11530] Remove extra quotes when depth limit is exceeded

PHPBB3-11530
This commit is contained in:
JoshyPHP
2015-05-18 03:57:48 +02:00
parent c967ba7b9b
commit c1777f4811
3 changed files with 103 additions and 1 deletions

View File

@@ -1250,6 +1250,16 @@ class parse_message extends bbcode_firstpass
return (!$update_this_message) ? $return_message : $this->warn_msg;
}
// Remove quotes that are nested too deep
if ($config['max_quote_depth'] > 0)
{
$this->message = $phpbb_container->get('text_formatter.utils')->remove_bbcode(
$this->message,
'quote',
$config['max_quote_depth']
);
}
// Check for errors
$errors = $parser->get_errors();
if ($errors)

View File

@@ -1578,11 +1578,22 @@ if (!sizeof($error) && $preview)
}
}
// Remove quotes that would become nested too deep before decoding the text
$generate_quote = ($mode == 'quote' && !$submit && !$preview && !$refresh);
if ($generate_quote && $config['max_quote_depth'] > 0 && preg_match('#^<[rt][ >]#', $message_parser->message))
{
$message_parser->message = $phpbb_container->get('text_formatter.utils')->remove_bbcode(
$message_parser->message,
'quote',
$config['max_quote_depth'] - 1
);
}
// Decode text for message display
$post_data['bbcode_uid'] = ($mode == 'quote' && !$preview && !$refresh && !sizeof($error)) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid;
$message_parser->decode_message($post_data['bbcode_uid']);
if ($mode == 'quote' && !$submit && !$preview && !$refresh)
if ($generate_quote)
{
if ($config['allow_bbcode'])
{