From 63712f3acd80878784d4fc1da18d57c18fa88342 Mon Sep 17 00:00:00 2001 From: marcus Date: Mon, 7 Jul 2008 16:06:58 +0000 Subject: Option to hide sender. git-svn-id: https://code.elgg.org/elgg/trunk@1316 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/notification.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'engine/lib/notification.php') diff --git a/engine/lib/notification.php b/engine/lib/notification.php index aa4bf35cf..1494c06e7 100644 --- a/engine/lib/notification.php +++ b/engine/lib/notification.php @@ -206,9 +206,10 @@ * @param string $subject The subject of the message. * @param string $message The message body * @param array $params Optional parameters (none taken in this instance) + * @param bool $hide_sender If true (default) hide the sender's email address (use noreply@site...) * @return bool */ - function email_notify_handler(ElggEntity $from, ElggUser $to, $subject, $message, array $params = NULL) + function email_notify_handler(ElggEntity $from, ElggUser $to, $subject, $message, array $params = NULL, $hide_sender = true) { global $CONFIG; @@ -222,16 +223,21 @@ throw new NotificationException(sprintf(elgg_echo('NotificationException:NoEmailAddress'), $to->guid)); $to = $to->email; - if ($from->email) - $from = $from->email; // Handle users - else if ($from->url) + if (!$hide_sender) { - $breakdown = parse_url($from->url); - $from = 'noreply@' . $breakdown['host']; // Handle anything with a url - } - else { - $from = 'noreply@' . get_site_domain($CONFIG->site_guid); // Handle a fallback + if ($from->email) + $from = $from->email; // Handle users + else if ($from->url) + { + $breakdown = parse_url($from->url); + $from = 'noreply@' . $breakdown['host']; // Handle anything with a url + } + else { + $from = 'noreply@' . get_site_domain($CONFIG->site_guid); // Handle a fallback + } } + else + $from = 'noreply@' . get_site_domain($CONFIG->site_guid); // Handle a fallback $headers = "From: $from\r\n"; -- cgit v1.2.3