本文整理汇总了PHP中get_site_domain函数的典型用法代码示例。如果您正苦于以下问题:PHP get_site_domain函数的具体用法?PHP get_site_domain怎么用?PHP get_site_domain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_site_domain函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: initializeAttributes
protected function initializeAttributes()
{
parent::initializeAttributes();
$this->siteDomain = get_site_domain($CONFIG->site_guid);
$this->site = elgg_get_site_entity();
$this->approvedDomains = ['forces.gc.ca', 'test.gc.ca'];
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:7,代码来源:UserManagement.php
示例2: phpmailer_extract_from_email
/**
* Determine the best from email address
*
* @return string with email address
*/
function phpmailer_extract_from_email()
{
global $CONFIG;
$from_email = '';
$site = get_entity($CONFIG->site_guid);
// If there's an email address, use it - but only if its not from a user.
if (isset($from->email) && !$from instanceof ElggUser) {
$from_email = $from->email;
// Has the current site got a from email address?
} else {
if ($site && isset($site->email)) {
$from_email = $site->email;
// If we have a url then try and use that.
} else {
if (isset($from->url)) {
$breakdown = parse_url($from->url);
$from_email = 'noreply@' . $breakdown['host'];
// Handle anything with a url
// If all else fails, use the domain of the site.
} else {
$from_email = 'noreply@' . get_site_domain($CONFIG->site_guid);
}
}
}
return $from_email;
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:31,代码来源:start.php
示例3: html_email_handler_notification_handler
function html_email_handler_notification_handler(ElggEntity $from, ElggUser $to, $subject, $message, array $params = NULL)
{
if (!$from) {
$msg = elgg_echo("NotificationException:MissingParameter", array("from"));
throw new NotificationException($msg);
}
if (!$to) {
$msg = elgg_echo("NotificationException:MissingParameter", array("to"));
throw new NotificationException($msg);
}
if ($to->email == "") {
$msg = elgg_echo("NotificationException:NoEmailAddress", array($to->guid));
throw new NotificationException($msg);
}
// To
$to = html_email_handler_make_rfc822_address($to);
// From
$site = elgg_get_site_entity();
// If there's an email address, use it - but only if its not from a user.
if (!$from instanceof ElggUser && !empty($from->email)) {
$from = html_email_handler_make_rfc822_address($from);
} elseif (!empty($site->email)) {
// Use email address of current site if we cannot use sender's email
$from = html_email_handler_make_rfc822_address($site);
} else {
// If all else fails, use the domain of the site.
if (!empty($site->name)) {
$name = $site->name;
if (strstr($name, ',')) {
$name = '"' . $name . '"';
// Protect the name with quotations if it contains a comma
}
$name = '=?UTF-8?B?' . base64_encode($name) . '?=';
// Encode the name. If may content nos ASCII chars.
$from = $name . " <noreply@" . get_site_domain($site->getGUID()) . ">";
} else {
$from = "noreply@" . get_site_domain($site->getGUID());
}
}
// generate HTML mail body
$html_message = html_email_handler_make_html_body($subject, $message);
// set options for sending
$options = array("to" => $to, "from" => $from, "subject" => '=?UTF-8?B?' . base64_encode($subject) . '?=', "html_message" => $html_message, "plaintext_message" => $message);
if (!empty($params) && is_array($params)) {
$options = array_merge($options, $params);
}
return html_email_handler_send_email($options);
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:48,代码来源:start.php
示例4: spam_login_filter_notify_admin
function spam_login_filter_notify_admin($blockedEmail, $blockedIp, $reason)
{
if (elgg_get_plugin_setting('notify_by_mail', 'spam_login_filter') == "yes") {
//Notify spam tentative to administrator
$site = elgg_get_site_entity();
if ($site && isset($site->email)) {
$from = $site->email;
} else {
$from = 'noreply@' . get_site_domain($site->guid);
}
$message = sprintf(elgg_echo('spam_login_filter:notify_message'), $blockedEmail, $blockedIp, $reason);
$to = elgg_get_plugin_setting('notify_mail_address', 'spam_login_filter');
if (!is_email_address($to)) {
return;
}
elgg_send_email($from, $to, elgg_echo('spam_login_filter:notify_subject'), $message);
}
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:18,代码来源:start.php
示例5: uservalidationbyadmin_request_validation
/**
* Request user validation email.
* Send email out to the address and request a confirmation.
*
* @param int $user_guid The user's GUID
* @param bool $admin_requested Was it requested by admin
* @return mixed
*/
function uservalidationbyadmin_request_validation($user_guid, $admin_requested = FALSE)
{
$site = elgg_get_site_entity();
if ($site && $site->email) {
$from = $site->email;
} else {
$from = 'noreply@' . get_site_domain($site->guid);
}
$user_guid = (int) $user_guid;
$user = get_entity($user_guid);
//notify admins
if ($user && $user instanceof ElggUser) {
// Work out validate link
$code = uservalidationbyadmin_generate_code($user_guid, $user->email);
$link = "{$site->url}uservalidationbyadmin/confirm?u={$user_guid}&c={$code}";
// IP detection
$ip_address = $_SERVER['REMOTE_ADDR'];
/*$geoloc = "https://secure.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=".$ip_address;
$geotags = get_meta_tags($geoloc);
$geocountry = $geotags['country'];
$georegion = $geotags['region'];
$geocity = $geotags['city'];
$geocertainty = $geotags['certainty'];*/
$geostring = $ip_address;
//." ; ".$geocountry." ; ".$georegion." ; ".$geocity." ; ".$geocertainty;
// Send validation email
$subject = elgg_echo('email:validate:subject', array($user->name, $site->name));
$body = elgg_echo('email:validate:body', array($user->name, $user->email, $ip_address, $geostring, $link, $site->name, $site->url));
$emails = elgg_get_plugin_setting('emails', 'uservalidationbyadmin');
$admin_mails = explode(",", $emails);
$sent_total = 0;
foreach ($admin_mails as $mail) {
if (elgg_send_email($from, $mail, $subject, $body)) {
$sent_total++;
}
}
// Atleast 1 mail sent
if ($sent_total > 0 && !$admin_requested) {
system_message(elgg_echo('uservalidationbyadmin:registerok'));
}
return $result;
}
return FALSE;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:52,代码来源:functions.php
示例6: send_user_password_mail
/**
* Send password for new user who is registered using facebook connect
*
* @param $email
* @param $name
* @param $username
* @param $password
*/
function send_user_password_mail($email, $name, $username, $password)
{
$site = elgg_get_site_entity();
$email = trim($email);
// send out other email addresses
if (!is_email_address($email)) {
return false;
}
$message = elgg_echo('facebook_connect:email:body', array($name, $site->name, $site->url, $username, $email, $password, $site->name, $site->url));
$subject = elgg_echo('facebook_connect:email:subject', array($name));
// create the from address
$site = get_entity($site->guid);
if ($site && isset($site->email)) {
$from = $site->email;
} else {
$from = 'noreply@' . get_site_domain($site->guid);
}
elgg_send_email($from, $email, $subject, $message);
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:27,代码来源:start.php
示例7: group_tools_invite_email
function group_tools_invite_email(ElggGroup $group, $email, $text = "", $resend = false)
{
$result = false;
if (!empty($group) && $group instanceof ElggGroup && !empty($email) && is_email_address($email) && ($loggedin_user = elgg_get_logged_in_user_entity())) {
// get site secret
$site_secret = get_site_secret();
// generate invite code
$invite_code = md5($site_secret . $email . $group->getGUID());
if (!group_tools_check_group_email_invitation($invite_code, $group->getGUID()) || $resend) {
// make site email
$site = elgg_get_site_entity();
if (!empty($site->email)) {
if (!empty($site->name)) {
$site_from = $site->name . " <" . $site->email . ">";
} else {
$site_from = $site->email;
}
} else {
// no site email, so make one up
if (!empty($site->name)) {
$site_from = $site->name . " <noreply@" . get_site_domain($site->getGUID()) . ">";
} else {
$site_from = "noreply@" . get_site_domain($site->getGUID());
}
}
if (!$resend) {
// register invite with group
$group->annotate("email_invitation", $invite_code, ACCESS_LOGGED_IN, $group->getGUID());
}
// make subject
$subject = elgg_echo("group_tools:groups:invite:email:subject", array($group->name));
// make body
$body = elgg_echo("group_tools:groups:invite:email:body", array($loggedin_user->name, $group->name, $site->name, $text, $site->name, elgg_get_site_url() . "register", elgg_get_site_url() . "groups/invitations/?invitecode=" . $invite_code, $invite_code));
$result = elgg_send_email($site_from, $email, $subject, $body);
} else {
$result = null;
}
}
return $result;
}
开发者ID:remy40,项目名称:gvrs,代码行数:40,代码来源:functions.php
示例8: event_manager_send_registration_validation_email
function event_manager_send_registration_validation_email($event, $object)
{
$subject = elgg_echo("event_manager:registration:confirm:subject", array($event->title));
$message = elgg_echo("event_manager:registration:confirm:message", array($object->name, $event->title, event_manager_get_registration_validation_url($event->getGUID(), $object->getGUID())));
$site = elgg_get_site_entity();
// send confirmation mail
if (elgg_instanceof($object, "user")) {
notify_user($object->getGUID(), $site->getGUID(), $subject, $message, null, "email");
} else {
$from = $site->email;
if (empty($from)) {
$from = "noreply@" . get_site_domain($site->getGUID());
}
if (!empty($site->name)) {
$site_name = $site->name;
if (strstr($site_name, ',')) {
$site_name = '"' . $site_name . '"';
// Protect the name with quotations if it contains a comma
}
$site_name = '=?UTF-8?B?' . base64_encode($site_name) . '?=';
// Encode the name. If may content nos ASCII chars.
$from = $site_name . " <" . $from . ">";
}
elgg_send_email($from, $object->email, $subject, $message);
}
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:26,代码来源:functions.php
示例9: izap_get_video_name_prefix
function izap_get_video_name_prefix()
{
global $CONFIG;
$domain = get_site_domain($CONFIG->site_guid);
$domain = preg_replace('/[^A-Za-z0-9]+/', '_', $domain);
return $domain . '_izap_videos_';
}
开发者ID:rimpy,项目名称:izap_videos,代码行数:7,代码来源:izapLib.php
示例10: array
// try to find a registration
$options = array("type" => "object", "subtype" => EventRegistration::SUBTYPE, "owner_guid" => $entity->getGUID(), "limit" => 1, "metadata_name_value_pairs" => array("name" => "email", "value" => $email, "case_sensitive" => false));
if ($registrations = elgg_get_entities_from_metadata($options)) {
$registration = $registrations[0];
// generate unsubscribe code
$unsubscribe_code = event_manager_create_unsubscribe_code($registration, $entity);
$unsubscribe_link = elgg_normalize_url("events/unsubscribe/confirm/" . $registration->getGUID() . "/" . $unsubscribe_code);
// make a message with further instructions
$subject = elgg_echo("event_manager:unsubscribe:confirm:subject", array($entity->title));
$message = elgg_echo("event_manager:unsubscribe:confirm:message", array($registration->name, $entity->title, $entity->getURL(), $unsubscribe_link));
// nice e-mail addresses
$site = elgg_get_site_entity();
if ($site->email) {
$from = $site->name . " <" . $site->email . ">";
} else {
$from = $site->name . " <noreply@" . get_site_domain($site->getGUID()) . ">";
}
$to = $registration->name . " <" . $registration->email . ">";
if (elgg_send_email($from, $to, $subject, $message)) {
elgg_clear_sticky_form("event_unsubscribe");
$forward_url = $entity->getURL();
system_message(elgg_echo("event_manager:action:unsubscribe:success"));
} else {
register_error(elgg_echo("event_manager:action:unsubscribe:error:mail"));
}
} else {
register_error(elgg_echo("event_manager:action:unsubscribe:error:no_registration"));
}
} else {
register_error(elgg_echo("ClassException:ClassnameNotClass", array($guid, elgg_echo("item:object:" . Event::SUBTYPE))));
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:31,代码来源:unsubscribe.php
示例11: html_email_handler_send_email
/**
*
* This function sends out a full HTML mail. It can handle several options
*
* This function requires the options 'to' and ('html_message' or 'plaintext_message')
*
* @param $options Array in the format:
* to => STR|ARR of recipients in RFC-2822 format (http://www.faqs.org/rfcs/rfc2822.html)
* from => STR of senden in RFC-2822 format (http://www.faqs.org/rfcs/rfc2822.html)
* subject => STR with the subject of the message
* html_message => STR with the HTML version of the message
* plaintext_message STR with the plaintext version of the message
* cc => NULL|STR|ARR of CC recipients in RFC-2822 format (http://www.faqs.org/rfcs/rfc2822.html)
* bcc => NULL|STR|ARR of BCC recipients in RFC-2822 format (http://www.faqs.org/rfcs/rfc2822.html)
* date => NULL|UNIX timestamp with the date the message was created
*
* @return BOOL true|false
*/
function html_email_handler_send_email(array $options = null)
{
$result = false;
$site = elgg_get_site_entity();
// make site email
if (!empty($site->email)) {
$sendmail_from = $site->email;
$site_from = html_email_handler_make_rfc822_address($site);
} else {
// no site email, so make one up
$sendmail_from = "noreply@" . get_site_domain($site->getGUID());
$site_from = $sendmail_from;
if (!empty($site->name)) {
$site_name = $site->name;
if (strstr($site_name, ',')) {
$site_name = '"' . $site_name . '"';
// Protect the name with quotations if it contains a comma
}
$site_name = '=?UTF-8?B?' . base64_encode($site_name) . '?=';
// Encode the name. If may content nos ASCII chars.
$site_from = $site_name . " <" . $sendmail_from . ">";
}
}
$sendmail_options = html_email_handler_get_sendmail_options();
// set default options
$default_options = array("to" => array(), "from" => $site_from, "subject" => "", "html_message" => "", "plaintext_message" => "", "cc" => array(), "bcc" => array(), "date" => null);
// merge options
$options = array_merge($default_options, $options);
// check options
if (!empty($options["to"]) && !is_array($options["to"])) {
$options["to"] = array($options["to"]);
}
if (!empty($options["cc"]) && !is_array($options["cc"])) {
$options["cc"] = array($options["cc"]);
}
if (!empty($options["bcc"]) && !is_array($options["bcc"])) {
$options["bcc"] = array($options["bcc"]);
}
// can we send a message
if (!empty($options["to"]) && (!empty($options["html_message"]) || !empty($options["plaintext_message"]))) {
// start preparing
$boundary = uniqid($site->name);
// start building headers
$headers = "";
if (!empty($options["from"])) {
$headers .= "From: " . $options["from"] . PHP_EOL;
} else {
$headers .= "From: " . $site_from . PHP_EOL;
}
// check CC mail
if (!empty($options["cc"])) {
$headers .= "Cc: " . implode(", ", $options["cc"]) . PHP_EOL;
}
// check BCC mail
if (!empty($options["bcc"])) {
$headers .= "Bcc: " . implode(", ", $options["bcc"]) . PHP_EOL;
}
// add a date header
if (!empty($options["date"])) {
$headers .= "Date: " . date("r", $options["date"]) . PHP_EOL;
}
$headers .= "X-Mailer: PHP/" . phpversion() . PHP_EOL;
$headers .= "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-Type: multipart/alternative; boundary=\"" . $boundary . "\"" . PHP_EOL . PHP_EOL;
// start building the message
$message = "";
// TEXT part of message
if (!empty($options["plaintext_message"])) {
$message .= "--" . $boundary . PHP_EOL;
$message .= "Content-Type: text/plain; charset=\"utf-8\"" . PHP_EOL;
$message .= "Content-Transfer-Encoding: base64" . PHP_EOL . PHP_EOL;
$message .= chunk_split(base64_encode($options["plaintext_message"])) . PHP_EOL . PHP_EOL;
}
// HTML part of message
if (!empty($options["html_message"])) {
$message .= "--" . $boundary . PHP_EOL;
$message .= "Content-Type: text/html; charset=\"utf-8\"" . PHP_EOL;
$message .= "Content-Transfer-Encoding: base64" . PHP_EOL . PHP_EOL;
$message .= chunk_split(base64_encode($options["html_message"])) . PHP_EOL;
}
// Final boundry
$message .= "--" . $boundary . "--" . PHP_EOL;
//.........这里部分代码省略.........
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:101,代码来源:functions.php
示例12: simplesaml_get_user_attributes
/**
* Get the user attributes for the provided IDendtity Provider (IDP) configuration.
*
* These attributes will be send to an external Service Provider.
*
* @param string $idp_auth_id the name of the IDP configuration
*
* @return array an array with all the configured attributes
*/
function simplesaml_get_user_attributes($idp_auth_id)
{
$result = null;
$user = elgg_get_logged_in_user_entity();
if (!empty($idp_auth_id) && !empty($user)) {
$field_configuration = elgg_get_plugin_setting("idp_" . $idp_auth_id . "_attributes", "simplesaml");
$site = elgg_get_site_entity();
$result = array("uid" => array($user->username . "@" . get_site_domain($site->getGUID())));
if (!empty($field_configuration)) {
$field_configuration = json_decode($field_configuration, true);
foreach ($field_configuration as $profile_field => $attribute_name) {
if (!empty($attribute_name)) {
$value = $user->{$profile_field};
if (!empty($value)) {
if (!is_array($value)) {
$value = array($value);
}
$result[$attribute_name] = $value;
}
}
}
}
$params = array("user" => $user, "idp_auth_id" => $idp_auth_id, "attributes" => $result);
$result = elgg_trigger_plugin_hook("idp_attributes", "simplesaml", $params, $result);
}
return $result;
}
开发者ID:pleio,项目名称:simplesaml,代码行数:36,代码来源:functions.php
示例13: sprintf
$message = sprintf(elgg_echo('invitefriends:email'), $CONFIG->site->name, $_SESSION['user']->name, $emailmessage, $link);
// **** this should be replaced by a core function for sending emails to people who are not members
$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";
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:31,代码来源:invite.php
示例14: group_tools_invite_email
/**
* Invite a new user by email to a group
*
* @param ElggGroup $group the group to be invited for
* @param string $email the email address to be invited
* @param string $text (optional) extra text in the invitation
* @param boolean $resend should existing invitations be resend
*
* @return boolean|NULL true is invited, false on failure, null when already send
*/
function group_tools_invite_email(ElggGroup $group, $email, $text = "", $resend = false)
{
$result = false;
$loggedin_user = elgg_get_logged_in_user_entity();
if (!empty($group) && $group instanceof ElggGroup && !empty($email) && is_email_address($email) && !empty($loggedin_user)) {
// generate invite code
$invite_code = group_tools_generate_email_invite_code($group->getGUID(), $email);
if (!empty($invite_code)) {
$found_group = group_tools_check_group_email_invitation($invite_code, $group->getGUID());
if (empty($found_group) || $resend) {
// make site email
$site = elgg_get_site_entity();
if (!empty($site->email)) {
if (!empty($site->name)) {
$site_from = $site->name . " <" . $site->email . ">";
} else {
$site_from = $site->email;
}
} else {
// no site email, so make one up
if (!empty($site->name)) {
$site_from = $site->name . " <noreply@" . get_site_domain($site->getGUID()) . ">";
} else {
$site_from = "noreply@" . get_site_domain($site->getGUID());
}
}
if (empty($found_group)) {
// register invite with group
$group->annotate("email_invitation", $invite_code . "|" . $email, ACCESS_LOGGED_IN, $group->getGUID());
}
// make subject
$subject = elgg_echo("group_tools:groups:invite:email:subject", array($group->name));
// make body
$body = elgg_echo("group_tools:groups:invite:email:body", array($loggedin_user->name, $group->name, $site->name, $text, $site->name, elgg_get_site_url() . "register?group_invitecode=" . $invite_code, elgg_get_site_url() . "groups/invitations/?invitecode=" . $invite_code, $invite_code));
$params = array("group" => $group, "inviter" => $loggedin_user, "invitee" => $email);
$body = elgg_trigger_plugin_hook("invite_notification", "group_tools", $params, $body);
$result = elgg_send_email($site_from, $email, $subject, $body);
} else {
$result = null;
}
}
}
return $result;
}
开发者ID:pleio,项目名称:group_tools,代码行数:54,代码来源:functions.php
示例15: form_send_invitations
function form_send_invitations($invite_box_name, $form_data_id)
{
global $CONFIG;
$contacts = trim(get_input($invite_box_name . '_contacts', ''));
if ($contacts) {
$user_message = trim(get_input($invite_box_name . '_message', ''));
$url = $CONFIG->wwwroot . 'mod/form/display_object.php?d=' . $form_data_id;
$message = sprintf(elgg_echo('form:invite_message'), $_SESSION['user']->name, $url);
if ($user_message) {
$message .= sprintf(elgg_echo('form:user_message'), $user_message);
}
$user_list = array();
$email_address_list = array();
// handle comma separators
$contacts2 = explode(",", $contacts);
// handle new line separators as well
$contact_list = array();
foreach ($contacts2 as $contact) {
$contact_list = array_merge($contact_list, explode("\n", $contact));
}
foreach ($contact_list as $contact) {
$contact = trim($contact);
if (strpos($contact, '@') === false) {
$user = get_user_by_username($contact);
if ($user && ($user_id = $user->getGUID())) {
$user_list[] = $user_id;
}
} else {
$email_address_list[] = $contact;
}
}
$subject = sprintf(elgg_echo('form:invite_subject'), $_SESSION['user']->name);
if ($user_list) {
$from = $_SESSION['user']->getGUID();
//print_r($user_list);
//print $subject;
//print $message;
// need to force email for now as Elgg 1 notification does not seem to work without it
notify_user($user_list, $from, $subject, $message, null, array('email'));
}
if ($email_address_list) {
$site = get_entity($CONFIG->site_guid);
if ($site->email) {
// this should be defined as of Elgg 1.1
$from = $site->email;
} else {
$from = 'noreply@' . get_site_domain($CONFIG->site_guid);
}
form_send_email($email_address_list, $from, $subject, $message);
}
}
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:52,代码来源:model.php
示例16: elgg_get_site_url
continue;
}
if (get_user_by_email($email)) {
$error = TRUE;
$already_members[] = $email;
continue;
}
$link = elgg_get_site_url() . 'register?friend_guid=' . $current_user->guid . '&invitecode=' . generate_invite_code($current_user->username);
$message = elgg_echo('invitefriends:email', array($site->name, $current_user->name, $emailmessage, $link));
$subject = elgg_echo('invitefriends:subject', array($site->name));
// create the from address
$site = get_entity($site->guid);
if ($site && isset($site->email)) {
$from = $site->email;
} else {
$from = 'noreply@' . get_site_domain($site->guid);
}
elgg_send_email($from, $email, $subject, $message);
$sent_total++;
}
if ($error) {
register_error(elgg_echo('invitefriends:invitations_sent', array($sent_total)));
if (count($bad_emails) > 0) {
register_error(elgg_echo('invitefriends:email_error', array(implode(', ', $bad_emails))));
}
if (count($already_members) > 0) {
register_error(elgg_echo('invitefriends:already_members', array(implode(', ', $already_members))));
}
} else {
system_message(elgg_echo('invitefriends:success'));
}
开发者ID:redvabel,项目名称:Vabelgg,代码行数:31,代码来源:invite.php
示例17: email_notify_handler
/**
* Send a notification via email.
*
* @param ElggEntity $from The from user/site/object
* @param ElggUser $to To which user?
* @param string $subject The subject of the message.
* @param string $message The message body
* @param array $params Optional parameters (none taken in this instance)
* @return bool
*/
function email_notify_handler(ElggEntity $from, ElggUser $to, $subject, $message, array $params = NULL)
{
global $CONFIG;
if (!$from) {
throw new NotificationException(sprintf(elgg_echo('NotificationException:MissingParameter'), 'from'));
}
if (!$to) {
throw new NotificationException(sprintf(elgg_echo('NotificationException:MissingParameter'), 'to'));
}
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;
// From
$site = get_entity($CONFIG->site_guid);
// If there's an email address, use it - but only if its not from a user.
if (isset($from->email) && !$from instanceof ElggUser) {
$from = $from->email;
} else {
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}";
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
return mail($to, $subject, wordwrap($message), $headers);
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:81,代码来源:notification.php
示例18: facebookservice_api
function facebookservice_api()
{
global $CONFIG;
// Get site domain name as it is required for Facebook class
$site_domain = get_site_domain($CONFIG->site_guid);
elgg_load_library('facebook');
return new Facebook(array('appId' => elgg_get_plugin_setting('consumer_key', 'facebook_connect'), 'secret' => elgg_get_plugin_setting('consumer_secret', 'facebook_connect'), 'cookie' => true, 'domain' => $site_domain));
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:8,代码来源:facebook_connect.php
示例19: html_email_handler_make_rfc822_address
/**
*
* This function build an RFC822 compliant address
*
* This function requires the option 'entity'
*
* @param ElggEntity $entity entity to use as the basis for the address
*
* @return string with the correctly formatted address
*/
function html_email_handler_make_rfc822_address(ElggEntity $entity)
{
// get the email address of the entity
$email = $entity->email;
if (empty($email)) {
// no email found, fallback to site email
$site = elgg_get_site_entity();
$email = $site->email;
if (empty($email)) {
// no site email, default to noreply
$email = "noreply@" . get_site_domain($site->getGUID());
}
}
// build the RFC822 format
if (!empty($entity->name)) {
$name = $entity->name;
if (strstr($name, ',')) {
$name = '"' . $name . '"';
// Protect the name with quotations if it contains a comma
}
$name = '=?UTF-8?B?' . base64_encode($name) . '?=';
// Encode the name. If may content nos ASCII chars.
$email = $name . " <" . $email . ">";
}
return $email;
}
开发者ID:pingwangcs,项目名称:51zhaohu,代码行数:36,代码来源:functions.php
示例20: simplesaml_get_user_attributes
/**
* Get the user attributes for the provided IDendtity Provider (IDP) configuration.
*
* These attributes will be send to an external Service Provider.
*
* @param string $idp_auth_id the name of the IDP configuration
*
* @return void|array
*/
function simplesaml_get_user_attributes($idp_auth_id)
{
$user = elgg_get_logged_in_user_entity();
if (empty($idp_auth_id) || empty($user)) {
return;
}
$site = elgg_get_site_entity();
$result = ['uid' => [$user->username . '@' . get_site_domain($site->getGUID())]];
$field_configuration = elgg_get_plugin_setting("idp_{$idp_auth_id}_attributes", 'simplesaml');
if (!empty($field_configuration)) {
$field_configuration = json_decode($field_configuration, true);
foreach ($field_configuration as $profile_field => $attribute_name) {
if (empty($attribute_name)) {
continue;
}
$value = $user->{$profile_field};
if (empty($value)) {
continue;
}
if (!is_array($value)) {
$value = [$value];
}
$result[$attribute_name] = $value;
}
}
$params = ['user' => $user, 'idp_auth_id' => $idp_auth_id, 'attributes' => $result];
return elgg_trigger_plugin_hook('idp_attributes', 'simplesaml', $params, $result);
}
开发者ID:coldtrick,项目名称:simplesaml,代码行数:37,代码来源:functions.php
注:本文中的get_site_domain函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论