From b6d6938b9fd99020dd4e5b92ef5fc8dc21a81a78 Mon Sep 17 00:00:00 2001 From: brunoais Date: Fri, 9 Aug 2013 17:01:09 +0100 Subject: [PATCH 1/3] [ticket/11663] Make generate_text_for_storage return the errors. generate_text_for_storage does not return anything, all returned values are outputted using the parameters so this uses the returned value with the same idea as many C language functions where the returned value is if all went well or not and if it didn't what went wrong. PHPBB3-11663 --- phpBB/includes/functions_content.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 05d3c5fde2..c2cfabe983 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -542,7 +542,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb $vars = array('text', 'uid', 'bitfield', 'flags'); extract($phpbb_dispatcher->trigger_event('core.modify_text_for_storage_after', compact($vars))); - return; + return $message_parser->warn_msg; } /** From 53888ec540a7f7b1aeabcb4ef2d1a6afce121c06 Mon Sep 17 00:00:00 2001 From: brunoais Date: Wed, 14 Aug 2013 10:44:45 +0100 Subject: [PATCH 2/3] [ticket/11663] Add the doc block about the return value. generate_text_for_storage does not return anything, all returned values are outputted using the parameters so this uses the returned value with the same idea as many C language functions where the returned value is if all went well or not and if it didn't what went wrong. PHPBB3-11663 --- phpBB/includes/functions_content.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index c2cfabe983..593d2eb045 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -481,6 +481,8 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text * For parsing custom parsed text to be stored within the database. * This function additionally returns the uid and bitfield that needs to be stored. * Expects $text to be the value directly from request_var() and in it's non-parsed form +* +* @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) { From 7a02a8bcf20b79feb996c2508e647c21f3a0ac70 Mon Sep 17 00:00:00 2001 From: brunoais Date: Sat, 17 Aug 2013 20:06:43 +0100 Subject: [PATCH 3/3] [ticket/11663] Add the doc block about the parameters. PHPBB3-11663 --- phpBB/includes/functions_content.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 593d2eb045..7e501de9c8 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -481,6 +481,14 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text * For parsing custom parsed text to be stored within the database. * This function additionally returns the uid and bitfield that needs to be stored. * Expects $text to be the value directly from request_var() and in it's non-parsed form +* +* @param string $text The text to be replaced with the parsed one +* @param string $uid The BBCode uid for this parse +* @param string $bitfield The BBCode bitfield for this parse +* @param int $flags The allow_bbcode, allow_urls and allow_smilies compiled into a single integer. +* @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 * * @return array An array of string with the errors that occurred while parsing */