本文整理汇总了PHP中emailer::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP emailer::reset方法的具体用法?PHP emailer::reset怎么用?PHP emailer::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类emailer
的用法示例。
在下文中一共展示了emailer::reset方法的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: _ticket_home
//.........这里部分代码省略.........
$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']);
$emailer->use_template('ticket_' . $row['to']);
$emailer->set_decode(true);
$emailer->assign_vars($v_mail);
$emailer->send();
$emailer->reset();
示例5: birthday_email_send
/**
* Sends a birthday Email
*/
function birthday_email_send()
{
global $db, $cache, $config, $lang;
if (!class_exists('emailer')) {
@(include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT);
}
$server_url = create_server_url();
$birthdays_list = get_birthdays_list_email();
foreach ($birthdays_list as $k => $v) {
// Birthday - BEGIN
// Check if the user has or have had birthday, also see if greetings are enabled
if (!empty($config['birthday_greeting'])) {
// Birthday Email - BEGIN
setup_extra_lang(array('lang_cron_vars'), '', $v['user_lang']);
$year = create_date('Y', time(), $v['user_timezone']);
$date_today = create_date('Ymd', time(), $v['user_timezone']);
$user_birthday = realdate('md', $v['user_birthday']);
$user_birthday2 = ($year . $user_birthday < $date_today ? $year + 1 : $year) . $user_birthday;
$user_age = create_date('Y', time(), $v['user_timezone']) - realdate('Y', $v['user_birthday']);
if (create_date('md', time(), $v['user_timezone']) < realdate('md', $v['user_birthday'])) {
$user_age--;
}
$email_subject = sprintf($lang['BIRTHDAY_GREETING_EMAIL_SUBJECT'], $config['sitename']);
//$email_text = sprintf($lang['BIRTHDAY_GREETING_EMAIL_CONTENT_AGE'], $user_age);
$email_text = sprintf($lang['BIRTHDAY_GREETING_EMAIL_CONTENT'], $config['sitename']);
// Send the email!
$emailer = new emailer();
$emailer->use_template('birthday_greeting', $v['user_lang']);
$emailer->to($v['user_email']);
// 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($email_subject);
$v['username'] = !empty($v['user_first_name']) ? $v['user_first_name'] : $v['username'];
// This is a nasty kludge to remove the username var ... till (if?) translators update their templates
$emailer->msg = preg_replace('#[ ]?{USERNAME}#', $v['username'], $emailer->msg);
$email_sig = create_signature($config['board_email_sig']);
$emailer->assign_vars(array('USERNAME' => !empty($config['html_email']) ? htmlspecialchars($v['username']) : $v['username'], 'USER_AGE' => $user_age, 'EMAIL_SIG' => $email_sig, 'SITENAME' => $config['sitename'], 'SITE_URL' => $server_url));
$emailer->send();
$emailer->reset();
// Birthday Email - END
$sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\tSET user_next_birthday_greeting = " . (create_date('Y', time(), $v['user_timezone']) + 1) . "\n\t\t\t\tWHERE user_id = " . $v['user_id'];
$status = $db->sql_query($sql);
}
// Birthday - END
}
// We reset the lang again for default lang...
setup_extra_lang(array('lang_cron_vars'));
}
示例6: user_notification
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user)
{
global $board_config, $lang, $db, $phpbb_root_path, $MAIN_CFG;
global $userdata;
$current_time = time();
if ($mode == 'delete') {
$delete_sql = !$post_data['first_post'] && !$post_data['last_post'] ? " AND user_id = " . $userdata['user_id'] : '';
$db->sql_query("DELETE FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = {$topic_id}" . $delete_sql);
} else {
if ($mode == 'reply') {
$result = $db->sql_query('SELECT user_id FROM ' . USERS_TABLE . ' WHERE user_level<1');
$user_id_sql = '';
while ($row = $db->sql_fetchrow($result)) {
$user_id_sql .= ', ' . $row['user_id'];
}
$sql = "SELECT u.user_id, u.user_email, u.user_lang\n\t\t\t\tFROM " . TOPICS_WATCH_TABLE . " tw, " . USERS_TABLE . " 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'] . ", " . ANONYMOUS . $user_id_sql . ")\n\t\t\t\t\tAND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "\n\t\t\t\t\tAND u.user_id = tw.user_id";
$result = $db->sql_query($sql);
$update_watched_sql = '';
$bcc_list_ary = array();
if ($row = $db->sql_fetchrow($result)) {
// Sixty second limit
set_time_limit(0);
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));
if (sizeof($bcc_list_ary)) {
include "includes/phpBB/emailer.php";
$emailer = new emailer();
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$topic_title = count($orig_word) ? preg_replace($orig_word, $replacement_word, htmlunprepare($topic_title)) : htmlunprepare($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']);
$emailer->assign_vars(array('EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'SITENAME' => $board_config['sitename'], 'TOPIC_TITLE' => $topic_title, 'U_TOPIC' => URL::index('&file=viewtopic&' . POST_POST_URL . "={$post_id}", true, true) . "#{$post_id}", 'U_STOP_WATCHING_TOPIC' => URL::index('&file=viewtopic&' . POST_TOPIC_URL . "={$topic_id}&unwatch=topic", true, true)));
$emailer->send();
$emailer->reset();
//send_mail($error, $message, false, $lang['Topic_reply_notification'], $to='', $to_name='')
}
}
}
$db->sql_freeresult($result);
if ($update_watched_sql != '') {
$sql = "UPDATE " . TOPICS_WATCH_TABLE . "\n\t\t\t\t\tSET notify_status = " . TOPIC_WATCH_NOTIFIED . "\n\t\t\t\t\tWHERE topic_id = {$topic_id} AND user_id IN ({$update_watched_sql})";
$db->sql_query($sql);
}
}
$sql = "SELECT topic_id FROM " . TOPICS_WATCH_TABLE . "\n\t\t\tWHERE topic_id = {$topic_id} AND user_id = " . $userdata['user_id'];
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
if (!$notify_user && !empty($row['topic_id'])) {
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "\n\t\t\t\t\tWHERE topic_id = {$topic_id} AND user_id = " . $userdata['user_id'];
$db->sql_query($sql);
} else {
if ($notify_user && empty($row['topic_id'])) {
$sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)\n\t\t\t\t\tVALUES (" . $userdata['user_id'] . ", {$topic_id}, 0)";
$db->sql_query($sql);
}
}
}
}
示例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: trim
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 ------------------------------------------------------------
//-- add
redirect(append_sid("privmsg.{$phpEx}?folder=inbox"));
//-- fin mod : Instant Post Redirect --------------------------------------------------------
示例9: home
//.........这里部分代码省略.........
$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;
}
}
if (!empty($name_compose)) {
$name_compose .= ', ';
}
}
}
$email_message = entity_decode($email['email_message']);
if (strpos($email_message, '<system_image>') !== false) {
$enc_email_id = encode($email['email_id']);
$enc_address_id = encode($row['address_id']);
$system_image_link = _link('i' . $enc_email_id . '-' . $enc_address_id . '.jpg', false, false);
$email_message = str_replace('<system_image>', $system_image_link, $email_message);
}
$emailer->assign_vars(array(
'USERNAME' => $name_compose,
'MESSAGE' => $email_message)
);
$emailer->send();
$emailer->reset();
$sql = 'UPDATE ?? SET address_sent = ?
WHERE address_id = ?';
sql_query(sql_filter($sql, $email['email_data'], time(), $row['address_id']));
$i++;
$sql = 'UPDATE _email SET email_last = email_last + 1
WHERE email_id = ?';
sql_query(sql_filter($sql, $email['email_id']));
$sent_to[] = $row['address_account'];
sleep(1);
}
$sql = 'SELECT COUNT(address_id) AS total
FROM ??
WHERE address_sent = 0
ORDER BY address_id';
if (!sql_field(sql_filter($sql, $email['email_data']), 'total', 0)) {
$sql = 'UPDATE _email SET email_active = 0, email_end = ?
WHERE email_id = ?';
sql_query(sql_filter($sql, time(), $email['email_id']));
return $this->e('Finished sending ' . $i . ' emails.');
}
return $this->e('Processed ' . $i . ' emails.');
}
示例10: 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);
}
}
}
示例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: _home
public function _home() {
global $config, $user, $cache;
$user_id = request_var('uid', 0);
if (_button() || $user_id)
{
$username = request_var('username', '');
$user_email = request_var('user_email', '');
if ($user_id) {
$sql = 'SELECT *
FROM _members
WHERE user_id = ';
$sql = sql_filter($sql, $user_id);
} else if (!empty($username)) {
$username = get_username_base($username);
$sql = 'SELECT *
FROM _members
WHERE username_base = ?';
$sql = sql_filter($sql, $username);
} else {
$sql = 'SELECT *
FROM _members
WHERE user_email = ?';
$sql = sql_filter($sql, $user_email);
}
if (!$userdata = sql_fieldrow($sql)) {
exit;
}
//
$user_id = $userdata['user_id'];
$sql = 'UPDATE _members SET user_type = ?
WHERE user_id = ?';
sql_query(sql_filter($sql, USER_NORMAL, $user_id));
$sql = 'DELETE FROM _crypt_confirm WHERE crypt_code = ?
AND crypt_userid = ?';
sql_query(sql_filter($sql, $code, $user_id));
$emailer = new emailer();
$emailer->from('info');
$emailer->use_template('user_welcome_confirm');
$emailer->email_address($userdata['user_email']);
$emailer->assign_vars(array(
'USERNAME' => $userdata['username'])
);
$emailer->send();
$emailer->reset();
_pre('La cuenta de <strong>' . $userdata['username'] . '</strong> ha sido activada.', true);
}
$sql = 'SELECT *
FROM _members
WHERE user_type = 1
ORDER BY username';
$result = sql_rowset($sql);
foreach ($result as $i => $row) {
if (!$i) _style('list');
_style('list.row', array(
'LINK' => s_link($this->name, $row['user_id']),
'USERNAME' => $row['username'],
'EMAIL' => $row['user_email'],
'DATE' => $row['user_regdate'],
'IP' => $row['user_regip'])
);
}
return;
}
示例13: store_dc
public function store_dc($mode, $to, $from, $subject, $message, $can_reply = true, $can_email = false) {
global $user;
if ($mode == 'reply') {
$insert = array(
'parent_id' => (int) $to['parent_id'],
'privmsgs_type' => PRIVMSGS_NEW_MAIL,
'privmsgs_from_userid' => (int) $from['user_id'],
'privmsgs_to_userid' => (int) $to['user_id'],
);
} else {
$insert = array(
'privmsgs_type' => PRIVMSGS_NEW_MAIL,
'privmsgs_subject' => $subject,
'privmsgs_from_userid' => (int) $from['user_id'],
'privmsgs_to_userid' => (int) $to['user_id']
);
}
$insert += array(
'privmsgs_date' => time(),
'msg_ip' => $user->ip,
'privmsgs_text' => $this->prepare($message),
'msg_can_reply' => (int) $can_reply
);
$dc_id = sql_insert('dc', $insert);
if ($mode == 'reply') {
$sql = 'UPDATE _dc SET root_conv = root_conv + 1, last_msg_id = ?
WHERE msg_id = ?';
sql_query(sql_filter($sql, $dc_id, $to['msg_id']));
$sql = 'UPDATE _dc SET msg_deleted = 0
WHERE parent_id = ?';
sql_query(sql_filter($sql, $to['parent_id']));
$user->delete_unread(UH_NOTE, $to['parent_id']);
} else {
$sql = 'UPDATE _dc SET parent_id = ?, last_msg_id = ?
WHERE msg_id = ?';
sql_query(sql_filter($sql, $dc_id, $dc_id, $dc_id));
}
$user->save_unread(UH_NOTE, (($mode == 'reply') ? $to['parent_id'] : $dc_id), 0, $to['user_id']);
//
// Notify via email if user requires it
//
if ($mode == 'start' && $can_email && $user->d('user_email_dc')) {
$emailer = new emailer();
$emailer->from('info');
$emailer->set_subject('Rock Republik: ' . $from['username'] . ' te ha enviado un mensaje');
$emailer->use_template('dc_email');
$emailer->email_address($to['user_email']);
$dc_url = s_link('my dc read', $dc_id);
$emailer->assign_vars(array(
'USERNAME' => $to['username'],
'SENT_BY' => $from['username'],
'DC_URL' => $dc_url)
);
$emailer->send();
$emailer->reset();
}
return $dc_id;
}
示例14: fatal_error
function fatal_error($mode = '404', $bp_message = '') {
global $user, $config;
$current_page = _page();
$error = 'La página <strong>' . $current_page . '</strong> ';
$username = (@method_exists($user, 'd')) ? $user->d('username') : '';
$bp_message .= nr(false, 2) . $current_page . nr(false, 2) . $username;
switch ($mode) {
case 'mysql':
if (isset($config['default_lang']) && isset($user->lang)) {
// Send email notification
$emailer = new emailer();
$emailer->from('info');
$emailer->set_subject('MySQL error');
$emailer->use_template('mcp_delete', $config['default_lang']);
$emailer->email_address('info@rockrepublik.net');
$emailer->assign_vars(array(
'MESSAGE' => $bp_message,
'TIME' => $user->format_date(time(), 'r'))
);
//$emailer->send();
$emailer->reset();
} else {
$email_message = $bp_message . nr(false, 2) . date('r');
$email_headers = "From: info@rockrepublik.net\nReturn-Path: " . $config['board_email'] . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=iso-8859-1\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\n";
//$result = @mail('info@rockrepublik.net', 'MySQL error', preg_replace("#(?<!\r)\n#s", "\n", $email_message), $email_headers, "-f{$config['board_email']}");
}
$title = 'Error del sistema';
$error .= 'tiene un error';
break;
case '600':
$title = 'Origen inválido';
$error .= 'no puede ser accesada porque no se reconoce su IP de origen.';
@error_log('[php client empty ip] File does not exist: ' . $current_page, 0);
break;
default:
$title = 'Archivo no encontrado';
$error .= 'no existe';
$bp_message = '';
status("404 Not Found");
@error_log('[php client ' . $user->ip . ($user->d('username') ? ' - ' . $user->d('username') : '') . '] File does not exist: ' . $current_page, 0);
break;
}
if ($mode != '600') {
$error .= ', puedes regresar a<br /><a href="/">página de inicio de Rock Republik</a> para encontrar información.';
if (!empty($bp_message)) {
$error .= '<br /><br />' . $bp_message;
}
}
sql_close();
$replaces = array(
'PAGE_TITLE' => $title,
'PAGE_MESSAGE' => $error
);
echo exception('error', $replaces);
exit;
}
示例15: home
public function home()
{
global $user;
$v = $this->__(array('faddr', 'nickname', 'address', 'birthday' => array('' => 0), 'country' => 0));
foreach (w('year month day') as $name) {
$v['birthday'][$name] = isset($v['birthday'][$name]) ? $v['birthday'][$name] : '';
}
if (f($v['faddr'])) {
$v['address'] = $v['faddr'];
}
if (_button()) {
if (!f($v['address']) || !f($v['nickname'])) {
$this->error('COMPLETE_FIELDS');
}
if (f($v['address'])) {
$sql = 'SELECT user_id
FROM _members
WHERE user_email = ?';
if (_field(sql_filter($sql, $v['address']), 'user_id', 0)) {
$this->error('EMAIL_EXISTS');
}
if (!preg_match('/^[a-z0-9&\'\\.\\-_\\+]+@[a-z0-9\\-]+\\.([a-z0-9\\-]+\\.)*?[a-z]+$/is', $v['address'])) {
$this->error('EMAIL_BAD');
}
}
$sql = 'SELECT country_id
FROM _countries
WHERE country_id = ?';
if (!_field(sql_filter($sql, $v['country']), 'country_id', 0)) {
$this->error('NO_COUNTRY');
}
if (!$this->errors()) {
$v['birthday'] = _zero($v['birthday']['year']) . _zero($v['birthday']['month']) . _zero($v['birthday']['day']);
$sql_insert = array('type' => 1, 'active' => 0, 'username' => $v['nickname'], 'password' => '', 'registration' => time(), 'lastvisit' => '', 'lastpage' => '', 'country' => $v['country'], 'email' => $v['address'], 'birthday' => $v['birthday'], 'gender' => 0, 'dateformat' => 'd M Y H:i', 'timezone' => 0, 'dst' => 0);
$sql = 'INSERT INTO _members' . _build_array('INSERT', prefix('user', $sql_insert));
_sql($sql);
require XFS . 'core/emailer.php';
$emailer = new emailer();
$emailer->format('plain');
$emailer->from('TWC Kaulitz <twc_princess@twckaulitz.com>');
$emailer->use_template('welcome');
$emailer->email_address($v['address']);
$emailer->assign_vars(array('USERNAME' => $v['nickname']));
$emailer->send();
$emailer->reset();
//
redirect('http://www.twckaulitz.com/', false);
}
}
if ($this->errors()) {
_style('errors', array('MSG' => $this->get_errors()));
}
for ($i = 1; $i < 32; $i++) {
_style('days', array('DAY' => $i));
}
$months = w('Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre');
foreach ($months as $i => $row) {
_style('months', array('VALUE' => $i + 1, 'MONTH' => $row));
}
for ($i = 2005; $i > 1899; $i--) {
_style('years', array('YEAR' => $i));
}
//
// GeoIP
//
include XFS . 'core/geoip.php';
$gi = geoip_open(XFS . 'core/GeoIP.dat', GEOIP_STANDARD);
$geoip_code = strtolower(geoip_country_code_by_addr($gi, $user->ip));
$sql = 'SELECT *
FROM _countries
ORDER BY country_name';
$countries = _rowset($sql);
$codes = w();
foreach ($countries as $row) {
$codes[$row['country_short']] = $row['country_id'];
_style('countries', array('VALUE' => $row['country_id'], 'NAME' => $row['country_name']));
}
if (!$v['country']) {
$v['country'] = isset($codes[$geoip_code]) ? $codes[$geoip_code] : $codes['gt'];
}
v_style(array('NICKNAME' => $v['nickname'], 'ADDRESS' => $v['address'], 'COUNTRY' => $v['country'], 'BIRTHDAY_YEAR' => $v['birthday']['year'], 'BIRTHDAY_MONTH' => $v['birthday']['month'], 'BIRTHDAY_DAY' => $v['birthday']['day']));
return;
}