当前位置: 首页>>代码示例>>PHP>>正文


PHP markread函数代码示例

本文整理汇总了PHP中markread函数的典型用法代码示例。如果您正苦于以下问题:PHP markread函数的具体用法?PHP markread怎么用?PHP markread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了markread函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: submit_post_end

    public function submit_post_end($event)
    {
        if ($event['mode'] == 'edit') {
            // we need to ensure that what we are resetting is appropriate
            // do we care about when someone edits the first post of a topic?
            // $event['data']['topic_first_post_id'] == $event['data']['post_id'] $post_mode = 'edit_first_post'
            $ext_post_mode = '';
            if ($event['data']['topic_posts_approved'] + $event['data']['topic_posts_unapproved'] + $event['data']['topic_posts_softdeleted'] == 1) {
                $ext_post_mode = 'edit_topic';
            } else {
                if ($event['data']['topic_last_post_id'] == $event['data']['post_id']) {
                    $ext_post_mode = 'edit_last_post';
                }
            }
            if ($ext_post_mode == 'edit_last_post' || $ext_post_mode == 'edit_topic') {
                $sql = 'UPDATE ' . POSTS_TABLE . '
					SET post_time = ' . time() . '
					WHERE post_id = ' . $event['data']['post_id'] . '
						AND topic_id = ' . $event['data']['topic_id'];
                $this->db->sql_query($sql);
                $sql = 'UPDATE ' . TOPICS_TABLE . '
					SET topic_last_post_time = ' . time() . '
					WHERE topic_id = ' . $event['data']['topic_id'];
                $this->db->sql_query($sql);
                if (!function_exists('update_post_information')) {
                    include $this->root_path . 'includes/functions_posting.' . $this->php_ext;
                }
                update_post_information('forum', $event['data']['forum_id']);
                markread('post', $event['data']['forum_id'], $event['data']['topic_id'], $event['data']['post_time']);
            }
        }
    }
开发者ID:rmcgirr83,项目名称:phpbb-3.1-ext-editedposts_unread,代码行数:32,代码来源:listener.php

示例2: mark_all_as_read_func

function mark_all_as_read_func($xmlrpc_params)
{
    $params = php_xmlrpc_decode($xmlrpc_params);
    if (!isset($params[0]) || $params[0] === 0) {
        markread('all');
    } else {
        $forum_id = intval($params[0]);
        markread('topics', $forum_id);
    }
    $response = new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'result_text' => new xmlrpcval('', 'base64')), 'struct');
    return new xmlrpcresp($response);
}
开发者ID:danielgospodinow,项目名称:GamingZone,代码行数:12,代码来源:mark_all_as_read.php

示例3: 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

示例4: append_sid

$template->assign_vars(array('U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", "f={$forum_id}" . ($start == 0 ? '' : "&start={$start}"))));
// Not postable forum or showing active topics?
if (!($forum_data['forum_type'] == FORUM_POST || $forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS && $forum_data['forum_type'] == FORUM_CAT)) {
    page_footer();
}
// Ok, if someone has only list-access, we only display the forum list.
// We also make this circumstance available to the template in case we want to display a notice. ;)
if (!$auth->acl_get('f_read', $forum_id)) {
    $template->assign_vars(array('S_NO_READ_ACCESS' => true));
    page_footer();
}
// Handle marking posts
if ($mark_read == 'topics') {
    $token = $request->variable('hash', '');
    if (check_link_hash($token, 'global')) {
        markread('topics', array($forum_id), false, $request->variable('mark_time', 0));
    }
    $redirect_url = append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id);
    meta_refresh(3, $redirect_url);
    if ($request->is_ajax()) {
        // Tell the ajax script what language vars and URL need to be replaced
        $data = array('NO_UNREAD_POSTS' => $user->lang['NO_UNREAD_POSTS'], 'UNREAD_POSTS' => $user->lang['UNREAD_POSTS'], 'U_MARK_TOPICS' => $user->data['is_registered'] || $config['load_anon_lastread'] ? append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'hash=' . generate_link_hash('global') . "&f={$forum_id}&mark=topics&mark_time=" . time()) : '', 'MESSAGE_TITLE' => $user->lang['INFORMATION'], 'MESSAGE_TEXT' => $user->lang['TOPICS_MARKED']);
        $json_response = new \phpbb\json_response();
        $json_response->send($data);
    }
    trigger_error($user->lang['TOPICS_MARKED'] . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>'));
}
// Is a forum specific topic count required?
if ($forum_data['forum_topics_per_page']) {
    $config['topics_per_page'] = $forum_data['forum_topics_per_page'];
}
开发者ID:ZerGabriel,项目名称:phpbb,代码行数:31,代码来源:viewforum.php

示例5: 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);
        }
    }
开发者ID:Mauron,项目名称:posts_merging,代码行数:30,代码来源:helper.php

示例6: append_sid

