diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_board.php | 3 | ||||
-rw-r--r-- | phpBB/includes/bbcode.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions_content.php | 16 | ||||
-rw-r--r-- | phpBB/includes/functions_messenger.php | 2 | ||||
-rw-r--r-- | phpBB/includes/message_parser.php | 10 |
5 files changed, 28 insertions, 5 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 965f1a6f70..ff3b50174b 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -515,7 +515,8 @@ class acp_board if ($config_name == 'guest_style') { - if (isset($cfg_array[$config_name])) { + if (isset($cfg_array[$config_name])) + { $this->guest_style_set($cfg_array[$config_name]); } continue; diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 150157e275..24eaddf067 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -138,7 +138,6 @@ class bbcode $template = new \phpbb\template\twig\twig( $phpbb_container->get('path_helper'), $phpbb_container->get('config'), - $phpbb_container->get('user'), new \phpbb\template\context(), new \phpbb\template\twig\environment( $phpbb_container->get('config'), @@ -152,6 +151,7 @@ class bbcode ) ), $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->get('user'), $phpbb_container->get('template.twig.extensions.collection'), $phpbb_extension_manager ); diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 60511d89a4..5cebc54eb2 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -560,10 +560,14 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text * @param bool $allow_bbcode If BBCode is allowed (i.e. if BBCode is parsed) * @param bool $allow_urls If urls is allowed * @param bool $allow_smilies If smilies are allowed +* @param bool $allow_img_bbcode +* @param bool $allow_flash_bbcode +* @param bool $allow_quote_bbcode +* @param bool $allow_url_bbcode * * @return array An array of string with the errors that occurred while parsing */ -function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false) +function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true) { global $phpbb_root_path, $phpEx, $phpbb_dispatcher; @@ -578,6 +582,10 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb * @var bool allow_bbcode Whether or not to parse BBCode * @var bool allow_urls Whether or not to parse URLs * @var bool allow_smilies Whether or not to parse Smilies + * @var bool allow_img_bbcode Whether or not to parse the [img] BBCode + * @var bool allow_flash_bbcode Whether or not to parse the [flash] BBCode + * @var bool allow_quote_bbcode Whether or not to parse the [quote] BBCode + * @var bool allow_url_bbcode Whether or not to parse the [url] BBCode * @since 3.1.0-a1 */ $vars = array( @@ -588,6 +596,10 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb 'allow_bbcode', 'allow_urls', 'allow_smilies', + 'allow_img_bbcode', + 'allow_flash_bbcode', + 'allow_quote_bbcode', + 'allow_url_bbcode', ); extract($phpbb_dispatcher->trigger_event('core.modify_text_for_storage_before', compact($vars))); @@ -600,7 +612,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb } $message_parser = new parse_message($text); - $message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies); + $message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies, $allow_img_bbcode, $allow_flash_bbcode, $allow_quote_bbcode, $allow_url_bbcode); $text = $message_parser->message; $uid = $message_parser->bbcode_uid; diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 4cbe1eb425..6abfb40b01 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -633,7 +633,6 @@ class messenger $this->template = new \phpbb\template\twig\twig( $phpbb_container->get('path_helper'), $phpbb_container->get('config'), - $phpbb_container->get('user'), new \phpbb\template\context(), new \phpbb\template\twig\environment( $phpbb_container->get('config'), @@ -647,6 +646,7 @@ class messenger ) ), $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->get('user'), $phpbb_container->get('template.twig.extensions.collection'), $phpbb_extension_manager ); diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 9fe598d7fb..f018d735a7 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -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) |