本文整理汇总了PHP中emailer::set_subject方法的典型用法代码示例。如果您正苦于以下问题:PHP emailer::set_subject方法的具体用法?PHP emailer::set_subject怎么用?PHP emailer::set_subject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类emailer
的用法示例。
在下文中一共展示了emailer::set_subject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: home
function home()
{
global $user;
$sql = 'SELECT *
FROM _email
WHERE email_active = ??
LIMIT ??';
if (!($email = _fieldrow(sql_filter($sql, 1, 1)))) {
$this->e('No queue emails.');
}
set_time_limit(0);
if (!$email['email_start']) {
$sql = 'UPDATE _email SET email_start = ?
WHERE email_id = ?';
_sql(sql_filter($sql, time(), $email['email_id']));
}
$sql = 'SELECT user_id, user_username, user_email
FROM _members
WHERE user_type = ?
AND user_id <> ?
ORDER BY user_username
LIMIT ??, ??';
$members = _rowset(sql_filter($sql, 1, 1, $email['email_last'], 100));
$i = 0;
foreach ($members as $row) {
if (!preg_match('/^[a-z0-9\\.\\-_\\+]+@[a-z0-9\\-_]+\\.([a-z0-9\\-_]+\\.)*?[a-z]+$/is', $row['user_email'])) {
continue;
}
if (!$i) {
include XFS . 'core/emailer.php';
$emailer = new emailer();
}
$emailer->use_template('mass');
$emailer->format('plain');
$emailer->from('TWC Kaulitz <twc_princess@twckaulitz.com>');
$emailer->set_subject(entity_decode($email['email_subject']));
$emailer->email_address($row['user_email']);
$emailer->assign_vars(array('USERNAME' => $row['user_username'], 'MESSAGE' => entity_decode($email['email_message'])));
$emailer->send();
$emailer->reset();
sleep(2);
$i++;
}
if ($i) {
$email['email_last'] += $i;
$sql = 'UPDATE _email SET email_last = ?
WHERE email_id = ?';
_sql(sql_filter($sql, $email['email_last'], $email['email_id']));
} else {
$sql = 'UPDATE _email SET email_active = ?, email_end = ?
WHERE email_id = ?';
_sql(sql_filter($sql, 0, time(), $email['email_id']));
$this->e('Finished processing [' . $email['email_id'] . '] emails.');
}
$this->e('Processed ' . $i . ' emails.');
return;
}
示例2: notification
function notification($sender_id, $recipient_id, $recipient_email, $email_subject, $email_text, $use_bcc = false, $pm_subject = '', $recipient_username = '', $recipient_lang = '', $emty_email_template = false)
{
global $db, $config, $user, $lang;
require IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
$recipient_lang = empty($recipient_lang) ? $config['default_lang'] : $recipient_lang;
// Let's do some checking to make sure that mass mail functions are working in win32 versions of php.
if (preg_match('/[c-z]:\\\\.*/i', getenv('PATH')) && !$config['smtp_delivery']) {
// We are running on windows, force delivery to use our smtp functions since php's are broken by default
$config['smtp_delivery'] = 1;
$config['smtp_host'] = @ini_get('SMTP');
}
$emailer = new emailer();
$emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name']));
$emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$emailer->headers('X-AntiAbuse: User IP - ' . $user->ip);
if ($use_bcc) {
$emailer->to($config['board_email']);
$emailer->bcc($recipient_email);
} else {
$emailer->to($recipient_email);
}
$emailer->set_subject($email_subject);
if ($emty_email_template) {
$emailer->use_template('admin_send_email', $recipient_lang);
$emailer->assign_vars(array('SITENAME' => $config['sitename'], 'BOARD_EMAIL' => $config['board_email'], 'MESSAGE' => $email_text));
} else {
$server_url = create_server_url();
$privmsg_url = $server_url . CMS_PAGE_PRIVMSG;
$recipient_username = empty($recipient_username) ? $lang['User'] : $recipient_username;
$email_sig = create_signature($config['board_email_sig']);
$emailer->use_template('privmsg_notify', $recipient_lang);
$emailer->assign_vars(array('USERNAME' => $recipient_username, 'SITENAME' => $config['sitename'], 'EMAIL_SIG' => $email_sig, 'FROM' => $user->data['username'], 'DATE' => create_date($config['default_dateformat'], time(), $config['board_timezone']), 'SUBJECT' => $pm_subject, 'PRIV_MSG_TEXT' => $email_text, 'FROM_USERNAME' => $user->data['username'], 'U_INBOX' => $privmsg_url . '?folder=inbox'));
}
$emailer->send();
$emailer->reset();
return true;
}
示例3: _email
public function _email() {
if ($this->make) {
return;
}
if (empty($this->data['email'])) {
fatal_error();
}
if (!$this->auth['user']) {
do_login();
}
global $user, $config;
$error_msg = '';
$subject = '';
$message = '';
$current_time = time();
if (_button()) {
$subject = request_var('subject', '');
$message = request_var('message', '', true);
if (empty($subject) || empty($message)) {
$error_msg .= (($error_msg != '') ? '<br />' : '') . lang('fields_empty');
}
if (empty($error_msg)) {
$sql = 'UPDATE _artists SET last_email = ?, last_email_user = ?
WHERE ub = ?';
sql_query(sql_filter($sql, $current_time, $user->d('user_id'), $this->data['ub']));
$emailer = new emailer($config['smtp_delivery']);
$emailer->from($user->d('user_email'));
$email_headers = 'X-AntiAbuse: User_id - ' . $user->d('user_id') . nr();
$email_headers .= 'X-AntiAbuse: Username - ' . $user->d('username') . nr();
$email_headers .= 'X-AntiAbuse: User IP - ' . $user->ip . nr();
$emailer->use_template('mmg_send_email', $config['default_lang']);
$emailer->email_address($this->data['email']);
$emailer->set_subject($subject);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array(
'SITENAME' => $config['sitename'],
'BOARD_EMAIL' => $config['board_email'],
'FROM_USERNAME' => $user->d('username'),
'UB_NAME' => $this->data['name'],
'MESSAGE' => $message
));
$emailer->send();
$emailer->reset();
redirect(s_link('a', $this->data['subdomain']));
}
}
if ($error_msg != '') {
_style('error');
}
v_style(array(
'ERROR_MESSAGE' => $error_msg,
'SUBJECT' => $subject,
'MESSAGE' => $message)
);
return;
}
示例4: trim
if (!($status = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql);
}
if ($to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) && $to_userdata['user_active']) {
$script_name = preg_replace('/^\\/?(.*?)\\/?$/', "\\1", trim($board_config['script_path']));
$script_name = $script_name != '' ? $script_name . '/privmsg.' . $phpEx : 'privmsg.' . $phpEx;
$server_name = trim($board_config['server_name']);
$server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
$server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
include $phpbb_root_path . 'includes/emailer.' . $phpEx;
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
$emailer->email_address($to_userdata['user_email']);
$emailer->set_subject($lang['Notification_subject']);
$emailer->assign_vars(array('USERNAME' => stripslashes($to_username), 'SENDER_USERNAME' => htmlspecialchars($userdata['username']), 'PM_SUBJECT' => $privmsg_subject, 'PM_MESSAGE' => $message_text, 'SITENAME' => $board_config['sitename'], 'EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox'));
$emailer->send();
$emailer->reset();
}
}
/*
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("privmsg.$phpEx?folder=inbox") . '">')
);
$msg = $lang['Message_sent'] . '<br /><br />' . sprintf($lang['Click_return_inbox'], '<a href="' . append_sid("privmsg.$phpEx?folder=inbox") . '">', '</a> ') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
message_die(GENERAL_MESSAGE, $msg);
*/
//-- mod : Instant Post Redirect ------------------------------------------------------------
示例5: emailer
$board_config['smtp_delivery'] = 1;
$board_config['smtp_host'] = @$ini_val('SMTP');
}
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
for ($i = 0; $i < count($bcc_list); $i++) {
$emailer->bcc($bcc_list[$i]);
}
$email_headers = 'X-AntiAbuse: Board servername - ' . $board_config['server_name'] . "\n";
$email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
$email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
$email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";
$emailer->use_template('admin_send_email');
$emailer->email_address($board_config['board_email']);
$emailer->set_subject($subject);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'BOARD_EMAIL' => $board_config['board_email'], 'MESSAGE' => $message));
$emailer->send();
$emailer->reset();
message_die(GENERAL_MESSAGE, $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.{$phpEx}?pane=right") . '">', '</a>'));
}
}
if ($error) {
$template->set_filenames(array('reg_header' => 'error_body.tpl'));
$template->assign_vars(array('ERROR_MESSAGE' => $error_msg));
$template->assign_var_from_handle('ERROR_BOX', 'reg_header');
}
//
// Initial selection
//
示例6: emailer
if ($board_config['require_activation'] == USER_ACTIVATION_ADMIN) {
$message = $lang['Account_inactive_admin'];
$email_template = 'admin_welcome_inactive';
} else {
$message = $lang['Account_added'];
$email_template = 'user_welcome';
}
}
}
include "includes/emailer.php";
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->use_template($email_template, stripslashes($user_lang));
$emailer->email_address($email);
$emailer->set_subject(sprintf($lang['Welcome_subject'], $board_config['sitename']));
if ($coppa) {
$emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']), 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\\'", "'", $username), 0, 25)), 'PASSWORD' => $password_confirm, 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 'FAX_INFO' => $board_config['coppa_fax'], 'MAIL_INFO' => $board_config['coppa_mail'], 'EMAIL_ADDRESS' => $email, 'ICQ' => $icq, 'AIM' => $aim, 'YIM' => $yim, 'MSN' => $msn, 'WEB_SITE' => $website, 'FROM' => $location, 'OCC' => $occupation, 'INTERESTS' => $interests, 'SITENAME' => $board_config['sitename']));
} else {
$emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']), 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\\'", "'", $username), 0, 25)), 'PASSWORD' => $password_confirm, 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 'U_ACTIVATE' => $server_url . '&mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey));
}
$emailer->send();
$emailer->reset();
if ($board_config['require_activation'] == USER_ACTIVATION_ADMIN) {
$sql = "SELECT user_email, user_lang\n FROM " . USERS_TABLE . "\n WHERE user_level = " . ADMIN;
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result)) {
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
示例7: main
function main($action)
{
global $db, $config, $template, $images, $user, $lang;
global $pafiledb_config, $debug;
$file_id = request_var('file_id', 0);
if (empty($file_id)) {
message_die(GENERAL_MESSAGE, $lang['File_not_exist']);
}
$sql = 'SELECT file_catid, file_name
FROM ' . PA_FILES_TABLE . "\n\t\t\tWHERE file_id = {$file_id}";
$result = $db->sql_query($sql);
if (!($file_data = $db->sql_fetchrow($result))) {
message_die(GENERAL_MESSAGE, $lang['File_not_exist']);
}
$db->sql_freeresult($result);
if (!$this->auth[$file_data['file_catid']]['auth_email']) {
if (!$user->data['session_logged_in']) {
redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=dload.' . PHP_EXT . '&action=email&file_id=' . $file_id, true));
}
$message = sprintf($lang['Sorry_auth_email'], $this->auth[$file_data['file_catid']]['auth_email_type']);
message_die(GENERAL_MESSAGE, $message);
}
if (isset($_POST['submit'])) {
// session id check
$sid = request_post_var('sid', '');
if (empty($sid) || $sid != $user->data['session_id']) {
message_die(GENERAL_ERROR, 'INVALID_SESSION');
}
$error = false;
$femail = request_var('femail', '');
if (!empty($femail) && preg_match('/^[a-z0-9\\.\\-_\\+]+@[a-z0-9\\-_]+\\.([a-z0-9\\-_]+\\.)*?[a-z]+$/is', $femail)) {
$user_email = $femail;
} else {
$error = true;
$error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Email_invalid'] : $lang['Email_invalid'];
}
$username = request_var('fname', '', true);
$sender_name = request_var('sname', '', true);
//if (!$user->data['session_logged_in'] || ($user->data['session_logged_in'] && ($sender_name != $user->data['username'])))
if (!$user->data['session_logged_in']) {
// Mighty Gorgon: is this really needed?
/*
include(IP_ROOT_PATH . 'includes/functions_validate.' . PHP_EXT);
$result = validate_username($sender_name);
if ($result['error'])
{
$error = true;
$error_msg .= (!empty($error_msg)) ? '<br />' . $result['error_msg'] : $result['error_msg'];
}
*/
} else {
$sender_name = $user->data['username'];
}
if (!$user->data['session_logged_in']) {
$semail = request_var('semail', '');
if (!empty($semail) && preg_match('/^[a-z0-9\\.\\-_\\+]+@[a-z0-9\\-_]+\\.([a-z0-9\\-_]+\\.)*?[a-z]+$/is', $femail)) {
$sender_email = $semail;
} else {
$error = true;
$error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Email_invalid'] : $lang['Email_invalid'];
}
} else {
$sender_email = $user->data['user_email'];
}
$subject = request_var('subject', '', true);
$subject = htmlspecialchars_decode($subject, ENT_COMPAT);
if (empty($subject)) {
$error = true;
$error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_subject_email'] : $lang['Empty_subject_email'];
}
$message = request_var('message', '', true);
// We need to check if HTML emails are enabled so we can correctly escape content and linebreaks
$message = !empty($config['html_email']) ? nl2br($message) : htmlspecialchars_decode($message, ENT_COMPAT);
if (empty($message)) {
$error = true;
$error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_message_email'] : $lang['Empty_message_email'];
}
if (!$error) {
include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
$emailer = new emailer();
$emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name']));
$emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$emailer->headers('X-AntiAbuse: User IP - ' . $user_ip);
$emailer->use_template('profile_send_email', $user_lang);
$emailer->to($user_email);
$emailer->from($sender_email);
$emailer->replyto($sender_email);
$emailer->set_subject($subject);
$emailer->assign_vars(array('SITENAME' => $config['sitename'], 'BOARD_EMAIL' => $config['board_email'], 'FROM_USERNAME' => $sender_name, 'TO_USERNAME' => $username, 'MESSAGE' => $message));
$emailer->send();
$emailer->reset();
$message = $lang['Econf'] . '<br /><br />' . sprintf($lang['Click_return'], '<a href="' . append_sid('dload.' . PHP_EXT . '?action=file&file_id=' . $file_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid(CMS_PAGE_HOME) . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
if ($error) {
message_die(GENERAL_MESSAGE, $error_msg);
}
}
$this->generate_category_nav($file_data['file_catid']);
//.........这里部分代码省略.........
示例8: emailer
//
$group_sql = "SELECT group_name \n\t\t\t\t\t\t\tFROM " . GROUPS_TABLE . " \n\t\t\t\t\t\t\tWHERE group_id = {$group_id}";
if (!($result = $db->sql_query($group_sql))) {
message_die(GENERAL_ERROR, 'Could not get group information', '', __LINE__, __FILE__, $group_sql);
}
$group_name_row = $db->sql_fetchrow($result);
$group_name = $group_name_row['group_name'];
include $phpbb_root_path . 'includes/emailer.' . $phpEx;
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
for ($i = 0; $i < count($bcc_list); $i++) {
$emailer->bcc($bcc_list[$i]);
}
$emailer->use_template('group_approved');
$emailer->set_subject($lang['Group_approved']);
$emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'GROUP_NAME' => $group_name, 'EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "={$group_id}"));
$emailer->send();
$emailer->reset();
}
}
}
}
//
// END approve or deny
//
} else {
message_die(GENERAL_MESSAGE, $lang['No_groups_exist']);
}
//
// Get group details
示例9: time
/**
* Send user notifications on new topic or reply
*/
function send_notifications($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user)
{
global $config, $lang, $db, $user;
global $bbcode;
$current_time = time();
include_once IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT;
if ($mode != 'delete') {
if ($mode == 'reply') {
// Look for users with notification enabled
$sql = "SELECT u.user_id, u.user_email, u.user_lang, u.username, f.forum_name\n\t\t\t\t\tFROM " . USERS_TABLE . " u, " . TOPICS_WATCH_TABLE . " tw, " . FORUMS_TABLE . " f\n\t\t\t\t\tWHERE tw.topic_id = " . $topic_id . "\n\t\t\t\t\t\tAND " . $db->sql_in_set('tw.user_id', $this->exclude_users, true, true) . "\n\t\t\t\t\t\tAND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "\n\t\t\t\t\t\tAND f.forum_id = " . $forum_id . "\n\t\t\t\t\t\tAND u.user_id = tw.user_id\n\t\t\t\t\t\tAND u.user_active = 1";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
if (!in_array($row['user_id'], $this->notify_userid)) {
if ($row['user_email'] != '') {
$this->notify_userdata[] = array('username' => $row['username'], 'user_email' => $row['user_email'], 'user_lang' => $row['user_lang']);
}
$this->notify_userid[] = $row['user_id'];
$this->notify_forum_name = $row['forum_name'];
}
}
$db->sql_freeresult($result);
}
if ($mode == 'newtopic' || $mode == 'reply') {
// Reply or New Topic forum notification
$sql = "SELECT u.user_id, u.user_email, u.user_lang, f.forum_name\n\t\t\t\t\tFROM " . USERS_TABLE . " u, " . FORUMS_WATCH_TABLE . " fw, " . FORUMS_TABLE . " f\n\t\t\t\t\tWHERE fw.forum_id = " . $forum_id . "\n\t\t\t\t\t\tAND " . $db->sql_in_set('fw.user_id', array_merge($this->exclude_users, $this->notify_userid), true, true) . "\n\t\t\t\t\t\tAND fw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "\n\t\t\t\t\t\tAND f.forum_id = " . $forum_id . "\n\t\t\t\t\t\tAND f.forum_notify = '1'\n\t\t\t\t\t\tAND u.user_id = fw.user_id\n\t\t\t\t\t\tAND u.user_active = 1";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
if (!in_array($row['user_id'], $this->notify_userid)) {
if ($row['user_email'] != '') {
$this->notify_userdata[] = array('username' => $row['username'], 'user_email' => $row['user_email'], 'user_lang' => $row['user_lang']);
}
$this->notify_userid[] = $row['user_id'];
$this->notify_forum_name = $row['forum_name'];
}
}
$db->sql_freeresult($result);
}
// Users array built, so start sending notifications
if (sizeof($this->notify_userdata) > 0) {
include_once IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
$emailer = new emailer();
$server_url = create_server_url();
$topic_title = unprepare_message($topic_title);
$topic_title = censor_text($topic_title);
$post_text = unprepare_message($post_data['message']);
$post_text = censor_text($post_text);
if (!empty($config['html_email'])) {
$bbcode->allow_bbcode = !empty($config['allow_bbcode']) ? $config['allow_bbcode'] : false;
$bbcode->allow_html = !empty($config['allow_html']) ? $config['allow_html'] : false;
$bbcode->allow_smilies = !empty($config['allow_smilies']) ? $config['allow_smilies'] : false;
$post_text = $bbcode->parse($post_text);
} else {
$post_text = $bbcode->plain_message($post_text, '');
}
for ($i = 0; $i < sizeof($this->notify_userdata); $i++) {
$emailer->use_template('topic_notify', $this->notify_userdata[$i]['user_lang']);
$emailer->bcc($this->notify_userdata[$i]['user_email']);
// The Topic_reply_notification lang string below will be used
// if for some reason the mail template subject cannot be read
// ... note it will not necessarily be in the posters own language!
$emailer->set_subject($lang['Topic_reply_notification']);
// This is a nasty kludge to remove the username var ... till (if?) translators update their templates
$emailer->msg = preg_replace('#[ ]?{USERNAME}#', $this->notify_userdata[$i]['username'], $emailer->msg);
if ($config['url_rw'] == '1') {
$topic_url = $server_url . str_replace('--', '-', make_url_friendly($topic_title) . '-vp' . $post_id . '.html#p' . $post_id);
} else {
$topic_url = $server_url . CMS_PAGE_VIEWTOPIC . '?' . POST_POST_URL . '=' . $post_id . '#p' . $post_id;
}
$email_sig = create_signature($config['board_email_sig']);
$emailer->assign_vars(array('EMAIL_SIG' => $email_sig, 'SITENAME' => $config['sitename'], 'TOPIC_TITLE' => $topic_title, 'POST_TEXT' => $post_text, 'POSTERNAME' => $post_data['username'], 'FORUM_NAME' => $this->notify_forum_name, 'ROOT' => $server_url, 'U_TOPIC' => $topic_url, 'U_STOP_WATCHING_TOPIC' => $server_url . CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $topic_id . '&unwatch=topic'));
$emailer->send();
$emailer->reset();
}
}
// Emails sent, so set users were notified
$sql = "UPDATE " . TOPICS_WATCH_TABLE . "\n\t\t\t\tSET notify_status = " . TOPIC_WATCH_NOTIFIED . "\n\t\t\t\tWHERE topic_id = " . $topic_id . "\n\t\t\t\tAND " . $db->sql_in_set('user_id', $this->notify_userid, false, true);
$db->sql_query($sql);
$sql = "UPDATE " . FORUMS_WATCH_TABLE . "\n\t\t\t\tSET notify_status = " . TOPIC_WATCH_NOTIFIED . "\n\t\t\t\tWHERE forum_id = " . $forum_id . "\n\t\t\t\tAND " . $db->sql_in_set('user_id', $this->notify_userid, false, true);
$db->sql_query($sql);
// Delete notification for poster if present, or re-activate it if requested
if (!$notify_user && !empty($row['topic_id'])) {
$this->delete_topic_watch($user->data['user_id'], $topic_id);
} elseif ($notify_user && empty($row['topic_id'])) {
$this->delete_topic_watch($user->data['user_id'], $topic_id);
$this->insert_topic_watch($user->data['user_id'], $topic_id, $forum_id, TOPIC_WATCH_UN_NOTIFIED);
}
}
}
示例10: album_comment_notify
function album_comment_notify($pic_id)
{
global $db, $config, $user, $lang, $album_config;
// One row SQL for caching purpose...
$sql = "SELECT ban_userid FROM " . BANLIST_TABLE . " WHERE ban_userid <> 0 ORDER BY ban_userid ASC";
$result = $db->sql_query($sql, 0, 'ban_', USERS_CACHE_FOLDER);
$user_id_sql = '';
while ($row = $db->sql_fetchrow($result)) {
if (isset($row['ban_userid']) && !empty($row['ban_userid'])) {
$user_id_sql .= ', ' . $row['ban_userid'];
}
}
$sql = "SELECT u.user_id, u.user_email, u.user_lang, p.pic_title\n\t\t\t\tFROM " . ALBUM_COMMENT_WATCH_TABLE . " cw, " . USERS_TABLE . " u\n\t\t\t\tLEFT JOIN " . ALBUM_TABLE . " AS p ON p.pic_id = {$pic_id}\n\t\t\t\tWHERE cw.pic_id = {$pic_id}\n\t\t\t\t\tAND cw.user_id NOT IN (" . $user->data['user_id'] . ", " . ANONYMOUS . $user_id_sql . ")\n\t\t\t\t\tAND cw.notify_status = " . COMMENT_WATCH_UN_NOTIFIED . "\n\t\t\t\t\tAND u.user_id = cw.user_id";
$result = $db->sql_query($sql);
$bcc_list_ary = array();
if ($row = $db->sql_fetchrow($result)) {
$pic_title = $row['pic_title'];
// Sixty second limit
@set_time_limit(60);
do {
if ($row['user_email'] != '') {
$bcc_list_ary[$row['user_lang']][] = $row['user_email'];
}
$update_watched_sql .= $update_watched_sql != '' ? ', ' . $row['user_id'] : $row['user_id'];
} while ($row = $db->sql_fetchrow($result));
//
// Let's do some checking to make sure that mass mail functions
// are working in win32 versions of php.
//
if (preg_match('/[c-z]:\\\\.*/i', getenv('PATH')) && !$config['smtp_delivery']) {
$ini_val = @phpversion() >= '4.0.0' ? 'ini_get' : 'get_cfg_var';
// We are running on windows, force delivery to use our smtp functions
// since php's are broken by default
$config['smtp_delivery'] = 1;
$config['smtp_host'] = @$ini_val('SMTP');
}
if (sizeof($bcc_list_ary)) {
include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
$emailer = new emailer();
$server_url = create_server_url();
$album_showpage_url = $server_url . 'album_showpage.' . PHP_EXT;
@reset($bcc_list_ary);
while (list($user_lang, $bcc_list) = each($bcc_list_ary)) {
$emailer->use_template('album_comment_notify', $user_lang);
for ($i = 0; $i < sizeof($bcc_list); $i++) {
$emailer->bcc($bcc_list[$i]);
}
// The Comment_notification lang string below will be used
// if for some reason the mail template subject cannot be read
// ... note it will not necessarily be in the posters own language!
$emailer->set_subject($lang['Pic_comment_notification']);
// This is a nasty kludge to remove the username var ... till translators update their templates
$emailer->msg = preg_replace('#[ ]?{USERNAME}#', '', $emailer->msg);
$email_sig = create_signature($config['board_email_sig']);
$emailer->assign_vars(array('EMAIL_SIG' => $email_sig, 'SITENAME' => $config['sitename'], 'PIC_TITLE' => $pic_title, 'U_PIC' => $album_showpage_url . '?pic_id=' . $pic_id, 'U_STOP_WATCHING_COMMENT' => $album_showpage_url . '?pic_id=' . $pic_id . '&unwatch=comment'));
$emailer->send();
$emailer->reset();
}
}
}
$db->sql_freeresult($result);
if ($update_watched_sql != '') {
$sql = "UPDATE " . ALBUM_COMMENT_WATCH_TABLE . "\n\t\t\tSET notify_status = " . COMMENT_WATCH_NOTIFIED . "\n\t\t\tWHERE pic_id = {$pic_id}\n\t\t\t\tAND user_id IN ({$update_watched_sql})";
$db->sql_query($sql);
}
}
示例11: chaser_email
function chaser_email($sender_email, $recip_email, $subject, $message)
{
global $board_config, $phpEx, $phpbb_root_path;
global $email_headers, $user_lang;
include_once $phpbb_root_path . 'includes/emailer.' . $phpEx;
// Left in for debugging
//echo '===============================<br>';
//echo '$sender_email=',$sender_email,'<br>';
//echo '$recip_email=',$recip_email,'<br>';
//echo '$subject=',$subject,'<br>';
//echo '$message=',$message,'<br>';
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($sender_email);
$emailer->replyto($sender_email);
$emailer->use_template('admin_send_email', $user_lang);
$emailer->email_address($recip_email);
$emailer->set_subject($subject);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'BOARD_EMAIL' => $board_config['board_email'], 'MESSAGE' => $message));
$emailer->send();
$emailer->reset();
}
示例12: _ticket_home
//.........这里部分代码省略.........
}
}
$recv_body = implode("\n", $htm_text);
}
if (f($recv_body)) {
$recv_body = htmlencode(_utf8($recv_body));
}
if (!f($recv_body)) {
$recv_blacklist = 1;
}
}
$recv[$i] = w();
foreach ($_v as $row) {
$recv[$i][$row] = ${'recv_' . $row};
}
}
foreach ($recv as $i => $row) {
if ($row['spam'] || $row['blacklist']) {
$pop3->delete($i);
$row_key = $row['spam'] ? 'spam' : 'blacklist';
$_c[$row_key]++;
continue;
}
// Send mail to group admin
if ($row['other']) {
$_c['other']++;
if (count($groups_mods[$row['to']])) {
foreach ($groups_mods[$row['to']] as $i => $mod_email) {
$email_func = !$i ? 'email_address' : 'cc';
$emailer->{$email_func}($mod_email);
}
$emailer->from($row['from']);
$emailer->replyto($row['from']);
$emailer->set_subject(entity_decode($row['subject']));
$emailer->use_template('ticket_other');
$emailer->set_decode(true);
$emailer->assign_vars(array('SUBJECT' => entity_decode($row['subject']), 'MESSAGE' => entity_decode($row['body'])));
$emailer->send();
$emailer->reset();
}
$pop3->delete($i);
continue;
}
$row['code'] = $row['reply'] ? $row['reply'] : substr(md5(unique_id()), 0, 8);
$row['from_d'] = unserialize($row['from_d']);
$row['group_id'] = $groups[$row['to']];
$row['msubject'] = entity_decode(sprintf('%s [#%s]: %s', $groups_name[$row['to']], $row['code'], $row['subject']));
$row['mbody'] = explode("\n", $row['body']);
//
$body_const = w();
foreach ($row['mbody'] as $part_i => $part_row) {
if (isset($row['mbody'][$part_i - 1]) && f($row['mbody'][$part_i - 1]) && f($row['mbody'][$part_i])) {
$row['mbody'][$part_i] = "\n" . $part_row;
}
}
$row['body'] = implode("\n", $row['mbody']);
$v_mail = array('USERNAME' => $row['from_d']['user_username'], 'FULLNAME' => entity_decode(_fullname($row['from_d'])), 'SUBJECT' => entity_decode($row['subject']), 'MESSAGE' => entity_decode($row['body']), 'TICKET_URL' => _link('ticket', array('x1' => 'view', 'code' => $row['code'])));
if (!$row['reply']) {
$_c['normal']++;
$sql_insert = array('parent' => 0, 'cat' => 1, 'group' => $row['group_id'], 'title' => _subject($row['subject']), 'text' => _prepare($row['body']), 'code' => $row['code'], 'contact' => $row['from_d']['user_id'], 'aby' => 0, 'status' => $ticket_status, 'start' => $row['date'], 'lastreply' => $row['date'], 'end' => 0, 'ip' => $row['ip']);
$sql = 'INSERT INTO _tickets' . _build_array('INSERT', prefix('ticket', $sql_insert));
_sql($sql);
// Send mail to user
$emailer->email_address($row['from']);
$emailer->from($row['to'] . '@' . $core->v('domain'));
$emailer->set_subject($row['msubject']);
示例13: time
// No activation key
message_die(GENERAL_ERROR, 'No_actkey');
}
$current_time = time();
if (intval($row['user_last_login_attempt']) > 0 && $current_time - intval($row['user_last_login_attempt']) < $config['login_reset_time']) {
// Request flood
message_die(GENERAL_ERROR, 'Send_actmail_flood_error');
}
// Start the email process
$unhtml_specialchars_match = array('#>#', '#<#', '#"#', '#&#');
$unhtml_specialchars_replace = array('>', '<', '"', '&');
include_once IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
$emailer = new emailer();
$emailer->to(trim($row['user_email']));
$emailer->use_template('user_welcome_inactive', $row['user_lang']);
$emailer->set_subject($lang['Resend_activation_email']);
$email_sig = create_signature($config['board_email_sig']);
$emailer->assign_vars(array('SITENAME' => $config['sitename'], 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr($username, 0, 25)), 'PASSWORD' => '', 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $config['sitename']), 'EMAIL_SIG' => $email_sig, 'U_ACTIVATE' => $profile_server_url . '?mode=activate&' . POST_USERS_URL . '=' . $row['user_id'] . '&act_key=' . $row['user_actkey']));
$emailer->send();
$emailer->reset();
// Update last activation sent time
$sql = "UPDATE " . USERS_TABLE . "\n\t\tSET user_last_login_attempt = {$current_time}\n\t\tWHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
$result = $db->sql_query($sql);
message_die(GENERAL_MESSAGE, 'Resend_activation_email_done');
} else {
$link_name = $lang['Resend_activation_email'];
$nav_server_url = create_server_url();
$breadcrumbs['address'] = $lang['Nav_Separator'] . '<a href="' . $nav_server_url . append_sid(CMS_PAGE_PROFILE_MAIN) . '"' . (!empty($link_name) ? '' : ' class="nav-current"') . '>' . $lang['Profile'] . '</a>' . (!empty($link_name) ? $lang['Nav_Separator'] . '<a class="nav-current" href="#">' . $link_name . '</a>' : '');
$template->assign_vars(array('L_SEND_PASSWORD' => $lang['Resend_activation_email'], 'L_ITEMS_REQUIRED' => $lang['Items_required'], 'L_SUBMIT' => $lang['Submit'], 'L_RESET' => $lang['Reset'], 'S_PROFILE_ACTION' => append_sid(CMS_PAGE_PROFILE . '?mode=resend'), 'S_HIDDEN_FIELDS' => ''));
full_page_generation('profile_send_pass.tpl', $lang['Resend_activation_email'], '', '');
}
示例14: user_notification
function user_notification($mode, &$post_data, &$forum_id, &$topic_id, &$post_id, &$notify_user)
{
global $board_config, $lang, $db, $phpbb_root_path;
global $userdata, $user_ip;
$current_time = time();
if ($mode == 'delete') {
$delete_sql = !$post_data['first_post'] && !$post_data['last_post'] ? " AND user_id = " . $userdata['user_id'] : '';
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = {$topic_id}" . $delete_sql;
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not change topic notify data', '', __LINE__, __FILE__, $sql);
}
} else {
if ($mode == 'reply') {
$sql = "SELECT ban_userid \r\n\t\t\t\tFROM " . BANLIST_TABLE;
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain banlist', '', __LINE__, __FILE__, $sql);
}
$user_id_sql = '';
while ($row = $db->sql_fetchrow($result)) {
if (isset($row['ban_userid'])) {
$user_id_sql = ', ' . $row['ban_userid'];
}
}
$sql = "SELECT u.user_id, u.username, u.user_email, u.user_lang, t.topic_title \r\n\t\t\t\tFROM " . TOPICS_WATCH_TABLE . " tw, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u \r\n\t\t\t\tWHERE tw.topic_id = {$topic_id} \r\n\t\t\t\t\tAND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . " ) \r\n\t\t\t\t\tAND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . " \r\n\t\t\t\t\tAND t.topic_id = tw.topic_id \r\n\t\t\t\t\tAND u.user_id = tw.user_id";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain list of topic watchers', '', __LINE__, __FILE__, $sql);
}
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
include $phpbb_root_path . 'includes/emailer.php';
$emailer = new emailer($board_config['smtp_delivery']);
$script_name = preg_replace('/^\\/?(.*?)\\/?$/', '\\1', trim($board_config['script_path']));
$script_name = $script_name != '' ? $script_name . '/viewtopic.php' : 'viewtopic.php';
$server_name = trim($board_config['server_name']);
$server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
$server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
$email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
$update_watched_sql = '';
if ($row = $db->sql_fetchrow($result)) {
@set_time_limit(120);
$topic_title = preg_replace($orig_word, $replacement_word, unprepare_message($row['topic_title']));
do {
if ($row['user_email'] != '') {
$emailer->use_template('topic_notify', $row['user_lang']);
$emailer->email_address($row['user_email']);
$emailer->set_subject();
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array('EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 'USERNAME' => $row['username'], 'SITENAME' => $board_config['sitename'], 'TOPIC_TITLE' => $topic_title, 'U_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_POST_URL . "={$post_id}#{$post_id}", 'U_STOP_WATCHING_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_TOPIC_URL . "={$topic_id}&unwatch=topic"));
$emailer->send();
$emailer->reset();
$update_watched_sql .= $update_watched_sql != '' ? ', ' . $row['user_id'] : $row['user_id'];
}
} while ($row = $db->sql_fetchrow($result));
}
if ($update_watched_sql != '') {
$sql = "UPDATE " . TOPICS_WATCH_TABLE . "\r\n\t\t\t\t\tSET notify_status = " . TOPIC_WATCH_NOTIFIED . "\r\n\t\t\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\t\t\tAND user_id IN ({$update_watched_sql})";
$db->sql_query($sql);
}
}
$sql = "SELECT topic_id \r\n\t\t\tFROM " . TOPICS_WATCH_TABLE . "\r\n\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\tAND user_id = " . $userdata['user_id'];
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain topic watch information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
if (!$notify_user && !empty($row['topic_id'])) {
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "\r\n\t\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\t\tAND user_id = " . $userdata['user_id'];
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete topic watch information', '', __LINE__, __FILE__, $sql);
}
} else {
if ($notify_user && empty($row['topic_id'])) {
$sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)\r\n\t\t\t\tVALUES (" . $userdata['user_id'] . ", {$topic_id}, 0)";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not insert topic watch information', '', __LINE__, __FILE__, $sql);
}
}
}
}
}
示例15: adr_send_pm
function adr_send_pm($dest_user, $subject, $message, $check_from_id = '')
{
global $db, $phpbb_root_path, $phpEx, $lang, $user_ip, $board_config, $userdata;
$dest_user = intval($dest_user);
$msg_time = time();
$from_id = $check_from_id === '' ? intval($userdata['user_id']) : $check_from_id;
$html_on = 1;
$bbcode_on = 1;
$smilies_on = 1;
include_once $phpbb_root_path . 'includes/functions_post.' . $phpEx;
include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
$privmsg_subject = trim(strip_tags($subject));
$bbcode_uid = make_bbcode_uid();
$privmsg_message = trim(strip_tags($message));
// APM compliance
if (defined('PRIVMSGA_TABLE')) {
include_once $phpbb_root_path . 'includes/functions_messages.' . $phpEx;
send_pm(0, '', $dest_user, $privmsg_subject, $privmsg_message, '');
} else {
$sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active\r\n\t\t\t FROM " . USERS_TABLE . "\r\n\t\t\t WHERE user_id = {$dest_user} ";
if (!($result = $db->sql_query($sql))) {
$error = TRUE;
$error_msg = $lang['No_such_user'];
}
$to_userdata = $db->sql_fetchrow($result);
$sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time\r\n\t\t\tFROM " . PRIVMSGS_TABLE . "\r\n\t\t\tWHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "\r\n\t\t\t OR privmsgs_type = " . PRIVMSGS_READ_MAIL . " \r\n\t\t\t\tOR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )\r\n\t\t\tAND privmsgs_to_userid = {$dest_user} ";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_MESSAGE, $lang['No_such_user']);
}
$sql_priority = SQL_LAYER == 'mysql' ? 'LOW_PRIORITY' : '';
if ($inbox_info = $db->sql_fetchrow($result)) {
if ($inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs']) {
$sql = "SELECT privmsgs_id FROM " . PRIVMSGS_TABLE . "\r\n\t\t\t\t\tWHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "\r\n\t\t\t\t\tOR privmsgs_type = " . PRIVMSGS_READ_MAIL . "\r\n\t\t\t\t\tOR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )\r\n\t\t\t\t\tAND privmsgs_date = " . $inbox_info['oldest_post_time'] . "\r\n\t\t\t\t\tAND privmsgs_to_userid = {$dest_user} ";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not find oldest privmsgs (inbox)', '', __LINE__, __FILE__, $sql);
}
$old_privmsgs_id = $db->sql_fetchrow($result);
$old_privmsgs_id = $old_privmsgs_id['privmsgs_id'];
$sql = "DELETE {$sql_priority} FROM " . PRIVMSGS_TABLE . "\r\n\t\t\t\t\tWHERE privmsgs_id = {$old_privmsgs_id}";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs (inbox)' . $sql, '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE {$sql_priority} FROM " . PRIVMSGS_TEXT_TABLE . "\r\n\t\t\t\t\tWHERE privmsgs_text_id = {$old_privmsgs_id}";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (inbox)', '', __LINE__, __FILE__, $sql);
}
}
}
$sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " \r\n\t\t\t(privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies)\r\n\t\t\tVALUES ( 1 , '" . str_replace("\\'", "''", addslashes($privmsg_subject)) . "' , " . $from_id . ", " . $to_userdata['user_id'] . ", {$msg_time}, '{$user_ip}' , {$html_on}, {$bbcode_on}, {$smilies_on})";
if (!$db->sql_query($sql_info)) {
message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (inbox)', '', __LINE__, __FILE__, $sql_info);
}
$privmsg_sent_id = $db->sql_nextid();
$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)\r\n\t\t\tVALUES ({$privmsg_sent_id}, '" . $bbcode_uid . "', '" . str_replace("\\'", "''", addslashes($privmsg_message)) . "')";
if (!$db->sql_query($sql, END_TRANSACTION)) {
message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . USERS_TABLE . "\r\n\t\t\tSET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . " \r\n\t\t\tWHERE user_id = " . $to_userdata['user_id'];
if (!($status = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql);
}
if ($to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) && $to_userdata['user_active']) {
// have the mail sender infos
$script_name = preg_replace('/^\\/?(.*?)\\/?$/', "\\1", trim($board_config['script_path']));
$script_name = $script_name != '' ? $script_name . '/privmsg.' . $phpEx : 'privmsg.' . $phpEx;
$server_name = trim($board_config['server_name']);
$server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
$server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
include_once $phpbb_root_path . './includes/emailer.' . $phpEx;
$emailer = new emailer($board_config['smtp_delivery']);
if ($board_config['version'] == '.0.5' || $board_config['version'] == '.0.6' || $board_config['version'] == '.0.7' || $board_config['version'] == '.0.8' || $board_config['version'] == '.0.9') {
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
} else {
$email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
$emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
$emailer->extra_headers($email_headers);
}
$emailer->email_address($to_userdata['user_email']);
$emailer->set_subject($lang['Notification_subject']);
$emailer->assign_vars(array('USERNAME' => $to_username, 'SITENAME' => $board_config['sitename'], 'EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox'));
$emailer->send();
$emailer->reset();
}
}
return;
}