$template->assign_vars(array('U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", "f={$forum_id}&amp;start={$start}")));
// Not postable forum or showing active topics?
if (!($forum_data['forum_type'] == FORUM_POST || $forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS && $forum_data['forum_type'] == FORUM_CAT)) {
    page_footer();
}
// Ok, if someone has only list-access, we only display the forum list.
// We also make this circumstance available to the template in case we want to display a notice. ;)
if (!$auth->acl_get('f_read', $forum_id)) {
    $template->assign_vars(array('S_NO_READ_ACCESS' => true, 'S_AUTOLOGIN_ENABLED' => $config['allow_autologin'] ? true : false, 'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=login') . '&amp;redirect=' . urlencode(str_replace('&amp;', '&', build_url()))));
    page_footer();
}
// Handle marking posts
if ($mark_read == 'topics') {
    $token = request_var('hash', '');
    if (check_link_hash($token, 'global')) {
        markread('topics', $forum_id);
    }
    $redirect_url = append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id);
    meta_refresh(3, $redirect_url);
    trigger_error($user->lang['TOPICS_MARKED'] . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>'));
}
// Is a forum specific topic count required?
if ($forum_data['forum_topics_per_page']) {
    $config['topics_per_page'] = $forum_data['forum_topics_per_page'];
}
// Do the forum Prune thang - cron type job ...
if ($forum_data['prune_next'] < time() && $forum_data['enable_prune']) {
    $template->assign_var('RUN_CRON_TASK', '<img src="' . append_sid($phpbb_root_path . 'cron.' . $phpEx, 'cron_type=prune_forum&amp;f=' . $forum_id) . '" alt="cron" width="1" height="1" />');
}
// Forum rules and subscription info
$s_watching_forum = array('link' => '', 'title' => '', 'is_watching' => false);
开发者ID:jvinhit,项目名称:php,代码行数:31,代码来源:viewforum.php

示例7: display_forums


//.........这里部分代码省略.........
                $subforums[$parent_id][$forum_id]['name'] = $row['forum_name'];
                $subforums[$parent_id][$forum_id]['orig_forum_last_post_time'] = $row['forum_last_post_time'];
                $subforums[$parent_id][$forum_id]['children'] = array();
                if (isset($subforums[$parent_id][$row['parent_id']]) && !$row['display_on_index']) {
                    $subforums[$parent_id][$row['parent_id']]['children'][] = $forum_id;
                }
                if (!$forum_rows[$parent_id]['forum_id_unapproved_topics'] && $row['forum_id_unapproved_topics']) {
                    $forum_rows[$parent_id]['forum_id_unapproved_topics'] = $forum_id;
                }
                $forum_rows[$parent_id]['forum_topics'] += $row['forum_topics'];
                // Do not list redirects in LINK Forums as Posts.
                if ($row['forum_type'] != FORUM_LINK) {
                    $forum_rows[$parent_id]['forum_posts'] += $row['forum_posts'];
                }
                if ($row['forum_last_post_time'] > $forum_rows[$parent_id]['forum_last_post_time']) {
                    $forum_rows[$parent_id]['forum_last_post_id'] = $row['forum_last_post_id'];
                    $forum_rows[$parent_id]['forum_last_post_subject'] = $row['forum_last_post_subject'];
                    $forum_rows[$parent_id]['forum_last_post_time'] = $row['forum_last_post_time'];
                    $forum_rows[$parent_id]['forum_last_poster_id'] = $row['forum_last_poster_id'];
                    $forum_rows[$parent_id]['forum_last_poster_name'] = $row['forum_last_poster_name'];
                    $forum_rows[$parent_id]['forum_last_poster_colour'] = $row['forum_last_poster_colour'];
                    $forum_rows[$parent_id]['forum_id_last_post'] = $forum_id;
                }
            }
        }
    }
    $db->sql_freeresult($result);
    // Handle marking posts
    if ($mark_read == 'forums' || $mark_read == 'all') {
        $redirect = build_url(array('mark', 'hash'));
        $token = request_var('hash', '');
        if (check_link_hash($token, 'global')) {
            if ($mark_read == 'all') {
                markread('all');
                $message = sprintf($user->lang['RETURN_INDEX'], '<a href="' . $redirect . '">', '</a>');
            } else {
                // Add 0 to forums array to mark global announcements correctly
                $forum_ids[] = 0;
                markread('topics', $forum_ids);
                $message = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect . '">', '</a>');
            }
            meta_refresh(3, $redirect);
            trigger_error($user->lang['FORUMS_MARKED'] . '<br /><br />' . $message);
        } else {
            $message = sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>');
            meta_refresh(3, $redirect);
            trigger_error($message);
        }
    }
    // Grab moderators ... if necessary
    if ($display_moderators) {
        if ($return_moderators) {
            $forum_ids_moderator[] = $root_data['forum_id'];
        }
        get_moderators($forum_moderators, $forum_ids_moderator);
    }
    // Used to tell whatever we have to create a dummy category or not.
    $last_catless = true;
    foreach ($forum_rows as $row) {
        // Empty category
        if ($row['parent_id'] == $root_data['forum_id'] && $row['forum_type'] == FORUM_CAT) {
            $template->assign_block_vars('forumrow', array('S_IS_CAT' => true, 'FORUM_ID' => $row['forum_id'], 'FORUM_NAME' => $row['forum_name'], 'FORUM_DESC' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']), 'FORUM_FOLDER_IMG' => '', 'FORUM_FOLDER_IMG_SRC' => '', 'FORUM_IMAGE' => $row['forum_image'] ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang['FORUM_CAT'] . '" />' : '', 'FORUM_IMAGE_SRC' => $row['forum_image'] ? $phpbb_root_path . $row['forum_image'] : '', 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $row['forum_id'])));
            continue;
        }
        $visible_forums++;
        $forum_id = $row['forum_id'];
开发者ID:ubick,项目名称:lorekeepers.org,代码行数:67,代码来源:functions_display.php

示例8: array

    }
    // List comments
    $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&amp;project={$report['project_name']}&amp;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&amp;mode=report_details&amp;f=' . $forum_id . '&amp;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&amp;mode=approve_details&amp;f=' . $forum_id . '&amp;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&amp;project={$report['project_name']}", $report['project_title']), array("bugs.{$phpEx}?mode=report&amp;project={$report['project_name']}&amp;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}";
开发者ID:BackupTheBerlios,项目名称:phpbb-hu-svn,代码行数:31,代码来源:bugs.php

示例9: update_forum_tracking_info

/**
* Check for read forums and update topic tracking info accordingly
*
* @param int $forum_id the forum id to check
* @param int $forum_last_post_time the forums last post time
* @param int $f_mark_time the forums last mark time if user is registered and load_db_lastread enabled
* @param int $mark_time_forum false if the mark time needs to be obtained, else the last users forum mark time
*
* @return true if complete forum got marked read, else false.
*/
function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false)
{
    global $db, $tracking_topics, $user, $config, $auth, $request, $phpbb_container;
    // Determine the users last forum mark time if not given.
    if ($mark_time_forum === false) {
        if ($config['load_db_lastread'] && $user->data['is_registered']) {
            $mark_time_forum = !empty($f_mark_time) ? $f_mark_time : $user->data['user_lastmark'];
        } else {
            if ($config['load_anon_lastread'] || $user->data['is_registered']) {
                $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE);
                $tracking_topics = $tracking_topics ? tracking_unserialize($tracking_topics) : array();
                if (!$user->data['is_registered']) {
                    $user->data['user_lastmark'] = isset($tracking_topics['l']) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0;
                }
                $mark_time_forum = isset($tracking_topics['f'][$forum_id]) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark'];
            }
        }
    }
    // Handle update of unapproved topics info.
    // Only update for moderators having m_approve permission for the forum.
    $phpbb_content_visibility = $phpbb_container->get('content.visibility');
    // Check the forum for any left unread topics.
    // If there are none, we mark the forum as read.
    if ($config['load_db_lastread'] && $user->data['is_registered']) {
        if ($mark_time_forum >= $forum_last_post_time) {
            // We do not need to mark read, this happened before. Therefore setting this to true
            $row = true;
        } else {
            $sql = 'SELECT t.forum_id
				FROM ' . TOPICS_TABLE . ' t
				LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt
					ON (tt.topic_id = t.topic_id
						AND tt.user_id = ' . $user->data['user_id'] . ')
				WHERE t.forum_id = ' . $forum_id . '
					AND t.topic_last_post_time > ' . $mark_time_forum . '
					AND t.topic_moved_id = 0
					AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.') . '
					AND (tt.topic_id IS NULL
						OR tt.mark_time < t.topic_last_post_time)';
            $result = $db->sql_query_limit($sql, 1);
            $row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
        }
    } else {
        if ($config['load_anon_lastread'] || $user->data['is_registered']) {
            // Get information from cookie
            $row = false;
            if (!isset($tracking_topics['tf'][$forum_id])) {
                // We do not need to mark read, this happened before. Therefore setting this to true
                $row = true;
            } else {
                $sql = 'SELECT t.topic_id
				FROM ' . TOPICS_TABLE . ' t
				WHERE t.forum_id = ' . $forum_id . '
					AND t.topic_last_post_time > ' . $mark_time_forum . '
					AND t.topic_moved_id = 0
					AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.');
                $result = $db->sql_query($sql);
                $check_forum = $tracking_topics['tf'][$forum_id];
                $unread = false;
                while ($row = $db->sql_fetchrow($result)) {
                    if (!isset($check_forum[base_convert($row['topic_id'], 10, 36)])) {
                        $unread = true;
                        break;
                    }
                }
                $db->sql_freeresult($result);
                $row = $unread;
            }
        } else {
            $row = true;
        }
    }
    if (!$row) {
        markread('topics', $forum_id);
        return true;
    }
    return false;
}
开发者ID:WarriorMachines,项目名称:warriormachines-phpbb,代码行数:89,代码来源:functions.php

