From 817db2f13526842e04aeabe4fcd6d809dce2d0a2 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Sat, 30 May 2015 01:02:12 +0200 Subject: [ticket/13880] Automatically remove quotes that are nested too deep PHPBB3-13880 --- phpBB/posting.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 651f674ef9..d994811a91 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1579,11 +1579,21 @@ 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) +{ + $tmp_bbcode_uid = $message_parser->bbcode_uid; + $message_parser->bbcode_uid = $post_data['bbcode_uid']; + $message_parser->remove_nested_quotes($config['max_quote_depth'] - 1); + $message_parser->bbcode_uid = $tmp_bbcode_uid; +} + // 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']) { -- cgit v1.2.1