From 12fdfe145af65b26b42a6a9a18134f748264e04d Mon Sep 17 00:00:00 2001 From: MikelAlejoBR Date: Sun, 22 Jul 2018 17:08:35 +0200 Subject: [PATCH] [ticket/15622] Fix quoting in PMs when BBCodes are disabled Before parsing the private message to be loaded a simple BBCode status check is done to verify that BBCodes are enabled. Depending on that option the quote will be formated as BBCode or as plain text, similarly to what is done in posting.php. PHPBB3-15622 --- phpBB/includes/ucp/ucp_pm_compose.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index bf18e76568..e108356584 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -978,7 +978,26 @@ function compose_pm($id, $mode, $action, $user_folders = array()) censor_text($message_parser->message), $quote_attributes ); - $message_parser->message = $message_link . $quote_text . "\n\n"; + if ($bbcode_status) + { + $message_parser->message = $message_link . $quote_text . "\n\n"; + } + else + { + $offset = 0; + $quote_string = "> "; + $message = censor_text(trim($message_parser->message)); + // see if we are nesting. It's easily tricked but should work for one level of nesting + if (strpos($message, ">") !== false) + { + $offset = 10; + } + $message = utf8_wordwrap($message, 75 + $offset, "\n"); + + $message = $quote_string . $message; + $message = str_replace("\n", "\n" . $quote_string, $message); + $message_parser->message = $quote_username . " " . $user->lang['WROTE'] . ":\n" . $message . "\n"; + } } if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !$preview && !$refresh)