本文整理汇总了PHP中messenger::subject方法的典型用法代码示例。如果您正苦于以下问题:PHP messenger::subject方法的具体用法?PHP messenger::subject怎么用?PHP messenger::subject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类messenger
的用法示例。
在下文中一共展示了messenger::subject方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
$user->add_lang('acp/email');
$this->tpl_name = 'acp_email';
$this->page_title = 'ACP_MASS_EMAIL';
$form_key = 'acp_email';
add_form_key($form_key);
// Set some vars
$submit = isset($_POST['submit']) ? true : false;
$error = array();
$usernames = request_var('usernames', '', true);
$group_id = request_var('g', 0);
$subject = utf8_normalize_nfc(request_var('subject', '', true));
$message = utf8_normalize_nfc(request_var('message', '', true));
// Do the job ...
if ($submit) {
// Error checking needs to go here ... if no subject and/or no message then skip
// over the send and return to the form
$use_queue = isset($_POST['send_immediately']) ? false : true;
$priority = request_var('mail_priority_flag', MAIL_NORMAL_PRIORITY);
if (!check_form_key($form_key)) {
$error[] = $user->lang['FORM_INVALID'];
}
if (!$subject) {
$error[] = $user->lang['NO_EMAIL_SUBJECT'];
}
if (!$message) {
$error[] = $user->lang['NO_EMAIL_MESSAGE'];
}
if (!sizeof($error)) {
if ($usernames) {
// If giving usernames the admin is able to email inactive users too...
$sql = 'SELECT username, user_email, user_jabber, user_notify_type, user_lang
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('username_clean', array_map('utf8_clean_string', explode("\n", $usernames))) . '
AND user_allow_massemail = 1
ORDER BY user_lang, user_notify_type';
// , SUBSTRING(user_email FROM INSTR(user_email, '@'))
} else {
if ($group_id) {
$sql_ary = array('SELECT' => 'u.user_email, u.username, u.username_clean, u.user_lang, u.user_jabber, u.user_notify_type', 'FROM' => array(USERS_TABLE => 'u', USER_GROUP_TABLE => 'ug'), 'WHERE' => 'ug.group_id = ' . $group_id . '
AND ug.user_pending = 0
AND u.user_id = ug.user_id
AND u.user_allow_massemail = 1
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')', 'ORDER_BY' => 'u.user_lang, u.user_notify_type');
} else {
$sql_ary = array('SELECT' => 'u.username, u.username_clean, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => 'u.user_allow_massemail = 1
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')', 'ORDER_BY' => 'u.user_lang, u.user_notify_type');
}
// Mail banned or not
if (!isset($_REQUEST['mail_banned_flag'])) {
$sql_ary['WHERE'] .= ' AND (b.ban_id IS NULL
OR b.ban_exclude = 1)';
$sql_ary['LEFT_JOIN'] = array(array('FROM' => array(BANLIST_TABLE => 'b'), 'ON' => 'u.user_id = b.ban_userid'));
}
$sql = $db->sql_build_query('SELECT', $sql_ary);
}
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
if (!$row) {
$db->sql_freeresult($result);
trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$i = $j = 0;
// Send with BCC, no more than 50 recipients for one mail (to not exceed the limit)
$max_chunk_size = 50;
$email_list = array();
$old_lang = $row['user_lang'];
$old_notify_type = $row['user_notify_type'];
do {
if ($row['user_notify_type'] == NOTIFY_EMAIL && $row['user_email'] || $row['user_notify_type'] == NOTIFY_IM && $row['user_jabber'] || $row['user_notify_type'] == NOTIFY_BOTH && ($row['user_email'] || $row['user_jabber'])) {
if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type) {
$i = 0;
if (sizeof($email_list)) {
$j++;
}
$old_lang = $row['user_lang'];
$old_notify_type = $row['user_notify_type'];
}
$email_list[$j][$i]['lang'] = $row['user_lang'];
$email_list[$j][$i]['method'] = $row['user_notify_type'];
$email_list[$j][$i]['email'] = $row['user_email'];
$email_list[$j][$i]['name'] = $row['username'];
$email_list[$j][$i]['jabber'] = $row['user_jabber'];
$i++;
}
} while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
// Send the messages
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
$messenger = new messenger($use_queue);
$errored = false;
for ($i = 0, $size = sizeof($email_list); $i < $size; $i++) {
$used_lang = $email_list[$i][0]['lang'];
$used_method = $email_list[$i][0]['method'];
for ($j = 0, $list_size = sizeof($email_list[$i]); $j < $list_size; $j++) {
$email_row = $email_list[$i][$j];
//.........这里部分代码省略.........
示例2: messenger
$result = $db->sql_query($sql);
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$email_tpl = $user_id ? 'profile_send_email' : 'email_notify';
$mail_to_users = array();
$mail_to_users[] = array('email_lang' => $email_lang, 'email' => $email, 'name' => $name, 'username' => $user_id ? $row['username'] : '', 'to_name' => $name, 'user_jabber' => $user_id ? $row['user_jabber'] : '', 'user_notify_type' => $user_id ? $row['user_notify_type'] : NOTIFY_EMAIL, 'topic_title' => !$user_id ? $row['topic_title'] : '', 'forum_id' => !$user_id ? $row['forum_id'] : 0);
// Ok, now the same email if CC specified, but without exposing the users email address
if ($cc) {
$mail_to_users[] = array('email_lang' => $user->data['user_lang'], 'email' => $user->data['user_email'], 'name' => $user->data['username'], 'username' => $user->data['username'], 'to_name' => $name, 'user_jabber' => $user->data['user_jabber'], 'user_notify_type' => $user_id ? $user->data['user_notify_type'] : NOTIFY_EMAIL, 'topic_title' => !$user_id ? $row['topic_title'] : '', 'forum_id' => !$user_id ? $row['forum_id'] : 0);
}
foreach ($mail_to_users as $row) {
$messenger->template($email_tpl, $row['email_lang']);
$messenger->replyto($user->data['user_email']);
$messenger->to($row['email'], $row['name']);
if ($user_id) {
$messenger->subject(htmlspecialchars_decode($subject));
$messenger->im($row['user_jabber'], $row['username']);
$notify_type = $row['user_notify_type'];
} else {
$notify_type = NOTIFY_EMAIL;
}
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
$messenger->assign_vars(array('BOARD_CONTACT' => $config['board_contact'], 'TO_USERNAME' => htmlspecialchars_decode($row['to_name']), 'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']), 'MESSAGE' => htmlspecialchars_decode($message)));
if ($topic_id) {
$messenger->assign_vars(array('TOPIC_NAME' => htmlspecialchars_decode($row['topic_title']), 'U_TOPIC' => generate_board_url() . "/viewtopic.{$phpEx}?f=" . $row['forum_id'] . "&t={$topic_id}"));
}
$messenger->send($notify_type);
}
示例3: send
/**
* Send the email
*
* @param \messenger $messenger
* @param string $contact
* @return null
*/
public function send(\messenger $messenger, $contact)
{
if (!sizeof($this->recipients)) {
return;
}
foreach ($this->recipients as $recipient) {
$messenger->template($this->template, $recipient['lang']);
$messenger->replyto($this->sender_address);
$messenger->to($recipient['address'], $recipient['name']);
$messenger->im($recipient['jabber'], $recipient['username']);
$messenger->headers('X-AntiAbuse: Board servername - ' . $this->server_name);
$messenger->headers('X-AntiAbuse: User IP - ' . $this->sender_ip);
if ($this->sender_id) {
$messenger->headers('X-AntiAbuse: User_id - ' . $this->sender_id);
}
if ($this->sender_username) {
$messenger->headers('X-AntiAbuse: Username - ' . $this->sender_username);
}
$messenger->subject(htmlspecialchars_decode($this->subject));
$messenger->assign_vars(array('BOARD_CONTACT' => $contact, 'TO_USERNAME' => htmlspecialchars_decode($recipient['to_name']), 'FROM_USERNAME' => htmlspecialchars_decode($this->sender_name), 'MESSAGE' => htmlspecialchars_decode($this->body)));
if (sizeof($this->template_vars)) {
$messenger->assign_vars($this->template_vars);
}
$messenger->send($recipient['notify_type']);
}
}
示例4: main
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $cache, $phpbb_log, $request;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $phpbb_dispatcher;
$user->add_lang('acp/email');
$this->tpl_name = 'acp_email';
$this->page_title = 'ACP_MASS_EMAIL';
$form_key = 'acp_email';
add_form_key($form_key);
// Set some vars
$submit = isset($_POST['submit']) ? true : false;
$error = array();
$usernames = $request->variable('usernames', '', true);
$usernames = !empty($usernames) ? explode("\n", $usernames) : array();
$group_id = $request->variable('g', 0);
$subject = $request->variable('subject', '', true);
$message = $request->variable('message', '', true);
// Do the job ...
if ($submit) {
// Error checking needs to go here ... if no subject and/or no message then skip
// over the send and return to the form
$use_queue = isset($_POST['send_immediately']) ? false : true;
$priority = $request->variable('mail_priority_flag', MAIL_NORMAL_PRIORITY);
if (!check_form_key($form_key)) {
$error[] = $user->lang['FORM_INVALID'];
}
if (!$subject) {
$error[] = $user->lang['NO_EMAIL_SUBJECT'];
}
if (!$message) {
$error[] = $user->lang['NO_EMAIL_MESSAGE'];
}
if (!sizeof($error)) {
if (!empty($usernames)) {
// If giving usernames the admin is able to email inactive users too...
$sql_ary = array('SELECT' => 'username, user_email, user_jabber, user_notify_type, user_lang', 'FROM' => array(USERS_TABLE => ''), 'WHERE' => $db->sql_in_set('username_clean', array_map('utf8_clean_string', $usernames)) . '
AND user_allow_massemail = 1', 'ORDER_BY' => 'user_lang, user_notify_type');
} else {
if ($group_id) {
$sql_ary = array('SELECT' => 'u.user_email, u.username, u.username_clean, u.user_lang, u.user_jabber, u.user_notify_type', 'FROM' => array(USERS_TABLE => 'u', USER_GROUP_TABLE => 'ug'), 'WHERE' => 'ug.group_id = ' . $group_id . '
AND ug.user_pending = 0
AND u.user_id = ug.user_id
AND u.user_allow_massemail = 1
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')', 'ORDER_BY' => 'u.user_lang, u.user_notify_type');
} else {
$sql_ary = array('SELECT' => 'u.username, u.username_clean, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => 'u.user_allow_massemail = 1
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')', 'ORDER_BY' => 'u.user_lang, u.user_notify_type');
}
// Mail banned or not
if (!isset($_REQUEST['mail_banned_flag'])) {
$sql_ary['WHERE'] .= ' AND (b.ban_id IS NULL
OR b.ban_exclude = 1)';
$sql_ary['LEFT_JOIN'] = array(array('FROM' => array(BANLIST_TABLE => 'b'), 'ON' => 'u.user_id = b.ban_userid'));
}
}
/**
* Modify sql query to change the list of users the email is sent to
*
* @event core.acp_email_modify_sql
* @var array sql_ary Array which is used to build the sql query
* @since 3.1.2-RC1
*/
$vars = array('sql_ary');
extract($phpbb_dispatcher->trigger_event('core.acp_email_modify_sql', compact($vars)));
$sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
if (!$row) {
$db->sql_freeresult($result);
trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$i = $j = 0;
// Send with BCC
// Maximum number of bcc recipients
$max_chunk_size = (int) $config['email_max_chunk_size'];
$email_list = array();
$old_lang = $row['user_lang'];
$old_notify_type = $row['user_notify_type'];
do {
if ($row['user_notify_type'] == NOTIFY_EMAIL && $row['user_email'] || $row['user_notify_type'] == NOTIFY_IM && $row['user_jabber'] || $row['user_notify_type'] == NOTIFY_BOTH && ($row['user_email'] || $row['user_jabber'])) {
if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type) {
$i = 0;
if (sizeof($email_list)) {
$j++;
}
$old_lang = $row['user_lang'];
$old_notify_type = $row['user_notify_type'];
}
$email_list[$j][$i]['lang'] = $row['user_lang'];
$email_list[$j][$i]['method'] = $row['user_notify_type'];
$email_list[$j][$i]['email'] = $row['user_email'];
$email_list[$j][$i]['name'] = $row['username'];
$email_list[$j][$i]['jabber'] = $row['user_jabber'];
$i++;
}
} while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
// Send the messages
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
//.........这里部分代码省略.........
示例5: send_email
/**
* Sends out an email.
*
* @todo Needs major work still...
*/
private function send_email()
{
global $user;
trigger_error('Send Email method is still under development ;)' . E_USER_ERROR);
// setup the e-mail for the founders
if (!class_exists('messenger')) {
include $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
}
$messenger = new messenger(false);
// use the specified email language template according tho this users' language settings.
$messenger->template($this->email_tpl, $user->data['lang']);
// Set the "to" header.
// @todo Set email
// $messenger->to(NOTIFICATION_EMAIL, 'Greg');
// E-mail subject
$messenger->subject(htmlspecialchars_decode($this->subject));
// set some X-AntiAbuse headers, may not be needed but...
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $user_id);
$messenger->headers('X-AntiAbuse: Username - ' . $username);
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
// Assign variables for the MVC to be used in the e-mail template
$messenger->assign_vars(array('TO_USERNAME' => 'Greg Head', 'MESSAGE' => $message, 'SUBJECT' => $subject, 'AMOUNT' => $this->data['mc_gross'], 'PAYER_EMAIL' => $this->data['payer_email'], 'PAYER_USERNAME' => $this->sender_data ? $this->sender_data['username'] : $this->data['first_name'], 'VERIFY' => $this->verified ? $user->lang['TRANSACTION_VERIFIED'] : sprintf($user->lang['TRANSACTION_NOT_VERIFIED'], $this->page . '?action=validate&txn_id=' . $this->data['txn_id'])));
// Now send the e-mail message
$messenger->send(NOTIFY_EMAIL);
}
示例6: messenger
/**
* function messenger
*/
function messenger($data, $method)
{
global $config, $user, $phpbb_root_path, $phpEx;
if (!class_exists('messenger')) {
include $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
}
if (!function_exists('submit_pm')) {
include $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
}
$template_file = array_search($data['message_type'], $this->INVITE_MESSAGE_TYPE) . '_message';
$subject = $this->get_template(array_search($data['message_type'], $this->INVITE_MESSAGE_TYPE) . '_subject.txt', $data['invite_language']);
$message = $this->get_template("{$template_file}.txt", $data['invite_language']);
// Set up subject and message wildcards
$this->vars['USER_SUBJECT'] = !empty($data['subject']) ? htmlspecialchars_decode($data['subject']) : '';
$this->vars['USER_MESSAGE'] = !empty($data['message']) ? htmlspecialchars_decode($data['message']) : '';
// Use user specified subject and message if the template is empty
$subject = empty($subject) ? $this->vars['USER_SUBJECT'] : $subject;
$message = empty($message) ? $this->vars['USER_MESSAGE'] : $message;
// Parse subject wildcards (message wildcards will be parsed later)
foreach ($this->vars as $wildcard => $value) {
$subject = str_replace('{' . $wildcard . '}', $value, $subject);
}
switch ($method) {
case EMAIL:
$messenger = new messenger(false);
// Use false so send the e-mail immediately
$username = isset($data['register_real_name']) ? $data['register_real_name'] : $this->register_user['username'];
$messenger->to($data['register_email'], $username);
$messenger->template($template_file, $data['invite_language']);
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $data['method_user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $this->user_return_data($data['method_user_id'], 'user_id', 'username'));
$messenger->headers('X-AntiAbuse: User IP - ' . $this->user_return_data($data['method_user_id'], 'user_id', 'user_ip'));
$messenger->subject($subject);
$messenger->set_mail_priority($data['priority']);
$messenger->assign_vars($this->vars);
$messenger->assign_vars(array('CONTACT_EMAIL' => $config['board_contact']));
if (!$messenger->send()) {
$errored = true;
return false;
}
break;
case PM:
// We can use invite_user_id here, because we are just going to send confirmations
$address_list = array();
$address_list['u'][$data['invite_user_id']] = 'to';
// Replace all placeholders
foreach ($this->vars as $replace => $value) {
$message = str_replace('{' . $replace . '}', $value, $message);
}
$pm_data = array('from_user_id' => $this->register_user['user_id'], 'from_user_ip' => $this->register_user['user_ip'], 'from_username' => $this->register_user['username'], 'icon_id' => 0, 'enable_sig' => true, 'enable_bbcode' => false, 'enable_smilies' => false, 'enable_urls' => false, 'bbcode_bitfield' => '', 'bbcode_uid' => '', 'message' => $message, 'attachment_data' => '', 'filename_data' => '', 'address_list' => $address_list);
submit_pm('post', $subject, $pm_data);
break;
}
return true;
}
示例7: main
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
$user->add_lang('acp/email');
$this->tpl_name = 'acp_email';
$this->page_title = 'ACP_MASS_EMAIL';
// Set some vars
$submit = isset($_POST['submit']) ? true : false;
$error = array();
$usernames = request_var('usernames', '');
$group_id = request_var('g', 0);
$subject = request_var('subject', '', true);
$message = request_var('message', '', true);
// Do the job ...
if ($submit) {
// Error checking needs to go here ... if no subject and/or no message then skip
// over the send and return to the form
$use_queue = isset($_POST['send_immediatly']) ? false : true;
$priority = request_var('mail_priority_flag', MAIL_NORMAL_PRIORITY);
if (!$subject) {
$error[] = $user->lang['NO_EMAIL_SUBJECT'];
}
if (!$message) {
$error[] = $user->lang['NO_EMAIL_MESSAGE'];
}
if (!sizeof($error)) {
if ($usernames) {
$usernames = implode(', ', preg_replace('#^[\\s]*?(.*?)[\\s]*?$#e', "\"'\" . \$db->sql_escape('\\1') . \"'\"", explode("\n", $usernames)));
$sql = 'SELECT username, user_email, user_jabber, user_notify_type, user_lang
FROM ' . USERS_TABLE . " \n\t\t\t\t\t\tWHERE username IN ({$usernames})\n\t\t\t\t\t\t\tAND user_allow_massemail = 1\n\t\t\t\t\t\tORDER BY user_lang, user_notify_type";
// , SUBSTRING(user_email FROM INSTR(user_email, '@'))
} else {
if ($group_id) {
$sql = 'SELECT u.user_email, u.username, u.user_lang, u.user_jabber, u.user_notify_type
FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug \n\t\t\t\t\t\t\tWHERE ug.group_id = {$group_id} \n\t\t\t\t\t\t\t\tAND ug.user_pending = 0\n\t\t\t\t\t\t\t\tAND u.user_id = ug.user_id \n\t\t\t\t\t\t\t\tAND u.user_allow_massemail = 1\n\t\t\t\t\t\t\tORDER BY u.user_lang, u.user_notify_type";
} else {
$sql = 'SELECT username, user_email, user_jabber, user_notify_type, user_lang
FROM ' . USERS_TABLE . '
WHERE user_allow_massemail = 1
ORDER BY user_lang, user_notify_type';
}
}
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$row) {
trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action));
}
$i = $j = 0;
// Send with BCC, no more than 50 recipients for one mail (to not exceed the limit)
$max_chunk_size = 50;
$email_list = array();
$old_lang = $row['user_lang'];
$old_notify_type = $row['user_notify_type'];
do {
if ($row['user_notify_type'] == NOTIFY_EMAIL && $row['user_email'] || $row['user_notify_type'] == NOTIFY_IM && $row['user_jabber'] || $row['user_notify_type'] == NOTIFY_BOTH && $row['user_email'] && $row['user_jabber']) {
if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type) {
$i = 0;
$j++;
$old_lang = $row['user_lang'];
$old_notify_type = $row['user_notify_type'];
}
$email_list[$j][$i]['lang'] = $row['user_lang'];
$email_list[$j][$i]['method'] = $row['user_notify_type'];
$email_list[$j][$i]['email'] = $row['user_email'];
$email_list[$j][$i]['name'] = $row['username'];
$email_list[$j][$i]['jabber'] = $row['user_jabber'];
$i++;
}
} while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
// Send the messages
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
$messenger = new messenger($use_queue);
$errored = false;
for ($i = 0, $size = sizeof($email_list); $i < $size; $i++) {
$used_lang = $email_list[$i][0]['lang'];
$used_method = $email_list[$i][0]['method'];
for ($j = 0, $list_size = sizeof($email_list[$i]); $j < $list_size; $j++) {
$email_row = $email_list[$i][$j];
$messenger->{sizeof($email_list[$i]) == 1 ? 'to' : 'bcc'}($email_row['email'], $email_row['name']);
$messenger->im($email_row['jabber'], $email_row['name']);
}
$messenger->template('admin_send_email', $used_lang);
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
$messenger->subject(html_entity_decode($subject));
$messenger->replyto($config['board_email']);
$messenger->set_mail_priority($priority);
$messenger->assign_vars(array('SITENAME' => $config['sitename'], 'CONTACT_EMAIL' => $config['board_contact'], 'MESSAGE' => html_entity_decode($message)));
if (!$messenger->send($used_method)) {
$errored = true;
}
}
unset($email_list);
$messenger->save_queue();
//.........这里部分代码省略.........
示例8: switch
}
$_CLASS['core_db']->free_result($result);
// Post data grab actions
switch ($action) {
case 'icq':
$presence_img = '<img src="http://web.icq.com/whitepages/online?icq=' . $row[$sql_field] . '&img=5" width="18" height="18" border="0" alt="" />';
break;
case 'jabber':
if ($submit && @extension_loaded('xml')) {
// Add class loader
require_once $site_file_root . 'includes/forums/functions_messenger.php';
$subject = sprintf($_CLASS['core_user']->lang['IM_JABBER_SUBJECT'], $_CLASS['core_user']->data['username'], $config['server_name']);
$message = $_POST['message'];
$messenger = new messenger();
$messenger->template('profile_send_email', $row['user_lang']);
$messenger->subject($subject);
$messenger->replyto($_CLASS['core_user']->data['user_email']);
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array('SITENAME' => $_CORE_CONFIG['global']['site_name'], 'BOARD_EMAIL' => $config['board_contact'], 'FROM_USERNAME' => $_CLASS['core_user']->data['username'], 'TO_USERNAME' => $row['username'], 'MESSAGE' => $message));
$messenger->send(NOTIFY_IM);
$messenger->save_queue();
$s_select = 'S_SENT_JABBER';
}
break;
}
$_CLASS['core_template']->assign_array(array('CONTACT_NAME' => $row[$sql_field], 'IM_CONTACT' => $row[$sql_field], 'USERNAME' => addslashes($row['username']), 'EMAIL' => $row['user_email'], 'SITENAME' => addslashes($_CORE_CONFIG['global']['site_name']), 'PRESENCE_IMG' => $presence_img, 'L_SEND_IM_EXPLAIN' => $_CLASS['core_user']->lang['IM_' . $lang], 'L_IM_SENT_JABBER' => sprintf($_CLASS['core_user']->lang['IM_SENT_JABBER'], $row['username']), $s_select => true, 'S_IM_ACTION' => $s_action));
break;
case 'viewprofile':
// Display a profile
if ($user_id == ANONYMOUS) {
trigger_error('NO_USER');
示例9: array
function notify_subscribers($digest_notify_list, $email_template = '')
{
// This function parses $digest_notify_list, an array of user_ids that represent users that had their digest subscriptions changed, and sends them an email
// letting them know an action has occurred.
global $phpbb_root_path, $phpEx, $config, $user, $db, $phpbb_log;
$emails_sent = 0;
if (isset($digest_notify_list) && sizeof($digest_notify_list) > 0) {
if (!class_exists('messenger')) {
include $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
// Used to send emails
}
$sql_array = array('SELECT' => 'username, user_email, user_lang, user_digest_type, user_digest_format', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => $db->sql_in_set('user_id', $digest_notify_list));
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query($sql);
$rowset = $db->sql_fetchrowset($result);
foreach ($rowset as $row) {
// E-mail setup
$messenger = new \messenger();
switch ($email_template) {
case 'digests_subscription_edited':
$digest_notify_template = $email_template;
$digest_email_subject = $user->lang('DIGESTS_SUBSCRIBE_EDITED');
break;
default:
// Mass subscribe/unsubscribe
$digest_notify_template = $config['phpbbservices_digests_subscribe_all'] ? 'digests_subscribe' : 'digests_unsubscribe';
$digest_email_subject = $config['phpbbservices_digests_subscribe_all'] ? $user->lang('DIGESTS_SUBSCRIBE_SUBJECT') : $user->lang('DIGESTS_UNSUBSCRIBE_SUBJECT');
break;
}
// Set up associations between digest types as constants and their language equivalents
switch ($row['user_digest_type']) {
case constants::DIGESTS_DAILY_VALUE:
$digest_type_text = strtolower($user->lang('DIGESTS_DAILY'));
break;
case constants::DIGESTS_WEEKLY_VALUE:
$digest_type_text = strtolower($user->lang('DIGESTS_WEEKLY'));
break;
case constants::DIGESTS_MONTHLY_VALUE:
$digest_type_text = strtolower($user->lang('DIGESTS_MONTHLY'));
break;
case constants::DIGESTS_NONE_VALUE:
$digest_type_text = strtolower($user->lang('DIGESTS_NONE'));
break;
default:
$digest_type_text = strtolower($user->lang('DIGESTS_DAILY'));
break;
}
// Set up associations between digest formats as constants and their language equivalents
switch ($row['user_digest_format']) {
case constants::DIGESTS_HTML_VALUE:
$digest_format_text = $user->lang('DIGESTS_FORMAT_HTML');
break;
case constants::DIGESTS_HTML_CLASSIC_VALUE:
$digest_format_text = $user->lang('DIGESTS_FORMAT_HTML_CLASSIC');
break;
case constants::DIGESTS_PLAIN_VALUE:
$digest_format_text = $user->lang('DIGESTS_FORMAT_PLAIN');
break;
case constants::DIGESTS_PLAIN_CLASSIC_VALUE:
$digest_format_text = $user->lang('DIGESTS_FORMAT_PLAIN_CLASSIC');
break;
case constants::DIGESTS_TEXT_VALUE:
$digest_format_text = strtolower($user->lang('DIGESTS_FORMAT_TEXT'));
break;
default:
$digest_format_text = $user->lang('DIGESTS_FORMAT_HTML');
break;
}
$messenger->template('@phpbbservices_digests/' . $digest_notify_template, $row['user_lang']);
$messenger->to($row['user_email']);
$from_addr = $config['phpbbservices_digests_from_email_address'] == '' ? $config['board_email'] : $config['phpbbservices_digests_from_email_address'];
$from_name = $config['phpbbservices_digests_from_email_name'] == '' ? $config['board_contact'] : $config['phpbbservices_digests_from_email_name'];
// SMTP delivery must strip text names due to likely bug in messenger class
if ($config['smtp_delivery']) {
$messenger->from($from_addr);
} else {
$messenger->from($from_addr . ' <' . $from_name . '>');
}
$messenger->replyto($from_addr);
$messenger->subject($digest_email_subject);
$messenger->assign_vars(array('DIGESTS_FORMAT' => $digest_format_text, 'DIGESTS_TYPE' => $digest_type_text, 'DIGESTS_UCP_LINK' => generate_board_url() . '/' . 'ucp.' . $phpEx, 'FORUM_NAME' => $config['sitename'], 'USERNAME' => $row['username']));
$mail_sent = $messenger->send(NOTIFY_EMAIL, false);
if (!$mail_sent) {
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_DIGESTS_NOTIFICATION_ERROR', false, array($row['user_email']));
} else {
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_DIGESTS_NOTIFICATION_SENT', false, array($row['user_email'], $row['username']));
$emails_sent++;
}
$messenger->reset();
}
$db->sql_freeresult($result);
// Query be gone!
}
return $emails_sent;
}
示例10: time
$error[] = $user->lang['EMPTY_NAME_EMAIL'];
}
}
if (!sizeof($error)) {
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_emailtime = ' . time() . '
WHERE user_id = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$email_tpl = $user_id ? 'profile_send_email' : 'email_notify';
$messenger->template($email_tpl, $email_lang);
$messenger->replyto($user->data['user_email']);
$messenger->to($email, $name);
if ($user_id) {
$messenger->subject(html_entity_decode($subject));
$messenger->im($row['user_jabber'], $row['username']);
$notify_type = $row['user_notify_type'];
} else {
$notify_type = NOTIFY_EMAIL;
}
if ($cc) {
$messenger->cc($user->data['user_email'], $user->data['username']);
}
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
$messenger->assign_vars(array('SITENAME' => $config['sitename'], 'BOARD_EMAIL' => $config['board_contact'], 'TO_USERNAME' => html_entity_decode($name), 'FROM_USERNAME' => html_entity_decode($user->data['username']), 'MESSAGE' => html_entity_decode($message)));
if ($topic_id) {
$messenger->assign_vars(array('TOPIC_NAME' => html_entity_decode($row['topic_title']), 'U_TOPIC' => generate_board_url() . "/viewtopic.{$phpEx}?f=" . $row['forum_id'] . "&t={$topic_id}"));