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 <*****@*****.**>'); $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; }
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; }
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; }
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 <*****@*****.**>'); $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))); }
message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql); } if ($to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) && $to_userdata['user_active']) { $script_name = preg_replace('/^\\/?(.*?)\\/?$/', "\\1", trim($board_config['script_path'])); $script_name = $script_name != '' ? $script_name . '/privmsg.' . $phpEx : 'privmsg.' . $phpEx; $server_name = trim($board_config['server_name']); $server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://'; $server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/'; include $phpbb_root_path . 'includes/emailer.' . $phpEx; $emailer = new emailer($board_config['smtp_delivery']); $emailer->from($board_config['board_email']); $emailer->replyto($board_config['board_email']); $emailer->use_template('privmsg_notify', $to_userdata['user_lang']); $emailer->email_address($to_userdata['user_email']); $emailer->set_subject($lang['Notification_subject']); $emailer->assign_vars(array('USERNAME' => stripslashes($to_username), 'SENDER_USERNAME' => htmlspecialchars($userdata['username']), 'PM_SUBJECT' => $privmsg_subject, 'PM_MESSAGE' => $message_text, 'SITENAME' => $board_config['sitename'], 'EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox')); $emailer->send(); $emailer->reset(); } } /* $template->assign_vars(array( 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("privmsg.$phpEx?folder=inbox") . '">') ); $msg = $lang['Message_sent'] . '<br /><br />' . sprintf($lang['Click_return_inbox'], '<a href="' . append_sid("privmsg.$phpEx?folder=inbox") . '">', '</a> ') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); message_die(GENERAL_MESSAGE, $msg); */ //-- mod : Instant Post Redirect ------------------------------------------------------------ //-- add
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user) { global $board_config, $lang, $db, $phpbb_root_path, $phpEx; global $userdata, $user_ip; $current_time = time(); if ($mode != 'delete') { if ($mode == 'reply') { $sql = "SELECT ban_userid \r\n\t\t\t\tFROM " . BANLIST_TABLE; if (!($result = $db->sql_query($sql, false, true))) { $db->clear_cache('posts_'); 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']) && !empty($row['ban_userid'])) { $user_id_sql .= ', ' . $row['ban_userid']; } } $sql = "SELECT u.user_id, u.user_email, u.user_lang \r\n\t\t\t\tFROM " . TOPICS_WATCH_TABLE . " tw, " . 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 u.user_id = tw.user_id"; if (!($result = $db->sql_query($sql))) { $db->clear_cache('posts_'); message_die(GENERAL_ERROR, 'Could not obtain list of topic watchers', '', __LINE__, __FILE__, $sql); } $update_watched_sql = ''; $bcc_list_ary = array(); if ($row = $db->sql_fetchrow($result)) { // Sixty second limit @set_time_limit(60); do { if ($row['user_email'] != '') { $bcc_list_ary[$row['user_lang']][] = $row['user_email']; } $update_watched_sql .= $update_watched_sql != '' ? ', ' . $row['user_id'] : $row['user_id']; } while ($row = $db->sql_fetchrow($result)); // // Let's do some checking to make sure that mass mail functions // are working in win32 versions of php. // if (preg_match('/[c-z]:\\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery']) { $ini_val = @phpversion() >= '4.0.0' ? 'ini_get' : 'get_cfg_var'; // We are running on windows, force delivery to use our smtp functions // since php's are broken by default $board_config['smtp_delivery'] = 1; $board_config['smtp_host'] = @$ini_val('SMTP'); } if (sizeof($bcc_list_ary)) { include $phpbb_root_path . 'includes/emailer.' . $phpEx; $emailer = new emailer($board_config['smtp_delivery']); $script_name = preg_replace('/^\\/?(.*?)\\/?$/', '\\1', trim($board_config['script_path'])); $script_name = $script_name != '' ? $script_name . '/viewtopic.' . $phpEx : 'viewtopic.' . $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']) . '/' : '/'; $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, unprepare_message($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' => !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' => $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(); } } } $db->sql_freeresult($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))) { $db->clear_cache('posts_'); 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)) { $db->clear_cache('posts_'); 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)) { $db->clear_cache('posts_'); message_die(GENERAL_ERROR, 'Could not insert topic watch information', '', __LINE__, __FILE__, $sql); } } } } $db->clear_cache('posts_'); }
$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 = ''; $email = ''; }
$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'); } } include $phpbb_root_path . 'includes/page_header.' . $phpEx; $template->set_filenames(array("body" => "tellafriend_body.tpl")); $template->pparse("body");
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']); $template->assign_vars(array('USER_LOGGED' => !$user->data['session_logged_in'] ? true : false, 'L_HOME' => $lang['Home'], 'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($config['default_dateformat'], time(), $config['board_timezone'])), 'S_EMAIL_ACTION' => append_sid('dload.' . PHP_EXT), 'S_HIDDEN_FIELDS' => '<input type="hidden" name="sid" value="' . $user->data['session_id'] . '" />', 'L_INDEX' => sprintf($lang['Forum_Index'], $config['sitename']), 'L_EMAIL' => $lang['Semail'], 'L_EMAIL' => $lang['Emailfile'], 'L_EMAILINFO' => $lang['Emailinfo'], 'L_YNAME' => $lang['Yname'], 'L_YEMAIL' => $lang['Yemail'], 'L_FNAME' => $lang['Fname'], 'L_FEMAIL' => $lang['Femail'], 'L_ETEXT' => $lang['Etext'], 'L_DEFAULTMAIL' => $lang['Defaultmail'], 'L_SEMAIL' => $lang['Semail'], 'L_ESUB' => $lang['Esub'], 'L_EMPTY_SUBJECT_EMAIL' => $lang['Empty_subject_email'], 'L_EMPTY_MESSAGE_EMAIL' => $lang['Empty_message_email'], 'U_INDEX_HOME' => append_sid(CMS_PAGE_HOME), 'U_DOWNLOAD_HOME' => append_sid('dload.' . PHP_EXT), 'U_FILE_NAME' => append_sid('dload.' . PHP_EXT . '?action=file&file_id=' . $file_id), 'FILE_NAME' => $file_data['file_name'], 'SNAME' => $user->data['username'], 'SEMAIL' => $user->data['user_email'], 'DOWNLOAD' => $pafiledb_config['settings_dbname'], 'FILE_URL' => create_server_url() . 'dload.' . PHP_EXT . '?action=file&file_id=' . $file_id, 'ID' => $file_id)); $this->display($lang['Download'], 'pa_email_body.tpl'); }
$group_sql = "SELECT group_name \n\t\t\t\t\t\t\tFROM " . GROUPS_TABLE . " \n\t\t\t\t\t\t\tWHERE group_id = {$group_id}"; if (!($result = $db->sql_query($group_sql))) { message_die(GENERAL_ERROR, 'Could not get group information', '', __LINE__, __FILE__, $group_sql); } $group_name_row = $db->sql_fetchrow($result); $group_name = $group_name_row['group_name']; include $phpbb_root_path . 'includes/emailer.' . $phpEx; $emailer = new emailer($board_config['smtp_delivery']); $emailer->from($board_config['board_email']); $emailer->replyto($board_config['board_email']); for ($i = 0; $i < count($bcc_list); $i++) { $emailer->bcc($bcc_list[$i]); } $emailer->use_template('group_approved'); $emailer->set_subject($lang['Group_approved']); $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'GROUP_NAME' => $group_name, 'EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "={$group_id}")); $emailer->send(); $emailer->reset(); } } } } // // END approve or deny // } else { message_die(GENERAL_MESSAGE, $lang['No_groups_exist']); } // // Get group details //
if (!empty($warning_data['user_email'])) { $server_url = create_server_url(); $viewtopic_server_url = $server_url . CMS_PAGE_VIEWTOPIC; $from_email = $user->data['user_email'] && $user->data['user_allow_viewemail'] ? $user->data['user_email'] : $config['board_email']; include_once 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($e_temp, $warning_data['user_lang']); $emailer->to($warning_data['user_email']); $emailer->from($from_email); $emailer->replyto($from_email); //$emailer->set_subject($e_subj); $email_sig = create_signature($config['board_email_sig']); $emailer->assign_vars(array('SITENAME' => $config['sitename'], 'WARNINGS' => $warning_data['user_warnings'], 'TOTAL_WARN' => $config['max_user_bancard'], 'POST_URL' => $viewtopic_server_url . '?' . $forum_id_append . $topic_id_append . POST_POST_URL . '=' . $post_id . '#p' . $post_id, 'EMAIL_SIG' => $email_sig, 'WARNER' => $user->data['username'], 'BLOCK_TIME' => $block_time, 'WARNED_POSTER' => $warning_data['username'])); $emailer->send(); $emailer->reset(); } else { $message .= '<br /><br />' . $lang['user_no_email']; } } elseif ($already_banned) { $message = $lang['user_already_banned']; } else { $message = 'Error in card.' . PHP_EXT; } $cache->destroy_datafiles(array('_ranks'), MAIN_CACHE_FOLDER, 'data', false); $db->clear_cache('ban_', USERS_CACHE_FOLDER); $message .= !empty($post_id) && $post_id > 0 ? '<br /><br />' . sprintf($lang['Click_return_viewtopic'], '<a href="' . append_sid(CMS_PAGE_VIEWTOPIC . '?' . $forum_id_append . $topic_id_append . POST_POST_URL . '=' . $post_id . '#p' . $post_id) . '">', '</a>') : '<br /><br />' . sprintf($lang['Click_return_profile'], '<a href="' . append_sid(CMS_PAGE_PROFILE . '?mode=viewprofile&' . POST_USERS_URL . '=' . $poster_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(CMS_PAGE_FORUM) . '">', '</a>'); message_die(GENERAL_MESSAGE, $message);
if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not rename users group', '', __LINE__, __FILE__, $sql); } } // send mails if requested if ($active_changed) { // // The users account has been deactivated, send them an email with a new activation key // $emailer = new emailer($board_config['smtp_delivery']); $email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n"; $emailer->use_template('user_activate', stripslashes($view_userdata['user_lang'])); $emailer->email_address($user_email); $emailer->set_subject($lang['Reactivate']); $emailer->extra_headers($email_headers); $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\\'", "'", $username), 0, 25)), '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(); } } } // // send update message if (!$user_active) { if ($userdata['session_logged_in'] && !is_admin($userdata)) { session_end($userdata['session_id'], $userdata['user_id']); } if ($create_user) { if ($board_config['require_activation'] == USER_ACTIVATION_SELF) { $message = $lang['Account_inactive'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.{$phpEx}") . '">', '</a>'); } else {
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; } } 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.'); }
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") ); $emailer->send(); $emailer->reset(); } } } if ($update_watched_sql != '') { $sql = 'UPDATE _forum_topics_fav SET notify_status = ? WHERE topic_id = ? AND user_id IN (??)'; sql_query(sql_filter($sql, TOPIC_WATCH_NOTIFIED, $topic_id, $update_watched_sql)); } } $sql = 'SELECT topic_id FROM _forum_topics_fav WHERE topic_id = ? AND user_id = ?'; if ($row = sql_fieldrow(sql_filter($sql, $topic_id, $userdata['user_id']))) { if (!$notify_user && !empty($row['topic_id'])) { $sql = 'DELETE FROM _forum_topics_fav WHERE topic_id = ? AND user_id = ?'; sql_query(sql_filter($sql, $topic_id, $userdata['user_id'])); } else if ($notify_user && empty($row['topic_id'])) { $sql = "INSERT INTO _forum_topics_fav (user_id, topic_id, notify_status) VALUES (" . $userdata['user_id'] . ", $topic_id, 0)"; sql_query($sql); } } } }
$emailer = new emailer(); $emailer->from($config['board_email']); $emailer->replyto($config['board_email']); for ($i = 0; $i < count($bcc_list); $i++) { $emailer->bcc($bcc_list[$i]); } $emailer->use_template('group_approved'); $emailer->set_subject($lang['Group_approved']); $emailer->assign_vars(array( 'SITENAME' => $config['sitename'], 'GROUP_NAME' => $group_name, 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "=$group_id") ); $emailer->send(); $emailer->reset(); } } } } // // END approve or deny // } else { trigger_error('No_groups_exist');
/** * 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); } } }
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(); if ($xcf->check($cv['comment_security']) === false) { $cv['comment_security'] = ''; $this->error('E_COMMENT_INVALID_CAPTCHA'); } unset($xcf); } if (!$this->errors()) { $approve_comments = !$user->v('is_member') ? $tree['tree_approve_comments'] : 1; $sql_insert = array('tree' => (int) $tree['tree_id'], 'uid' => (int) $user->v('user_id'), 'username' => $cv['comment_username'], 'email' => $cv['comment_address'], 'website' => $cv['comment_website'], 'ip' => $user->ip, 'status' => (int) $approve_comments, 'time' => (int) $comment_time, 'message' => $cv['comment_message']); $sql = 'INSERT INTO _comments' . _build_array('INSERT', prefix('comment', $sql_insert)); _sql($sql); if ($approve_comments) { $sql = 'UPDATE _tree SET tree_comments = tree_comments + 1 WHERE tree_id = ?'; _sql(sql_filter($sql, $tree['tree_id'])); } // Send new comment email notification for approval. if (!$approve_comments) { unset($cv['comment_security']); require_once XFS . 'core/emailer.php'; $emailer = new emailer(); $emailer->from($cv['comment_address']); $emailer->use_template('comment_approval'); if (f($tree['tree_form_email'])) { $tree['tree_form_email'] = $core->v('default_comments_email'); } foreach (explode(';', $tree['tree_form_email']) as $i => $row) { $row_f = !$i ? 'email_address' : 'cc'; $emailer->{$row_f}($row); } $input = w(); foreach ($cv as $row_k => $row_v) { if (!f($row_v)) { continue; } if ($row_k == 'comment_message') { $row_v = str_replace("\r\n", '<br />', $row_v); } $input[] = '< ' . $row_v; } $emailer->assign_vars(array('U_APPROVAL' => _link(_rewrite($tree), array('x1' => 'comments')), 'INPUT_FIELDS' => implode('<br /><br />', $input), 'FROM_USERNAME' => $cv['comment_username'])); $emailer->send(); $emailer->reset(); } redirect(_link(_rewrite($tree))); } if ($this->errors()) { if (is_ghost()) { $this->e('!'); } _style('comments_error', array('MESSAGE' => $this->get_errors())); } } // if (f($tree['tree_redirect'])) { if (preg_match('#^[a-z0-9\\-\\_]+$#is', $tree['tree_redirect'])) { $tree['tree_redirect'] = _link($tree['tree_redirect']); } redirect($tree['tree_redirect']); } // if ($tree['tree_parent']) { $sql = 'SELECT * FROM _tree WHERE tree_id = ?'; $parent = _fieldrow(sql_filter($sql, $tree['tree_parent'])); if ($tree['tree_level'] > 2) { $sql = 'SELECT * FROM _tree WHERE tree_id = ?'; $subparent = _fieldrow(sql_filter($sql, $parent['tree_parent'])); } } if ($tree['tree_node']) { $sql = 'SELECT * FROM _tree WHERE tree_id = ?'; $node = _fieldrow(sql_filter($sql, $tree['tree_node'])); } // if (@method_exists($this, 'cf_' . _rewrite($tree))) { $this->{'cf_' . _rewrite($tree)}($tree); } // $sql = 'SELECT * FROM _tree WHERE tree_parent = ? AND tree_child_hide = 0 ORDER BY ??'; $childs = _rowset(sql_filter($sql, $tree['tree_id'], $this->child_order($tree))); foreach ($childs as $i => $row) { if (!$i) { $sql = 'SELECT image_id, image_tree, image_extension FROM _images WHERE image_tree IN (??) ORDER BY RAND()'; $images_child = _rowset(sql_filter($sql, _implode(',', array_keys($childs))), 'tree_id'); _style('tree_child1', array('ORDER_URL' => _link($tree['tree_id'], array('order', 0, 0, 0, 0)))); } _style('tree_child.row', array('ITEM' => $row['tree_id'], 'URL' => _link(_rewrite($row)), 'SUBJECT' => $row['tree_subject'], 'CONTENT' => $row['tree_content'], 'EDITED' => _format_date($row['tree_edited']), 'IMAGE' => isset($images_child[$row['tree_id']]) ? $images_child[$row['tree_id']]['image_id'] . '.' . $images_child[$row['tree_id']]['image_extension'] : 'default.gif')); } // Comments if ($tree['tree_allow_comments'] && $tree['tree_comments']) { $sql = 'SELECT c.comment_id, c.comment_username, c.comment_website, c.comment_time, c.comment_message, m.user_username FROM _comments c, _members m WHERE c.comment_tree = ? AND c.comment_status = 1 AND c.comment_uid = m.user_id ORDER BY c.comment_time DESC'; $comments = _rowset(sql_filter($sql, $tree['tree_id'])); foreach ($comments as $i => $row) { if (!$i) { _style('comments'); } _style('comments.row', array('ID' => $row['comment_id'], 'SUSERNAME' => $row['user_username'], 'USERNAME' => $row['comment_username'], 'WEBSITE' => $row['comment_website'], 'TIME' => _format_date($row['comment_time']), 'MESSAGE' => str_replace("\n", '<br />', $row['comment_message']))); } } // if ($this->css_parent($tree)) { $sql = 'SELECT * FROM _tree WHERE tree_parent = ? AND tree_child_hide = 0 ORDER BY ??'; $childs_parent = _rowset(sql_filter($sql, $this->css_var($tree), $this->child_order($tree))); foreach ($childs_parent as $i => $row) { if (!$i) { $sql = 'SELECT image_id, image_tree, image_extension FROM _images WHERE image_tree IN (??) ORDER BY RAND()'; $images_child_parent = _rowset(sql_filter($sql, _implode(',', array_keys($childs_parent))), 'tree_id'); _style('tree_child', array('ORDER_URL' => _link($tree['tree_id'], array('order', 0, 0, 0, 0)))); } _style('tree_child_parent.row', array('ITEM' => $row['tree_id'], 'URL' => _link(_rewrite($row)), 'TITLE' => $row['tree_subject'], 'IMAGE' => isset($images_child_parent[$row['tree_id']]) ? $images_child_parent[$row['tree_id']]['image_id'] . '.' . $images_child_parent[$row['tree_id']]['image_extension'] : 'default.gif')); } } if ($tree['tree_downloads']) { $sql = 'SELECT * FROM _downloads WHERE download_tree = ? ORDER BY download_order'; $downloads = _rowset(sql_filter($sql, $tree['tree_id'])); foreach ($downloads as $i => $row) { if (!$i) { _style('downloads', array('ORDER_URL' => _link($tree['tree_id'], array('orderd', 0, 0, 0, 0)))); } _style('downloads.row', array('ITEM' => $row['download_id'], 'DOWNLOAD' => _link('get', $row['download_alias'] . '.' . $row['download_extension']), 'TITLE' => $row['download_title'])); } } // if ($tree['tree_form']) { $sql = 'SELECT * FROM _form_fields WHERE form_tree = ? ORDER BY form_order'; $form = _rowset(sql_filter($sql, $tree['tree_id']), 'form_alias'); if (!count($form)) { $sql = 'SELECT * FROM _form_fields WHERE form_tree = 0 ORDER BY form_order'; $form = _rowset($sql, 'form_alias'); } $form['secure'] = array('form_required' => 1, 'form_regex' => '^([a-zA-Z]+)$', 'form_alias' => 'secure', 'form_type' => 'text', 'form_legend' => 'Imagen de seguridad'); _style('form', array('URL' => _link(_rewrite($tree)))); foreach ($form as $row) { _style('form.row', array('ALIAS' => $row['form_alias'], 'REQUIRED' => $row['form_required'], 'LEGEND' => _lang($row['form_legend']), 'TYPE' => $row['form_type'], 'PAGE' => $tree['tree_alias'])); foreach ($row as $row_k => $row_v) { if (preg_match('#^form_(alias|type)$#is', $row_k)) { if ($row_k == 'form_alias') { $row_k = 'name'; } _style('form.row.attrib', array('ATTRIB' => str_replace('form_', '', $row_k), 'VALUE' => $row_v)); } } } } $s_css_page = ''; if (@file_exists('./style/css/_tree_' . _rewrite($tree) . '.css')) { $s_css_page = _rewrite($tree) . '/'; } elseif ($this->css_parent($tree)) { if (!f($tree['tree_css_var'])) { $tree['tree_css_var'] = 'parent'; } $ary_css_var = false; switch ($tree['tree_css_var']) { case 'parent': case 'subparent': case 'node': $ary_css_var = ${$tree['tree_css_var']}; break; default: if (is_numb($tree['tree_css_var'])) { $sql = 'SELECT * FROM _tree WHERE tree_id = ?'; if ($css_var_row = _fieldrow(sql_filter($sql, $tree['tree_css_var']))) { $ary_css_var = $css_var_row; } } break; } if ($ary_css_var !== false) { $s_css_page = _rewrite($ary_css_var) . '/'; } } v_style(array('S_IMAGES' => $core->v('address') . 'container/images/a_' . ($this->css_parent($tree) ? $this->css_var($tree) : $tree['tree_id']) . '/', 'V_TREE' => $tree['tree_id'], 'V_CSS' => $s_css_page, 'V_SUBJECT' => $tree['tree_subject'], 'V_CONTENT' => _message($tree['tree_content']), 'V_COMMENTS' => $tree['tree_comments'], 'V_ALLOW_COMMENTS' => $tree['tree_allow_comments'], 'V_ALLOW_FORM' => $tree['tree_form'], 'U_COMMENTS' => _link(_rewrite($tree)), 'U_XCF' => _link(_rewrite($tree) . '-xs.jpg', false, false))); $tree['tree_subject'] = strip_tags($tree['tree_subject']); // if ($tree['tree_alias'] != 'home') { if ($node['tree_id'] != $parent['tree_id']) { $this->navigation($node['tree_subject'], _rewrite($node)); } if ($tree['tree_level'] > 2) { if ($parent['tree_id'] && $node['tree_id'] && $tree['tree_level'] > 3) { $this->navigation('...'); } $this->navigation($subparent['tree_subject'], _rewrite($subparent)); } if ($parent['tree_id']) { $this->navigation($parent['tree_subject'], _rewrite($parent)); } $this->navigation($tree['tree_subject'], _rewrite($tree)); } if ($user->v('is_member')) { $tree['tree_cp'] = 1; $i = 0; $auth_tree = array('create', 'modify', 'remove'); foreach ($auth_tree as $row) { if (_auth_get('cp_' . $row)) { if (!$i) { _style('auth'); } _style('auth.row', array('U_AUTH' => _link('cp', array($row, _rewrite($tree))), 'V_NAME' => _lang('CP_AUTH_' . $row))); $i++; } } } // $this->_template('tree'); if (f($tree['tree_template']) && @file_exists('./style/custom/' . $tree['tree_template'] . '.htm')) { $this->_template('custom/' . $tree['tree_template']); } // TODO: 304 header response header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $tree['tree_edited']) . ' GMT'); return; }
} } $sql_update_pass = $row['user_newpasswd'] != '' ? ", user_password = '******'", "''", $row['user_newpasswd']) . "', user_newpasswd = ''" : ''; $sql = "UPDATE " . USERS_TABLE . "\n\t\t\tSET user_active = 1, user_actkey = ''" . $sql_update_pass . " \n\t\t\tWHERE user_id = " . $row['user_id']; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql_update); } if (intval($board_config['require_activation']) == USER_ACTIVATION_ADMIN && $sql_update_pass == '') { 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('admin_welcome_activated', $row['user_lang']); $emailer->email_address($row['user_email']); $emailer->set_subject($lang['Account_activated_subject']); $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'USERNAME' => $row['username'], 'PASSWORD' => $password_confirm, 'EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '')); $emailer->send(); $emailer->reset(); $template->assign_vars(array('META' => '<meta http-equiv="refresh" content="10;url=' . append_sid("index.{$phpEx}") . '">')); message_die(GENERAL_MESSAGE, $lang['Account_active_admin']); } else { $template->assign_vars(array('META' => '<meta http-equiv="refresh" content="10;url=' . append_sid("index.{$phpEx}") . '">')); $message = $sql_update_pass == '' ? $lang['Account_active'] : $lang['Password_activated']; message_die(GENERAL_MESSAGE, $message); } } else { message_die(GENERAL_MESSAGE, $lang['Wrong_activation']); } } } else { message_die(GENERAL_MESSAGE, $lang['No_such_user']);
$emailer->assign_vars(array( 'BOARD_URL' => DIGEST_SITE_URL, 'LINK' => $link_tag, 'L_SITENAME' => $config['sitename'], 'L_SALUTATION' => $lang['digest_salutation'], 'SALUTATION' => $row['username'], 'L_DIGEST_OPTIONS' => $lang['digest_your_digest_options'], 'L_INTRODUCTION' => $lang['digest_introduction'], 'L_FORMAT' => $lang['digest_format_short'], 'FORMAT' => $row['format'], 'L_MESSAGE_TEXT' => $lang['digest_show_message_text'], 'MESSAGE_TEXT' => $row['show_text'], 'L_MY_MESSAGES' => $lang['digest_show_my_messages'], 'MY_MESSAGES' => $row['show_mine'], 'L_FREQUENCY' => $lang['digest_frequency'], 'FREQUENCY' => $row['digest_type'], 'L_NEW_MESSAGES' => $lang['digest_show_only_new_messages'], 'NEW_MESSAGES' => $row['new_only'], 'L_SEND_DIGEST' => $lang['digest_send_if_no_new_messages'], 'SEND_DIGEST' => $row['send_on_no_messages'], 'L_SEND_TIME' => $lang['digest_hour_to_send_short'], 'SEND_TIME' => gmdate('g A', gmmktime($send_hour)), 'DIGEST_CONTENT' => $msg, 'DISCLAIMER' => ($html) ? $lang['digest_disclaimer_html'] : $lang['digest_disclaimer_text'], 'L_TEXT_LENGTH' => $lang['digest_message_size'], 'TEXT_LENGTH' => $row['text_length'], 'L_VERSION' => $lang['digest_version_text'], 'VERSION' => DIGEST_VERSION ) ); $emailer->send($html);
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($ft_cfg['script_path'])); $script_name = $script_name != '' ? $script_name . '/privmsg.php' : 'privmsg.php'; $server_name = trim($ft_cfg['server_name']); $server_protocol = $ft_cfg['cookie_secure'] ? 'https://' : 'http://'; $server_port = $ft_cfg['server_port'] != 80 ? ':' . trim($ft_cfg['server_port']) . '/' : '/'; require FT_ROOT . 'includes/emailer.php'; $emailer = new emailer($ft_cfg['smtp_delivery']); $emailer->from($ft_cfg['board_email']); $emailer->replyto($ft_cfg['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' => $to_username, 'SITENAME' => $ft_cfg['sitename'], 'EMAIL_SIG' => !empty($ft_cfg['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $ft_cfg['board_email_sig']) : '', 'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox&mode=read&p=' . $privmsg_sent_id)); $emailer->send(); $emailer->reset(); } } $template->assign_vars(array('META' => '<meta http-equiv="refresh" content="10;url=' . append_sid("privmsg.php?folder=inbox") . '">')); // orig $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>'); $msg = $lang['Message_sent'] . '<br /><br />' . sprintf($lang['Click_return_inbox'], '<a href="' . append_sid("privmsg.php?folder=inbox") . '">', '</a> ') . sprintf($lang['Click_return_sentbox'], '<a href="' . append_sid("privmsg.{$phpEx}?folder=sentbox") . '">', '</a> ') . sprintf($lang['Click_return_outbox'], '<a href="' . append_sid("privmsg.php?folder=outbox") . '">', '</a> ') . sprintf($lang['Click_return_savebox'], '<a href="' . append_sid("privmsg.php?folder=savebox") . '">', '</a> ') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.php") . '">', '</a>'); message_die(GENERAL_MESSAGE, $msg); } 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. //
} } // 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"; if ($row = DB()->fetch_row($sql)) { if ($row['user_pending'] == 0) { $is_group_member = true;
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 }
$email_template = 'admin_welcome_inactive'; } else { $message = $lang['Account_added']; $email_template = 'user_welcome'; } } } include "includes/emailer.php"; $emailer = new emailer($board_config['smtp_delivery']); $emailer->from($board_config['board_email']); $emailer->replyto($board_config['board_email']); $emailer->use_template($email_template, stripslashes($user_lang)); $emailer->email_address($email); $emailer->set_subject(sprintf($lang['Welcome_subject'], $board_config['sitename'])); if ($coppa) { $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']), 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\\'", "'", $username), 0, 25)), 'PASSWORD' => $password_confirm, 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 'FAX_INFO' => $board_config['coppa_fax'], 'MAIL_INFO' => $board_config['coppa_mail'], 'EMAIL_ADDRESS' => $email, 'ICQ' => $icq, 'AIM' => $aim, 'YIM' => $yim, 'MSN' => $msn, 'WEB_SITE' => $website, 'FROM' => $location, 'OCC' => $occupation, 'INTERESTS' => $interests, 'SITENAME' => $board_config['sitename'])); } else { $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']), 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\\'", "'", $username), 0, 25)), 'PASSWORD' => $password_confirm, 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 'U_ACTIVATE' => $server_url . '&mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)); } $emailer->send(); $emailer->reset(); if ($board_config['require_activation'] == USER_ACTIVATION_ADMIN) { $sql = "SELECT user_email, user_lang\n FROM " . USERS_TABLE . "\n WHERE user_level = " . ADMIN; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) { $emailer->from($board_config['board_email']); $emailer->replyto($board_config['board_email']); $emailer->email_address(trim($row['user_email'])); $emailer->use_template("admin_activate", $row['user_lang']);
// Get the group name $group_sql = "SELECT group_name\n\t\t\t\t\t\t\tFROM " . GROUPS_TABLE . "\n\t\t\t\t\t\t\tWHERE group_id = '" . $group_id . "'"; $result = $db->sql_query($group_sql); $group_name_row = $db->sql_fetchrow($result); $group_name = $group_name_row['group_name']; include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT; $emailer = new emailer(); foreach ($bcc_list as $bcc_address) { if (!empty($bcc_address)) { $emailer->bcc($bcc_address); } } $emailer->use_template('group_approved'); $emailer->set_subject($lang['Group_approved']); $email_sig = create_signature($config['board_email_sig']); $emailer->assign_vars(array('SITENAME' => $config['sitename'], 'GROUP_NAME' => $group_name, 'EMAIL_SIG' => $email_sig, 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . '=' . $group_id)); $emailer->send(); $emailer->reset(); } } } } // END approve or deny } else { message_die(GENERAL_MESSAGE, $lang['No_groups_exist']); } // Get group details $sql = "SELECT *\n\t\tFROM " . GROUPS_TABLE . "\n\t\tWHERE group_id = '" . $group_id . "'\n\t\t\tAND group_single_user = '******'"; $result = $db->sql_query($sql); if (!($group_info = $db->sql_fetchrow($result))) { message_die(GENERAL_MESSAGE, $lang['Group_not_exist']);
} $emailer = new emailer($board_config['smtp_delivery']); $emailer->from($board_config['board_email']); $emailer->replyto($board_config['board_email']); for ($i = 0; $i < count($bcc_list); $i++) { $emailer->bcc($bcc_list[$i]); } $email_headers = 'X-AntiAbuse: Board servername - ' . $board_config['server_name'] . "\n"; $email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n"; $email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n"; $email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n"; $emailer->use_template('admin_send_email'); $emailer->email_address($board_config['board_email']); $emailer->set_subject($subject); $emailer->extra_headers($email_headers); $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'BOARD_EMAIL' => $board_config['board_email'], 'MESSAGE' => $message)); $emailer->send(); $emailer->reset(); message_die(GENERAL_MESSAGE, $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.{$phpEx}?pane=right") . '">', '</a>')); } } if ($error) { $template->set_filenames(array('reg_header' => 'error_body.tpl')); $template->assign_vars(array('ERROR_MESSAGE' => $error_msg)); $template->assign_var_from_handle('ERROR_BOX', 'reg_header'); } // // Initial selection // $sql = "SELECT group_id, group_name\r\n FROM " . GROUPS_TABLE . "\r\n WHERE group_single_user <> 1"; if (!($result = $db->sql_query($sql))) {
function send_mail($type, $from_userdata, &$to_user_ids, &$recips, $subject, $message, $time = 0, $copy = true, $parsed_values = array()) { global $db, $board_config, $lang, $phpbb_root_path, $phpEx, $userdata; // fix some parameters $subject = trim($subject); $message = trim($message); // check we have a message and a subject if (empty($subject)) { return 'Empty_subject'; } if (empty($message)) { return 'Empty_message'; } // recipient is not an array, so make one if (!is_array($to_user_ids) && !empty($to_user_ids)) { $to_user_ids = array(intval($to_user_ids)); } // check if recipients if (empty($to_user_ids)) { return 'No_to_user'; } $s_to_user_ids = implode(', ', $to_user_ids); // censor words $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); // process some cleaning $subject = count($orig_word) ? preg_replace($orig_word, $replacement_word, unprepare_message($subject)) : unprepare_message($subject); $message = count($orig_word) ? preg_replace($orig_word, $replacement_word, unprepare_message($message)) : unprepare_message($message); // clean any bbcode_uid $subject = preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $subject); $message = preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $message); // clean HTML $subject = preg_replace('#(<)([\\/]?.*?)(>)#is', "<\\2>", $subject); $message = preg_replace('#(<)([\\/]?.*?)(>)#is', "<\\2>", $message); // from_user_id can be 0 for sys message (sent by the board) if (empty($from_userdata)) { $from_userdata['user_id'] = 0; $from_userdata['user_level'] = ADMIN; $from_userdata['username'] = $board_config['sitename']; } $from_user_id = intval($from_userdata['user_id']); // get the recipients $sql_where = "user_email <> '' AND user_email IS NOT NULL"; // this will require enhancement for the pcp ignore/friend list if (!$copy) { $sql_where .= " AND user_id <> " . intval($from_userdata['user_id']); } if ($userdata['user_level'] != ADMIN) { $sql_where .= " AND (user_viewemail = 1 OR user_id = " . intval($userdata['user_id']) . ")"; } // // Make sure user wánts the mail // $notify_sql = ''; $sql_notify = ''; if ($type == 'privmsg_notify') { $sql_notify = ', user_notify_pm'; $notify_sql = 'AND user_notify_pm != 0'; } // read the mail recipients $sql = "SELECT user_id, user_email, user_lang, username" . $sql_notify . "\n FROM " . USERS_TABLE . "\n WHERE user_id IN ({$s_to_user_ids})\n {$notify_sql}\n AND user_id NOT IN (0, " . ANONYMOUS . ")\n AND {$sql_where}"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not read recipient mail list', '', __LINE__, __FILE__, $sql); } $count = 0; $bcc_list_ary = array(); while ($row = $db->sql_fetchrow($result)) { $count++; $bcc_list_ary[$row['user_lang']][] = array('user_id' => $row['user_id'], 'mail' => $row['user_email'], 'username' => $row['username']); } if ($count > 0) { // read the message recipients $msg_to = ''; if (!empty($recips)) { for ($i = 0; $i < count($recips); $i++) { $username = isset($recips[$i]['privmsg_to_username']) ? $recips[$i]['privmsg_to_username'] : $recips[$i]['username']; if (!empty($username)) { $msg_to .= (empty($msg_to) ? '' : ', ') . $username; } } } // // 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')) && !$board_config['smtp_delivery']) { $ini_val = @phpversion() >= '4.0.0' ? 'ini_get' : 'get_cfg_var'; // We are running on windows, force delivery to use our smtp functions // since php's are broken by default $board_config['smtp_delivery'] = 1; $board_config['smtp_host'] = @$ini_val('SMTP'); } // init the mailer $emailer = new emailer($board_config['smtp_delivery']); // init server vars $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']) . '/' : '/'; // sender script $script_path = preg_replace('/^\\/?(.*?)\\/?$/', '\\1', trim($board_config['script_path'])); $script_path = !empty($script_name) ? $server_protocol . $server_name . $server_port . $script_name . '/' : $server_protocol . $server_name . $server_port; // start the emailer data $emailer->from($board_config['board_email']); $emailer->replyto($board_config['board_email']); // choose template switch ($type) { case 'privmsg_notify': $tpl = 'privmsg_notify'; $mail_subject = _lang('Notification_subject'); break; case 'save_to_mail': $tpl = 'admin_send_email'; $mail_subject = _lang('Save_to_mail_subject') . $subject; break; default: $tpl = 'admin_send_email'; $mail_subject = $subject; break; } // send message (coming partially from privmsgs.php) : one per lang @reset($bcc_list_ary); while (list($user_lang, $bcc_list) = each($bcc_list_ary)) { if ($count == 1) { $emailer->email_address($bcc_list[0]['mail']); } else { // affect users mail for ($i = 0; $i < count($bcc_list); $i++) { $emailer->bcc($bcc_list[$i]['mail']); } } // remove {USERNAME} from the template if more than one recipient if ($count > 0) { $emailer->msg = preg_replace('#[ ]?{USERNAME}#', '', $emailer->msg); } // build message $msg = _lang('Subject') . ': ' . $subject; $msg .= "\n" . _lang('From') . ': ' . $from_userdata['username']; if (!empty($msg_to)) { $msg .= "\n" . _lang('To') . ': ' . $msg_to; } if (!empty($time)) { $dformat = $board_config['default_dateformat']; $dtz = $board_config['board_timezone']; if (count($to_user_ids) == 1) { $dformat = $userdata['user_dateformat']; $dtz = $userdata['user_timezone']; } $post_date = create_date($dformat, $time, $dtz); $msg .= "\n" . _lang('Date') . ': ' . $post_date; } $msg .= "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" . $message; // generic values $parsed_values['SITENAME'] = $board_config['sitename']; $parsed_values['EMAIL_SIG'] = !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''; $parsed_values['MESSAGE'] = $msg; $parsed_values['FROM'] = $userdata['username']; $emailer->use_template($tpl, $user_lang); $emailer->set_subject($mail_subject); $emailer->assign_vars($parsed_values); // send $emailer->send(); $emailer->reset(); } } }
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' => $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(); } } $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); } 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($HTTP_POST_VARS['username']) ? trim(htmlspecialchars(stripslashes($HTTP_POST_VARS['username']))) : '';
$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)); $emailer->send(); $emailer->reset(); } $message = $message . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.php") . '">', '</a>');
protected function _tech_add() { global $user, $core; gfatal(); if (!_auth_get('ticket_assign_tech') && !_auth_get('ticket_auto_assign')) { _fatal(); } $v = $this->__(array('ticket' => 0, 'tech')); if (_auth_get('ticket_auto_assign') && !$user->v('is_founder') && $user->v('user_username') != $v['tech']) { $this->_error('NO_ASSIGN_OTHER'); } $sql = 'SELECT * FROM _tickets t, _groups g WHERE t.ticket_id = ? AND t.ticket_group = g.group_id'; if (!($tdata = _fieldrow(sql_filter($sql, $v['ticket'])))) { $this->_error('NOT_MEMBER_2'); } $sql = 'SELECT user_id FROM _members WHERE user_username = ?'; $v['tech'] = _field(sql_filter($sql, $v['tech']), 'user_id', 0); $sql = 'SELECT * FROM _members WHERE user_id = ?'; if (!($techdata = _fieldrow(sql_filter($sql, $v['tech'])))) { $this->_error('NOT_MEMBER'); } $sql = 'SELECT ticket_id FROM _tickets WHERE ticket_contact = ? AND ticket_id = ?'; if ($row1 = _field(sql_filter($sql, $v['tech'], $v['ticket']), 'ticket_id', 0)) { $this->_error('CANT_ASSIGN'); } $sql = 'SELECT * FROM _tickets_assign WHERE user_id = ? AND assign_ticket = ?'; if ($row2 = _fieldrow(sql_filter($sql, $v['tech'], $v['ticket']))) { $this->_error('ALREADY_ASSIGN'); } $sql = 'SELECT * FROM _members WHERE user_id = ?'; if (!($cdata = _fieldrow(sql_filter($sql, $tdata['ticket_contact'])))) { $this->_error('NOT_MEMBER_3'); } $sql_insert = array('assign_ticket' => $v['ticket'], 'user_id' => $v['tech'], 'assign_status' => $tdata['ticket_status'], 'assign_end' => 0); $sql = 'INSERT INTO _tickets_assign' . _build_array('INSERT', $sql_insert); _sql($sql); // Send notification require_once XFS . 'core/emailer.php'; $emailer = new emailer(); $ticket_subject = entity_decode($tdata['group_name'] . ' [#' . $tdata['ticket_code'] . ']: ' . $tdata['ticket_title']); $ticket_message = entity_decode($tdata['ticket_text']); $emailer->from($tdata['group_email'] . '@' . $core->v('domain')); $emailer->email_address($techdata['user_email']); $emailer->use_template('ticket_tech'); $emailer->set_subject($ticket_subject); $emailer->assign_vars(array('USERNAME' => $techdata['user_username'], 'FULLNAME' => entity_decode(_fullname($cdata)), 'SUBJECT' => entity_decode($tdata['ticket_title']), 'MESSAGE' => $ticket_message, 'TICKET_URL' => _link($this->m(), array('x1' => 'view', 'code' => $tdata['ticket_code'])))); $emailer->send(); $emailer->reset(); return $this->e(_fullname($cdata)); }
} // if $outbidded_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 = $outbidded_user['username']; $email = $outbidded_user['user_email']; 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('auction_outbid', stripslashes($user_lang)); $emailer->email_address($email); $emailer->set_subject($lang['outbid']); $emailer->assign_vars(array('AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OUTBID_SUBJECT' => $lang['outbid'], 'AUCTION_USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\\'", "'", $username), 0, 25)), 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($auction_corresponding_bids_start_stop_row['auction_offer_title']))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $server_port . $board_config['script_path'] . '/auction_offer_view.php?ao=' . $HTTP_GET_VARS[POST_AUCTION_OFFER_URL], 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '')); $emailer->send(); $emailer->reset(); // END EMAIL-NOTIFY } // BEGIN PM-NOTIFY ON OUTBID // Check ACP-setting if ($auction_config_data['auction_pm_notify']) { $outbid_pm_subject = $lang['outbid'] . " - " . prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($auction_corresponding_bids_start_stop_row['auction_offer_title']))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0); $outbid_pm = $lang['outbid_pm']; $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($outbid_pm_subject, $board_config['sitename']))) . "',\r\n '2',\r\n " . $auction_corresponding_bids_start_stop_row['FK_auction_offer_last_bid_user_id'] . ",\r\n " . $privmsgs_date . ",\r\n '0',\r\n '1',\r\n '1',\r\n '0')"; if (!$db->sql_query($sql)) { message_die(GENERAL_ERROR, 'Could not insert private message sent info', '', __LINE__, __FILE__, $sql); } // if