本文整理汇总了PHP中emailer::email_address方法的典型用法代码示例。如果您正苦于以下问题:PHP emailer::email_address方法的具体用法?PHP emailer::email_address怎么用?PHP emailer::email_address使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类emailer
的用法示例。
在下文中一共展示了emailer::email_address方法的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: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
return false;
}
$username1 = request_var('username1', '');
$username2 = request_var('username2', '');
if (empty($username1) || empty($username2)) {
fatal_error();
}
$username_base1 = get_username_base($username1);
$username_base2 = get_username_base($username2);
$sql = 'SELECT *
FROM _members
WHERE username_base = ?';
if (!$userdata = sql_fieldrow(sql_filter($sql, $username_base1))) {
_pre('El usuario no existe.', true);
}
$sql = 'SELECT *
FROM _members
WHERE username_base = ?';
if ($void = sql_fieldrow(sql_filter($sql, $username_base2))) {
_pre('El usuario ya existe.', true);
}
//
$sql = 'UPDATE _members SET username = ?, username_base = ?
WHERE user_id = ?';
sql_query(sql_filter($sql, $username2, $username_base2, $userdata['user_id']));
$emailer = new emailer();
$emailer->from('info');
$emailer->use_template('username_change', $config['default_lang']);
$emailer->email_address($userdata['user_email']);
$emailer->assign_vars(array(
'USERNAME' => $userdata['username'],
'NEW_USERNAME' => $username2,
'U_USERNAME' => s_link('m', $username_base2))
);
$emailer->send();
$emailer->reset();
redirect(s_link('m', $username_base2));
return;
}
示例3: home
function home()
{
$sql = 'SELECT *
FROM _members
WHERE user_type = ?
AND user_birthday LIKE ?
AND user_birthday_last < ?
ORDER BY user_username
LIMIT ??';
$birthday = _rowset(sql_filter($sql, 1, '%' . date('md'), date('Y'), 10));
if (!$birthday) {
$this->e('None.');
}
$process = w();
foreach ($birthday as $i => $row) {
if (!$i) {
@set_time_limit(0);
require XFS . 'core/emailer.php';
$emailer = new emailer();
}
$emailer->format('plain');
$emailer->from('TWC Kaulitz <twc_princess@twckaulitz.com>');
$emailer->use_template('user_birthday');
$emailer->email_address($row['user_email']);
$emailer->assign_vars(array('USERNAME' => $row['user_username']));
$emailer->send();
$emailer->reset();
$process[$row['user_id']] = $row['user_username'];
}
if (count($process)) {
$sql = 'UPDATE _members SET user_birthday_last = ?
WHERE user_id IN (??)';
_sql(sql_filter($sql, date('Y'), _implode(',', array_keys($process))));
}
return $this->e('Done @ ' . implode(',', array_values($process)));
}
示例4: time
$sql = "UPDATE " . USERS_TABLE . "\r\n\t\t\t\tSET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . " \r\n\t\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']) {
$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);
*/
示例5: strlen
$user_id = $row['user_id'];
$user_actkey = gen_rand_string(true);
$key_len = 54 - strlen($server_url);
$key_len = $key_len > 6 ? $key_len : 6;
$user_actkey = substr($user_actkey, 0, $key_len);
$user_password = gen_rand_string(false);
$sql = "UPDATE " . USERS_TABLE . " \n\t\t\t\tSET user_newpasswd = '" . md5($user_password) . "', user_actkey = '{$user_actkey}' \n\t\t\t\tWHERE user_id = " . $row['user_id'];
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not update new password information', '', __LINE__, __FILE__, $sql);
}
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('user_activate_passwd', $row['user_lang']);
$emailer->email_address($row['user_email']);
$emailer->set_subject($lang['New_password_activation']);
$emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'USERNAME' => $username, 'PASSWORD' => $user_password, 'EMAIL_SIG' => !empty($board_config['board_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();
$template->assign_vars(array('META' => '<meta http-equiv="refresh" content="15;url=' . append_sid("index.{$phpEx}") . '">'));
$message = $lang['Password_updated'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.{$phpEx}") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
} else {
message_die(GENERAL_MESSAGE, $lang['No_email_match']);
}
} else {
message_die(GENERAL_ERROR, 'Could not obtain user information for sendpassword', '', __LINE__, __FILE__, $sql);
}
} else {
$username = '';
示例6: a
}
} else {
$error = TRUE;
$error_msg = "You have not entered a (valid) email address";
}
if (!$error) {
include $phpbb_root_path . 'includes/emailer.' . $phpEx;
$emailer = new emailer($board_config['smtp_delivery']);
$email_headers = 'X-AntiAbuse: Board servername - ' . $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) . "\r\n";
$emailer->from($userdata['username'] . " <" . $userdata['user_email'] . ">");
$emailer->replyto($userdata['username'] . " <" . $userdata['user_email'] . ">");
$emailer->use_template('tellafriend_email', $userdata['user_lang']);
$emailer->email_address($friendname . '<' . $friendemail . '>');
$emailer->set_subject(trim(stripslashes($topic)));
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'BOARD_EMAIL' => $board_config['board_email'], 'FROM_USERNAME' => $userdata['username'], 'TO_USERNAME' => $friendname, 'MESSAGE' => $message));
$emailer->send();
$emailer->reset();
$template->assign_vars(array('META' => '<meta http-equiv="refresh" content="3;url=' . append_sid($_POST['link']) . '">'));
$message = $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.{$phpEx}") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
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');
}
}
示例7: time
$error = TRUE;
$error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_message_email'] : $lang['Empty_message_email'];
}
if (!$error) {
$sql = "UPDATE " . USERS_TABLE . " \n\t\t\t\t\t\tSET user_emailtime = " . time() . " \n\t\t\t\t\t\tWHERE user_id = " . $userdata['user_id'];
if ($result = $db->sql_query($sql)) {
include $phpbb_root_path . 'includes/emailer.' . $phpEx;
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($userdata['user_email']);
$emailer->replyto($userdata['user_email']);
$email_headers = 'X-AntiAbuse: Board servername - ' . $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('profile_send_email', $user_lang);
$emailer->email_address($user_email);
$emailer->set_subject($subject);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'BOARD_EMAIL' => $board_config['board_email'], 'FROM_USERNAME' => $userdata['username'], 'TO_USERNAME' => $username, 'MESSAGE' => $message));
$emailer->send();
$emailer->reset();
if (!empty($HTTP_POST_VARS['cc_email'])) {
$emailer->from($userdata['user_email']);
$emailer->replyto($userdata['user_email']);
$emailer->use_template('profile_send_email');
$emailer->email_address($userdata['user_email']);
$emailer->set_subject($subject);
$emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'BOARD_EMAIL' => $board_config['board_email'], 'FROM_USERNAME' => $userdata['username'], 'TO_USERNAME' => $username, 'MESSAGE' => $message));
$emailer->send();
$emailer->reset();
}
示例8: emailer
$message = $lang['Account_inactive'];
$email_template = 'user_welcome_inactive';
} else {
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 $phpbb_root_path . 'includes/emailer.php';
$emailer = new emailer($board_config['smtp_delivery']);
$email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
$emailer->use_template($email_template, stripslashes($user_lang));
$emailer->email_address($current_email);
$emailer->set_subject();
//sprintf($lang['Welcome_subject'], $board_config['sitename'])
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']), 'USERNAME' => $username, '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) {
//$emailer->use_template("admin_activate", stripslashes($user_lang));
$emailer->use_template("admin_activate", $board_config['default_lang']);
$emailer->email_address($board_config['board_email']);
$emailer->set_subject();
//$lang['New_account_subject']
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array('USERNAME' => $username, '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));
示例9: notifyUser
function notifyUser($user_id, $notify_type, $offer_id, $offer_title)
{
global $db, $lang, $auction_config_data, $board_config;
if ($auction_config_data['auction_end_notify_email']) {
// BEGIN EMAIL-NOTIFY
$sql = "SELECT user_email,\r\n username\r\n FROM " . USERS_TABLE . "\r\n WHERE user_id=" . $user_id . "";
if (!($result = $db->sql_query($sql))) {
}
// if
$user = $db->sql_fetchrow($result);
$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']) . '/' : '/';
$username = $user['username'];
$email = $user['user_email'];
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
if ($notify_type == 'WON') {
$emailer->use_template('auction_won', stripslashes($user_lang));
$emailer->set_subject($lang['auction_won']);
$emailer->assign_vars(array('AUCTION_WON' => $lang['auction_offer_won'], 'AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $board_config['script_path'] . 'auction_offer_view.php?ao=' . $offer_id, 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
}
if ($notify_type == 'SOLD') {
$emailer->use_template('auction_sold', stripslashes($user_lang));
$emailer->set_subject($lang['auction_sold']);
$emailer->assign_vars(array('AUCTION_SOLD' => $lang['auction_offer_sold'], 'AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $board_config['script_path'] . 'auction_offer_view.php?ao=' . $offer_id, 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
}
if ($notify_type == 'NOT_SOLD') {
$emailer->use_template('auction_not_sold', stripslashes($user_lang));
$emailer->set_subject($lang['auction_not_sold']);
$emailer->assign_vars(array('AUCTION_NOT_SOLD' => $lang['auction_offer_not_sold'], 'AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $board_config['script_path'] . 'auction_offer_view.php?ao=' . $offer_id, 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
}
$emailer->email_address($email);
// Try to send email...
$emailer->send();
// $emailer->reset();
}
// END EMAIL-NOTIFY
if ($auction_config_data['auction_end_notify_pm']) {
// BEGIN PM-NOTIFY ON OUTBID
if ($notify_type == 'WON') {
$pm_subject = $lang['auction_won'];
$pm_text = $lang['auction_won_text'];
}
if ($notify_type == 'SOLD') {
$pm_subject = $lang['auction_sold'];
$pm_text = $lang['auction_sold_text'];
}
if ($notify_type == 'NOT_SOLD') {
$pm_subject = $lang['auction_not_sold'];
$pm_text = $lang['auction_not_sold_text'];
}
$privmsgs_date = date("U");
$sql = "INSERT INTO " . PRIVMSGS_TABLE . "\r\n (privmsgs_type,\r\n privmsgs_subject,\r\n privmsgs_from_userid,\r\n privmsgs_to_userid,\r\n privmsgs_date,\r\n privmsgs_enable_html,\r\n privmsgs_enable_bbcode,\r\n privmsgs_enable_smilies,\r\n privmsgs_attach_sig)\r\n VALUES ('0',\r\n '" . str_replace("\\'", "''", addslashes(sprintf($pm_subject, $board_config['sitename']))) . "',\r\n '2',\r\n " . $user_id . ",\r\n " . $privmsgs_date . ",\r\n '0',\r\n '1',\r\n '1',\r\n '0')";
if (!$db->sql_query($sql)) {
}
// if
$outbid_sent_id = $db->sql_nextid();
$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . "\r\n (privmsgs_text_id,\r\n privmsgs_text)\r\n VALUES (" . $outbid_sent_id . ",\r\n '" . str_replace("\\'", "''", $pm_text . "</br></br><a href=\"auction_offer_view.php?ao=" . $offer_id . "\">" . prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0) . "</a></br>" . $board_config['board_email_sig']) . "')";
if (!$db->sql_query($sql)) {
}
// if
$sql = "UPDATE " . USERS_TABLE . "\r\n SET user_new_privmsg=user_new_privmsg+1\r\n WHERE user_id=" . $user_id;
if (!$db->sql_query($sql)) {
}
// if
}
// End pm-notification
}
示例10: user_notification
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$notify_user)
{
global $bb_cfg, $lang, $userdata;
if (!$bb_cfg['topic_notify_enabled']) {
return;
}
if ($mode != 'delete') {
if ($mode == 'reply') {
$update_watched_sql = $user_id_sql = array();
$sql = DB()->fetch_rowset("SELECT ban_userid FROM " . BB_BANLIST . " WHERE ban_userid != 0");
foreach ($sql as $row) {
$user_id_sql[] = ',' . $row['ban_userid'];
}
$user_id_sql = join('', $user_id_sql);
$watch_list = DB()->fetch_rowset("SELECT u.username, u.user_id, u.user_email, u.user_lang\n\t\t\t\tFROM " . BB_TOPICS_WATCH . " tw, " . BB_USERS . " u\n\t\t\t\tWHERE tw.topic_id = {$topic_id}\n\t\t\t\t\tAND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . EXCLUDED_USERS_CSV . $user_id_sql . ")\n\t\t\t\t\tAND tw.notify_status = " . TOPIC_WATCH_NOTIFIED . "\n\t\t\t\t\tAND u.user_id = tw.user_id\n\t\t\t\t\tAND u.user_active = 1\n\t\t\t\tORDER BY u.user_id\n\t\t\t");
if ($watch_list) {
require CLASS_DIR . 'emailer.php';
$emailer = new emailer($bb_cfg['smtp_delivery']);
$orig_word = $replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
if (count($orig_word)) {
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
}
$u_topic = make_url(TOPIC_URL . $topic_id . '&view=newest#newest');
$unwatch_topic = make_url(TOPIC_URL . "{$topic_id}&unwatch=topic");
foreach ($watch_list as $row) {
$emailer->from($bb_cfg['sitename'] . " <{$bb_cfg['board_email']}>");
$emailer->email_address($row['username'] . " <{$row['user_email']}>");
$emailer->use_template('topic_notify', $row['user_lang']);
$emailer->assign_vars(array('TOPIC_TITLE' => html_entity_decode($topic_title), 'SITENAME' => $bb_cfg['sitename'], 'USERNAME' => $row['username'], 'U_TOPIC' => $u_topic, 'U_STOP_WATCHING_TOPIC' => $unwatch_topic));
$emailer->send();
$emailer->reset();
$update_watched_sql[] = $row['user_id'];
}
$update_watched_sql = join(',', $update_watched_sql);
}
if ($update_watched_sql) {
DB()->query("UPDATE " . BB_TOPICS_WATCH . "\n\t\t\t\t\tSET notify_status = " . TOPIC_WATCH_UNNOTIFIED . "\n\t\t\t\t\tWHERE topic_id = {$topic_id}\n\t\t\t\t\t\tAND user_id IN ({$update_watched_sql})\n\t\t\t\t");
}
}
$topic_watch = DB()->fetch_row("SELECT topic_id FROM " . BB_TOPICS_WATCH . " WHERE topic_id = {$topic_id} AND user_id = {$userdata['user_id']}", 'topic_id');
if (!$notify_user && !empty($topic_watch)) {
DB()->query("DELETE FROM " . BB_TOPICS_WATCH . " WHERE topic_id = {$topic_id} AND user_id = {$userdata['user_id']}");
} else {
if ($notify_user && empty($topic_watch)) {
DB()->query("\n\t\t\t\tINSERT INTO " . BB_TOPICS_WATCH . " (user_id, topic_id, notify_status)\n\t\t\t\tVALUES (" . $userdata['user_id'] . ", {$topic_id}, " . TOPIC_WATCH_NOTIFIED . ")\n\t\t\t");
}
}
}
}
示例11: 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);
}
}
}
}
}
示例12: 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;
}
示例13: emailer
if (!DB()->sql_query($sql)) {
bb_die('Could not insert / update private message sent text');
}
if ($mode != 'edit') {
$timenow = TIMENOW;
// Add to the users new pm counter
$sql = "UPDATE " . BB_USERS . " SET\n\t\t\t\t\tuser_new_privmsg = user_new_privmsg + 1,\n\t\t\t\t\tuser_last_privmsg = {$timenow},\n\t\t\t\t\tuser_newest_pm_id = {$privmsg_sent_id}\n\t\t\t\tWHERE user_id = {$to_userdata['user_id']}\n\t\t\t\tLIMIT 1";
if (!($status = DB()->sql_query($sql))) {
bb_die('Could not update private message new / read status for user');
}
cache_rm_user_sessions($to_userdata['user_id']);
if (bf($to_userdata['user_opt'], 'user_opt', 'user_notify_pm') && $to_userdata['user_active'] && $bb_cfg['pm_notify_enabled']) {
require CLASS_DIR . 'emailer.php';
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['sitename'] . " <{$bb_cfg['board_email']}>");
$emailer->email_address($to_userdata['username'] . " <{$to_userdata['user_email']}>");
$emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
$emailer->assign_vars(array('USERNAME' => html_entity_decode($to_username), 'NAME_FROM' => $userdata['username'], 'MSG_SUBJECT' => html_entity_decode($privmsg_subject), 'SITENAME' => $bb_cfg['sitename'], 'U_INBOX' => make_url(PM_URL . "?folder=inbox&mode=read&p={$privmsg_sent_id}")));
$emailer->send();
$emailer->reset();
}
}
pm_die($lang['MESSAGE_SENT']);
} else {
if ($preview || $refresh || $error) {
//
// If we're previewing or refreshing then obtain the data
// passed to the script, process it a little, do some checks
// where neccessary, etc.
//
$to_username = isset($_POST['username']) ? clean_username($_POST['username']) : '';
示例14: _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;
}
示例15: emailer
// since php's are broken by default
$board_config['smtp_delivery'] = 1;
$board_config['smtp_host'] = @$ini_val('SMTP');
}
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from(EMAIL_ADMIN);
$emailer->replyto(EMAIL_ADMIN);
for ($i = 0; $i < count($bcc_list); $i++) {
$emailer->bcc($bcc_list[$i]);
}
$email_headers = 'X-AntiAbuse: Board servername - Asterisk 2 billing\\n';
$email_headers .= 'X-AntiAbuse: User_id - 1\\n';
$email_headers .= 'X-AntiAbuse: Username - Areski\\n';
$email_headers .= 'X-AntiAbuse: User IP - 192.168.1.241\\n';
$emailer->use_template($message);
$emailer->email_address(EMAIL_ADMIN);
$emailer->set_subject($subject);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array('SITENAME' => 'a2billing', 'BOARD_EMAIL' => EMAIL_ADMIN, 'MESSAGE' => 'Hey it is a message, just to watch working'));
$result = $emailer->send();
$emailer->reset();
}
// #### HEADER SECTION
$smarty->display('main.tpl');
echo $CC_help_mass_mail;
if (!isset($submit)) {
?>
<script language="JavaScript" src="javascript/card.js"></script>
<div class="toggle_hide2show">
<center><a href="#" target="_self" class="toggle_menu"><img class="toggle_hide2show" src="<?php
echo KICON_PATH;