本文整理汇总了PHP中update_forum_tracking_info函数的典型用法代码示例。如果您正苦于以下问题:PHP update_forum_tracking_info函数的具体用法?PHP update_forum_tracking_info怎么用?PHP update_forum_tracking_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_forum_tracking_info函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_read_tracking
public function update_read_tracking($data)
{
// Mark the post and the topic read
markread('post', (int) $data['forum_id'], (int) $data['topic_id'], $data['post_time']);
markread('topic', (int) $data['forum_id'], (int) $data['topic_id'], time());
// Handle read tracking
if ($this->config['load_db_lastread'] && $this->user->data['is_registered']) {
$sql = 'SELECT mark_time
FROM ' . FORUMS_TRACK_TABLE . '
WHERE user_id = ' . (int) $this->user->data['user_id'] . '
AND forum_id = ' . (int) $data['forum_id'];
$result = $this->db->sql_query($sql);
$f_mark_time = (int) $this->db->sql_fetchfield('mark_time');
$this->db->sql_freeresult($result);
} else {
if ($this->config['load_anon_lastread'] || $this->user->data['is_registered']) {
$f_mark_time = false;
}
}
if ($this->config['load_db_lastread'] && $this->user->data['is_registered'] || $this->config['load_anon_lastread'] || $this->user->data['is_registered']) {
// Update forum info
$sql = 'SELECT forum_last_post_time
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . (int) $data['forum_id'];
$result = $this->db->sql_query($sql);
$forum_last_post_time = (int) $this->db->sql_fetchfield('forum_last_post_time');
$this->db->sql_freeresult($result);
update_forum_tracking_info((int) $data['forum_id'], $forum_last_post_time, $f_mark_time, false);
}
}
示例2: array
$template->assign_block_vars('topicrow', $topic_row);
$pagination->generate_template_pagination($view_topic_url, 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true);
$s_type_switch = $row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL ? 1 : 0;
/**
* Event after the topic data has been assigned to the template
*
* @event core.viewforum_topic_row_after
* @var array row Array with the topic data
* @var array rowset Array with topics data (in topic_id => topic_data format)
* @var bool s_type_switch Flag indicating if the topic type is [global] announcement
* @var int topic_id The topic ID
* @var array topic_list Array with current viewforum page topic ids
* @var array topic_row Template array with topic data
* @since 3.1.3-RC1
*/
$vars = array('row', 'rowset', 's_type_switch', 'topic_id', 'topic_list', 'topic_row');
extract($phpbb_dispatcher->trigger_event('core.viewforum_topic_row_after', compact($vars)));
if ($unread_topic) {
$mark_forum_read = false;
}
unset($rowset[$topic_id]);
}
}
// This is rather a fudge but it's the best I can think of without requiring information
// on all topics (as we do in 2.0.x). It looks for unread or new topics, if it doesn't find
// any it updates the forum last read cookie. This requires that the user visit the forum
// after reading a topic
if ($forum_data['forum_type'] == FORUM_POST && sizeof($topic_list) && $mark_forum_read) {
update_forum_tracking_info($forum_id, $forum_data['forum_last_post_time'], false, $mark_time_forum);
}
page_footer();
示例3: time
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_views = topic_views + 1, topic_last_view_time = ' . time() . "\n\t\tWHERE topic_id = {$topic_id}";
$db->sql_query($sql);
// Update the attachment download counts
if (sizeof($update_count)) {
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
SET download_count = download_count + 1
WHERE ' . $db->sql_in_set('attach_id', array_unique($update_count));
$db->sql_query($sql);
}
}
// Only mark topic if it's currently unread. Also make sure we do not set topic tracking back if earlier pages are viewed.
if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $topic_tracking_info[$topic_id] && $max_post_time > $topic_tracking_info[$topic_id]) {
markread('topic', $forum_id, $topic_id, $max_post_time);
// Update forum info
$all_marked_read = update_forum_tracking_info($forum_id, $topic_data['forum_last_post_time'], isset($topic_data['forum_mark_time']) ? $topic_data['forum_mark_time'] : false, false);
} else {
$all_marked_read = true;
}
// If there are absolutely no more unread posts in this forum
// and unread posts shown, we can safely show the #unread link
if ($all_marked_read) {
if ($post_unread) {
$template->assign_vars(array('U_VIEW_UNREAD_POST' => '#unread'));
} else {
if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $topic_tracking_info[$topic_id]) {
$template->assign_vars(array('U_VIEW_UNREAD_POST' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&t={$topic_id}&view=unread") . '#unread'));
}
}
} else {
if (!$all_marked_read) {
示例4: phpbb_bump_topic
/**
* Handle topic bumping
* @param int $forum_id The ID of the forum the topic is being bumped belongs to
* @param int $topic_id The ID of the topic is being bumping
* @param array $post_data Passes some topic parameters:
* - 'topic_title'
* - 'topic_last_post_id'
* - 'topic_last_poster_id'
* - 'topic_last_post_subject'
* - 'topic_last_poster_name'
* - 'topic_last_poster_colour'
* @param int $bump_time The time at which topic was bumped, usually it is a current time as obtained via time().
* @return string An URL to the bumped topic, example: ./viewtopic.php?forum_id=1&topic_id=2&p=3#p3
*/
function phpbb_bump_topic($forum_id, $topic_id, $post_data, $bump_time = false)
{
global $config, $db, $user, $phpEx, $phpbb_root_path, $phpbb_log;
if ($bump_time === false) {
$bump_time = time();
}
// Begin bumping
$db->sql_transaction('begin');
// Update the topic's last post post_time
$sql = 'UPDATE ' . POSTS_TABLE . "\n\t\tSET post_time = {$bump_time}\n\t\tWHERE post_id = {$post_data['topic_last_post_id']}\n\t\t\tAND topic_id = {$topic_id}";
$db->sql_query($sql);
// Sync the topic's last post time, the rest of the topic's last post data isn't changed
$sql = 'UPDATE ' . TOPICS_TABLE . "\n\t\tSET topic_last_post_time = {$bump_time},\n\t\t\ttopic_bumped = 1,\n\t\t\ttopic_bumper = " . $user->data['user_id'] . "\n\t\tWHERE topic_id = {$topic_id}";
$db->sql_query($sql);
// Update the forum's last post info
$sql = 'UPDATE ' . FORUMS_TABLE . "\n\t\tSET forum_last_post_id = " . $post_data['topic_last_post_id'] . ",\n\t\t\tforum_last_poster_id = " . $post_data['topic_last_poster_id'] . ",\n\t\t\tforum_last_post_subject = '" . $db->sql_escape($post_data['topic_last_post_subject']) . "',\n\t\t\tforum_last_post_time = {$bump_time},\n\t\t\tforum_last_poster_name = '" . $db->sql_escape($post_data['topic_last_poster_name']) . "',\n\t\t\tforum_last_poster_colour = '" . $db->sql_escape($post_data['topic_last_poster_colour']) . "'\n\t\tWHERE forum_id = {$forum_id}";
$db->sql_query($sql);
// Update bumper's time of the last posting to prevent flood
$sql = 'UPDATE ' . USERS_TABLE . "\n\t\tSET user_lastpost_time = {$bump_time}\n\t\tWHERE user_id = " . $user->data['user_id'];
$db->sql_query($sql);
$db->sql_transaction('commit');
// Mark this topic as posted to
markread('post', $forum_id, $topic_id, $bump_time);
// Mark this topic as read
markread('topic', $forum_id, $topic_id, $bump_time);
// Update forum tracking info
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 = ' . $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 = ' . $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($forum_id, $forum_last_post_time, $f_mark_time, false);
}
$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_BUMP_TOPIC', false, array('forum_id' => $forum_id, 'topic_id' => $topic_id, $post_data['topic_title']));
$url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&t={$topic_id}&p={$post_data['topic_last_post_id']}") . "#p{$post_data['topic_last_post_id']}";
return $url;
}
示例5: array
$sql = $db->sql_build_query('SELECT', array('SELECT' => 'p.*, u.*, r.rank_title', 'FROM' => array(POSTS_TABLE => 'p', USERS_TABLE => 'u'), 'WHERE' => "p.topic_id = {$topic_id}\n\t\t\tAND p.post_id != {$report['post_id']}\n\t\t\t" . (!$auth->acl_get('m_approve', $forum_id) ? 'AND p.post_approved = 1' : '') . '
AND u.user_id = p.poster_id', 'LEFT_JOIN' => array(array('FROM' => array(RANKS_TABLE => 'r'), 'ON' => 'u.user_rank = r.rank_id AND r.rank_special = 1')), 'ORDER_BY' => 'p.post_time ' . ($user->data['user_post_sortby_dir'] == 'a' ? 'ASC' : 'DESC')));
$result = $db->sql_query($sql);
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id);
while ($row = $db->sql_fetchrow($result)) {
$row['bbcode_options'] = ($row['enable_bbcode'] ? OPTION_FLAG_BBCODE : 0) + ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0) + ($row['enable_magic_url'] ? OPTION_FLAG_LINKS : 0);
$post_unread = isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id] ? true : false;
// @todo add edit option?
$template->assign_block_vars('commentrow', array('COMMENT_ID' => $row['post_id'], 'U_MINI_POST' => append_sid("{$phpbb_root_path}bugs.{$phpEx}", "mode=report&project={$report['project_name']}&report_id={$report_id}#comment-{$row['post_id']}"), 'POST_SUBJECT' => $row['post_subject'], 'POSTED_INFO' => sprintf($user->lang['POSTED_INFO'], get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $row['post_username']), $row['rank_title'] == '' ? '' : '(' . $row['rank_title'] . ')', $user->format_date($row['post_time'])), 'COMMENT_ID' => $row['post_id'], 'POST_AUTHOR' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $row['post_username']), 'MINI_POST_IMG' => $post_unread ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), 'MESSAGE' => generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']), 'COMMENT_ID' => $row['post_id'], 'COMMENT_ID' => $row['post_id'], 'U_MCP_REPORT' => $auth->acl_get('m_report', $forum_id) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', 'U_MCP_APPROVE' => $auth->acl_get('m_approve', $forum_id) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', 'S_POST_REPORTED' => $row['post_reported'] == 1 && $auth->acl_get('m_report', $forum_id) ? true : false, 'S_POST_UNAPPROVED' => $row['post_approved'] == 0 ? true : false));
}
$db->sql_freeresult($result);
// Mark comments read
if (isset($topic_tracking_info[$topic_id]) && $report['topic_last_post_time'] > $topic_tracking_info[$topic_id] && $report['topic_last_post_time'] > $topic_tracking_info[$topic_id]) {
markread('topic', $forum_id, $topic_id, $report['topic_last_post_time']);
// Update forum info
update_forum_tracking_info($forum_id, $report['forum_last_post_time']);
}
// Finally display the page
site_header($user->lang['BUG_TRACKER'] . ' - ' . $report['report_title'], 'bugs', array(array('bugs.' . $phpEx, 'BUG_TRACKER'), array("bugs.{$phpEx}?mode=project&project={$report['project_name']}", $report['project_title']), array("bugs.{$phpEx}?mode=report&project={$report['project_name']}&report_id={$report_id}", sprintf($user->lang['BUG_NO'], $report_id))));
$template->set_filenames(array('body' => 'bugs_report.html'));
site_footer();
} elseif ($mode == 'add' || $mode == 'edit') {
$project_name = request_var('project', '');
$report_id = request_var('report_id', 0);
// Load language file
$user->add_lang('posting');
// Include files
include "{$phpbb_root_path}includes/functions_user.{$phpEx}";
include "{$phpbb_root_path}includes/functions_posting.{$phpEx}";
// Check if project exists (also grab project and forum data)
$sql = $db->sql_build_query('SELECT', array('SELECT' => 'p.*, f.forum_status, f.enable_indexing', 'FROM' => array(BUGS_PROJECTS_TABLE => 'p'), 'LEFT_JOIN' => array(array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 'p.forum_id = f.forum_id')), 'WHERE' => "p.project_name = '" . $db->sql_escape($project_name) . "'"));
示例6: update_forum_tracking_info
$sql = 'SELECT mark_time as forum_mark_time
FROM ' . FORUMS_TRACK_TABLE . '
WHERE forum_id = 0
AND user_id = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
$topic_data['forum_mark_time'] = (int) $db->sql_fetchfield('forum_mark_time');
$db->sql_freeresult($result);
}
// Only mark topic if it's currently unread. Also make sure we do not set topic tracking back if earlier pages are viewed.
if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $topic_tracking_info[$topic_id] && $max_post_time > $topic_tracking_info[$topic_id])
{
markread('topic', (($topic_data['topic_type'] == POST_GLOBAL) ? 0 : $forum_id), $topic_id, $max_post_time);
// Update forum info
$all_marked_read = update_forum_tracking_info((($topic_data['topic_type'] == POST_GLOBAL) ? 0 : $forum_id), $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false);
}
else
{
$all_marked_read = true;
}
// If there are absolutely no more unread posts in this forum and unread posts shown, we can savely show the #unread link
if ($all_marked_read)
{
if ($post_unread)
{
$template->assign_vars(array(
'U_VIEW_UNREAD_POST' => '#unread',
));
}
示例7: submit_post
//.........这里部分代码省略.........
$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 ($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'], $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', $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 != 'edit' && $mode != 'delete' && $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'];
}
}
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
$phpbb_seo->set_url($data['forum_name'], $data['forum_id'], $phpbb_seo->seo_static['forum']);
if ($params) {
$phpbb_seo->prepare_iurl($data, 'topic', $topic_type == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$data['forum_id']]);
}
// www.phpBB-SEO.com SEO TOOLKIT END
$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;
}
示例8: _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);
}
}*/
}
示例9: submit_post
//.........这里部分代码省略.........
$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', $data['forum_id'], $data['topic_id'], time());
//
if ($config['load_db_lastread'] && $userdata['is_registered']) {
$sql = 'SELECT mark_time
FROM ' . FORUMS_TRACK_TABLE . '
WHERE user_id = ' . $userdata['user_id'] . '
AND forum_id = ' . $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'] || $userdata['is_registered']) {
$f_mark_time = false;
}
}
if ($config['load_db_lastread'] && $user->data['is_registered'] || $config['load_anon_lastread'] || $userdata['is_registered']) {
// Update forum info
$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($data['forum_id'], $forum_last_post_time, $f_mark_time, false);
}
// If a username was supplied or the poster is a guest, we will use the supplied username.
// Doing it this way we can use "...post by guest-username..." in notifications when
// "guest-username" is supplied or ommit the username if it is not.
$username = $username !== '' || !$userdata['is_registered'] ? $username : $userdata['username'];
// Send Notifications
$notification_data = array_merge($data, array('topic_title' => isset($data['topic_title']) ? $data['topic_title'] : $subject, 'post_username' => $username, 'poster_id' => $poster_id, 'post_text' => $data['message'], 'post_time' => $current_time, 'post_subject' => $subject));
$phpbb_notifications = $phpbb_container->get('notification_manager');
if ($post_visibility == ITEM_APPROVED) {
switch ($mode) {
case 'post':
$phpbb_notifications->add_notifications(array('notification.type.quote', 'notification.type.topic'), $notification_data);
break;
case 'reply':
case 'quote':
$phpbb_notifications->add_notifications(array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post'), $notification_data);
break;
case 'edit_topic':
case 'edit_first_post':
case 'edit':
case 'edit_last_post':
$phpbb_notifications->update_notifications(array('notification.type.quote', 'notification.type.bookmark', 'notification.type.topic', 'notification.type.post'), $notification_data);
break;
}
} else {
if ($post_visibility == ITEM_UNAPPROVED) {
switch ($mode) {
case 'post':
$phpbb_notifications->add_notifications('notification.type.topic_in_queue', $notification_data);
break;
case 'reply':
case 'quote':