From a8181c1989b1a5ef547e2f8cb6c1115b5b37fb79 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 3 Aug 2014 08:57:32 -0400 Subject: [PATCH 1/3] changing invitation sender-refs #3702 --- main/inc/lib/notification.lib.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) mode change 100755 => 100644 main/inc/lib/notification.lib.php diff --git a/main/inc/lib/notification.lib.php b/main/inc/lib/notification.lib.php old mode 100755 new mode 100644 index d06c0214c4..7310aa24ec --- a/main/inc/lib/notification.lib.php +++ b/main/inc/lib/notification.lib.php @@ -159,6 +159,34 @@ class Notification extends Model //Send notification right now! case self::NOTIFY_MESSAGE_AT_ONCE: case self::NOTIFY_INVITATION_AT_ONCE: + $name = api_get_person_name($user_info['firstname'], $user_info['lastname']); + $mail= api_get_setting('noreply_email_address'); + if (!empty($mail)) { + $extra_headers = array(); + $extra_headers['reply_to']['mail'] = $mail; + $extra_headers['reply_to']['name'] = $this->admin_name; + api_mail_html( + $name, + $user_info['mail'], + Security::filter_terms($title), + Security::filter_terms($content), + $this->admin_name, + $mail, + $extra_headers + ); + } else { + echo "ed2"; + api_mail_html( + $name, + $user_info['mail'], + Security::filter_terms($title), + Security::filter_terms($content), + $this->admin_name, + $this->admin_email + ); + } + + // Saving the notification to be sent some day. case self::NOTIFY_GROUP_AT_ONCE: if (!empty($user_info['mail'])) { $name = api_get_person_name($user_info['firstname'], $user_info['lastname']); From 27096e2cfff9e23b2eed4d1dda9fd597e1f952bb Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 4 Aug 2014 21:58:42 -0400 Subject: [PATCH 2/3] fixing code when sending invitation -ref #3702 --- main/inc/lib/notification.lib.php | 75 +++++++++++++------------------ 1 file changed, 30 insertions(+), 45 deletions(-) diff --git a/main/inc/lib/notification.lib.php b/main/inc/lib/notification.lib.php index 7310aa24ec..a38c0242c6 100644 --- a/main/inc/lib/notification.lib.php +++ b/main/inc/lib/notification.lib.php @@ -159,60 +159,45 @@ class Notification extends Model //Send notification right now! case self::NOTIFY_MESSAGE_AT_ONCE: case self::NOTIFY_INVITATION_AT_ONCE: - $name = api_get_person_name($user_info['firstname'], $user_info['lastname']); - $mail= api_get_setting('noreply_email_address'); - if (!empty($mail)) { + // Saving the notification to be sent some day. + case self::NOTIFY_GROUP_AT_ONCE: + $mail = api_get_setting('noreply_email_address'); + if ($user_setting == NOTIFY_INVITATION_AT_ONCE) { + $sender_info['complete_name'] = $this->admin_name; $extra_headers = array(); - $extra_headers['reply_to']['mail'] = $mail; $extra_headers['reply_to']['name'] = $this->admin_name; + if (!empty($mail)) { + $sender_info['email'] = $mail; + $extra_headers['reply_to']['mail'] = $mail; + + } else { + $sender_info['email'] = $this->admin_email; + $extra_headers['reply_to']['mail'] = $this->admin_email; + } + } + if (!empty($user_info['mail']) || !empty($mail)) { + $name = api_get_person_name($user_info['firstname'], $user_info['lastname']); + if (!empty($sender_info['complete_name']) && !empty($sender_info['email'])) { + if ($user_setting != NOTIFY_INVITATION_AT_ONCE) { + $extra_headers = array(); + $extra_headers['reply_to']['mail'] = $sender_info['email']; + $extra_headers['reply_to']['name'] = $sender_info['complete_name']; + } + } else{ + $extra_headers = array(); + $sender_info['complete_name'] = $this->admin_name; + $sender_info['email'] = $this->admin_email; + } api_mail_html( $name, $user_info['mail'], Security::filter_terms($title), Security::filter_terms($content), - $this->admin_name, - $mail, + $sender_info['complete_name'], + $sender_info['email'], $extra_headers ); - } else { - echo "ed2"; - api_mail_html( - $name, - $user_info['mail'], - Security::filter_terms($title), - Security::filter_terms($content), - $this->admin_name, - $this->admin_email - ); - } - - // Saving the notification to be sent some day. - case self::NOTIFY_GROUP_AT_ONCE: - if (!empty($user_info['mail'])) { - $name = api_get_person_name($user_info['firstname'], $user_info['lastname']); - if (!empty($sender_info['complete_name']) && !empty($sender_info['email'])) { - $extra_headers = array(); - $extra_headers['reply_to']['mail'] = $sender_info['email']; - $extra_headers['reply_to']['name'] = $sender_info['complete_name']; - api_mail_html( - $name, - $user_info['mail'], - Security::filter_terms($title), - Security::filter_terms($content), - $sender_info['complete_name'], - $sender_info['email'], - $extra_headers - ); - } else { - api_mail_html( - $name, - $user_info['mail'], - Security::filter_terms($title), - Security::filter_terms($content), - $this->admin_name, - $this->admin_email - ); - } + } $params['sent_at'] = api_get_utc_datetime(); // Saving the notification to be sent some day. From 15abc5975a9808bfa3215b3735ef79bef53333bb Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 4 Aug 2014 22:08:08 -0400 Subject: [PATCH 3/3] fixing code when sending invitation -ref #3702 --- main/inc/lib/notification.lib.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main/inc/lib/notification.lib.php b/main/inc/lib/notification.lib.php index a38c0242c6..c73c0521c1 100644 --- a/main/inc/lib/notification.lib.php +++ b/main/inc/lib/notification.lib.php @@ -159,7 +159,6 @@ class Notification extends Model //Send notification right now! case self::NOTIFY_MESSAGE_AT_ONCE: case self::NOTIFY_INVITATION_AT_ONCE: - // Saving the notification to be sent some day. case self::NOTIFY_GROUP_AT_ONCE: $mail = api_get_setting('noreply_email_address'); if ($user_setting == NOTIFY_INVITATION_AT_ONCE) { @@ -183,7 +182,7 @@ class Notification extends Model $extra_headers['reply_to']['mail'] = $sender_info['email']; $extra_headers['reply_to']['name'] = $sender_info['complete_name']; } - } else{ + } else { $extra_headers = array(); $sender_info['complete_name'] = $this->admin_name; $sender_info['email'] = $this->admin_email;