aboutsummaryrefslogtreecommitdiff
path: root/mod/invitefriends
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-14 16:27:08 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-14 16:27:08 +0000
commit6ba1737c22a002a71210fcd15ad36c3c2bc68402 (patch)
tree22e44b38f986ac94ecb7d831d043d87ac687bf27 /mod/invitefriends
parent368c947601348a68dd6805658e637a1e634779e5 (diff)
downloadelgg-6ba1737c22a002a71210fcd15ad36c3c2bc68402.tar.gz
elgg-6ba1737c22a002a71210fcd15ad36c3c2bc68402.tar.bz2
merge -r5832:5898 from 1.7 to trunk.
git-svn-id: http://code.elgg.org/elgg/trunk@6055 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/invitefriends')
-rw-r--r--mod/invitefriends/actions/invite.php52
1 files changed, 4 insertions, 48 deletions
diff --git a/mod/invitefriends/actions/invite.php b/mod/invitefriends/actions/invite.php
index 7e0bd54b8..66902606a 100644
--- a/mod/invitefriends/actions/invite.php
+++ b/mod/invitefriends/actions/invite.php
@@ -51,59 +51,17 @@
$link
);
- // **** this should be replaced by a core function for sending emails to people who are not members
+ $subject = sprintf(elgg_echo('invitefriends:subject'), $CONFIG->site->name);
+
+ // create the from address
$site = get_entity($CONFIG->site_guid);
- // If there's an email address, use it - but only if its not from a user.
if (($site) && (isset($site->email))) {
- // Has the current site got a from email address?
$from = $site->email;
- } else if (isset($from->url)) {
- // If we have a url then try and use that.
- $breakdown = parse_url($from->url);
- $from = 'noreply@' . $breakdown['host']; // Handle anything with a url
} else {
- // If all else fails, use the domain of the site.
$from = 'noreply@' . get_site_domain($CONFIG->site_guid);
}
-
- if (is_callable('mb_internal_encoding')) {
- mb_internal_encoding('UTF-8');
- }
- $site = get_entity($CONFIG->site_guid);
- $sitename = $site->name;
- if (is_callable('mb_encode_mimeheader')) {
- $sitename = mb_encode_mimeheader($site->name,"UTF-8", "B");
- }
-
- $header_eol = "\r\n";
- if ((isset($CONFIG->broken_mta)) && ($CONFIG->broken_mta)) {
- // Allow non-RFC 2822 mail headers to support some broken MTAs
- $header_eol = "\n";
- }
-
- $from_email = "\"$sitename\" <$from>";
- if (strtolower(substr(PHP_OS, 0 , 3)) == 'win') {
- // Windows is somewhat broken, so we use a different format from header
- $from_email = "$from";
- }
-
- $headers = "From: $from_email{$header_eol}"
- . "Content-Type: text/plain; charset=UTF-8; format=flowed{$header_eol}"
- . "MIME-Version: 1.0{$header_eol}"
- . "Content-Transfer-Encoding: 8bit{$header_eol}";
-
- $subject = sprintf(elgg_echo('invitefriends:subject'), $CONFIG->site->name);
- if (is_callable('mb_encode_mimeheader')) {
- $subject = mb_encode_mimeheader($subject,"UTF-8", "B");
- }
-
- // Format message
- $message = html_entity_decode($message, ENT_COMPAT, 'UTF-8'); // Decode any html entities
- $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
- mail($email, $subject, wordwrap($message), $headers);
+ elgg_send_email($from, $email, $subject, $message);
}
if ($error) {
@@ -113,5 +71,3 @@
}
forward($_SERVER['HTTP_REFERER']);
-
-?>