From 3130f9df52ee8e23d33e8df7349cf60855b5a527 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 5 Oct 2016 16:31:58 +0200 Subject: [PATCH] Run HTMLawed on compose body --- mail/inc/class.mail_compose.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 1a60099a1d..f8072fb4b4 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -594,6 +594,7 @@ class mail_compose unset($_content['body']); unset($_content['mail_htmltext']); unset($_content['mail_plaintext']); + $_currentMode = $_content['mimeType']; // form was submitted either by clicking a button or by changing one of the triggering selectboxes // identity and signatureid; this might trigger that the signature in mail body may have to be altered @@ -622,7 +623,7 @@ class mail_compose } $_oldSig = $composeCache['mailidentity']; $_signatureid = ($newSig?$newSig:$_content['mailidentity']); - $_currentMode = $_content['mimeType']; + if ($_oldSig != $_signatureid) { if($this->_debug) error_log(__METHOD__.__LINE__.' old,new ->'.$_oldSig.','.$_signatureid.'#'.$content['body']); @@ -731,6 +732,9 @@ class mail_compose } } } + /*run the purify on compose body unconditional*/ + $content['body'] = str_replace(array("\r", "\t", "
\n", ": "), array("", "", "
", ":"), + $_currentMode == 'html' ? Api\Html::purify($content['body'], Mail::$htmLawed_config, array(), true) : $content['body']); // do not double insert a signature on a server roundtrip if ($buttonClicked) $suppressSigOnTop = true;