本文整理汇总了PHP中Mailer::set_thread方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::set_thread方法的具体用法?PHP Mailer::set_thread怎么用?PHP Mailer::set_thread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mailer
的用法示例。
在下文中一共展示了Mailer::set_thread方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: alert_watchers
/**
* alert watchers of this anchor
*
* @param array message attributes, such as 'subject', 'message', 'headers'
* @param string description of the on-going action (e.g., 'file:create')
* @param boolean TRUE if access to the target object is restricted, FALSE otherwise
* @return boolean TRUE on success, FALSE otherwise
*/
function alert_watchers($mail, $action = NULL, $restricted = FALSE)
{
global $context;
// do not notify watchers if overlay prevents it
if (is_object($this->overlay) && !$this->overlay->should_notify_watchers($mail)) {
return FALSE;
}
// list all items in the watching context
$containers = $this->get_watched_context($action);
// finalize the message
$mail['message'] = Mailer::build_notification($mail['notification'], 1);
// allow for message threading
if (!isset($mail['headers'])) {
$mail['headers'] = Mailer::set_thread($this->get_reference());
}
// we are private, so consider only watchers who are also editors
if ($this->item['active'] == 'N') {
$restricted = TRUE;
}
// list editors if access is restricted
$editors = NULL;
if ($restricted) {
$editors = Members::list_editors_for_member($this->get_focus(), 0, 10000, 'ids');
}
// do the job
return Users::alert_watchers($containers, $mail, $editors);
}
示例2: array_merge
$menu = array_merge($menu, array('sections/' => i18n::s('Site map')));
$menu = array_merge($menu, array('search.php' => i18n::s('Search')));
$menu = array_merge($menu, array('help/' => i18n::s('Help index')));
$follow_up .= Skin::build_list($menu, 'menu_bar');
$context['text'] .= Skin::build_block($follow_up, 'bottom');
// send a confirmation message to the surfer
if (isset($_REQUEST['edit_address']) && preg_match('/.+@.+/', $_REQUEST['edit_address']) && $link) {
// message recipient
$to = $_REQUEST['edit_address'];
// message subject
$subject = sprintf(i18n::s('Your query: %s'), strip_tags($_REQUEST['title']));
// message body
$message = sprintf(i18n::s("<p>Your query will now be reviewed by one of the associates of this community. It is likely that this will be done within the next 24 hours at the latest.</p><p>You can check the status of your query at the following address:</p><p>%s</p><p>We would like to thank you for your interest in our web site.</p>"), '<a href="' . $link . '">' . $link . '</a>');
// enable threading
if (isset($item['id'])) {
$headers = Mailer::set_thread('article:' . $item['id']);
} else {
$headers = '';
}
// actual post - don't stop on error
Mailer::notify(NULL, $to, $subject, $message, $headers);
}
// get the article back
$article = Anchors::get('article:' . $_REQUEST['id']);
// log the query submission
if (is_object($article)) {
$label = sprintf(i18n::c('New query: %s'), strip_tags($article->get_title()));
$link = $context['url_to_home'] . $context['url_to_root'] . $article->get_url();
$description = '<a href="' . $link . '">' . $link . '</a>' . "\n\n" . $article->get_teaser('basic');
Logger::notify('query.php: ' . $label, $description);
}
示例3: sprintf
$subject = sprintf(i18n::c('%s is following you'), strip_tags($follower->get_title()));
// headline
$headline = sprintf(i18n::c('%s is following you'), '<a href="' . $context['url_to_home'] . $context['url_to_root'] . $follower->get_url() . '">' . $follower->get_title() . '</a>');
// information
$message = '<p>' . sprintf(i18n::c('%s will receive notifications when you will update your followers at %s'), $follower->get_title(), $context['site_name']) . '</p>';
// assemble main content of this message
$message = Skin::build_mail_content($headline, $message);
// a set of links
$menu = array();
// call for action
$link = $context['url_to_home'] . $context['url_to_root'] . $follower->get_url();
$menu[] = Skin::build_mail_button($link, $follower->get_title(), TRUE);
// finalize links
$message .= Skin::build_mail_menu($menu);
// enable threading
$headers = Mailer::set_thread($follower->get_reference());
// allow for cross-referencing
Mailer::notify(Surfer::from(), $user['email'], $subject, $message, $headers);
}
// regular container
} else {
// always update the watch list
Members::assign($_REQUEST['member'], $_REQUEST['anchor']);
// editor link has to be added explicitly on non-private items
if (!$anchor->is_hidden() && (!isset($_REQUEST['assignment']) || $_REQUEST['assignment'] != 'editor')) {
} else {
Members::assign($_REQUEST['anchor'], $_REQUEST['member']);
}
}
// set editor
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'set' && isset($_REQUEST['editor']) && isset($_REQUEST['member'])) {
示例4: str_replace
$link = Sections::get_permalink($item);
if (!is_object($overlay) || !($label = $overlay->get_label('permalink_command', 'sections', FALSE))) {
$label = i18n::c('View the section');
}
$menu[] = Skin::build_mail_button($link, $label, TRUE);
// link to the container
if (is_object($anchor)) {
$link = $context['url_to_home'] . $context['url_to_root'] . $anchor->get_url();
$menu[] = Skin::build_mail_button($link, $anchor->get_title(), FALSE);
}
// finalize links
$message .= Skin::build_mail_menu($menu);
// provide a link that also authenticates surfers on click-through --see users/login.php
$message = str_replace(array(Sections::get_permalink($item), str_replace('&', '&', Sections::get_permalink($item))), $context['url_to_root'] . Users::get_login_url('visit', 'section:' . $item['id'], $user['id'], $item['handle']), $message);
// threads messages
$headers = Mailer::set_thread('section:' . $item['id']);
// get attachments from the overlay, if any
$attachments = NULL;
if (is_callable(array($overlay, 'get_invite_attachments'))) {
$attachments = $overlay->get_invite_attachments('PUBLISH');
}
// post it
if (Mailer::notify(Surfer::from(), $recipient, $subject, $message, $headers, $attachments)) {
$actual_names[] = htmlspecialchars($recipient);
}
}
Mailer::close();
// display the list of actual recipients
if ($actual_names) {
$context['text'] .= '<div>' . sprintf(i18n::s('Your message is being transmitted to %s'), Skin::finalize_list($actual_names, 'compact')) . '</div>';
} else {
示例5: array
$menu = array();
// call for action
$link = Categories::get_permalink($item);
if (!is_object($overlay) || !($label = $overlay->get_label('permalink_command', 'categories', FALSE))) {
$label = i18n::c('View the category');
}
$menu[] = Skin::build_mail_button($link, $label, TRUE);
// link to the container
if (is_object($anchor)) {
$link = $context['url_to_home'] . $context['url_to_root'] . $anchor->get_url();
$menu[] = Skin::build_mail_button($link, $anchor->get_title(), FALSE);
}
// finalize links
$message .= Skin::build_mail_menu($menu);
// threads messages
$headers = Mailer::set_thread('category:' . $item['id']);
// send the message
if (Mailer::notify(Surfer::from(), $to, $subject, $message, $headers)) {
// feed-back to the sender
$context['text'] .= '<p>' . i18n::s('A message has been sent to:') . "</p>\n" . '<ul>' . "\n";
foreach ($to as $address) {
$context['text'] .= '<li>' . encode_field($address) . '</li>' . "\n";
}
$context['text'] .= '</ul>' . "\n";
// back to the category page
$menu = array();
$menu[] = Skin::build_link(Categories::get_permalink($item), i18n::s('Done'), 'button');
$context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
}
Mailer::close();
// no recipient has been found
示例6: sprintf
} else {
// message title
$subject = sprintf(i18n::s('Your account at %s'), strip_tags($context['site_name']));
// top of the message
$message = '<p>' . sprintf(i18n::s('This message relates to your account at %s.'), '<a href="' . $context['url_to_home'] . $context['url_to_root'] . '">' . strip_tags($context['site_name']) . '</a>') . '</p>';
// mention nick name
$message .= '<p>' . sprintf(i18n::s('Your nick name is %s'), $item['nick_name']) . '</p>';
// direct link to login page --see users/login.php
$link = $context['url_to_home'] . $context['url_to_root'] . Users::get_login_url('login', $id, rand(1000, 9999), $item['handle']);
$message .= '<p>' . i18n::s('Record this message and use the following link to authenticate to the site at any time:') . '</p>' . '<p><a href="' . $link . '">' . $link . '</a></p>';
// caution note
$message .= '<p>' . i18n::s('Caution: This hyperlink contains your login credentials encrypted. Please be aware anyone who uses this link will have full access to your account.') . '</p>';
// bottom of the message
$message .= '<p>' . sprintf(i18n::s('On-line help is available at %s'), '<a href="' . $context['url_to_home'] . $context['url_to_root'] . 'help/' . '">' . $context['url_to_home'] . $context['url_to_root'] . 'help/' . '</a>') . '</p>' . '<p>' . sprintf(i18n::s('Thank you for your interest into %s.'), '<a href="' . $context['url_to_home'] . $context['url_to_root'] . '">' . strip_tags($context['site_name']) . '</a>') . '</p>';
// enable threading
$headers = Mailer::set_thread('user:' . $item['id']);
// post the confirmation message
Mailer::notify(NULL, $item['email'], $subject, $message, $headers);
// feed-back message
$context['text'] .= '<p>' . i18n::s('A reminder message has been sent to you. Check your mailbox and use provided information to authenticate to this site.') . '</p>';
// back to the anchor page
$links = array();
$links[] = Skin::build_link('users/login.php', i18n::s('Login'));
$context['text'] .= Skin::finalize_list($links, 'assistant_bar');
}
// redirect to the origin server
} elseif ($origin) {
Logger::error(sprintf(i18n::s('We are only keeping a shadow record for this profile. Please handle this account at %s'), Skin::build_link('http://' . $origin, $origin, 'external')));
// password is changing
} elseif (isset($_REQUEST['confirm'])) {
// restrictions: anyone can modify its own profile; associates can modify everything
示例7: remember
/**
* remember an action once it's done
*
* To be overloaded into derived class
*
* @param string the action 'insert', 'update' or 'delete'
* @param array the hosting record
* @param string reference of the hosting record (e.g., 'article:123')
* @return FALSE on error, TRUE otherwise
*/
function remember($action, $host, $reference)
{
global $context;
// remember the id of the master record
$id = $host['id'];
// set default values for this editor
Surfer::check_default_editor($this->attributes);
// we use the existing back-end for dates
include_once $context['path_to_root'] . 'dates/dates.php';
// build the update query
switch ($action) {
case 'delete':
// no need to notify participants after the date planned for the event, nor if the event has been initiated
if (isset($this->attributes['date_stamp']) && $this->attributes['date_stamp'] > gmstrftime('%Y-%m-%d %H:%M') && isset($this->attributes['status']) && $this->attributes['status'] != 'started' && $this->attributes['status'] != 'stopped') {
// send a cancellation message to participants
$query = "SELECT user_email FROM " . SQL::table_name('enrolments') . " WHERE (anchor LIKE '" . $reference . "') AND (approved LIKE 'Y')";
$result = SQL::query($query);
while ($item = SQL::fetch($result)) {
// sanity check
if (!preg_match(VALID_RECIPIENT, $item['user_email'])) {
continue;
}
// message title
$subject = sprintf('%s: %s', i18n::c('Cancellation'), strip_tags($this->anchor->get_title()));
// headline
$headline = sprintf(i18n::c('%s has cancelled %s'), Surfer::get_link(), $this->anchor->get_title());
// message to reader
$message = $this->get_invite_default_message('CANCEL');
// assemble main content of this message
$message = Skin::build_mail_content($headline, $message);
// threads messages
$headers = Mailer::set_thread($this->anchor->get_reference());
// get attachment from the overlay
$attachments = $this->get_invite_attachments('CANCEL');
// post it
Mailer::notify(Surfer::from(), $item['user_email'], $subject, $message, $headers, $attachments);
}
}
// delete dates for this anchor
Dates::delete_for_anchor($reference);
// also delete related enrolment records
$query = "DELETE FROM " . SQL::table_name('enrolments') . " WHERE anchor LIKE '" . $reference . "'";
SQL::query($query);
break;
case 'insert':
// bind one date to this record
if (isset($this->attributes['date_stamp']) && $this->attributes['date_stamp']) {
$fields = array();
$fields['anchor'] = $reference;
$fields['date_stamp'] = $this->attributes['date_stamp'];
// update the database
if (!($fields['id'] = Dates::post($fields))) {
Logger::error(i18n::s('Impossible to add an item.'));
return FALSE;
}
}
// enroll page creator
include_once $context['path_to_root'] . 'shared/enrolments.php';
enrolments::confirm($reference);
// reload the anchor through the cache to reflect the update
if ($reference) {
$this->anchor = Anchors::get($reference, TRUE);
}
// send a confirmation message to event creator
$query = "SELECT * FROM " . SQL::table_name('enrolments') . " WHERE (anchor LIKE '" . $reference . "')";
$result = SQL::query($query);
while ($item = SQL::fetch($result)) {
// a user registered on this server
if ($item['user_id'] && ($watcher = Users::get($item['user_id']))) {
// sanity check
if (!preg_match(VALID_RECIPIENT, $item['user_email'])) {
continue;
}
// use this email address
if ($watcher['full_name']) {
$recipient = Mailer::encode_recipient($watcher['email'], $watcher['full_name']);
} else {
$recipient = Mailer::encode_recipient($watcher['email'], $watcher['nick_name']);
}
// message title
$subject = sprintf(i18n::c('Meeting: %s'), strip_tags($this->anchor->get_title()));
// headline
$headline = sprintf(i18n::c('you have arranged %s'), '<a href="' . $context['url_to_home'] . $context['url_to_root'] . $this->anchor->get_url() . '">' . $this->anchor->get_title() . '</a>');
// message to reader
$message = $this->get_invite_default_message('PUBLISH');
// assemble main content of this message
$message = Skin::build_mail_content($headline, $message);
// a set of links
$menu = array();
// call for action
//.........这里部分代码省略.........
示例8: submit_page
//.........这里部分代码省略.........
$entry_fields['edit_id'] = $user['id'];
}
if (!isset($entry_fields['edit_address'])) {
$entry_fields['edit_address'] = $user['email'];
}
// we have to extend an existing article --this entity is mutable
if ($target && !strncmp($target, 'article:', 8) && ($article = Articles::get(substr($target, 8), TRUE))) {
// append the text to article description field
$fields = array();
$fields['id'] = $article['id'];
$fields['description'] = $article['description'] . $entry_fields['description'];
$fields['silent'] = TRUE;
Articles::put_attributes($fields);
return $target;
// we have to extend an existing comment --this entity is mutable
} elseif ($target && !strncmp($target, 'comment:', 8) && ($comment = Comments::get(substr($target, 8), TRUE))) {
// append the text to comment description field
$comment['description'] .= $entry_fields['description'];
Comments::post($comment);
return $target;
// we have to comment an existing page
} elseif (!strncmp($anchor, 'article:', 8)) {
// insert comment in the database
if (!($entry_fields['id'] = Comments::post($entry_fields))) {
Logger::remember('agents/messages.php: ' . Logger::error_pop());
return NULL;
}
// debug, if required to do so
if ($context['debug_messages'] == 'Y') {
Logger::remember('agents/messages.php: Messages::submit_page() as a comment', $entry_fields, 'debug');
}
// increment the post counter of the surfer
Users::increment_posts($user['id']);
// clear cache
$parent = Anchors::get($entry_fields['anchor']);
// touch the related anchor
if (is_object($parent) && isset($entry_fields['id'])) {
$parent->touch('comment:create', $entry_fields['id'], TRUE);
}
return 'comment:' . $entry_fields['id'];
// create a new page
} else {
// publish automatically, if required to do so
$section = Anchors::get($entry_fields['anchor']);
if (isset($context['users_with_auto_publish']) && $context['users_with_auto_publish'] == 'Y' || preg_match('/\\bauto_publish\\b/i', $options) || is_object($section) && $section->has_option('auto_publish')) {
$entry_fields['publish_date'] = gmstrftime('%Y-%m-%d %H:%M:%S', time());
if (!isset($entry_fields['publish_name'])) {
$entry_fields['publish_name'] = $user['nick_name'];
}
if (!isset($entry_fields['publish_id'])) {
$entry_fields['publish_id'] = $user['id'];
}
if (!isset($entry_fields['publish_address'])) {
$entry_fields['publish_address'] = $user['email'];
}
}
// ensure we are using ids instead of nicknames
if (is_object($section)) {
$entry_fields['anchor'] = $section->get_reference();
}
// save in the database
if (!($entry_fields['id'] = Articles::post($entry_fields))) {
Logger::remember('agents/messages.php: ' . Logger::error_pop());
return NULL;
}
// debugging log
if (isset($context['debug_messages']) && $context['debug_messages'] == 'Y') {
$entry_fields['description'] = substr($entry_fields['description'], 0, 1024);
Logger::remember('agents/messages.php: Messages::submit_page() as an article', $entry_fields, 'debug');
}
// increment the post counter of the surfer
Users::increment_posts($user['id']);
// do whatever is necessary on page creation
if (isset($entry_fields['publish_date']) && $entry_fields['publish_date'] > NULL_DATE) {
Articles::finalize_publication($section, $entry_fields);
} else {
Articles::finalize_submission($section, $entry_fields);
}
// get the new item
$article = Anchors::get($anchor);
// if replies are allowed
if (!preg_match('/\\bno_reply\\b/i', $options)) {
// let the sender know about his post
if (isset($entry_fields['publish_date']) && $entry_fields['publish_date'] > NULL_DATE) {
$splash = i18n::s("The page received by e-mail has been successfully published. Please review it now to ensure that it reflects your mind.");
} else {
$splash = i18n::s("The page received by e-mail has been posted. Don't forget to read it online. Then click on the Publish command to make it publicly available.");
}
$message = '<p>' . $splash . '</p>' . '<p><a href="' . $context['url_to_home'] . $context['url_to_root'] . $article->get_url() . '">' . $article->get_title() . '</a></p>' . '<div>' . $article->get_teaser('basic') . '</div>' . '<p>' . i18n::c('Thank you for your contribution') . '</p>';
// enable threading
$headers = Mailer::set_thread($section);
// send a mail message
Mailer::notify(NULL, $post_sender, 'Re: ' . $post_subject, $message, $headers);
}
// reference to the new page
return 'article:' . $entry_fields['id'];
}
// job ends
return NULL;
}
示例9: finalize_update
/**
* do whatever is necessary when a page has been updated
*
* This function:
* - logs the update
* - sends notification to watchers and to followers
* - "touches" the container of the page,
* - ping referred pages remotely (via the pingback protocol)
* - ping selected servers, if any
* - and triggers the hook 'update'.
*
* The first parameter provides the watching context to consider. If call is related
* to the creation of a published page, the context is the section that hosts the new
* page. If call is related to a draft page that has been published, then the context
* is the page itself.
*
* This function is also able to notify followers of the surfer who has initiated the
* action.
*
* @param object the watching context
* @param array attributes of the published page
* @param object page overlay, if any
* @param boolean TRUE if dates should be left unchanged, FALSE otherwise
* @param boolean TRUE if watchers should be notified, FALSE otherwise
* @param boolean TRUE if followers should be notified, FALSE otherwise
*/
public static function finalize_update($anchor, $item, $overlay = NULL, $silently = FALSE, $with_watchers = TRUE, $with_followers = FALSE)
{
global $context;
// proceed only if the page has been published
if (isset($item['publish_date']) && $item['publish_date'] > NULL_DATE) {
// notification to send by e-mail
$mail = array();
$mail['subject'] = sprintf(i18n::c('%s: %s'), i18n::c('Update'), strip_tags($item['title']));
$mail['notification'] = Articles::build_notification('update', $item);
$mail['headers'] = Mailer::set_thread('article:' . $item['id']);
// allow the overlay to prevent notifications of watcherss
if (is_object($overlay) && !$overlay->should_notify_watchers($mail)) {
$with_watchers = FALSE;
}
// send to watchers of this page, and to watchers upwards
if ($with_watchers && ($handle = new Article())) {
$handle->load_by_content($item, $anchor);
$handle->alert_watchers($mail, 'article:update', $item['active'] == 'N');
}
// never notify followers on private pages
if (isset($item['active']) && $item['active'] == 'N') {
$with_followers = FALSE;
}
// allow the overlay to prevent notifications of followers
if (is_object($overlay) && !$overlay->should_notify_followers()) {
$with_followers = FALSE;
}
// send to followers of this user
if ($with_followers && Surfer::get_id()) {
$mail['message'] = Mailer::build_notification($mail['notification'], 2);
Users::alert_watchers('user:' . Surfer::get_id(), $mail);
}
// update anchors
$anchor->touch('article:update', $item['id'], $silently);
// advertise public pages
if (isset($item['active']) && $item['active'] == 'Y') {
// expose links within the page
$raw = '';
if (isset($item['introduction'])) {
$raw .= $item['introduction'];
}
if (isset($item['source'])) {
$raw .= ' ' . $item['source'];
}
if (isset($item['description'])) {
$raw .= ' ' . $item['description'];
}
// pingback to referred links, if any
include_once $context['path_to_root'] . 'links/links.php';
Links::ping($raw, 'article:' . $item['id']);
// ping servers, if any
Servers::notify($anchor->get_url());
}
}
// 'update' hook
if (is_callable(array('Hooks', 'include_scripts'))) {
Hooks::include_scripts('update', $item['id']);
}
// log page update
$label = sprintf(i18n::c('Update: %s'), strip_tags($item['title']));
$poster = Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']);
$description = sprintf(i18n::c('Updated by %s in %s'), $poster, $anchor->get_title());
$description .= "\n\n" . '<a href="' . Articles::get_permalink($item) . '">' . $item['title'] . '</a>';
Logger::notify('articles/articles.php: ' . $label, $description);
}
示例10: elseif
// create a new section
} elseif (!($_REQUEST['id'] = Sections::post($_REQUEST))) {
$item = $_REQUEST;
$with_form = TRUE;
// successful post
} else {
// post an overlay, with the new section id --don't stop on error
if (is_object($overlay)) {
$overlay->remember('insert', $_REQUEST, 'section:' . $_REQUEST['id']);
}
// notification to send by e-mail
$mail = array();
$anchor_title = is_object($anchor) ? strip_tags($anchor->get_title()) : i18n::s('Root');
$mail['subject'] = sprintf(i18n::c('%s: %s'), $anchor_title, strip_tags($_REQUEST['title']));
$mail['notification'] = Sections::build_notification('create', $_REQUEST);
$mail['headers'] = Mailer::set_thread('section:' . $_REQUEST['id']);
// touch the related anchor
if (is_object($anchor)) {
// send to watchers of this anchor
if (isset($_REQUEST['notify_watchers']) && $_REQUEST['notify_watchers'] == 'Y') {
$anchor->alert_watchers($mail, 'section:create', $_REQUEST['active'] == 'N');
}
// update anchors
$anchor->touch('section:create', $_REQUEST['id'], isset($_REQUEST['silent']) && $_REQUEST['silent'] == 'Y');
}
// send to followers of this user
if (isset($_REQUEST['notify_followers']) && $_REQUEST['notify_followers'] == 'Y' && Surfer::get_id() && $_REQUEST['active'] != 'N') {
$mail['message'] = Mailer::build_notification($mail['notification'], 2);
Users::alert_watchers('user:' . Surfer::get_id(), $mail);
}
// increment the post counter of the surfer
示例11: foreach
}
// add this page to watch lists
Members::assign('article:' . $article['id'], 'user:' . Surfer::get_id());
foreach ($items as $item) {
if (isset($item['id'])) {
Members::assign('article:' . $article['id'], 'user:' . $item['id']);
}
}
// email has to be activated
if (isset($context['with_email']) && $context['with_email'] == 'Y') {
// contact target user by e-mail
$mail = array();
$mail['subject'] = sprintf(i18n::c('Private message: %s'), strip_tags($article['title']));
$mail['message'] = Articles::build_notification('message', $article, $overlay);
// enable threading
$mail['headers'] = Mailer::set_thread('article:' . $article['id'], $anchor);
// each recipient, one at a time
foreach ($items as $item) {
// you cannot write to yourself
if (isset($item['id']) && Surfer::get_id() == $item['id']) {
continue;
}
// target recipient does not accept messages
if (isset($item['without_messages']) && $item['without_messages'] == 'Y') {
continue;
}
// target is known here
if (isset($item['id'])) {
// suggest to change user preferences if applicable
$mail['message'] .= '<p> </p>' . '<p>' . i18n::c('To prevent other members from contacting you, please visit your profile at the following address, and change preferences.') . '</p>' . '<p>' . $context['url_to_master'] . $context['url_to_root'] . Users::get_permalink($item) . '</p>';
// alert the target user
示例12: sprintf
$subject = sprintf(i18n::c('%s: %s'), i18n::c('Meeting'), strip_tags($anchor->get_title()));
// headline
$headline = sprintf(i18n::c('%s has confirmed your participation to %s'), Surfer::get_link(), '<a href="' . $context['url_to_home'] . $context['url_to_root'] . $anchor->get_url() . '">' . $anchor->get_title() . '</a>');
// message confirmation
$message = $overlay->get_invite_default_message('PUBLISH');
// assemble main content of this message
$message = Skin::build_mail_content($headline, $message);
// a set of links
$menu = array();
// call for action
$link = $context['url_to_home'] . $context['url_to_root'] . $anchor->get_url();
$menu[] = Skin::build_mail_button($link, $anchor->get_title(), TRUE);
// finalize links
$message .= Skin::build_mail_menu($menu);
// threads messages
$headers = Mailer::set_thread($anchor->get_reference());
// get attachments from the overlay, if any
$attachments = $overlay->get_invite_attachments('PUBLISH');
// send the message
Mailer::notify(Surfer::from(), $recipient, $subject, $message, $headers, $attachments);
// report on this notification
$enrolled_names[] = htmlspecialchars($recipient);
}
}
}
// display the list of actual recipients
if ($enrolled_names) {
$context['text'] .= '<div style="margin-bottom: 2em">' . Skin::build_block(i18n::s('Following persons have been notified of their enrolment by e-mail') . Skin::finalize_list($enrolled_names, 'compact'), 'note') . '</div>';
}
// splash
switch ($overlay->get_value('enrolment')) {
示例13: put
//.........这里部分代码省略.........
Logger::error(i18n::s('Another member already has this nick name. Please select a different one.'));
return FALSE;
}
// ensure we have a full name
if (!isset($fields['full_name']) || !trim($fields['full_name'])) {
$fields['full_name'] = $fields['nick_name'];
}
// protect from hackers
if (isset($fields['avatar_url'])) {
$fields['avatar_url'] = encode_link($fields['avatar_url']);
}
// set default values
if (!isset($fields['active']) || !$fields['active']) {
$fields['active'] = 'Y';
}
if (isset($fields['selected_editor'])) {
$fields['editor'] = $fields['selected_editor'];
} elseif (isset($context['users_default_editor'])) {
$fields['editor'] = $context['users_default_editor'];
} else {
$fields['editor'] = 'yacs';
}
if (!isset($fields['interface']) || $fields['interface'] != 'C') {
$fields['interface'] = 'I';
}
if (!isset($fields['with_newsletters']) || $fields['with_newsletters'] != 'Y') {
$fields['with_newsletters'] = 'N';
}
if (!isset($fields['without_alerts']) || $fields['without_alerts'] != 'N') {
$fields['without_alerts'] = 'Y';
}
if (!isset($fields['without_confirmations']) || $fields['without_confirmations'] != 'N') {
$fields['without_confirmations'] = 'Y';
}
if (!isset($fields['without_messages']) || $fields['without_messages'] != 'N') {
$fields['without_messages'] = 'Y';
}
if (!isset($fields['birth_date']) || !$fields['birth_date']) {
$fields['birth_date'] = NULL_DATE;
}
// clean provided tags
if (isset($fields['tags'])) {
$fields['tags'] = trim($fields['tags'], " \t.:,!?");
}
// save new settings in session and in cookie
if (Surfer::is($fields['id'])) {
// change preferred editor
$_SESSION['surfer_editor'] = $fields['editor'];
Safe::setcookie('surfer_editor', $fields['editor'], NULL, '/');
// change preferred language
if (isset($fields['language']) && $_SESSION['surfer_language'] != $fields['language']) {
$_SESSION['surfer_language'] = $fields['language'];
$_SESSION['l10n_modules'] = array();
}
}
}
// update an existing record
$query = "UPDATE " . SQL::table_name('users') . " SET ";
// change only the password
if (isset($fields['password'])) {
$query .= "password='" . SQL::escape($fields['password']) . "'";
} else {
$query .= "email='" . SQL::escape(isset($fields['email']) ? $fields['email'] : '') . "', " . "aim_address='" . SQL::escape(isset($fields['aim_address']) ? $fields['aim_address'] : '') . "', " . "alternate_number='" . SQL::escape(isset($fields['alternate_number']) ? $fields['alternate_number'] : '') . "', " . "avatar_url='" . SQL::escape(isset($fields['avatar_url']) ? $fields['avatar_url'] : '') . "', " . "birth_date='" . SQL::escape($fields['birth_date']) . "', " . "description='" . SQL::escape(isset($fields['description']) ? $fields['description'] : '') . "', " . "editor='" . SQL::escape($fields['editor']) . "', " . "from_where='" . SQL::escape(isset($fields['from_where']) ? $fields['from_where'] : '') . "', " . "full_name='" . SQL::escape(isset($fields['full_name']) ? $fields['full_name'] : '') . "', " . "icq_address='" . SQL::escape(isset($fields['icq_address']) ? $fields['icq_address'] : '') . "', " . "interface='" . SQL::escape($fields['interface']) . "', " . "introduction='" . SQL::escape(isset($fields['introduction']) ? $fields['introduction'] : '') . "', " . "irc_address='" . SQL::escape(isset($fields['irc_address']) ? $fields['irc_address'] : '') . "', " . "jabber_address='" . SQL::escape(isset($fields['jabber_address']) ? $fields['jabber_address'] : '') . "', " . "language='" . SQL::escape(isset($fields['language']) ? $fields['language'] : 'none') . "', " . "msn_address='" . SQL::escape(isset($fields['msn_address']) ? $fields['msn_address'] : '') . "', " . "nick_name='" . SQL::escape($fields['nick_name']) . "', " . "options='" . SQL::escape(isset($fields['options']) ? $fields['options'] : '') . "', " . "overlay='" . SQL::escape(isset($fields['overlay']) ? $fields['overlay'] : '') . "'," . "overlay_id='" . SQL::escape(isset($fields['overlay_id']) ? $fields['overlay_id'] : '') . "'," . "pgp_key='" . SQL::escape(isset($fields['pgp_key']) ? $fields['pgp_key'] : '') . "', " . "phone_number='" . SQL::escape(isset($fields['phone_number']) ? $fields['phone_number'] : '') . "', " . "signature='" . SQL::escape(isset($fields['signature']) ? $fields['signature'] : '') . "', " . "skype_address='" . SQL::escape(isset($fields['skype_address']) ? $fields['skype_address'] : '') . "', " . "tags='" . SQL::escape(isset($fields['tags']) ? $fields['tags'] : '') . "', " . "twitter_address='" . SQL::escape(isset($fields['twitter_address']) ? $fields['twitter_address'] : '') . "', " . "vcard_agent='" . SQL::escape(isset($fields['vcard_agent']) ? $fields['vcard_agent'] : '') . "', " . "vcard_label='" . SQL::escape(isset($fields['vcard_label']) ? $fields['vcard_label'] : '') . "', " . "vcard_organization='" . SQL::escape(isset($fields['vcard_organization']) ? $fields['vcard_organization'] : '') . "', " . "vcard_title='" . SQL::escape(isset($fields['vcard_title']) ? $fields['vcard_title'] : '') . "', " . "web_address='" . SQL::escape(isset($fields['web_address']) ? $fields['web_address'] : '') . "', " . "with_newsletters='" . $fields['with_newsletters'] . "', " . "without_alerts='" . $fields['without_alerts'] . "', " . "without_confirmations='" . $fields['without_confirmations'] . "', " . "without_messages='" . $fields['without_messages'] . "', " . "yahoo_address='" . SQL::escape(isset($fields['yahoo_address']) ? $fields['yahoo_address'] : '') . "'";
// fields set only by associates -- see users/edit.php
if (Surfer::is_associate()) {
$query .= ", " . "capability='" . SQL::escape($fields['capability']) . "', " . "active='" . SQL::escape($fields['active']) . "'";
}
}
// maybe a silent update
if (!isset($fields['silent']) || $fields['silent'] != 'Y') {
$query .= ", " . "edit_name='" . SQL::escape($fields['edit_name']) . "', " . "edit_id=" . SQL::escape($fields['edit_id']) . ", " . "edit_address='" . SQL::escape($fields['edit_address']) . "', " . "edit_action='user:update', " . "edit_date='" . SQL::escape($fields['edit_date']) . "'";
}
// actual update query
$query .= " WHERE id = " . SQL::escape($item['id']);
SQL::query($query, FALSE, $context['users_connection']);
// list the user in categories
if (isset($fields['tags']) && $fields['tags']) {
Categories::remember('user:' . $item['id'], NULL_DATE, $fields['tags']);
}
// clear all the cache on profile update, because of avatars, etc.
$fields['id'] = $item['id'];
Users::clear($fields);
// send a confirmation message on password change
if (isset($context['with_email']) && $context['with_email'] == 'Y' && isset($fields['confirm']) && $item['email'] && $item['without_confirmations'] != 'Y') {
// message title
$subject = sprintf(i18n::s('Your account at %s'), strip_tags($context['site_name']));
// message body
$message = '<p>' . sprintf(i18n::s('This message has been automatically sent to you to confirm a change of your profile at %s.'), '<a href="' . $context['url_to_master'] . $context['url_to_root'] . '">' . strip_tags($context['site_name']) . '</a>') . '</p>' . '<p>' . sprintf(i18n::s('Your nick name is %s'), $item['nick_name']) . BR . sprintf(i18n::s('Authenticate with password %s'), $fields['confirm']) . '</p>' . '<p>' . sprintf(i18n::s('On-line help is available at %s'), '<a href="' . $context['url_to_home'] . $context['url_to_root'] . 'help/' . '">' . $context['url_to_home'] . $context['url_to_root'] . 'help/' . '</a>') . '</p>' . '<p>' . sprintf(i18n::s('Thank you for your interest into %s.'), '<a href="' . $context['url_to_master'] . $context['url_to_root'] . '">' . strip_tags($context['site_name']) . '</a>') . '</p>';
// enable threading
$headers = Mailer::set_thread('user:' . $item['id']);
// post the confirmation message
Mailer::notify(NULL, $item['email'], $subject, $message, $headers);
}
// update user session
if (isset($fields['nick_name']) && Surfer::get_id() && $fields['id'] == Surfer::get_id() && is_callable(array('Surfer', 'set'))) {
Surfer::set($fields);
}
// end of job
return TRUE;
}