本文整理汇总了PHP中unprepare_message函数的典型用法代码示例。如果您正苦于以下问题:PHP unprepare_message函数的具体用法?PHP unprepare_message怎么用?PHP unprepare_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unprepare_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: die
//
//--------------------------------------------------------------------------------------------------
if (!defined('IN_PHPBB') || !defined('IN_PRIVMSG')) {
die('Hacking attempt');
}
//--------------------------
//
// get parameters
//
//--------------------------
_hidden_init();
// vars
$folder_id = _read_var('folder', 1, INBOX);
$search_folder = _read_var('search_folder', 1);
$username = htmlspecialchars(unprepare_message(stripslashes(urldecode(_read_var('username')))));
$words = htmlspecialchars(unprepare_message(stripslashes(urldecode(_read_var('words')))));
// buttons
$submit = _button_var('submit_search');
$cancel = _button_var('cancel');
//-----------------------------
//
// performed some checks
//
//-----------------------------
$error = false;
$error_msg = '';
// folder
if (!isset($folders['data'][$folder_id])) {
$folder_id = INBOX;
}
$folder_main = $folder_id;
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:31,代码来源:privmsga_search.php
示例2: 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, $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)) {
//.........这里部分代码省略.........
开发者ID:Nekrofage,项目名称:FJR,代码行数:101,代码来源:functions_post.php
示例3: htmlspecialchars
if ($result['error']) {
$error = true;
$error_msg .= !empty($error_msg) ? '<br />' . $result['error_msg'] : $result['error_msg'];
}
}
}
if ($refresh || $preview) {
$message = !empty($HTTP_POST_VARS['message']) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['message']))) : '';
if (!empty($message)) {
if ($preview) {
require_once $phpbb_root_path . 'includes/functions_post.' . $phpEx;
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
$bbcode_uid = $bbcode_on ? make_bbcode_uid() : '';
$preview_message = stripslashes(prepare_message(addslashes(unprepare_message($message)), $html_on, $bbcode_on, $smilies_on, $bbcode_uid));
if ($bbcode_on) {
$preview_message = bbencode_second_pass($preview_message, $bbcode_uid);
}
if (!empty($orig_word)) {
$preview_message = !empty($preview_message) ? preg_replace($orig_word, $replacement_word, $preview_message) : '';
}
$preview_message = make_clickable($preview_message);
if ($smilies_on) {
$preview_message = smilies_pass($preview_message);
}
$preview_message = str_replace("\n", '<br />', $preview_message);
$template->set_filenames(array('preview' => 'posting_preview.tpl'));
$template->assign_vars(array('USERNAME' => $username, 'POST_DATE' => create_date($board_config['default_dateformat'], time(), $board_config['board_timezone']), 'MESSAGE' => $preview_message, 'L_POSTED' => $lang['Posted'], 'L_PREVIEW' => $lang['Preview']));
$template->assign_var_from_handle('POST_PREVIEW_BOX', 'preview');
}
开发者ID:Nekrofage,项目名称:FJR,代码行数:31,代码来源:shoutbox_max.php
示例4: message_die
$sql = "UPDATE " . USERS_TABLE . "\n\t\t\tSET user_sig = '" . $db->sql_escape($signature) . "'\n\t\t\tWHERE user_id = {$user_id}";
$result = $db->sql_query($sql);
$save_message = $lang['sig_save_message'];
}
} else {
message_die(GENERAL_MESSAGE, 'An Error occured while submitting Signature');
}
} elseif ($preview) {
$template->assign_block_vars('switch_preview_sig', array());
if (isset($signature)) {
$preview_sig = $signature;
if (strlen($preview_sig) > $config['max_sig_chars']) {
$preview_sig = $lang['Signature_too_long'];
} else {
$preview_sig = htmlspecialchars($preview_sig);
$preview_sig = stripslashes(prepare_message(addslashes(unprepare_message($preview_sig)), $html_on, $bbcode_on, $smilies_on));
if ($preview_sig != '') {
$bbcode->is_sig = true;
$preview_sig = $bbcode->parse($preview_sig);
$bbcode->is_sig = false;
$preview_sig = '<br />' . $config['sig_line'] . '<br />' . $preview_sig;
//$preview_sig = nl2br($preview_sig);
$preview_sig = censor_text($preview_sig);
} else {
$preview_sig = $lang['sig_none'];
}
}
} else {
message_die(GENERAL_MESSAGE, 'An Error occured while submitting Signature');
}
} elseif ($mode) {
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:31,代码来源:usercp_signature.php
示例5: prepare_message
// 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
$outbid_sent_id = $db->sql_nextid();
$outbid_text = $lang['outbid_pm_text'];
$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("\\'", "''", addslashes(sprintf($outbid_pm, $board_config['sitename']))) . "</br></br><a href=auction_offer_view.php?ao=" . $HTTP_GET_VARS[POST_AUCTION_OFFER_URL] . '>' . 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) . '</a></br>' . $board_config['board_email_sig'] . "')";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not insert private message sent text', '', __LINE__, __FILE__, $sql);
}
// if
$sql = "UPDATE " . USERS_TABLE . "\r\n SET user_new_privmsg=user_new_privmsg+1,\r\n user_new_privmsg = user_new_privmsg +1\r\n WHERE user_id=" . $auction_corresponding_bids_start_stop_row['FK_auction_offer_last_bid_user_id'];
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not update user table for outbid notification', '', __LINE__, __FILE__, $sql);
}
// if
}
// if
// End pm-notification
}
// if
$message = $lang['auction_room_bid_successful'] . "<br /><br />" . sprintf($lang['Click_return_offer'], "<a href=\"" . append_sid("auction_offer_view.{$phpEx}?ao=" . $HTTP_GET_VARS[POST_AUCTION_OFFER_URL]) . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_auction_index'], "<a href=\"" . append_sid("auction.{$phpEx}") . "\">", "</a>");
开发者ID:wrtcoder,项目名称:mini_isp,代码行数:31,代码来源:auction_offer.php
示例6: send_notifications
/**
* 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);
}
}
}
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:91,代码来源:class_notifications.php
示例7: notifyUser
function notifyUser($user_id, $notify_type, $offer_id, $offer_title)
{
global $db, $lang, $auction_config_data, $board_config;
if ($auction_config_data['auction_end_notify_email']) {
// BEGIN EMAIL-NOTIFY
$sql = "SELECT user_email,\r\n username\r\n FROM " . USERS_TABLE . "\r\n WHERE user_id=" . $user_id . "";
if (!($result = $db->sql_query($sql))) {
}
// if
$user = $db->sql_fetchrow($result);
$server_name = trim($board_config['server_name']);
$server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
$server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
$username = $user['username'];
$email = $user['user_email'];
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
if ($notify_type == 'WON') {
$emailer->use_template('auction_won', stripslashes($user_lang));
$emailer->set_subject($lang['auction_won']);
$emailer->assign_vars(array('AUCTION_WON' => $lang['auction_offer_won'], 'AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $board_config['script_path'] . 'auction_offer_view.php?ao=' . $offer_id, 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
}
if ($notify_type == 'SOLD') {
$emailer->use_template('auction_sold', stripslashes($user_lang));
$emailer->set_subject($lang['auction_sold']);
$emailer->assign_vars(array('AUCTION_SOLD' => $lang['auction_offer_sold'], 'AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $board_config['script_path'] . 'auction_offer_view.php?ao=' . $offer_id, 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
}
if ($notify_type == 'NOT_SOLD') {
$emailer->use_template('auction_not_sold', stripslashes($user_lang));
$emailer->set_subject($lang['auction_not_sold']);
$emailer->assign_vars(array('AUCTION_NOT_SOLD' => $lang['auction_offer_not_sold'], 'AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $board_config['script_path'] . 'auction_offer_view.php?ao=' . $offer_id, 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
}
$emailer->email_address($email);
// Try to send email...
$emailer->send();
// $emailer->reset();
}
// END EMAIL-NOTIFY
if ($auction_config_data['auction_end_notify_pm']) {
// BEGIN PM-NOTIFY ON OUTBID
if ($notify_type == 'WON') {
$pm_subject = $lang['auction_won'];
$pm_text = $lang['auction_won_text'];
}
if ($notify_type == 'SOLD') {
$pm_subject = $lang['auction_sold'];
$pm_text = $lang['auction_sold_text'];
}
if ($notify_type == 'NOT_SOLD') {
$pm_subject = $lang['auction_not_sold'];
$pm_text = $lang['auction_not_sold_text'];
}
$privmsgs_date = date("U");
$sql = "INSERT INTO " . PRIVMSGS_TABLE . "\r\n (privmsgs_type,\r\n privmsgs_subject,\r\n privmsgs_from_userid,\r\n privmsgs_to_userid,\r\n privmsgs_date,\r\n privmsgs_enable_html,\r\n privmsgs_enable_bbcode,\r\n privmsgs_enable_smilies,\r\n privmsgs_attach_sig)\r\n VALUES ('0',\r\n '" . str_replace("\\'", "''", addslashes(sprintf($pm_subject, $board_config['sitename']))) . "',\r\n '2',\r\n " . $user_id . ",\r\n " . $privmsgs_date . ",\r\n '0',\r\n '1',\r\n '1',\r\n '0')";
if (!$db->sql_query($sql)) {
}
// if
$outbid_sent_id = $db->sql_nextid();
$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . "\r\n (privmsgs_text_id,\r\n privmsgs_text)\r\n VALUES (" . $outbid_sent_id . ",\r\n '" . str_replace("\\'", "''", $pm_text . "</br></br><a href=\"auction_offer_view.php?ao=" . $offer_id . "\">" . prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0) . "</a></br>" . $board_config['board_email_sig']) . "')";
if (!$db->sql_query($sql)) {
}
// if
$sql = "UPDATE " . USERS_TABLE . "\r\n SET user_new_privmsg=user_new_privmsg+1\r\n WHERE user_id=" . $user_id;
if (!$db->sql_query($sql)) {
}
// if
}
// End pm-notification
}
开发者ID:wrtcoder,项目名称:mini_isp,代码行数:70,代码来源:auction_cron.php
示例8: send_mail
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
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:101,代码来源:functions_messages.php
示例9: user_notification
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user)
{
global $config, $lang, $userdata, $user_ip;
$current_time = time();
if ($mode == 'delete')
{
$delete_sql = (!$post_data['first_post'] && !$post_data['last_post']) ? sql_filter(' AND user_id = ? ', $userdata['user_id']) : '';
$sql = 'DELETE FROM _forum_topics_fav WHERE topic_id = ?' . $delete_sql;
sql_query(sql_filter($sql, $topic_id));
}
else
{
if ($mode == 'reply')
{
$sql = 'SELECT ban_userid
FROM _banlist';
$result = sql_rowset($sql);
$user_id_sql = '';
foreach ($result as $row) {
if (isset($row['ban_userid']) && !empty($row['ban_userid'])) {
$user_id_sql .= ', ' . $row['ban_userid'];
}
}
$update_watched_sql = '';
$bcc_list_ary = w();
$usr_list_ary = w();
$sql = 'SELECT DISTINCT u.user_id, u.user_email, u.user_lang
FROM _forum_topics_fav tw
INNER JOIN _members u ON tw.user_id = u.user_id
INNER JOIN _members_group ug ON tw.user_id = ug.user_id
LEFT OUTER JOIN _auth_access aa ON ug.group_id = aa.group_id, _forums f
WHERE tw.topic_id = ?
AND tw.user_id NOT IN (??, ??, ??)
AND tw.notify_status = ?
AND f.forum_id = ?
AND u.user_active = 1
AND (
(aa.forum_id = ? AND aa.auth_read = 1)
OR f.auth_read <= ?
OR (u.user_level = ? AND f.auth_read = ?)
OR u.user_level = ?
)';
if ($result = sql_rowset(sql_filter($sql, $topic_id, $userdata['user_id'], GUEST, $user_id_sql, TOPIC_WATCH_UN_NOTIFIED, $forum_id, $forum_id, AUTH_REG, USER_MOD, AUTH_MOD, USER_ADMIN))) {
@set_time_limit(60);
foreach ($result as $row) {
if ($row['user_email'] != '') {
$bcc_list_ary[$row['user_lang']][] = $row['user_email'];
}
$update_watched_sql .= ($update_watched_sql != '') ? ', ' . $row['user_id'] : $row['user_id'];
}
if (sizeof($bcc_list_ary)) {
$emailer = new emailer();
$server_name = trim($config['server_name']);
$server_protocol = ($config['cookie_secure']) ? 'https://' : 'http://';
$post_url = $server_protocol . $server_name . s_link('post', $post_id) . "#$post_id";
$emailer->from($config['board_email']);
$emailer->replyto($config['board_email']);
$topic_title = unprepare_message($topic_title);
@reset($bcc_list_ary);
while (list($user_lang, $bcc_list) = each($bcc_list_ary))
{
$emailer->use_template('topic_notify', $user_lang);
for ($i = 0; $i < count($bcc_list); $i++)
{
$emailer->bcc($bcc_list[$i]);
}
// The Topic_reply_notification lang string below will be used
// if for some reason the mail template subject cannot be read
// ... note it will not necessarily be in the posters own language!
$emailer->set_subject($lang['Topic_reply_notification']);
// This is a nasty kludge to remove the username var ... till (if?)
// translators update their templates
$emailer->msg = preg_replace('#[ ]?{USERNAME}#', '', $emailer->msg);
$emailer->assign_vars(array(
'EMAIL_SIG' => '',
'SITENAME' => $config['sitename'],
'TOPIC_TITLE' => $topic_title,
'U_TOPIC' => $post_url,
'U_STOP_WATCHING_TOPIC' => $server_protocol . $server_name . $script_name . '&' . POST_TOPIC_URL . "=$topic_id&unwatch=topic")
);
//.........这里部分代码省略.........
开发者ID:nopticon,项目名称:rockr,代码行数:101,代码来源:functions_post.php
示例10: insert_post
function insert_post($message, $subject, $forum_id, $user_id, $user_name, $user_attach_sig, $topic_id = NULL, $topic_type = POST_NORMAL, $do_notification = false, $notify_user = false, $current_time = 0, $error_die_function = '', $html_on = 0, $bbcode_on = 1, $smilies_on = 1)
{
global $db, $board_config, $user_ip;
// initialise some variables
$topic_vote = 0;
$mode = 'reply';
$bbcode_uid = $bbcode_on ? make_bbcode_uid() : '';
$error_die_function = $error_die_function == '' ? "message_die" : $error_die_function;
$current_time = $current_time == 0 ? time() : $current_time;
// parse the message and the subject (belt & braces :)
$message = addslashes(unprepare_message($message));
$message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
$subject = addslashes(str_replace('"', '"', trim($subject)));
$username = addslashes(unprepare_message(trim($user_name)));
// fix for \" in username - wineknow.com
$username = str_replace("\\\"", "\"", $username);
// if this is a new topic then insert the topic details
if (is_null($topic_id)) {
$mode = 'newtopic';
$sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('{$subject}', " . $user_id . ", {$current_time}, {$forum_id}, " . TOPIC_UNLOCKED . ", {$topic_type}, {$topic_vote})";
if (!$db->sql_query($sql, BEGIN_TRANSACTION)) {
$error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
$topic_id = $db->sql_nextid();
}
// insert the post details using the topic id
$sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig) VALUES ({$topic_id}, {$forum_id}, " . $user_id . ", '{$username}', {$current_time}, '{$user_ip}', {$bbcode_on}, {$html_on}, {$smilies_on}, {$user_attach_sig})";
if (!$db->sql_query($sql, BEGIN_TRANSACTION)) {
$error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
$post_id = $db->sql_nextid();
// insert the actual post text for our new post
$sql = "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text) VALUES ({$post_id}, '{$subject}', '{$bbcode_uid}', '{$message}')";
if (!$db->sql_query($sql, BEGIN_TRANSACTION)) {
$error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
// update the post counts etc.
$newpostsql = $mode == 'newtopic' ? ',forum_topics = forum_topics + 1' : '';
$sql = "UPDATE " . FORUMS_TABLE . " SET \n forum_posts = forum_posts + 1,\n forum_last_post_id = {$post_id}\n {$newpostsql} \t\n WHERE forum_id = {$forum_id}";
if (!$db->sql_query($sql, BEGIN_TRANSACTION)) {
$error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
// update the first / last post ids for the topic
$first_post_sql = $mode == 'newtopic' ? ", topic_first_post_id = {$post_id} " : ' , topic_replies=topic_replies+1';
$sql = "UPDATE " . TOPICS_TABLE . " SET \n topic_last_post_id = {$post_id} \n {$first_post_sql}\n WHERE topic_id = {$topic_id}";
if (!$db->sql_query($sql, BEGIN_TRANSACTION)) {
$error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
// update the user's post count and commit the transaction
$sql = "UPDATE " . USERS_TABLE . " SET \n user_posts = user_posts + 1\n WHERE user_id = {$user_id}";
if (!$db->sql_query($sql, END_TRANSACTION)) {
$error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
// add the search words for our new post
switch ($board_config['version']) {
case '.0.0':
case '.0.1':
case '.0.2':
case '.0.3':
add_search_words($post_id, stripslashes($message), stripslashes($subject));
break;
default:
add_search_words('', $post_id, stripslashes($message), stripslashes($subject));
break;
}
// do we need to do user notification
if ($mode == 'reply' && $do_notification) {
// DP bugfix (critical): $userdata['user_id'] must be set; otherwise,
// user_notification() will generate a bad SQL query and die.
global $userdata;
$userdata['user_id'] = $user_id;
// DP bugfix (minor): We should pass the topic title, not the post subject,
// as the third param to user_notification.
$sql = "SELECT topic_title FROM " . TOPICS_TABLE . " WHERE topic_id = {$topic_id}";
if (!($result = $db->sql_query($sql))) {
$error_die_function(GENERAL_ERROR, 'Error getting topic_title', '', __LINE__, __FILE__, $sql);
}
list($topic_title) = $db->sql_fetchrow($result);
$post_data = array();
user_notification($mode, $post_data, $topic_title, $forum_id, $topic_id, $post_id, $notify_user);
}
// if all is well then return the id of our new post
return array('post_id' => $post_id, 'topic_id' => $topic_id);
}
开发者ID:cpeel,项目名称:dproofreaders-shadow,代码行数:84,代码来源:functions_insert_post.php
示例11: _read_var
if (!empty($rules_word)) {
$rules_type = 4;
} else {
$rules_type = 3;
}
}
}
}
// get data from form
$rules_folder_id = _read_var('rules_folder_id', 1, $rules_folder_id);
$rules_name = unprepare_message(trim(str_replace("\\'", "''", htmlspecialchars(_read_var('rules_name', 0, $rules_name)))));
$rules_type = _read_var('rules_type', 1, $rules_type);
$rules_group_id = _read_var('rules_group_id', 1, $rules_group_id);
$rules_username = unprepare_message(trim(str_replace("\\'", "''", htmlspecialchars(_read_var('username', 0, $rules_username)))));
$rules_sysuser = _read_var('rules_sysuser', 1, $rules_sysuser);
$rules_word = unprepare_message(trim(str_replace("\\'", "''", htmlspecialchars(_read_var('rules_word', 0, $rules_word)))));
}
if ($pmmode == 'rdelete') {
if ($cancel) {
$pmmode = 'redit';
$cancel = false;
} else {
if ($confirm) {
if ($error) {
$l_link = 'Click_return_folders';
$u_link = append_sid("{$main_pgm}&pmmode=rlist&folder={$folder_id}");
_message_return($error_msg, $l_link, $u_link);
}
if (!$error) {
$sql = "DELETE FROM " . PRIVMSGA_RULES_TABLE . "\n WHERE rules_id = {$rules_id}\n AND rules_user_id = {$view_user_id}";
if (!($result = $db->sql_query($sql))) {
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:31,代码来源:privmsga_folders.php
示例12: message_die
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, "Could not create download stream for post.", '', __LINE__, __FILE__, $sql);
}
$download_file = '';
while ($row = $db->sql_fetchrow($result)) {
$poster_id = $row['user_id'];
$poster = $poster_id == ANONYMOUS ? $lang['Guest'] : $row['username'];
$post_date = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']);
$post_subject = $row['post_subject'] != '' ? $row['post_subject'] : '';
$bbcode_uid = $row['bbcode_uid'];
$message = $row['post_text'];
$message = strip_tags($message);
$message = preg_replace("/\\[.*?:{$bbcode_uid}:?.*?\\]/si", '', $message);
$message = preg_replace('/\\[url\\]|\\[\\/url\\]/si', '', $message);
$message = preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $message);
$message = unprepare_message($message);
$message = preg_replace('/(/', '(', $message);
$message = preg_replace('/)/', ')', $message);
$message = preg_replace('/:/', ':', $message);
if (count($orig_word)) {
$post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
$message = str_replace('\\"', '"', substr(preg_
|
请发表评论