diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2018-07-12 16:05:24 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-07-21 15:02:18 +0200 |
commit | c116d116facb45683514cbb2d175b66e3d3c5c59 (patch) | |
tree | df29fc8a34dd05a97b8fd56e4fcf9eefa660a1e1 | |
parent | a93f2a648b2694dcebc3dffd9ca391c1303ce381 (diff) | |
download | nextcloud-server-c116d116facb45683514cbb2d175b66e3d3c5c59.tar.gz nextcloud-server-c116d116facb45683514cbb2d175b66e3d3c5c59.zip |
improve mail template and escape html code
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
-rw-r--r-- | apps/sharebymail/lib/ShareByMailProvider.php | 17 | ||||
-rw-r--r-- | lib/private/Share20/DefaultShareProvider.php | 17 |
2 files changed, 10 insertions, 24 deletions
diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index bf251c627a0..0eceeca1cac 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -519,24 +519,17 @@ class ShareByMailProvider implements IShareProvider { $initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator; $initiatorEmailAddress = ($initiatorUser instanceof IUser) ? $initiatorUser->getEMailAddress() : null; - $plainBodyPart = $this->l->t("%s shared »%s« with you and want to add:\n", [$initiatorDisplayName, $filename]); - $htmlBodyPart = $this->l->t('%s shared »%s« with you and want to add:', [$initiatorDisplayName, $filename]); + $plainHeading = $this->l->t('%1s shared »%2s« with you and want to add:', [$initiatorDisplayName, $filename]); + $htmlHeading = $this->l->t('%1s shared »%2s« with you and want to add:', [$initiatorDisplayName, $filename]); $message = $this->mailer->createMessage(); - $emailTemplate = $this->mailer->createEMailTemplate('shareByMail.sendNote', [ - 'filename' => $filename, - 'note' => $note, - 'initiator' => $initiatorDisplayName, - 'initiatorEmail' => $initiatorEmailAddress, - 'shareWith' => $recipient, - ]); + $emailTemplate = $this->mailer->createEMailTemplate('shareByMail.sendNote'); $emailTemplate->setSubject($this->l->t('»%s« added a note to a file shared with you', [$initiatorDisplayName])); $emailTemplate->addHeader(); - $emailTemplate->addHeading($this->l->t('Note regarding »%s«', [$filename]), false); - $emailTemplate->addBodyText(htmlspecialchars($htmlBodyPart), $plainBodyPart); - $emailTemplate->addBodyText($note); + $emailTemplate->addHeading(htmlspecialchars($htmlHeading), $plainHeading); + $emailTemplate->addBodyText(htmlspecialchars($note), $note); // The "From" contains the sharers name $instanceName = $this->defaults->getName(); diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 1d7dddcaf4a..86eac45f88e 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -1309,24 +1309,17 @@ class DefaultShareProvider implements IShareProvider { $initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator; $initiatorEmailAddress = ($initiatorUser instanceof IUser) ? $initiatorUser->getEMailAddress() : null; - $plainBodyPart = $this->l->t("%s shared »%s« with you and want to add:\n", [$initiatorDisplayName, $filename]); - $htmlBodyPart = $this->l->t('%s shared »%s« with you and want to add:', [$initiatorDisplayName, $filename]); + $plainHeading = $this->l->t('%1s shared »%2s« with you and want to add:', [$initiatorDisplayName, $filename]); + $htmlHeading = $this->l->t('%1s shared »%2s« with you and want to add:', [$initiatorDisplayName, $filename]); $message = $this->mailer->createMessage(); - $emailTemplate = $this->mailer->createEMailTemplate('defaultShareProvider.sendNote', [ - 'filename' => $filename, - 'note' => $note, - 'initiator' => $initiatorDisplayName, - 'initiatorEmail' => $initiatorEmailAddress, - 'shareWith' => $recipient, - ]); + $emailTemplate = $this->mailer->createEMailTemplate('defaultShareProvider.sendNote'); $emailTemplate->setSubject($this->l->t('»%s« added a note to a file shared with you', [$initiatorDisplayName])); $emailTemplate->addHeader(); - $emailTemplate->addHeading($this->l->t('Note regarding »%s«', [$filename]), false); - $emailTemplate->addBodyText(htmlspecialchars($htmlBodyPart), $plainBodyPart); - $emailTemplate->addBodyText($note); + $emailTemplate->addHeading(htmlspecialchars($htmlHeading), $plainHeading); + $emailTemplate->addBodyText(htmlspecialchars($note), $note); // The "From" contains the sharers name $instanceName = $this->defaults->getName(); |