aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/notification.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-31 13:22:43 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-31 13:22:43 +0000
commitae404a6265279cfcc61e3669b94d5fe57377c7e2 (patch)
tree14ac15f89341ce71e5f0309d37adafad004fffdf /engine/lib/notification.php
parent1195ed3a69f40976977520f1cefac98cc614a319 (diff)
downloadelgg-ae404a6265279cfcc61e3669b94d5fe57377c7e2.tar.gz
elgg-ae404a6265279cfcc61e3669b94d5fe57377c7e2.tar.bz2
Closes #446:
* Errant \r\n and \r chars coverted to \n. * newlines stripped from subject headers. * Lines starting with From are changed to >From git-svn-id: https://code.elgg.org/elgg/trunk@2375 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/notification.php')
-rw-r--r--engine/lib/notification.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/engine/lib/notification.php b/engine/lib/notification.php
index 87f5b962a..8eeb009c0 100644
--- a/engine/lib/notification.php
+++ b/engine/lib/notification.php
@@ -221,6 +221,9 @@
if ($to->email=="")
throw new NotificationException(sprintf(elgg_echo('NotificationException:NoEmailAddress'), $to->guid));
+ // Sanitise subject
+ $subject = preg_replace("/(\r\n|\r|\n)/", " ", $subject); // Strip line endings
+
// To
$to = $to->email;
@@ -255,8 +258,10 @@
$subject = mb_encode_mimeheader($subject,"UTF-8", "B");
}
- // Strip tags from message
- $message = strip_tags($message);
+ // Format message
+ $message = strip_tags($message); // Strip tags from message
+ $message = preg_replace("/(\r\n|\r)/", "\n", $message); // Convert to unix line endings in body
+ $message = preg_replace("/^From/", ">From", $message); // Change lines starting with From to >From
return mail($to, $subject, wordwrap($message), $headers);
}