示例10: mcp_fork_topic

/**
* Fork Topic
*/
function mcp_fork_topic($topic_ids)
{
    global $auth, $user, $db, $template, $config;
    global $phpEx, $phpbb_root_path;
    if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_'))) {
        return;
    }
    $to_forum_id = request_var('to_forum_id', 0);
    $forum_id = request_var('f', 0);
    $redirect = request_var('redirect', build_url(array('action', 'quickmod')));
    $additional_msg = $success_msg = '';
    $s_hidden_fields = build_hidden_fields(array('topic_id_list' => $topic_ids, 'f' => $forum_id, 'action' => 'fork', 'redirect' => $redirect));
    if ($to_forum_id) {
        $forum_data = get_forum_data($to_forum_id, 'f_post');
        if (!sizeof($topic_ids)) {
            $additional_msg = $user->lang['NO_TOPIC_SELECTED'];
        } else {
            if (!sizeof($forum_data)) {
                $additional_msg = $user->lang['FORUM_NOT_EXIST'];
            } else {
                $forum_data = $forum_data[$to_forum_id];
                if ($forum_data['forum_type'] != FORUM_POST) {
                    $additional_msg = $user->lang['FORUM_NOT_POSTABLE'];
                } else {
                    if (!$auth->acl_get('f_post', $to_forum_id)) {
                        $additional_msg = $user->lang['USER_CANNOT_POST'];
                    }
                }
            }
        }
    } else {
        if (isset($_POST['confirm'])) {
            $additional_msg = $user->lang['FORUM_NOT_EXIST'];
        }
    }
    if ($additional_msg) {
        unset($_POST['confirm']);
        unset($_REQUEST['confirm_key']);
    }
    if (confirm_box(true)) {
        $topic_data = get_topic_data($topic_ids, 'f_post');
        $total_posts = 0;
        $new_topic_id_list = array();
        if ($topic_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);
            $search_mode = 'post';
            if ($error) {
                trigger_error($error);
            }
        } else {
            $search_type = false;
        }
        foreach ($topic_data as $topic_id => $topic_row) {
            $sql_ary = array('forum_id' => (int) $to_forum_id, 'icon_id' => (int) $topic_row['icon_id'], 'topic_attachment' => (int) $topic_row['topic_attachment'], 'topic_approved' => 1, 'topic_reported' => 0, 'topic_title' => (string) $topic_row['topic_title'], 'topic_poster' => (int) $topic_row['topic_poster'], 'topic_time' => (int) $topic_row['topic_time'], 'topic_replies' => (int) $topic_row['topic_replies_real'], 'topic_replies_real' => (int) $topic_row['topic_replies_real'], 'topic_status' => (int) $topic_row['topic_status'], 'topic_type' => (int) $topic_row['topic_type'], 'topic_first_poster_name' => (string) $topic_row['topic_first_poster_name'], 'topic_last_poster_id' => (int) $topic_row['topic_last_poster_id'], 'topic_last_poster_name' => (string) $topic_row['topic_last_poster_name'], 'topic_last_post_time' => (int) $topic_row['topic_last_post_time'], 'topic_last_view_time' => (int) $topic_row['topic_last_view_time'], 'topic_bumped' => (int) $topic_row['topic_bumped'], 'topic_bumper' => (int) $topic_row['topic_bumper'], 'poll_title' => (string) $topic_row['poll_title'], 'poll_start' => (int) $topic_row['poll_start'], 'poll_length' => (int) $topic_row['poll_length'], 'poll_max_options' => (int) $topic_row['poll_max_options'], 'poll_vote_change' => (int) $topic_row['poll_vote_change']);
            $db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
            $new_topic_id = $db->sql_nextid();
            $new_topic_id_list[$topic_id] = $new_topic_id;
            if ($topic_row['poll_start']) {
                $poll_rows = array();
                $sql = 'SELECT *
					FROM ' . POLL_OPTIONS_TABLE . "\n\t\t\t\t\tWHERE topic_id = {$topic_id}";
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $sql_ary = array('poll_option_id' => (int) $row['poll_option_id'], 'topic_id' => (int) $new_topic_id, 'poll_option_text' => (string) $row['poll_option_text'], 'poll_option_total' => 0);
                    $db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
                }
            }
            $sql = 'SELECT *
				FROM ' . POSTS_TABLE . "\n\t\t\t\tWHERE topic_id = {$topic_id}\n\t\t\t\tORDER BY post_time ASC";
            $result = $db->sql_query($sql);
            $post_rows = array();
            while ($row = $db->sql_fetchrow($result)) {
                $post_rows[] = $row;
            }
            $db->sql_freeresult($result);
            if (!sizeof($post_rows)) {
                continue;
            }
            $total_posts += sizeof($post_rows);
            foreach ($post_rows as $row) {
                $sql_ary = array('topic_id' => (int) $new_topic_id, 'forum_id' => (int) $to_forum_id, 'poster_id' => (int) $row['poster_id'], 'icon_id' => (int) $row['icon_id'], 'poster_ip' => (string) $row['poster_ip'], 'post_time' => (int) $row['post_time'], 'post_approved' => 1, 'post_reported' => 0, 'enable_bbcode' => (int) $row['enable_bbcode'], 'enable_smilies' => (int) $row['enable_smilies'], 'enable_magic_url' => (int) $row['enable_magic_url'], 'enable_sig' => (int) $row['enable_sig'], 'post_username' => (string) $row['post_username'], 'post_subject' => (string) $row['post_subject'], 'post_text' => (string) $row['post_text'], 'post_edit_reason' => (string) $row['post_edit_reason'], 'post_edit_user' => (int) $row['post_edit_user'], 'post_checksum' => (string) $row['post_checksum'], 'post_attachment' => (int) $row['post_attachment'], 'bbcode_bitfield' => $row['bbcode_bitfield'], 'bbcode_uid' => (string) $row['bbcode_uid'], 'post_edit_time' => (int) $row['post_edit_time'], 'post_edit_count' => (int) $row['post_edit_count'], 'post_edit_locked' => (int) $row['post_edit_locked'], 'post_postcount' => 0);
                $db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
                $new_post_id = $db->sql_nextid();
                // Copy whether the topic is dotted
                markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']);
                if ($search_type) {
                    $search->index($search_mode, $sql_ary['post_id'], $sql_ary['post_text'], $sql_ary['post_subject'], $sql_ary['poster_id'], $topic_row['topic_type'] == POST_GLOBAL ? 0 : $to_forum_id);
                    $search_mode = 'reply';
//.........这里部分代码省略.........
开发者ID:danielheyman,项目名称:EazySubs,代码行数:101,代码来源:mcp_main.php

示例11: display_forums

/**
* Display Forums
*/
function display_forums($root_data = '', $display_moderators = true, $return_moderators = false)
{
    global $db, $auth, $user, $template;
    global $phpbb_root_path, $phpEx, $config;
    global $request, $phpbb_dispatcher, $phpbb_container;
    $forum_rows = $subforums = $forum_ids = $forum_ids_moderator = $forum_moderators = $active_forum_ary = array();
    $parent_id = $visible_forums = 0;
    $sql_from = '';
    // Mark forums read?
    $mark_read = $request->variable('mark', '');
    if ($mark_read == 'all') {
        $mark_read = '';
    }
    if (!$root_data) {
        if ($mark_read == 'forums') {
            $mark_read = 'all';
        }
        $root_data = array('forum_id' => 0);
        $sql_where = '';
    } else {
        $sql_where = 'left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id'];
    }
    // Handle marking everything read
    if ($mark_read == 'all') {
        $redirect = build_url(array('mark', 'hash', 'mark_time'));
        meta_refresh(3, $redirect);
        if (check_link_hash($request->variable('hash', ''), 'global')) {
            markread('all', false, false, $request->variable('mark_time', 0));
            if ($request->is_ajax()) {
                // Tell the ajax script what language vars and URL need to be replaced
                $data = array('NO_UNREAD_POSTS' => $user->lang['NO_UNREAD_POSTS'], 'UNREAD_POSTS' => $user->lang['UNREAD_POSTS'], 'U_MARK_FORUMS' => $user->data['is_registered'] || $config['load_anon_lastread'] ? append_sid("{$phpbb_root_path}index.{$phpEx}", 'hash=' . generate_link_hash('global') . '&mark=forums&mark_time=' . time()) : '', 'MESSAGE_TITLE' => $user->lang['INFORMATION'], 'MESSAGE_TEXT' => $user->lang['FORUMS_MARKED']);
                $json_response = new \phpbb\json_response();
                $json_response->send($data);
            }
            trigger_error($user->lang['FORUMS_MARKED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . $redirect . '">', '</a>'));
        } else {
            trigger_error(sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
        }
    }
    // Display list of active topics for this category?
    $show_active = isset($root_data['forum_flags']) && $root_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS ? true : false;
    $sql_array = array('SELECT' => 'f.*', 'FROM' => array(FORUMS_TABLE => 'f'), 'LEFT_JOIN' => array());
    if ($config['load_db_lastread'] && $user->data['is_registered']) {
        $sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id');
        $sql_array['SELECT'] .= ', ft.mark_time';
    } else {
        if ($config['load_anon_lastread'] || $user->data['is_registered']) {
            $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE);
            $tracking_topics = $tracking_topics ? tracking_unserialize($tracking_topics) : array();
            if (!$user->data['is_registered']) {
                $user->data['user_lastmark'] = isset($tracking_topics['l']) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0;
            }
        }
    }
    if ($show_active) {
        $sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_ACCESS_TABLE => 'fa'), 'ON' => "fa.forum_id = f.forum_id AND fa.session_id = '" . $db->sql_escape($user->session_id) . "'");
        $sql_array['SELECT'] .= ', fa.user_id';
    }
    $sql_ary = array('SELECT' => $sql_array['SELECT'], 'FROM' => $sql_array['FROM'], 'LEFT_JOIN' => $sql_array['LEFT_JOIN'], 'WHERE' => $sql_where, 'ORDER_BY' => 'f.left_id');
    /**
     * Event to modify the SQL query before the forum data is queried
     *
     * @event core.display_forums_modify_sql
     * @var	array	sql_ary		The SQL array to get the data of the forums
     * @since 3.1.0-a1
     */
    $vars = array('sql_ary');
    extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_sql', compact($vars)));
    $sql = $db->sql_build_query('SELECT', $sql_ary);
    $result = $db->sql_query($sql);
    $forum_tracking_info = $valid_categories = array();
    $branch_root_id = $root_data['forum_id'];
    /* @var $phpbb_content_visibility \phpbb\content_visibility */
    $phpbb_content_visibility = $phpbb_container->get('content.visibility');
    while ($row = $db->sql_fetchrow($result)) {
        /**
         * Event to modify the data set of a forum
         *
         * This event is triggered once per forum
         *
         * @event core.display_forums_modify_row
         * @var	int		branch_root_id	Last top-level forum
         * @var	array	row				The data of the forum
         * @since 3.1.0-a1
         */
        $vars = array('branch_root_id', 'row');
        extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_row', compact($vars)));
        $forum_id = $row['forum_id'];
        // Mark forums read?
        if ($mark_read == 'forums') {
            if ($auth->acl_get('f_list', $forum_id)) {
                $forum_ids[] = $forum_id;
            }
            continue;
        }
        // Category with no members
        if ($row['forum_type'] == FORUM_CAT && $row['left_id'] + 1 == $row['right_id']) {
//.........这里部分代码省略.........
开发者ID:hgchen,项目名称:phpbb,代码行数:101,代码来源:functions_display.php

示例12: append_sid

$template->assign_vars(array('U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", "f={$forum_id}" . ($start == 0 ? '' : "&amp;start={$start}"))));
// Not postable forum or showing active topics?
if (!($forum_data['forum_type'] == FORUM_POST || $forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS && $forum_data['forum_type'] == FORUM_CAT)) {
    page_footer();
}
// Ok, if someone has only list-access, we only display the forum list.
// We also make this circumstance available to the template in case we want to display a notice. ;)
if (!$auth->acl_get('f_read', $forum_id)) {
    $template->assign_vars(array('S_NO_READ_ACCESS' => true));
    page_footer();
}
// Handle marking posts
if ($mark_read == 'topics') {
    $token = request_var('hash', '');
    if (check_link_hash($token, 'global')) {
        markread('topics', array($forum_id), false, request_var('mark_time', 0));
    }
    $redirect_url = append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id);
    meta_refresh(3, $redirect_url);
    if ($request->is_ajax()) {
        // Tell the ajax script what language vars and URL need to be replaced
        $data = array('NO_UNREAD_POSTS' => $user->lang['NO_UNREAD_POSTS'], 'UNREAD_POSTS' => $user->lang['UNREAD_POSTS'], 'U_MARK_TOPICS' => $user->data['is_registered'] || $config['load_anon_lastread'] ? append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'hash=' . generate_link_hash('global') . "&f={$forum_id}&mark=topics&mark_time=" . time()) : '', 'MESSAGE_TITLE' => $user->lang['INFORMATION'], 'MESSAGE_TEXT' => $user->lang['TOPICS_MARKED']);
        $json_response = new \phpbb\json_response();
        $json_response->send($data);
    }
    trigger_error($user->lang['TOPICS_MARKED'] . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>'));
}
// Is a forum specific topic count required?
if ($forum_data['forum_topics_per_page']) {
    $config['topics_per_page'] = $forum_data['forum_topics_per_page'];
}
开发者ID:yuxuibbs,项目名称:worldcubeassociation.org,代码行数:31,代码来源:viewforum.php

示例13: topic_status

        // topics
        $s_type_switch_test = $row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL ? 1 : 0;
        // Replies
        $replies = $_CLASS['auth']->acl_get('m_approve', $forum_id) ? (int) $row['topic_replies_real'] : (int) $row['topic_replies'];
        if ($row['topic_status'] == ITEM_MOVED) {
            // currently no marking supported
            $topic_id = $row['topic_moved_id'];
        }
        // Get folder img, topic status/type related informations
        $folder_img = $folder_alt = $topic_type = '';
        //	$status = topic_status($row, $replies, $mark_time, $unread_topic, $folder_img, $folder_alt, $topic_type);
        topic_status($row, $replies, $mark_time, $unread_topic, $folder_img, $folder_alt, $topic_type);
        $newest_post_img = $unread_topic ? '<a href="' . generate_link("Forums&amp;file=viewtopic&amp;t={$topic_id}&amp;view=unread#unread") . '">' . $_CLASS['core_user']->img('icon_post_newest', 'VIEW_NEWEST_POST') . '</a> ' : '';
        // Generate all the URIs ...
        $view_topic_url = 'Forums&amp;file=viewtopic&amp;t=' . $topic_id;
        $pagination = generate_pagination('Forums&amp;file=viewtopic&amp;&amp;t=' . $topic_id, $replies, $config['posts_per_page']);
        // Send vars to template
        $_CLASS['core_template']->assign_vars_array('topicrow', array('FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, 'AUTHOR' => $row['topic_poster'] == ANONYMOUS ? $row['topic_first_poster_name'] ? $row['topic_first_poster_name'] : $_CLASS['core_user']->get_lang('GUEST') : $row['topic_first_poster_name'], 'LINK_AUTHOR' => $row['topic_poster'] == ANONYMOUS ? '' : generate_link('Members_List&amp;mode=viewprofile&amp;u=' . $row['topic_poster']), 'FIRST_POST_TIME' => $_CLASS['core_user']->format_date($row['topic_time']), 'LAST_POST_TIME' => $_CLASS['core_user']->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $_CLASS['core_user']->format_date($row['topic_last_view_time']), 'LAST_POST_AUTHOR' => $row['topic_last_poster_name'] != '' ? $row['topic_last_poster_name'] : $_CLASS['core_user']->lang['GUEST'], 'PAGINATION' => $pagination['formated'], 'PAGINATION_ARRAY' => $pagination['array'], 'REPLIES' => $replies, 'VIEWS' => $row['topic_views'], 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, 'TOPIC_LOCKED' => $row['topic_status'] == ITEM_LOCKED ? 1 : 0, 'LAST_POST_IMG' => $_CLASS['core_user']->img('icon_post_latest', 'VIEW_LATEST_POST'), 'NEWEST_POST_IMG' => $newest_post_img, 'TOPIC_FOLDER_IMG' => $_CLASS['core_user']->img($folder_img, $folder_alt), 'TOPIC_ICON_IMG' => empty($icons[$row['icon_id']]) ? '' : $icons[$row['icon_id']]['img'], 'TOPIC_ICON_IMG_WIDTH' => empty($icons[$row['icon_id']]) ? '' : $icons[$row['icon_id']]['width'], 'TOPIC_ICON_IMG_HEIGHT' => empty($icons[$row['icon_id']]) ? '' : $icons[$row['icon_id']]['height'], 'ATTACH_ICON_IMG' => $row['topic_attachment'] && $_CLASS['auth']->acl_gets(array('f_download', 'u_download'), $forum_id) ? $_CLASS['core_user']->img('icon_attach', $_CLASS['core_user']->lang['TOTAL_ATTACHMENTS']) : '', 'S_TOPIC_TYPE' => $row['topic_type'], 'S_UNREAD_TOPIC' => $unread_topic, 'S_TOPIC_REPORTED' => $row['topic_reported'] && $_CLASS['auth']->acl_get('m_report', $forum_id), 'S_TOPIC_UNAPPROVED' => !$row['topic_approved'] && $_CLASS['auth']->acl_get('m_approve', $forum_id), 'U_LAST_POST' => generate_link($view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id']), 'U_LAST_POST_AUTHOR' => $row['topic_last_poster_id'] ? generate_link('Members_List&amp;mode=viewprofile&amp;u=' . $row['topic_last_poster_id']) : '', 'U_VIEW_TOPIC' => generate_link($view_topic_url), 'U_MCP_REPORT' => generate_link('Forums&amp;file=mcp&amp;mode=reports&amp;t=' . $topic_id), 'U_MCP_QUEUE' => generate_link('Forums&amp;file=mcp&amp;i=queue&amp;mode=approve_details&amp;t=' . $topic_id), 'S_TOPIC_TYPE_SWITCH' => $s_type_switch == $s_type_switch_test ? -1 : $s_type_switch_test));
        $s_type_switch = $row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL ? 1 : 0;
        unset($row, $rowset[$topic_id]);
    }
    unset($topic_list);
}
// Update the marktime only if $mark_forum_read is set to a time
if ($forum_data['forum_type'] == FORUM_POST && is_int($mark_forum_read)) {
    markread('forum', $forum_id, false, $mark_forum_read);
}
page_header();
make_jumpbox(generate_link('Forums&amp;file=viewforum'), $forum_id);
$_CLASS['core_display']->footer .= $_CLASS['core_template']->display('modules/Forums/menus.html', true);
$_CLASS['core_display']->display(false, 'modules/Forums/viewforum_body.html');
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:31,代码来源:viewforum.php

示例14: mcp_fork_topic

/**
* Fork Topic
*/
function mcp_fork_topic($topic_ids)
{
    global $auth, $user, $db, $template, $config;
    global $phpEx, $phpbb_root_path;
    if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_'))) {
        return;
    }
    $to_forum_id = request_var('to_forum_id', 0);
    $redirect = request_var('redirect', $user->data['session_page']);
    $additional_msg = $success_msg = '';
    $s_hidden_fields = build_hidden_fields(array('topic_id_list' => $topic_ids, 'f' => $forum_id, 'action' => 'fork', 'redirect' => $redirect));
    if ($to_forum_id) {
        $forum_data = get_forum_data($to_forum_id);
        if (!sizeof($topic_ids)) {
            $additional_msg = $user->lang['NO_TOPICS_SELECTED'];
        } else {
            if (!sizeof($forum_data)) {
                $additional_msg = $user->lang['FORUM_NOT_EXIST'];
            } else {
                $forum_data = $forum_data[$to_forum_id];
                if ($forum_data['forum_type'] != FORUM_POST) {
                    $additional_msg = $user->lang['FORUM_NOT_POSTABLE'];
                } else {
                    if (!$auth->acl_get('f_post', $to_forum_id)) {
                        $additional_msg = $user->lang['USER_CANNOT_POST'];
                    }
                }
            }
        }
    }
    if (!$to_forum_id || $additional_msg) {
        unset($_POST['confirm']);
    }
    if (confirm_box(true)) {
        $topic_data = get_topic_data($topic_ids);
        $total_posts = 0;
        $new_topic_id_list = array();
        foreach ($topic_data as $topic_id => $topic_row) {
            $sql_ary = array('forum_id' => (int) $to_forum_id, 'icon_id' => (int) $topic_row['icon_id'], 'topic_attachment' => (int) $topic_row['topic_attachment'], 'topic_approved' => 1, 'topic_reported' => 0, 'topic_title' => (string) $topic_row['topic_title'], 'topic_poster' => (int) $topic_row['topic_poster'], 'topic_time' => (int) $topic_row['topic_time'], 'topic_replies' => (int) $topic_row['topic_replies_real'], 'topic_replies_real' => (int) $topic_row['topic_replies_real'], 'topic_status' => (int) $topic_row['topic_status'], 'topic_type' => (int) $topic_row['topic_type'], 'topic_first_poster_name' => (string) $topic_row['topic_first_poster_name'], 'topic_last_poster_id' => (int) $topic_row['topic_last_poster_id'], 'topic_last_poster_name' => (string) $topic_row['topic_last_poster_name'], 'topic_last_post_time' => (int) $topic_row['topic_last_post_time'], 'topic_last_view_time' => (int) $topic_row['topic_last_view_time'], 'topic_bumped' => (int) $topic_row['topic_bumped'], 'topic_bumper' => (int) $topic_row['topic_bumper'], 'poll_title' => (string) $topic_row['poll_title'], 'poll_start' => (int) $topic_row['poll_start'], 'poll_length' => (int) $topic_row['poll_length']);
            $db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
            $new_topic_id = $db->sql_nextid();
            $new_topic_id_list[$topic_id] = $new_topic_id;
            /**
             * @todo enable? (is this still needed?)
             * markread('topic', $to_forum_id, $new_topic_id);
             */
            if ($topic_row['poll_start']) {
                $poll_rows = array();
                $sql = 'SELECT *
					FROM ' . POLL_OPTIONS_TABLE . "\n\t\t\t\t\tWHERE topic_id = {$topic_id}";
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $sql_ary = array('poll_option_id' => (int) $row['poll_option_id'], 'topic_id' => (int) $new_topic_id, 'poll_option_text' => (string) $row['poll_option_text'], 'poll_option_total' => 0);
                    $db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
                }
            }
            $sql = 'SELECT *
				FROM ' . POSTS_TABLE . "\n\t\t\t\tWHERE topic_id = {$topic_id}\n\t\t\t\tORDER BY post_id ASC";
            $result = $db->sql_query($sql);
            $post_rows = array();
            while ($row = $db->sql_fetchrow($result)) {
                $post_rows[] = $row;
            }
            $db->sql_freeresult($result);
            if (!sizeof($post_rows)) {
                continue;
            }
            $total_posts += sizeof($post_rows);
            foreach ($post_rows as $row) {
                $sql_ary = array('topic_id' => (int) $new_topic_id, 'forum_id' => (int) $to_forum_id, 'poster_id' => (int) $row['poster_id'], 'icon_id' => (int) $row['icon_id'], 'poster_ip' => (string) $row['poster_ip'], 'post_time' => (int) $row['post_time'], 'post_approved' => 1, 'post_reported' => 0, 'enable_bbcode' => (int) $row['enable_bbcode'], 'enable_smilies' => (int) $row['enable_smilies'], 'enable_magic_url' => (int) $row['enable_magic_url'], 'enable_sig' => (int) $row['enable_sig'], 'post_username' => (string) $row['post_username'], 'post_subject' => (string) $row['post_subject'], 'post_text' => (string) $row['post_text'], 'post_edit_reason' => (string) $row['post_edit_reason'], 'post_edit_user' => (int) $row['post_edit_user'], 'post_checksum' => (string) $row['post_checksum'], 'post_encoding' => (string) $row['post_encoding'], 'post_attachment' => (int) $row['post_attachment'], 'bbcode_bitfield' => (int) $row['bbcode_bitfield'], 'bbcode_uid' => (string) $row['bbcode_uid'], 'post_edit_time' => (int) $row['post_edit_time'], 'post_edit_count' => (int) $row['post_edit_count'], 'post_edit_locked' => (int) $row['post_edit_locked']);
                $db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
                $new_post_id = $db->sql_nextid();
                // Copy whether the topic is dotted
                markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']);
                // Copy Attachments
                if ($row['post_attachment']) {
                    $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . "\n\t\t\t\t\t\tWHERE post_msg_id = {$row['post_id']}\n\t\t\t\t\t\t\tAND topic_id = {$topic_id}\n\t\t\t\t\t\t\tAND in_message = 0";
                    $result = $db->sql_query($sql);
                    while ($attach_row = $db->sql_fetchrow($result)) {
                        $sql_ary = array('post_msg_id' => (int) $new_post_id, 'topic_id' => (int) $new_topic_id, 'in_message' => 0, 'poster_id' => (int) $attach_row['poster_id'], 'physical_filename' => (string) basename($attach_row['physical_filename']), 'real_filename' => (string) basename($attach_row['real_filename']), 'download_count' => (int) $attach_row['download_count'], 'comment' => (string) $attach_row['comment'], 'extension' => (string) $attach_row['extension'], 'mimetype' => (string) $attach_row['mimetype'], 'filesize' => (int) $attach_row['filesize'], 'filetime' => (int) $attach_row['filetime'], 'thumbnail' => (int) $attach_row['thumbnail']);
                        $db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
                    }
                    $db->sql_freeresult($result);
                }
            }
        }
        // Sync new topics, parent forums and board stats
        sync('topic', 'topic_id', $new_topic_id_list, true);
        sync('forum', 'forum_id', $to_forum_id, true);
        set_config('num_topics', $config['num_topics'] + sizeof($new_topic_id_list));
        set_config('num_posts', $config['num_posts'] + $total_posts);
        foreach ($new_topic_id_list as $topic_id => $new_topic_id) {
            add_log('mod', $to_forum_id, $new_topic_id, 'LOG_FORK', $topic_row['forum_name']);
        }
        $success_msg = sizeof($topic_ids) == 1 ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS';
    } else {
        $template->assign_vars(array('S_FORUM_SELECT' => make_forum_select($to_forum_id, false, false, true, true), 'S_CAN_LEAVE_SHADOW' => false, 'ADDITIONAL_MSG' => $additional_msg));
//.........这里部分代码省略.........
开发者ID:yunsite,项目名称:gloryroad,代码行数:101,代码来源:mcp_main.php

示例15: change_poster

/**
* Change a post's poster
*/
function change_poster(&$post_info, $userdata)
{
    global $auth, $db, $config;
    if (empty($userdata) || $userdata['user_id'] == $post_info['user_id']) {
        return;
    }
    $post_id = $post_info['post_id'];
    $sql = 'UPDATE ' . POSTS_TABLE . "\n\t\tSET poster_id = {$userdata['user_id']}\n\t\tWHERE post_id = {$post_id}";
    $db->sql_query($sql);
    // Resync topic/forum if needed
    if ($post_info['topic_last_post_id'] == $post_id || $post_info['forum_last_post_id'] == $post_id) {
        sync('topic', 'topic_id', $post_info['topic_id'], false, false);
        sync('forum', 'forum_id', $post_info['forum_id'], false, false);
    }
    // Adjust post counts
    $auth_user_from = new auth();
    $auth_user_from->acl($post_info);
    $auth_user_to = new auth();
    $auth_user_to->acl($userdata);
    // Decrease post count by one for the old user
    if ($auth_user_from->acl_get('f_postcount', $post_info['forum_id'])) {
        $sql = 'UPDATE ' . USERS_TABLE . '
			SET user_posts = user_posts - 1
			WHERE user_id = ' . $post_info['user_id'];
        $db->sql_query($sql);
    }
    // Increase post count by one for the new user
    if ($auth_user_to->acl_get('f_postcount', $post_info['forum_id'])) {
        $sql = 'UPDATE ' . USERS_TABLE . '
			SET user_posts = user_posts + 1
			WHERE user_id = ' . $userdata['user_id'];
        $db->sql_query($sql);
    }
    // Add posted to information for this topic for the new user
    markread('post', $post_info['forum_id'], $post_info['topic_id'], time(), $userdata['user_id']);
    // Remove the dotted topic option if the old user has no more posts within this topic
    if ($config['load_db_track'] && $post_info['user_id'] != ANONYMOUS) {
        $sql = 'SELECT topic_id
			FROM ' . POSTS_TABLE . '
			WHERE topic_id = ' . $post_info['topic_id'] . '
				AND poster_id = ' . $post_info['user_id'];
        $result = $db->sql_query_limit($sql, 1);
        $topic_id = (int) $db->sql_fetchfield('topic_id');
        $db->sql_freeresult($result);
        if (!$topic_id) {
            $sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . '
				WHERE user_id = ' . $post_info['user_id'] . '
					AND topic_id = ' . $post_info['topic_id'];
            $db->sql_query($sql);
        }
    }
    // Do not change the poster_id within the attachments table, since they were still posted by the original user
    $from_username = $post_info['username'];
    $to_username = $userdata['username'];
    // Renew post info
    $post_info = get_post_data(array($post_id));
    if (!sizeof($post_info)) {
        trigger_error($user->lang['POST_NOT_EXIST']);
    }
    $post_info = $post_info[$post_id];
    // Now add log entry
    add_log('mod', $post_info['forum_id'], $post_info['topic_id'], 'LOG_MCP_CHANGE_POSTER', $post_info['topic_title'], $from_username, $to_username);
}
开发者ID:yunsite,项目名称:gloryroad,代码行数:66,代码来源:mcp_post.php


注:本文中的markread函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。