本文整理汇总了PHP中user_notification函数的典型用法代码示例。如果您正苦于以下问题:PHP user_notification函数的具体用法?PHP user_notification怎么用?PHP user_notification使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_notification函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: approve_post
//.........这里部分代码省略.........
if (sizeof($forum_topics_posts)) {
foreach ($forum_topics_posts as $forum_id => $row) {
$sql = 'UPDATE ' . FORUMS_TABLE . '
SET ';
$sql .= $row['forum_topics'] ? "forum_topics = forum_topics + {$row['forum_topics']}" : '';
$sql .= $row['forum_topics'] && $row['forum_posts'] ? ', ' : '';
$sql .= $row['forum_posts'] ? "forum_posts = forum_posts + {$row['forum_posts']}" : '';
$sql .= " WHERE forum_id = {$forum_id}";
$db->sql_query($sql);
}
}
if (sizeof($user_posts_sql)) {
// Try to minimize the query count by merging users with the same post count additions
$user_posts_update = array();
foreach ($user_posts_sql as $user_id => $user_posts) {
$user_posts_update[$user_posts][] = $user_id;
}
foreach ($user_posts_update as $user_posts => $user_id_ary) {
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_posts = user_posts + ' . $user_posts . '
WHERE ' . $db->sql_in_set('user_id', $user_id_ary);
$db->sql_query($sql);
}
}
if ($total_topics) {
set_config_count('num_topics', $total_topics, true);
}
if ($total_posts) {
set_config_count('num_posts', $total_posts, true);
}
unset($topic_approve_sql, $topic_replies_sql, $post_approve_sql);
update_post_information('topic', array_keys($topic_id_list));
if ($update_forum_information) {
update_post_information('forum', array_keys($forum_id_list));
}
unset($topic_id_list, $forum_id_list);
$messenger = new messenger();
// Notify Poster?
if ($notify_poster) {
foreach ($post_info as $post_id => $post_data) {
if ($post_data['poster_id'] == ANONYMOUS) {
continue;
}
$email_template = $post_data['post_id'] == $post_data['topic_first_post_id'] && $post_data['post_id'] == $post_data['topic_last_post_id'] ? 'topic_approved' : 'post_approved';
$messenger->template($email_template, $post_data['user_lang']);
$messenger->to($post_data['user_email'], $post_data['username']);
$messenger->im($post_data['user_jabber'], $post_data['username']);
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($post_data['username']), 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_data['post_subject'])), 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_data['topic_title'])), 'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.{$phpEx}?f={$post_data['forum_id']}&t={$post_data['topic_id']}&e=0", 'U_VIEW_POST' => generate_board_url() . "/viewtopic.{$phpEx}?f={$post_data['forum_id']}&t={$post_data['topic_id']}&p={$post_id}&e={$post_id}"));
$messenger->send($post_data['user_notify_type']);
}
}
$messenger->save_queue();
// Send out normal user notifications
$email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
foreach ($post_info as $post_id => $post_data) {
if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) {
// Forum Notifications
user_notification('post', $post_data['topic_title'], $post_data['topic_title'], $post_data['forum_name'], $post_data['forum_id'], $post_data['topic_id'], $post_id);
} else {
// Topic Notifications
user_notification('reply', $post_data['post_subject'], $post_data['topic_title'], $post_data['forum_name'], $post_data['forum_id'], $post_data['topic_id'], $post_id);
}
}
if (sizeof($post_id_list) == 1) {
$post_data = $post_info[$post_id_list[0]];
$post_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$post_data['forum_id']}&t={$post_data['topic_id']}&p={$post_data['post_id']}") . '#p' . $post_data['post_id'];
}
unset($post_info);
if ($total_topics) {
$success_msg = $total_topics == 1 ? 'TOPIC_APPROVED_SUCCESS' : 'TOPICS_APPROVED_SUCCESS';
} else {
$success_msg = sizeof($post_id_list) + sizeof($post_approved_list) == 1 ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS';
}
} else {
$show_notify = false;
foreach ($post_info as $post_data) {
if ($post_data['poster_id'] == ANONYMOUS) {
continue;
} else {
$show_notify = true;
break;
}
}
$template->assign_vars(array('S_NOTIFY_POSTER' => $show_notify, 'S_APPROVE' => true));
confirm_box(false, 'APPROVE_POST' . (sizeof($post_id_list) == 1 ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
}
$redirect = request_var('redirect', "index.{$phpEx}");
$redirect = reapply_sid($redirect);
if (!$success_msg) {
redirect($redirect);
} else {
meta_refresh(3, $redirect);
// If approving one post, also give links back to post...
$add_message = '';
if (sizeof($post_id_list) == 1 && !empty($post_url)) {
$add_message = '<br /><br />' . sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>');
}
trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"{$redirect}\">", '</a>') . $add_message);
}
}
开发者ID:html,项目名称:PI,代码行数:101,代码来源:mcp_queue.php
示例2: message_die
break;
case 'delete':
case 'poll_delete':
if ($error_msg != '') {
message_die(GENERAL_MESSAGE, $error_msg);
}
delete_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id);
break;
}
if ($error_msg == '') {
if ($mode != 'editpost') {
$user_id = $mode == 'reply' || $mode == 'newtopic' ? $userdata['user_id'] : $post_data['poster_id'];
update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id);
}
if ($error_msg == '' && $mode != 'poll_delete') {
user_notification($mode, $post_data, $post_info['topic_title'], $forum_id, $topic_id, $post_id, $notify_user);
}
if ($mode == 'newtopic' || $mode == 'reply') {
$tracking_topics = !empty($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
$tracking_forums = !empty($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
if (count($tracking_topics) + count($tracking_forums) == 100 && empty($tracking_topics[$topic_id])) {
asort($tracking_topics);
unset($tracking_topics[key($tracking_topics)]);
}
$tracking_topics[$topic_id] = time();
setcookie($board_config['cookie_name'] . '_t', serialize($tracking_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
}
$template->assign_vars(array('META' => $return_meta));
message_die(GENERAL_MESSAGE, $return_message);
}
}
开发者ID:damncabbage,项目名称:publicwhip,代码行数:31,代码来源:posting.php
示例3: submit_post
//.........这里部分代码省略.........
WHERE topic_moved_id = ' . $data['topic_id'];
$db->sql_query($sql);
}
// Committing the transaction before updating search index
$db->sql_transaction('commit');
// Delete draft if post was loaded...
$draft_id = request_var('draft_loaded', 0);
if ($draft_id) {
$sql = 'DELETE FROM ' . DRAFTS_TABLE . "\n\t\t\tWHERE draft_id = {$draft_id}\n\t\t\t\tAND user_id = {$user->data['user_id']}";
$db->sql_query($sql);
}
// Index message contents
if ($update_search_index && $data['enable_indexing']) {
// Select the search method and do some additional checks to ensure it can actually be utilised
$search_type = basename($config['search_type']);
if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) {
trigger_error('NO_SUCH_SEARCH_MODULE');
}
if (!class_exists($search_type)) {
include "{$phpbb_root_path}includes/search/{$search_type}.{$phpEx}";
}
$error = false;
$search = new $search_type($error);
if ($error) {
trigger_error($error);
}
$search->index($mode, $data['post_id'], $data['message'], $subject, $poster_id, $topic_type == POST_GLOBAL ? 0 : $data['forum_id']);
}
// Topic Notification, do not change if moderator is changing other users posts...
if ($user->data['user_id'] == $poster_id) {
if (!$data['notify_set'] && $data['notify']) {
$sql = 'INSERT INTO ' . TOPICS_WATCH_TABLE . ' (user_id, topic_id)
VALUES (' . $user->data['user_id'] . ', ' . $data['topic_id'] . ')';
$db->sql_query($sql);
} else {
if (($config['email_enable'] || $config['jab_enable']) && $data['notify_set'] && !$data['notify']) {
$sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . '
WHERE user_id = ' . $user->data['user_id'] . '
AND topic_id = ' . $data['topic_id'];
$db->sql_query($sql);
}
}
}
if ($mode == 'post' || $mode == 'reply' || $mode == 'quote') {
// Mark this topic as posted to
markread('post', $data['forum_id'], $data['topic_id']);
}
// Mark this topic as read
// We do not use post_time here, this is intended (post_time can have a date in the past if editing a message)
markread('topic', $topic_type == POST_GLOBAL ? 0 : $data['forum_id'], $data['topic_id'], time());
//
if ($config['load_db_lastread'] && $user->data['is_registered']) {
$sql = 'SELECT mark_time
FROM ' . FORUMS_TRACK_TABLE . '
WHERE user_id = ' . $user->data['user_id'] . '
AND forum_id = ' . ($topic_type == POST_GLOBAL ? 0 : $data['forum_id']);
$result = $db->sql_query($sql);
$f_mark_time = (int) $db->sql_fetchfield('mark_time');
$db->sql_freeresult($result);
} else {
if ($config['load_anon_lastread'] || $user->data['is_registered']) {
$f_mark_time = false;
}
}
if ($config['load_db_lastread'] && $user->data['is_registered'] || $config['load_anon_lastread'] || $user->data['is_registered']) {
// Update forum info
if ($topic_type == POST_GLOBAL) {
$sql = 'SELECT MAX(topic_last_post_time) as forum_last_post_time
FROM ' . TOPICS_TABLE . '
WHERE forum_id = 0';
} else {
$sql = 'SELECT forum_last_post_time
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . $data['forum_id'];
}
$result = $db->sql_query($sql);
$forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time');
$db->sql_freeresult($result);
update_forum_tracking_info($topic_type == POST_GLOBAL ? 0 : $data['forum_id'], $forum_last_post_time, $f_mark_time, false);
}
// Send Notifications
if (($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_approval) {
user_notification($mode, $subject, $data['topic_title'], $data['forum_name'], $data['forum_id'], $data['topic_id'], $data['post_id']);
}
$params = $add_anchor = '';
if ($post_approval) {
$params .= '&t=' . $data['topic_id'];
if ($mode != 'post') {
$params .= '&p=' . $data['post_id'];
$add_anchor = '#p' . $data['post_id'];
}
} else {
if ($mode != 'post' && $post_mode != 'edit_first_post' && $post_mode != 'edit_topic') {
$params .= '&t=' . $data['topic_id'];
}
}
$url = !$params ? "{$phpbb_root_path}viewforum.{$phpEx}" : "{$phpbb_root_path}viewtopic.{$phpEx}";
$url = append_sid($url, 'f=' . $data['forum_id'] . $params) . $add_anchor;
return $url;
}
开发者ID:tuxmania87,项目名称:GalaxyAdventures,代码行数:101,代码来源:functions_posting.php
示例4: submit_post
//.........这里部分代码省略.........
$_CLASS['core_db']->query($sql);
$space_taken += $attach_row['filesize'];
$files_added++;
}
}
if (sizeof($data['attachment_data'])) {
$sql = 'UPDATE ' . FORUMS_POSTS_TABLE . '
SET post_attachment = 1
WHERE post_id = ' . $data['post_id'];
$_CLASS['core_db']->query($sql);
$sql = 'UPDATE ' . FORUMS_TOPICS_TABLE . '
SET topic_attachment = 1
WHERE topic_id = ' . $data['topic_id'];
$_CLASS['core_db']->query($sql);
}
set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true);
set_config('num_files', $config['num_files'] + $files_added, true);
}
$_CLASS['core_db']->transaction('commit');
if ($post_mode == 'post' || $post_mode == 'reply' || $post_mode == 'edit_last_post') {
if ($topic_type != POST_GLOBAL) {
$sql_data[FORUMS_FORUMS_TABLE]['stat'][] = implode(', ', update_last_post_information('forum', $data['forum_id']));
}
$update = update_last_post_information('topic', $data['topic_id']);
if (sizeof($update)) {
$sql_data[FORUMS_TOPICS_TABLE]['stat'][] = implode(', ', $update);
}
}
if ($make_global) {
$sql_data[FORUMS_FORUMS_TABLE]['stat'][] = implode(', ', update_last_post_information('forum', $data['forum_id']));
}
if ($post_mode == 'edit_topic') {
$update = update_last_post_information('topic', $data['topic_id']);
if (sizeof($update)) {
$sql_data[FORUMS_TOPICS_TABLE]['stat'][] = implode(', ', $update);
}
}
// Update total post count, do not consider moderated posts/topics
if (!$_CLASS['auth']->acl_get('f_moderate', $data['forum_id']) || $_CLASS['auth']->acl_get('m_approve')) {
if ($post_mode == 'post') {
set_config('num_topics', $config['num_topics'] + 1, true);
set_config('num_posts', $config['num_posts'] + 1, true);
}
if ($post_mode == 'reply') {
set_config('num_posts', $config['num_posts'] + 1, true);
}
}
// Update forum stats
$_CLASS['core_db']->transaction();
$where_sql = array(FORUMS_POSTS_TABLE => 'post_id = ' . $data['post_id'], FORUMS_TOPICS_TABLE => 'topic_id = ' . $data['topic_id'], FORUMS_FORUMS_TABLE => 'forum_id = ' . $data['forum_id'], USERS_TABLE => 'user_id = ' . $_CLASS['core_user']->data['user_id']);
foreach ($sql_data as $table => $update_ary) {
if (isset($update_ary['stat']) && implode('', $update_ary['stat'])) {
$_CLASS['core_db']->query("UPDATE {$table} SET " . implode(', ', $update_ary['stat']) . ' WHERE ' . $where_sql[$table]);
}
}
// Delete topic shadows (if any exist). We do not need a shadow topic for an global announcement
if ($make_global) {
$_CLASS['core_db']->query('DELETE FROM ' . FORUMS_TOPICS_TABLE . '
WHERE topic_moved_id = ' . $data['topic_id']);
}
// Fulltext parse
if ($update_message && $data['enable_indexing']) {
$search = new fulltext_search();
$result = $search->add($mode, $data['post_id'], $data['message'], $subject);
}
$_CLASS['core_db']->transaction('commit');
// Delete draft if post was loaded...
$draft_id = request_var('draft_loaded', 0);
if ($draft_id) {
$_CLASS['core_db']->query('DELETE FROM ' . DRAFTS_TABLE . " WHERE draft_id = {$draft_id} AND user_id = " . $_CLASS['core_user']->data['user_id']);
}
// Topic Notification
if (!$data['notify_set'] && $data['notify']) {
$sql = 'INSERT INTO ' . FORUMS_TOPICS_WATCH_TABLE . ' (user_id, topic_id)
VALUES (' . $_CLASS['core_user']->data['user_id'] . ', ' . $data['topic_id'] . ')';
$_CLASS['core_db']->query($sql);
} else {
if ($data['notify_set'] && !$data['notify']) {
$sql = 'DELETE FROM ' . FORUMS_TOPICS_WATCH_TABLE . '
WHERE user_id = ' . $_CLASS['core_user']->data['user_id'] . '
AND topic_id = ' . $data['topic_id'];
$_CLASS['core_db']->query($sql);
}
}
// Mark this topic as read and posted to.
markread('topic', $data['forum_id'], $data['topic_id'], $data['post_time']);
// Send Notifications
if ($mode != 'edit' && $mode != 'delete' && (!$_CLASS['auth']->acl_get('f_moderate', $data['forum_id']) || $_CLASS['auth']->acl_get('m_approve'))) {
user_notification($mode, stripslashes($subject), stripslashes($data['topic_title']), stripslashes($data['forum_name']), $data['forum_id'], $data['topic_id'], $data['post_id']);
}
if ($mode == 'post') {
$url = !$_CLASS['auth']->acl_get('f_moderate', $data['forum_id']) || $_CLASS['auth']->acl_get('m_approve') ? generate_link('Forums&file=viewtopic&f=' . $data['forum_id'] . '&t=' . $data['topic_id']) : generate_link('Forums&file=viewforum&f=' . $data['forum_id']);
} else {
$url = !$_CLASS['auth']->acl_get('f_moderate', $data['forum_id']) || $_CLASS['auth']->acl_get('m_approve') ? generate_link("Forums&file=viewtopic&f={$data['forum_id']}&t={$data['topic_id']}&p={$data['post_id']}#{$data['post_id']}") : generate_link("Forums&file=viewtopic&f={$data['forum_id']}&t={$data['topic_id']}");
}
$_CLASS['core_display']->meta_refresh(3, $url);
$message = $_CLASS['auth']->acl_get('f_moderate', $data['forum_id']) && !$_CLASS['auth']->acl_get('m_approve') ? $mode == 'edit' ? 'POST_EDITED_MOD' : 'POST_STORED_MOD' : ($mode == 'edit' ? 'POST_EDITED' : 'POST_STORED');
$message = $_CLASS['core_user']->lang[$message] . (!$_CLASS['auth']->acl_get('f_moderate', $data['forum_id']) || $_CLASS['auth']->acl_get('m_approve') ? '<br /><br />' . sprintf($_CLASS['core_user']->lang['VIEW_MESSAGE'], '<a href="' . $url . '">', '</a>') : '') . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_FORUM'], '<a href="' . generate_link('Forums&file=viewforum&f=' . $data['forum_id']) . '">', '</a>');
trigger_error($message);
}
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:101,代码来源:posting.php
示例5: approve_post
//.........这里部分代码省略.........
$topic_approve_sql[] = $post_data['topic_id'];
} else {
if (!isset($topic_replies_sql[$post_data['topic_id']])) {
$topic_replies_sql[$post_data['topic_id']] = 1;
} else {
$topic_replies_sql[$post_data['topic_id']]++;
}
}
if ($post_data['forum_id']) {
$total_posts++;
$forum_posts++;
}
$post_approve_sql[] = $post_id;
}
if (sizeof($topic_approve_sql)) {
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_approved = 1
WHERE topic_id IN (' . implode(', ', $topic_approve_sql) . ')';
$db->sql_query($sql);
}
if (sizeof($post_approve_sql)) {
$sql = 'UPDATE ' . POSTS_TABLE . '
SET post_approved = 1
WHERE post_id IN (' . implode(', ', $post_approve_sql) . ')';
$db->sql_query($sql);
}
if (sizeof($topic_replies_sql)) {
foreach ($topic_replies_sql as $topic_id => $num_replies) {
$sql = 'UPDATE ' . TOPICS_TABLE . "\n\t\t\t\t\tSET topic_replies = topic_replies + {$num_replies}\n\t\t\t\t\tWHERE topic_id = {$topic_id}";
$db->sql_query($sql);
}
}
if ($forum_topics || $forum_posts) {
$sql = 'UPDATE ' . FORUMS_TABLE . '
SET ';
$sql .= $forum_topics ? "forum_topics = forum_topics + {$forum_topics}" : '';
$sql .= $forum_topics && $forum_posts ? ', ' : '';
$sql .= $forum_posts ? "forum_posts = forum_posts + {$forum_posts}" : '';
$sql .= " WHERE forum_id = {$forum_id}";
$db->sql_query($sql);
}
if ($total_topics) {
set_config('num_topics', $config['num_topics'] + $total_topics, true);
}
if ($total_posts) {
set_config('num_posts', $config['num_posts'] + $total_posts, true);
}
unset($topic_approve_sql, $topic_replies_sql, $post_approve_sql);
update_post_information('topic', array_keys($topic_id_list));
update_post_information('forum', $forum_id);
unset($topic_id_list);
$messenger = new messenger();
// Notify Poster?
if ($notify_poster) {
$email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
foreach ($post_info as $post_id => $post_data) {
if ($post_data['poster_id'] == ANONYMOUS) {
continue;
}
$email_template = $post_data['post_id'] == $post_data['topic_first_post_id'] && $post_data['post_id'] == $post_data['topic_last_post_id'] ? 'topic_approved' : 'post_approved';
$messenger->template($email_template, $post_data['user_lang']);
$messenger->replyto($config['board_email']);
$messenger->to($post_data['user_email'], $post_data['username']);
$messenger->im($post_data['user_jabber'], $post_data['username']);
$messenger->assign_vars(array('EMAIL_SIG' => $email_sig, 'SITENAME' => $config['sitename'], 'USERNAME' => html_entity_decode($post_data['username']), 'POST_SUBJECT' => html_entity_decode(censor_text($post_data['post_subject'])), 'TOPIC_TITLE' => html_entity_decode(censor_text($post_data['topic_title'])), 'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.{$phpEx}?f={$forum_id}&t={$post_data['topic_id']}&e=0", 'U_VIEW_POST' => generate_board_url() . "/viewtopic.{$phpEx}?f={$forum_id}&t={$post_data['topic_id']}&p={$post_id}&e={$post_id}"));
$messenger->send($post_data['user_notify_type']);
$messenger->reset();
}
$messenger->save_queue();
}
// Send out normal user notifications
$email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
foreach ($post_info as $post_id => $post_data) {
if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) {
// Forum Notifications
user_notification('post', $post_data['topic_title'], $post_data['topic_title'], $post_data['forum_name'], $forum_id, $post_data['topic_id'], $post_id);
} else {
// Topic Notifications
user_notification('reply', $post_data['post_subject'], $post_data['topic_title'], $post_data['forum_name'], $forum_id, $post_data['topic_id'], $post_id);
}
}
unset($post_info);
if ($forum_topics) {
$success_msg = $forum_topics == 1 ? 'TOPIC_APPROVED_SUCCESS' : 'TOPICS_APPROVED_SUCCESS';
} else {
$success_msg = sizeof($post_id_list) == 1 ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS';
}
} else {
$template->assign_vars(array('S_NOTIFY_POSTER' => true, 'S_APPROVE' => true));
confirm_box(false, 'APPROVE_POST' . (sizeof($post_id_list) == 1 ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
}
$redirect = request_var('redirect', "index.{$phpEx}");
$redirect = reapply_sid($redirect);
if (!$success_msg) {
redirect($redirect);
} else {
meta_refresh(3, $redirect);
trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"{$redirect}\">", '</a>'));
}
}
开发者ID:yunsite,项目名称:gloryroad,代码行数:101,代码来源:mcp_queue.php
示例6: _submit
//.........这里部分代码省略.........
//make sure we have a post_subject (empty subjects are bad for e.g. approving)
if ($this->post_subject == '') {
$this->post_subject = 'Re: ' . $topic_data['topic_title'];
}
$db->sql_transaction('begin');
//insert post
$sql = "INSERT INTO " . POSTS_TABLE . " " . $db->sql_build_array('INSERT', $sql_data);
$db->sql_query($sql);
$this->post_id = $db->sql_nextid();
//update topic
if (!$sync->new_topic_flag) {
$sync->add('topic', $this->topic_id, 'topic_replies', $this->post_approved ? 1 : 0);
$sync->add('topic', $this->topic_id, 'topic_replies_real', 1);
$sync->set('topic', $this->topic_id, 'topic_bumped', 0);
$sync->set('topic', $this->topic_id, 'topic_bumper', 0);
} else {
$sync->topic_first_post($this->topic_id);
$sync->new_topic_flag = false;
}
$sync->topic_last_post($this->topic_id);
//update forum
if ($this->forum_id != 0) {
$sync->add('forum', $this->forum_id, 'forum_posts', $this->post_approved ? 1 : 0);
$sync->forum_last_post($this->forum_id);
}
if ($this->post_postcount) {
//increase user_posts...
$sync->add('user', $this->poster_id, 'user_posts', 1);
}
if ($this->post_approved) {
//...and total posts
set_config('num_posts', $config['num_posts'] + 1, true);
}
reindex('reply', $this->post_id, $sql_data['post_text'], $this->post_subject, $this->poster_id, $this->forum_id);
$db->sql_transaction('commit');
// Mark this topic as posted to
markread('post', $this->forum_id, $this->topic_id, $this->post_time, $this->poster_id);
// Mark this topic as read
// We do not use post_time here, this is intended (post_time can have a date in the past if editing a message)
markread('topic', $this->forum_id, $this->topic_id, time());
//
if ($config['load_db_lastread'] && $user->data['is_registered']) {
$sql = 'SELECT mark_time
FROM ' . FORUMS_TRACK_TABLE . '
WHERE user_id = ' . $user->data['user_id'] . '
AND forum_id = ' . $this->forum_id;
$result = $db->sql_query($sql);
$f_mark_time = (int) $db->sql_fetchfield('mark_time');
$db->sql_freeresult($result);
} else {
if ($config['load_anon_lastread'] || $user->data['is_registered']) {
$f_mark_time = false;
}
}
if ($config['load_db_lastread'] && $user->data['is_registered'] || $config['load_anon_lastread'] || $user->data['is_registered']) {
// Update forum info
$sql = 'SELECT forum_last_post_time
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . $this->forum_id;
$result = $db->sql_query($sql);
$forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time');
$db->sql_freeresult($result);
update_forum_tracking_info($this->forum_id, $forum_last_post_time, $f_mark_time, false);
}
// Send Notifications
user_notification('reply', $this->post_subject, $topic_data['topic_title'], $topic_data['forum_name'], $this->forum_id, $this->topic_id, $this->post_id);
} else {
//new topic
$this->_topic = topic::from_post($this);
$this->_topic->submit(true);
//PHP4 Compatibility:
if (version_compare(PHP_VERSION, '5.0.0', '<')) {
$this->topic_id = $this->_topic->topic_id;
$this->post_id = $this->_topic->topic_first_post_id;
}
$exec_sync = false;
}
foreach ($this->attachments as $attachment) {
$attachment->post_msg_id = $this->post_id;
$attachment->topic_id = $this->topic_id;
$attachment->poster_id = $this->poster_id;
$attachment->in_message = 0;
$attachment->is_orphan = 0;
$attachment->submit();
}
if ($exec_sync) {
$sync->execute();
}
/*if($sync_topic)
{
if($this->_topic)
{
$this->_topic->sync();
}
else
{
sync('topic', 'topic_id', $this->topic_id);
}
}*/
}
开发者ID:gn36,项目名称:phpbb-oo-posting-api,代码行数:101,代码来源:functions_post_oo.php
示例7: 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
示例8: trim
case 'editpost':
case 'newtopic':
case 'reply':
$username = !empty($HTTP_POST_VARS['username']) ? $HTTP_POST_VARS['username'] : '';
$subject = !empty($HTTP_POST_VARS['subject']) ? trim($HTTP_POST_VARS['subject']) : '';
$message = !empty($HTTP_POST_VARS['message']) ? $HTTP_POST_VARS['message'] : '';
$poll_title = isset($HTTP_POST_VARS['poll_title']) && $is_auth['auth_pollcreate'] ? $HTTP_POST_VARS['poll_title'] : '';
$poll_options = isset($HTTP_POST_VARS['poll_option_text']) && $is_auth['auth_pollcreate'] ? $HTTP_POST_VARS['poll_option_text'] : '';
$poll_length = isset($HTTP_POST_VARS['poll_length']) && $is_auth['auth_pollcreate'] ? $HTTP_POST_VARS['poll_length'] : '';
$bbcode_uid = '';
prepare_post($mode, $post_data, $bbcode_on, $html_on, $smilies_on, $error_msg, $username, $bbcode_uid, $subject, $message, $poll_title, $poll_options, $poll_length);
if ($error_msg == '') {
$topic_type = $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ? $post_data['topic_type'] : $topic_type;
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\\'", "''", $username), str_replace("\\'", "''", $subject), str_replace("\\'", "''", $message), str_replace("\\'", "''", $poll_title), $poll_options, $poll_length);
if ($error_msg == '') {
user_notification($mode, $post_data, $forum_id, $topic_id, $post_id, $notify_user);
}
}
break;
case 'delete':
case 'poll_delete':
delete_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id);
break;
}
if ($error_msg == '') {
if ($mode != 'editpost') {
$user_id = $mode == 'reply' || $mode == 'newtopic' ? $userdata['user_id'] : $post_data['poster_id'];
update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id);
}
if ($mode == 'newtopic' || $mode == 'reply') {
$tracking_topics = !empty($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:31,代码来源:posting.php
示例9: substr_count
if ($last_msg == $message) {
$this->ajax_die($lang['DOUBLE_POST_ERROR']);
}
}
}
if ($bb_cfg['max_smilies']) {
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . $bb_cfg['smilies_path']);
if ($count_smilies > $bb_cfg['max_smilies']) {
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
}
}
DB()->sql_query("INSERT INTO " . BB_POSTS . " (topic_id, forum_id, poster_id, post_time, poster_ip) VALUES ({$topic_id}, " . $post['forum_id'] . ", " . $userdata['user_id'] . ", '" . TIMENOW . "', '" . USER_IP . "')");
$post_id = DB()->sql_nextid();
DB()->sql_query("INSERT INTO " . BB_POSTS_TEXT . " (post_id, post_text) VALUES ({$post_id}, '" . DB()->escape($message) . "')");
update_post_stats('reply', $post, $post['forum_id'], $topic_id, $post_id, $userdata['user_id']);
$s_message = str_replace('\\n', "\n", $message);
$s_topic_title = str_replace('\\n', "\n", $post['topic_title']);
add_search_words($post_id, stripslashes($s_message), stripslashes($s_topic_title));
update_post_html(array('post_id' => $post_id, 'post_text' => $message));
if ($bb_cfg['topic_notify_enabled']) {
$notify = !empty($this->request['notify']);
user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify);
}
// Update atom feed
update_atom('topic', (int) $this->request['topic_id']);
$this->response['redirect'] = make_url(POST_URL . "{$post_id}#{$post_id}");
break;
default:
$this->ajax_die('empty type');
break;
}
开发者ID:ErR163,项目名称:torrentpier,代码行数:31,代码来源:posts.php
示例10: submit_post
//.........这里部分代码省略.........
if (sizeof($update_sql)) {
$sql_data[FORUMS_FORUMS_TABLE]['stat'][] = implode(', ', $update_sql[$data['forum_id']]);
}
}
$update_sql = update_post_information('topic', $data['topic_id'], true);
if (sizeof($update_sql)) {
$sql_data[FORUMS_TOPICS_TABLE]['stat'][] = implode(', ', $update_sql[$data['topic_id']]);
}
}
if ($make_global) {
$update_sql = update_post_information('forum', $data['forum_id'], true);
if (sizeof($update_sql)) {
$sql_data[FORUMS_FORUMS_TABLE]['stat'][] = implode(', ', $update_sql[$data['forum_id']]);
}
}
if ($post_mode === 'edit_topic') {
$update_sql = update_post_information('topic', $data['topic_id'], true);
if (sizeof($update_sql)) {
$sql_data[FORUMS_TOPICS_TABLE]['stat'][] = implode(', ', $update_sql[$data['topic_id']]);
}
}
// Update total post count, do not consider moderated posts/topics
if ($_CLASS['forums_auth']->acl_get('f_noapprove', $data['forum_id']) || $_CLASS['forums_auth']->acl_get('m_approve', $data['forum_id'])) {
if ($post_mode === 'post') {
set_config('num_topics', $config['num_topics'] + 1, true);
set_config('num_posts', $config['num_posts'] + 1, true);
}
if ($post_mode === 'reply') {
set_config('num_posts', $config['num_posts'] + 1, true);
}
}
// Update forum stats
$_CLASS['core_db']->transaction();
$where_sql = array(FORUMS_POSTS_TABLE => 'post_id = ' . $data['post_id'], FORUMS_TOPICS_TABLE => 'topic_id = ' . $data['topic_id'], FORUMS_FORUMS_TABLE => 'forum_id = ' . $data['forum_id'], CORE_USERS_TABLE => 'user_id = ' . $_CLASS['core_user']->data['user_id']);
foreach ($sql_data as $table => $update_ary) {
if (isset($update_ary['stat']) && implode('', $update_ary['stat'])) {
$_CLASS['core_db']->query("UPDATE {$table} SET " . implode(', ', $update_ary['stat']) . ' WHERE ' . $where_sql[$table]);
}
}
// Delete topic shadows (if any exist). We do not need a shadow topic for an global announcement
if ($make_global) {
$sql = 'DELETE FROM ' . FORUMS_TOPICS_TABLE . '
WHERE topic_moved_id = ' . $data['topic_id'];
$_CLASS['core_db']->query($sql);
}
// Index message contents
if (false && $update_message && $data['enable_indexing']) {
// Select the search method and do some additional checks to ensure it can actually be utilised
$search_type = basename($config['search_type']);
if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) {
trigger_error('NO_SUCH_SEARCH_MODULE');
}
require "{$phpbb_root_path}includes/search/{$search_type}.{$phpEx}";
$error = false;
$search = new $search_type($error);
if ($error) {
trigger_error($error);
}
$search->index($mode, $data['post_id'], $data['message'], $subject, $poster_id, $topic_type == POST_GLOBAL ? 0 : $data['forum_id']);
}
$_CLASS['core_db']->transaction('commit');
// Delete draft if post was loaded...
$draft_id = request_var('draft_loaded', 0);
if ($draft_id) {
$sql = 'DELETE FROM ' . FORUMS_DRAFTS_TABLE . "\r\n\t\t\tWHERE draft_id = {$draft_id}\r\n\t\t\t\tAND user_id = {$_CLASS['core_user']->data['user_id']}";
$_CLASS['core_db']->query($sql);
}
// Topic Notification, do not change if moderator is changing other users posts...
if ($_CLASS['core_user']->data['user_id'] == $poster_id) {
if (!$data['notify_set'] && $data['notify']) {
$notify_sql = array('user_id' => $_CLASS['core_user']->data['user_id'], 'forum_id' => $data['forum_id'], 'topic_id' => $data['topic_id'], 'notify_type' => $poster_id, 'notify_status' => 0);
$_CLASS['core_db']->sql_query_build('INSERT', $notify_sql, FORUMS_WATCH_TABLE);
unset($notify_sql);
} else {
if ($data['notify_set'] && !$data['notify']) {
$sql = 'DELETE FROM ' . FORUMS_TOPICS_WATCH_TABLE . '
WHERE user_id = ' . $_CLASS['core_user']->data['user_id'] . '
AND topic_id = ' . $data['topic_id'];
$_CLASS['core_db']->query($sql);
}
}
}
if ($mode == 'post' || $mode == 'reply' || $mode == 'quote') {
// Mark this topic as posted to
markread('post', $data['forum_id'], $data['topic_id'], $data['post_time']);
}
// Mark this topic as read
// We do not use post_time here, this is intended (post_time can have a date in the past if editing a message)
markread('topic', $data['forum_id'], $data['topic_id'], $_CLASS['core_user']->time);
// Send Notifications
if ($mode !== 'edit' && $mode !== 'delete' && ($_CLASS['forums_auth']->acl_get('f_noapprove', $data['forum_id']) || $_CLASS['forums_auth']->acl_get('m_approve', $data['forum_id']))) {
user_notification($mode, $subject, $data['topic_title'], $data['forum_name'], $data['forum_id'], $data['topic_id'], $data['post_id']);
}
if ($mode === 'post') {
$url = $_CLASS['forums_auth']->acl_get('f_noapprove', $data['forum_id']) || $_CLASS['forums_auth']->acl_get('m_approve', $data['forum_id']) ? generate_link('forums&file=viewtopic&f=' . $data['forum_id'] . '&t=' . $data['topic_id']) : generate_link('forums&file=viewforum&f=' . $data['forum_id']);
} else {
$url = $_CLASS['forums_auth']->acl_get('f_noapprove', $data['forum_id']) || $_CLASS['forums_auth']->acl_get('m_approve', $data['forum_id']) ? generate_link("forums&file=viewtopic&f={$data['forum_id']}&t={$data['topic_id']}&p={$data['post_id']}") . "#p{$data['post_id']}" : generate_link("forums&file=viewtopic&f={$data['forum_id']}&t={$data['topic_id']}");
}
return $url;
}
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:101,代码来源:functions_posting.php
示例11: addReply
/**
* Add a reply to this topic.
*
*
*/
public function addReply($message)
{
global $phpbb_root_path, $phpEx, $user_ip, $userdata, $db, $themes_id, $board_config, $template, $theme, $lang, $page_title, $SID, $html_entities_match, $html_entities_replace, $user_ip, $attachment_mod, $unhtml_specialchars_match, $unhtml_specialchars_replace;
require_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
require_once $phpbb_root_path . 'includes/functions_post.' . $phpEx;
$forum_id = $this->getForumId();
$topic_id = $this->getTopicId();
$message = addslashes($message);
$post_id = null;
$poll_id = null;
$attach_sig = 0;
$mode = 'reply';
$post_data = array('first_post' => 0, 'last_post' => false, 'has_poll' => false, 'edit_poll' => false);
$bbcode_on = '1';
$html_on = '0';
$smilies_on = '1';
$error_msg = '';
$username = '';
$bbcode_uid = '';
$subject = '';
$poll_title = '';
$poll_options = '';
$poll_length = '0';
$poll_length_h = '0';
$poll_length = $poll_length * 24;
$poll_length = $poll_length_h + $poll_length;
$poll_length = 0;
$max_vote = '';
$hide_vote = '';
$tothide_vote = '';
prepare_post($mode, $post_data, $bbcode_on, $html_on, $smilies_on, $error_msg, $username, $bbcode_uid, $subject, $message, $poll_title, $poll_options, $poll_length, $max_vote, $hide_vote, $tothide_vote);
if ($error_msg == '') {
$topic_type = 0;
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\\'", "''", $username), str_replace("\\'", "''", $subject), str_replace("\\'", "''", $message), str_replace("\\'", "''", $poll_title), $poll_options, $poll_length, $max_vote, $hide_vote, $tothide_vote);
}
if ($error_msg == '') {
$user_id = $userdata['user_id'];
update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id);
//$attachment_mod['posting']->insert_attachment($post_id);
if ($error_msg == '') {
$notify_user = true;
user_notification($mode, $post_data, $this->getTopicTitle(), $forum_id, $topic_
|
请发表评论