本文整理汇总了PHP中emailer::use_template方法的典型用法代码示例。如果您正苦于以下问题:PHP emailer::use_template方法的具体用法?PHP emailer::use_template怎么用?PHP emailer::use_template使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类emailer
的用法示例。
在下文中一共展示了emailer::use_template方法的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: 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;
}
示例4: 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)));
}
示例5: 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);
示例6: emailer
// We are running on windows, force delivery to use our smtp functions
// 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($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');
}
//
示例7: emailer
$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 "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)) {
示例8: IN
if (!empty($_POST['remove'])) {
update_user_level($sql_in);
}
}
}
// Email users when they are approved
if (!empty($_POST['approve']) && $bb_cfg['group_send_email']) {
$sql_select = "SELECT username, user_email, user_lang\n\t\t\t\t\t\tFROM " . BB_USERS . "\n\t\t\t\t\t\tWHERE user_id IN({$sql_in})";
if (!($result = DB()->sql_query($sql_select))) {
bb_die('Could not get user email information');
}
require CLASS_DIR . 'emailer.php';
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['sitename'] . " <{$bb_cfg['board_email']}>");
foreach (DB()->fetch_rowset($sql_select) as $row) {
$emailer->use_template('group_approved', $row['user_lang']);
$emailer->email_address($row['username'] . " <{$row['user_email']}>");
}
$emailer->assign_vars(array('SITENAME' => $bb_cfg['sitename'], 'GROUP_NAME' => $group_info['group_name'], 'U_GROUP' => make_url(GROUP_URL . $group_id)));
$emailer->send();
$emailer->reset();
}
}
}
}
// END approve or deny
// Get moderator details for this group
$group_moderator = DB()->fetch_row("\n\t\tSELECT *\n\t\tFROM " . BB_USERS . "\n\t\tWHERE user_id = " . $group_info['group_moderator'] . "\n\t");
// Current user membership
$is_group_member = $is_group_pending_member = false;
$sql = "SELECT user_pending\n\t\tFROM " . BB_USER_GROUP . "\n\t\tWHERE group_id = {$group_id}\n\t\t\tAND user_id = " . $userdata['user_id'] . "\n\t\tLIMIT 1";
示例9: emailer
if ($msg_count == 0)
{
$msg .= $parastart . $lang['digest_no_new_messages'] . $paraend;
}
// Send the email if there are messages or if user selected to send email anyhow
if (($msg_count > 0) || ($row['send_on_no_messages'] == 'YES'))
{
if (!is_object($emailer))
{
$emailer = new emailer();
}
$emailer->use_template('mail_digests', $row['user_lang']);
if ($html)
{
// Apply a style sheet if requested for HTML digest. If no style sheet is wanted then the
// link tag pointing to the style sheet is not displayed. A custom style sheet gets first priority.
/*
if ($link_tag_unset)
{
$stylesheet = '';
if (DIGEST_USE_CUSTOM_STYLESHEET)
{
$stylesheet = DIGEST_CUSTOM_STYLESHEET_PATH;
}
elseif (DIGEST_USE_DEFAULT_STYLESHEET)
{
// Get the default style sheet to apply to the HTML email
示例10: home
public function home()
{
global $core, $user;
$tree = $this->valid_tree();
$v = $this->__(_array_keys(w('is_comment is_form'), 0));
// Form posting enabled and form submitted
if ($v['is_form'] && _button()) {
if (!is_ghost()) {
_fatal(405);
}
if (!$tree['tree_form']) {
_fatal();
}
$sql_fields = 'SELECT form_alias, form_required, form_legend, form_regex,
FROM _form_fields
WHERE form_tree = ?
ORDER BY form_order';
if (!($form = _rowset(sql_filter($sql_fields, $tree['tree_id']), 'form_alias'))) {
$form = _rowset(sql_filter($sql_fields, 0), 'form_alias');
}
$form['secure'] = array('form_required' => 1, 'form_regex' => '^([a-zA-Z]+)$', 'form_alias' => 'secure', 'form_type' => 'text', 'form_legend' => _lang('XCF_LEGEND'));
foreach ($form as $row) {
$v = array_merge($v, $this->__(array($row['form_alias'])));
if (!f($v[$row['form_alias']])) {
if ($row['form_required']) {
$this->_error(sprintf(_lang('E_COMMENT_FIELD_EMPTY'), $row['form_legend']), false);
}
continue;
}
if (f($row['form_regex']) && !preg_match('#' . $row['form_regex'] . '#is', $v[$row['form_alias']])) {
$this->_error(sprintf(_lang('E_COMMENT_FIELD_BAD'), $row['form_legend']), false);
if ($row['form_alias'] == 'secure') {
$v[$row['form_alias']] = '';
}
}
}
require_once XFS . 'core/xcf.php';
$xcf = new captcha();
if ($xcf->check($v['secure']) === false) {
$v['secure'] = '';
$this->_error('#E_COMMENT_INVALID_CAPTCHA');
}
unset($xcf);
require_once XFS . 'core/emailer.php';
$emailer = new emailer();
$emailer->set_decode(true);
$emailer->format('plain');
$emailer->from($v['address']);
$emailer->set_subject(_rm_acute($v['subject']));
$emailer->use_template('contact_email');
if (f($core->v('default_email'))) {
$tree['tree_form_email'] .= (f($tree['tree_form_email']) ? ';' : '') . $core->v('default_email');
}
$form_addresses = array_map('trim', array_unique(explode(';', $tree['tree_form_email'])));
foreach ($form_addresses as $i => $address) {
$row_f = !$i ? 'email_address' : 'cc';
$emailer->{$row_f}($address);
}
unset($v['secure']);
$content = w();
foreach ($form as $row) {
if (!f($v[$row['form_alias']])) {
continue;
}
$content[] = $row['form_legend'] . ":\n" . $v[$row['form_alias']];
}
$emailer->assign_vars(array('CONTENT' => implode("\n\n", $content), 'FORM_ARTICLE' => $tree['tree_subject']));
$emailer->send();
$emailer->reset();
$response = array('lang' => _lang('FORM_SUCCESS'));
$this->e(json_encode($response));
}
// Comment posting enabled and form submitted.
if ($v['is_comment'] && _button()) {
if (!$tree['tree_allow_comments']) {
_fatal();
}
$cv = $this->__(w('comment_username comment_address comment_website comment_message comment_security'));
$comment_time = time();
if (!$user->v('is_member')) {
foreach ($cv as $cv_k => $cv_v) {
if (!f($cv_v)) {
$this->error('E_COMMENT_FILL_FIELDS');
break;
}
}
if (!$this->errors()) {
$sql = 'SELECT comment_time
FROM _comments
WHERE comment_ip = ?
AND comment_status = 0';
if ($row_flood = _fieldrow(sql_filter($sql, $user->ip))) {
if ($comment_time - $row_flood['comment_time'] < 30) {
$this->error('E_COMMENT_FLOOD_TIME');
}
}
}
// CAPTCHA verification
require_once XFS . 'core/xcf.php';
$xcf = new captcha();
//.........这里部分代码省略.........
示例11: home
function home() {
global $core, $user, $style;
$sql = 'SELECT *
FROM _email
WHERE email_active = 1
AND (email_schedule > ??
OR email_schedule = 0)
ORDER BY email_priority, email_id
LIMIT 1';
if (!$email = sql_fieldrow(sql_filter($sql, time()))) {
$this->e('No queue.');
}
set_time_limit(0);
$sql = 'SELECT *
FROM ??
WHERE address_sent = 0
ORDER BY address_id
LIMIT ??';
if ($members = sql_rowset(sql_filter($sql, $email['email_data'], $email['email_batch']))) {
if (!$email['email_start']) {
$sql = 'UPDATE _email SET email_start = ?
WHERE email_id = ?';
sql_query(sql_filter($sql, time(), $email['email_id']));
}
}
$i = 0;
$sent_to = array();
foreach ($members as $row) {
$address_account = trim($row['address_account']);
if (!preg_match('/^[a-z0-9\.\-_\+]+@[a-z0-9\-_]+\.([a-z0-9\-_]+\.)*?[a-z]+$/is', $address_account)) {
$sql = 'UPDATE ?? SET address_sent = ?
WHERE address_id = ?';
sql_query(sql_filter($sql, $email['email_data'], 1, $row['address_id']));
continue;
}
if (!$i) {
include(XFS . 'core/emailer.php');
$emailer = new emailer();
}
$emailer->use_template('mass');
$emailer->format('html');
$emailer->from($email['email_from'] . ' <' . $email['email_from_address'] . '>');
$emailer->set_subject(entity_decode($email['email_subject']));
$emailer->email_address($address_account);
$name_compose = '';
if (isset($row['address_name']) && !empty($row['address_name'])) {
$row['address_name'] = preg_replace('/\s\s+/', ' ', $row['address_name']);
$name_compose = ucwords(strtolower(trim($row['address_name'])));
if (isset($row['address_last']) && !empty($row['address_last'])) {
$row['address_last'] = preg_replace('/\s\s+/', ' ', $row['address_last']);
$name_compose .= ' ' . ucwords(strtolower(trim($row['address_last'])));
}
if (!empty($name_compose)) {
$name_gretting = '';
if (isset($row['address_gender']) && !empty($row['address_gender'])) {
switch ($row['address_gender']) {
case 'Femenino':
$name_by = 'a';
break;
case 'Masculino':
$name_by = 'o';
break;
default:
$name_gretting = $core->config['email_gretting'];
break;
}
} else {
if (strpos($name_compose, 'Sra.') !== false || strpos($name_compose, 'Srta.') !== false) {
$name_by = 'a';
} else if (strpos($name_compose, 'Sr.') !== false) {
$name_by = 'o';
} else {
$name_gretting = $core->config['email_gretting'];
}
}
if (empty($email['email_gretting'])) {
$name_gretting = $core->config['email_gretting'];
}
if (!empty($name_gretting)) {
$name_compose = $name_gretting . ' ' . $name_compose;
} elseif (!empty($name_by)) {
if (strpos($email['email_gretting'], '*') !== false) {
$name_compose = str_replace('*', $name_by, $email['email_gretting']) . ' ' . $name_compose;
//.........这里部分代码省略.........
示例12: user_notification
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user)
{
global $config, $lang, $userdata, $user_ip;
$current_time = time();
if ($mode == 'delete')
{
$delete_sql = (!$post_data['first_post'] && !$post_data['last_post']) ? sql_filter(' AND user_id = ? ', $userdata['user_id']) : '';
$sql = 'DELETE FROM _forum_topics_fav WHERE topic_id = ?' . $delete_sql;
sql_query(sql_filter($sql, $topic_id));
}
else
{
if ($mode == 'reply')
{
$sql = 'SELECT ban_userid
FROM _banlist';
$result = sql_rowset($sql);
$user_id_sql = '';
foreach ($result as $row) {
if (isset($row['ban_userid']) && !empty($row['ban_userid'])) {
$user_id_sql .= ', ' . $row['ban_userid'];
}
}
$update_watched_sql = '';
$bcc_list_ary = w();
$usr_list_ary = w();
$sql = 'SELECT DISTINCT u.user_id, u.user_email, u.user_lang
FROM _forum_topics_fav tw
INNER JOIN _members u ON tw.user_id = u.user_id
INNER JOIN _members_group ug ON tw.user_id = ug.user_id
LEFT OUTER JOIN _auth_access aa ON ug.group_id = aa.group_id, _forums f
WHERE tw.topic_id = ?
AND tw.user_id NOT IN (??, ??, ??)
AND tw.notify_status = ?
AND f.forum_id = ?
AND u.user_active = 1
AND (
(aa.forum_id = ? AND aa.auth_read = 1)
OR f.auth_read <= ?
OR (u.user_level = ? AND f.auth_read = ?)
OR u.user_level = ?
)';
if ($result = sql_rowset(sql_filter($sql, $topic_id, $userdata['user_id'], GUEST, $user_id_sql, TOPIC_WATCH_UN_NOTIFIED, $forum_id, $forum_id, AUTH_REG, USER_MOD, AUTH_MOD, USER_ADMIN))) {
@set_time_limit(60);
foreach ($result as $row) {
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'];
}
if (sizeof($bcc_list_ary)) {
$emailer = new emailer();
$server_name = trim($config['server_name']);
$server_protocol = ($config['cookie_secure']) ? 'https://' : 'http://';
$post_url = $server_protocol . $server_name . s_link('post', $post_id) . "#$post_id";
$emailer->from($config['board_email']);
$emailer->replyto($config['board_email']);
$topic_title = unprepare_message($topic_title);
@reset($bcc_list_ary);
while (list($user_lang, $bcc_list) = each($bcc_list_ary))
{
$emailer->use_template('topic_notify', $user_lang);
for ($i = 0; $i < count($bcc_list); $i++)
{
$emailer->bcc($bcc_list[$i]);
}
// 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}#', '', $emailer->msg);
$emailer->assign_vars(array(
'EMAIL_SIG' => '',
'SITENAME' => $config['sitename'],
'TOPIC_TITLE' => $topic_title,
'U_TOPIC' => $post_url,
'U_STOP_WATCHING_TOPIC' => $server_protocol . $server_name . $script_name . '&' . POST_TOPIC_URL . "=$topic_id&unwatch=topic")
);
//.........这里部分代码省略.........
示例13: emailer
$emailer->reset();
}
bb_die($message);
} else {
set_pr_die_append_msg($pr_data['user_id']);
// если что-то было изменено
if ($db_data) {
if (!$pr_data['user_active']) {
$user_actkey = make_rand_str(12);
$pr_data['user_actkey'] = $user_actkey;
$db_data['user_actkey'] = $user_actkey;
require CLASS_DIR . 'emailer.php';
$emailer = new emailer($bb_cfg['smtp_delivery']);
$emailer->from($bb_cfg['sitename'] . " <{$bb_cfg['board_email']}>");
$emailer->email_address($username . " <{$email}>");
$emailer->use_template('user_activate', $pr_data['user_lang']);
$emailer->assign_vars(array('SITENAME' => $bb_cfg['sitename'], 'USERNAME' => html_entity_decode($username), 'U_ACTIVATE' => make_url("profile.php?mode=activate&u={$pr_data['user_id']}&act_key={$user_actkey}")));
$emailer->send();
$emailer->reset();
$message = $lang['PROFILE_UPDATED_INACTIVE'];
$user->session_end();
} else {
meta_refresh('index.php', 10);
$message = $lang['PROFILE_UPDATED'];
}
$sql_args = DB()->build_array('UPDATE', $db_data);
DB()->query("UPDATE " . BB_USERS . " SET {$sql_args} WHERE user_id = {$pr_data['user_id']} LIMIT 1");
if ($pr_data['user_id'] != $userdata['user_id']) {
if ($pr_data['user_level'] == MOD && !empty($db_data['username'])) {
$datastore->update('moderators');
}
示例14: foreach
case "delete":
if ($HTTP_POST_VARS['selected_usr'] != "") {
//
//Delete Inactive Users
//
foreach ($HTTP_POST_VARS['selected_usr'] as $to_userdata) {
//
//Email to send to Inactive Users
//
$sql = "SELECT username, user_lang, user_email FROM " . USERS_TABLE . " WHERE user_id={$to_userdata} AND user_id <> " . ANONYMOUS;
if ($result = $db->sql_query($sql)) {
$userdata = $db->sql_fetchrow($result);
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->use_template('user_inactive_delete', $userdata['user_lang']);
$emailer->email_address($userdata['user_email']);
$emailer->assign_vars(array('USERNAME' => $userdata['username'], 'SITENAME' => $board_config['sitename'], 'EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'U_REGISTER' => $server_protocol . $server_name . $server_port . $script_name . "?mode=register"));
$emailer->send();
$emailer->reset();
} else {
message_die(GENERAL_ERROR, 'Could not sends emails to inactive users', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . USERS_TABLE . " WHERE user_id={$to_userdata} AND user_id <> " . ANONYMOUS;
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not delete inactive users', '', __LINE__, __FILE__, $sql);
}
$sql = "SELECT g.group_id\n FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g\n WHERE ug.user_id = {$to_userdata}\n AND g.group_id = ug.group_id\n AND g.group_single_user = 1";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain group information for this user', '', __LINE__, __FILE__, $sql);
}
示例15: emailer
$sql_full = "SELECT user_id , username, user_email, user_lang\n\t\t\t\t\t\t\t" . $sql . "\n\t\t\t\t\t\t\tORDER BY username\n\t\t\t\t\t\t\tLIMIT 0, " . $users_number;
} else {
$sql_full = "SELECT user_id , username, user_email, user_lang\n\t\t\t\t\t\t\t" . $sql . "\n\t\t\t\t\t\t\tORDER BY username\n\t\t\t\t\t\t\tLIMIT 800";
}
$result = $db->sql_query($sql_full);
$users_list = $db->sql_fetchrowset($result);
$i = 0;
$name_list = '';
$server_url = create_server_url();
$profile_server_url = $server_url . CMS_PAGE_PROFILE . '?mode=register';
while (isset($users_list[$i]['user_id'])) {
$user_id = $users_list[$i]['user_id'];
$username = str_replace("'", "\\'", $users_list[$i]['username']);
$user_email = $users_list[$i]['user_email'];
$user_lang = $users_list[$i]['user_lang'];
$killed = ip_user_kill($user_id);
if (NOTIFY_USERS && !empty($user_email)) {
$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('delete_users', file_exists(IP_ROOT_PATH . 'language/lang_' . $user_lang . '/email/delete_users.tpl') ? $user_lang : 'english');
$emailer->to($user_email);
$emailer->assign_vars(array('U_REGISTER' => $profile_server_url, 'USER' => $user->data['username'], 'USERNAME' => $username, 'SITENAME' => $config['sitename'], 'BOARD_EMAIL' => $config['board_email']));
$emailer->send();
$emailer->reset();
}
$name_list .= (!empty($name_list) ? ', ' : '<br />') . $username;
$i++;
}