示例#1
0
display_custom_bbcodes();
// Poll entry
if (($mode == 'post' || $mode == 'edit' && $post_id == $post_data['topic_first_post_id']) && $auth->acl_get('f_poll', $forum_id)) {
    $template->assign_vars(array('S_SHOW_POLL_BOX' => true, 'S_POLL_VOTE_CHANGE' => $auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id), 'S_POLL_DELETE' => $mode == 'edit' && sizeof($post_data['poll_options']) && (!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) || $auth->acl_get('m_delete', $forum_id)), 'S_POLL_DELETE_CHECKED' => !empty($poll_delete) ? true : false, 'L_POLL_OPTIONS_EXPLAIN' => sprintf($user->lang['POLL_OPTIONS_' . ($mode == 'edit' ? 'EDIT_' : '') . 'EXPLAIN'], $config['max_poll_options']), 'VOTE_CHANGE_CHECKED' => !empty($post_data['poll_vote_change']) ? ' checked="checked"' : '', 'POLL_TITLE' => isset($post_data['poll_title']) ? $post_data['poll_title'] : '', 'POLL_OPTIONS' => !empty($post_data['poll_options']) ? implode("\n", $post_data['poll_options']) : '', 'POLL_MAX_OPTIONS' => isset($post_data['poll_max_options']) ? (int) $post_data['poll_max_options'] : 1, 'POLL_LENGTH' => $post_data['poll_length']));
}
// Show attachment box for adding attachments if true
$allowed = $auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && $form_enctype;
// Attachment entry
posting_gen_attachment_entry($attachment_data, $filename_data, $allowed);
// Output page ...
page_header($page_title, false);
$template->set_filenames(array('body' => 'posting_body.html'));
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.{$phpEx}"));
// Topic review
if ($mode == 'reply' || $mode == 'quote') {
    if (topic_review($topic_id, $forum_id)) {
        $template->assign_var('S_DISPLAY_REVIEW', true);
    }
}
page_footer();
/**
* Show upload popup (progress bar)
*/
function upload_popup($forum_style = 0)
{
    global $template, $user;
    $forum_style ? $user->setup('posting', $forum_style) : $user->setup('posting');
    page_header($user->lang['PROGRESS_BAR'], false);
    $template->set_filenames(array('popup' => 'posting_progress_bar.html'));
    $template->assign_vars(array('PROGRESS_BAR' => $user->img('upload_bar', $user->lang['UPLOAD_IN_PROGRESS'])));
    $template->display('popup');
示例#2
0
    function main($id, $mode)
    {
        global $auth, $db, $user, $template, $cache;
        global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container, $phpbb_dispatcher;
        include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
        $forum_id = request_var('f', 0);
        $start = request_var('start', 0);
        $this->page_title = 'MCP_REPORTS';
        switch ($action) {
            case 'close':
            case 'delete':
                include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                $report_id_list = request_var('report_id_list', array(0));
                if (!sizeof($report_id_list)) {
                    trigger_error('NO_REPORT_SELECTED');
                }
                close_report($report_id_list, $mode, $action);
                break;
        }
        switch ($mode) {
            case 'report_details':
                $user->add_lang(array('posting', 'viewforum', 'viewtopic'));
                $post_id = request_var('p', 0);
                // closed reports are accessed by report id
                $report_id = request_var('r', 0);
                $sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, r.reported_post_text, r.reported_post_uid, r.reported_post_bitfield, r.reported_post_enable_magic_url, r.reported_post_enable_smilies, r.reported_post_enable_bbcode, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour
					FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u
					WHERE ' . ($report_id ? 'r.report_id = ' . $report_id : "r.post_id = {$post_id}") . '
						AND rr.reason_id = r.reason_id
						AND r.user_id = u.user_id
						AND r.pm_id = 0
					ORDER BY report_closed ASC';
                $result = $db->sql_query_limit($sql, 1);
                $report = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);
                if (!$report) {
                    trigger_error('NO_REPORT');
                }
                $phpbb_notifications = $phpbb_container->get('notification_manager');
                $phpbb_notifications->mark_notifications_read('notification.type.report_post', $post_id, $user->data['user_id']);
                if (!$report_id && $report['report_closed']) {
                    trigger_error('REPORT_CLOSED');
                }
                $post_id = $report['post_id'];
                $report_id = $report['report_id'];
                $parse_post_flags = $report['reported_post_enable_bbcode'] ? OPTION_FLAG_BBCODE : 0;
                $parse_post_flags += $report['reported_post_enable_smilies'] ? OPTION_FLAG_SMILIES : 0;
                $parse_post_flags += $report['reported_post_enable_magic_url'] ? OPTION_FLAG_LINKS : 0;
                $post_info = phpbb_get_post_data(array($post_id), 'm_report', true);
                if (!sizeof($post_info)) {
                    trigger_error('NO_REPORT_SELECTED');
                }
                $post_info = $post_info[$post_id];
                $reason = array('title' => $report['reason_title'], 'description' => $report['reason_description']);
                if (isset($user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])])) {
                    $reason['description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])];
                    $reason['title'] = $user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])];
                }
                if (topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false)) {
                    $template->assign_vars(array('S_TOPIC_REVIEW' => true, 'S_BBCODE_ALLOWED' => $post_info['enable_bbcode'], 'TOPIC_TITLE' => $post_info['topic_title'], 'REPORTED_POST_ID' => $post_id));
                }
                $topic_tracking_info = $extensions = $attachments = array();
                // Get topic tracking info
                if ($config['load_db_lastread']) {
                    $tmp_topic_data = array($post_info['topic_id'] => $post_info);
                    $topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time']));
                    unset($tmp_topic_data);
                } else {
                    $topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
                }
                $post_unread = isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']] ? true : false;
                $message = generate_text_for_display($report['reported_post_text'], $report['reported_post_uid'], $report['reported_post_bitfield'], $parse_post_flags, false);
                $report['report_text'] = make_clickable(bbcode_nl2br($report['report_text']));
                if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) {
                    $sql = 'SELECT *
						FROM ' . ATTACHMENTS_TABLE . '
						WHERE post_msg_id = ' . $post_id . '
							AND in_message = 0
							AND filetime <= ' . (int) $report['report_time'] . '
						ORDER BY filetime DESC';
                    $result = $db->sql_query($sql);
                    while ($row = $db->sql_fetchrow($result)) {
                        $attachments[] = $row;
                    }
                    $db->sql_freeresult($result);
                    if (sizeof($attachments)) {
                        $update_count = array();
                        parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
                    }
                    // Display not already displayed Attachments for this post, we already parsed them. ;)
                    if (!empty($attachments)) {
                        $template->assign_var('S_HAS_ATTACHMENTS', true);
                        foreach ($attachments as $attachment) {
                            $template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
                        }
                    }
                }
                $template->assign_vars(array('S_MCP_REPORT' => true, 'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => $post_info['post_visibility'] == ITEM_UNAPPROVED || $post_info['post_visibility'] == ITEM_REAPPROVE, 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_REPORT_CLOSED' => $report['report_closed'], 'S_USER_NOTES' => true, 'U_EDIT' => $auth->acl_get('m_edit', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '', 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_REPORTER_NOTES' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&amp;mode=user_notes&amp;u=' . $report['user_id']), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&amp;mode=user_notes&amp;u=' . $post_info['user_id']), 'U_MCP_WARN_REPORTER' => $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&amp;mode=warn_user&amp;u=' . $report['user_id']) : '', 'U_MCP_WARN_USER' => $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&amp;mode=warn_user&amp;u=' . $post_info['user_id']) : '', 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $post_info['forum_id']), 'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&amp;p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), 'MINI_POST_IMG' => $post_unread ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), 'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '<a href="' . append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports' . ($post_info['post_reported'] ? '&amp;mode=reports' : '&amp;mode=reports_closed') . '&amp;start=' . $start . '&amp;f=' . $post_info['forum_id']) . '">', '</a>'), 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), 'REPORT_DATE' => $user->format_date($report['report_time']), 'REPORT_ID' => $report_id, 'REPORT_REASON_TITLE' => $reason['title'], 'REPORT_REASON_DESCRIPTION' => $reason['description'], 'REPORT_TEXT' => $report['report_text'], 'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'REPORTER_FULL' => get_username_string('full', $report['user_id'], $report['username'], $report['user_colour']), 'REPORTER_COLOUR' => get_username_string('colour', $report['user_id'], $report['username'], $report['user_colour']), 'REPORTER_NAME' => get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']), 'U_VIEW_REPORTER_PROFILE' => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']), 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'] ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => $auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '') ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], 'U_LOOKUP_IP' => $auth->acl_get('m_info', $post_info['forum_id']) ? $this->u_action . '&amp;r=' . $report_id . '&amp;p=' . $post_id . '&amp;f=' . $forum_id . '&amp;lookup=' . $post_info['poster_ip'] . '#ip' : ''));
                $this->tpl_name = 'mcp_post';
                break;
            case 'reports':
            case 'reports_closed':
                $topic_id = request_var('t', 0);
                $forum_info = array();
                $forum_list_reports = get_forum_list('m_report', false, true);
                $forum_list_read = array_flip(get_forum_list('f_read', true, true));
                // Flipped so we can isset() the forum IDs
                // Remove forums we cannot read
                foreach ($forum_list_reports as $k => $forum_data) {
                    if (!isset($forum_list_read[$forum_data['forum_id']])) {
                        unset($forum_list_reports[$k]);
                    }
                }
                unset($forum_list_read);
                if ($topic_id) {
                    $topic_info = phpbb_get_topic_data(array($topic_id));
                    if (!sizeof($topic_info)) {
                        trigger_error('TOPIC_NOT_EXIST');
                    }
                    if ($forum_id != $topic_info[$topic_id]['forum_id']) {
                        $topic_id = 0;
                    } else {
                        $topic_info = $topic_info[$topic_id];
                        $forum_id = (int) $topic_info['forum_id'];
                    }
                }
                $forum_list = array();
                if (!$forum_id) {
                    foreach ($forum_list_reports as $row) {
                        $forum_list[] = $row['forum_id'];
                    }
                    if (!sizeof($forum_list)) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $global_id = $forum_list[0];
                    $sql = 'SELECT SUM(forum_topics_approved) as sum_forum_topics
						FROM ' . FORUMS_TABLE . '
						WHERE ' . $db->sql_in_set('forum_id', $forum_list);
                    $result = $db->sql_query($sql);
                    $forum_info['forum_topics_approved'] = (int) $db->sql_fetchfield('sum_forum_topics');
                    $db->sql_freeresult($result);
                } else {
                    $forum_info = phpbb_get_forum_data(array($forum_id), 'm_report');
                    if (!sizeof($forum_info)) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $forum_info = $forum_info[$forum_id];
                    $forum_list = array($forum_id);
                }
                $forum_list[] = 0;
                $forum_data = array();
                $pagination = $phpbb_container->get('pagination');
                $forum_options = '<option value="0"' . ($forum_id == 0 ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
                foreach ($forum_list_reports as $row) {
                    $forum_options .= '<option value="' . $row['forum_id'] . '"' . ($forum_id == $row['forum_id'] ? ' selected="selected"' : '') . '>' . str_repeat('&nbsp; &nbsp;', $row['padding']) . $row['forum_name'] . '</option>';
                    $forum_data[$row['forum_id']] = $row;
                }
                unset($forum_list_reports);
                $sort_days = $total = 0;
                $sort_key = $sort_dir = '';
                $sort_by_sql = $sort_order_sql = array();
                phpbb_mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
                $forum_topics = $total == -1 ? $forum_info['forum_topics_approved'] : $total;
                $limit_time_sql = $sort_days ? 'AND r.report_time >= ' . (time() - $sort_days * 86400) : '';
                if ($mode == 'reports') {
                    $report_state = 'AND p.post_reported = 1 AND r.report_closed = 0';
                } else {
                    $report_state = 'AND r.report_closed = 1';
                }
                $sql = 'SELECT r.report_id
					FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . REPORTS_TABLE . ' r ' . ($sort_order_sql[0] == 'u' ? ', ' . USERS_TABLE . ' u' : '') . ($sort_order_sql[0] == 'r' ? ', ' . USERS_TABLE . ' ru' : '') . '
					WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . "\n\t\t\t\t\t\t{$report_state}\n\t\t\t\t\t\tAND r.post_id = p.post_id\n\t\t\t\t\t\t" . ($sort_order_sql[0] == 'u' ? 'AND u.user_id = p.poster_id' : '') . '
						' . ($sort_order_sql[0] == 'r' ? 'AND ru.user_id = r.user_id' : '') . '
						' . ($topic_id ? 'AND p.topic_id = ' . $topic_id : '') . "\n\t\t\t\t\t\tAND t.topic_id = p.topic_id\n\t\t\t\t\t\tAND r.pm_id = 0\n\t\t\t\t\t\t{$limit_time_sql}\n\t\t\t\t\tORDER BY {$sort_order_sql}";
                /**
                 * Alter sql query to get report id of all reports for requested forum and topic or just forum
                 *
                 * @event core.mcp_reports_get_reports_query_before
                 * @var	string	sql						String with the query to be executed
                 * @var	array	forum_list				List of forums that contain the posts
                 * @var	int		topic_id				topic_id in the page request
                 * @var	string	limit_time_sql			String with the SQL code to limit the time interval of the post (Note: May be empty string)
                 * @var	string	sort_order_sql			String with the ORDER BY SQL code used in this query
                 * @since 3.1.0-RC4
                 */
                $vars = array('sql', 'forum_list', 'topic_id', 'limit_time_sql', 'sort_order_sql');
                extract($phpbb_dispatcher->trigger_event('core.mcp_reports_get_reports_query_before', compact($vars)));
                $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
                $i = 0;
                $report_ids = array();
                while ($row = $db->sql_fetchrow($result)) {
                    $report_ids[] = $row['report_id'];
                    $row_num[$row['report_id']] = $i++;
                }
                $db->sql_freeresult($result);
                if (sizeof($report_ids)) {
                    $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, p.post_attachment, u.username, u.username_clean, u.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id
						FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru
						WHERE ' . $db->sql_in_set('r.report_id', $report_ids) . '
							AND t.topic_id = p.topic_id
							AND r.post_id = p.post_id
							AND u.user_id = p.poster_id
							AND ru.user_id = r.user_id
							AND r.pm_id = 0
						ORDER BY ' . $sort_order_sql;
                    $result = $db->sql_query($sql);
                    $report_data = $rowset = array();
                    while ($row = $db->sql_fetchrow($result)) {
                        $template->assign_block_vars('postrow', array('U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $row['forum_id']), 'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']) . '#p' . $row['post_id'], 'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=reports&amp;start={$start}&amp;mode=report_details&amp;f={$row['forum_id']}&amp;r={$row['report_id']}"), 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'REPORTER_FULL' => get_username_string('full', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']), 'REPORTER_COLOUR' => get_username_string('colour', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']), 'REPORTER' => get_username_string('username', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']), 'U_REPORTER' => get_username_string('profile', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']), 'FORUM_NAME' => $forum_data[$row['forum_id']]['forum_name'], 'POST_ID' => $row['post_id'], 'POST_SUBJECT' => $row['post_subject'] ? $row['post_subject'] : $user->lang['NO_SUBJECT'], 'POST_TIME' => $user->format_date($row['post_time']), 'REPORT_ID' => $row['report_id'], 'REPORT_TIME' => $user->format_date($row['report_time']), 'TOPIC_TITLE' => $row['topic_title'], 'ATTACH_ICON_IMG' => $auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment'] ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : ''));
                    }
                    $db->sql_freeresult($result);
                    unset($report_ids, $row);
                }
                $base_url = $this->u_action . "&amp;f={$forum_id}&amp;t={$topic_id}&amp;st={$sort_days}&amp;sk={$sort_key}&amp;sd={$sort_dir}";
                $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
                // Now display the page
                $template->assign_vars(array('L_EXPLAIN' => $mode == 'reports' ? $user->lang['MCP_REPORTS_OPEN_EXPLAIN'] : $user->lang['MCP_REPORTS_CLOSED_EXPLAIN'], 'L_TITLE' => $mode == 'reports' ? $user->lang['MCP_REPORTS_OPEN'] : $user->lang['MCP_REPORTS_CLOSED'], 'L_ONLY_TOPIC' => $topic_id ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '', 'S_MCP_ACTION' => $this->u_action, 'S_FORUM_OPTIONS' => $forum_options, 'S_CLOSED' => $mode == 'reports_closed' ? true : false, 'TOPIC_ID' => $topic_id, 'TOTAL' => $total, 'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $total)));
                $this->tpl_name = 'mcp_reports';
                break;
        }
    }
示例#3
0
文件: aljax.php 项目: velocat/phpbb3
                $sql = 'SELECT f.*, t.*
		FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f\n\t\tWHERE t.topic_id = {$topic_id}\n\t\t\tAND f.forum_id = t.forum_id";
                $result = $db->sql_query($sql);
                $post_data = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);
                $post_data['topic_cur_post_id'] = request_var('topic_cur_post_id', 0);
                // If replying/quoting and last post id has changed
                // give user option to continue submit or return to post
                // notify and show user the post made between his request and the final submit
                if ($post_data['topic_cur_post_id'] != $post_data['topic_last_post_id']) {
                    // Only do so if it is allowed forum-wide
                    if ($post_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) {
                        // Set template file
                        $template->set_filenames(array('body' => 'aljax_review.html'));
                        // Generate and output review
                        if (topic_review($topic_id, $post_data['forum_id'], 'post_review', $post_data['topic_cur_post_id'])) {
                            $template->assign_var('S_AJAX_REVIEW', true);
                            $_RESULT['topic_cur_post_id'] = $post_data['topic_last_post_id'];
                            $_RESULT['success'] = true;
                            $template->display('body');
                        }
                    }
                }
            } else {
                if ($mode == 'post_quick_reply') {
                    include $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
                    include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
                    // Set up language
                    $user->setup(array('posting', 'mcp', 'viewtopic'));
                    // Grab only parameters needed here
                    //$param	= request_var('param', '');
示例#4
0
文件: mcp_queue.php 项目: html/PI
    function main($id, $mode)
    {
        global $auth, $db, $user, $template, $cache;
        global $config, $phpbb_root_path, $phpEx, $action;
        include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
        $forum_id = request_var('f', 0);
        $start = request_var('start', 0);
        $this->page_title = 'MCP_QUEUE';
        switch ($action) {
            case 'approve':
            case 'disapprove':
                include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                $post_id_list = request_var('post_id_list', array(0));
                if (!sizeof($post_id_list)) {
                    trigger_error('NO_POST_SELECTED');
                }
                if ($action == 'approve') {
                    approve_post($post_id_list, 'queue', $mode);
                } else {
                    disapprove_post($post_id_list, 'queue', $mode);
                }
                break;
        }
        switch ($mode) {
            case 'approve_details':
                $this->tpl_name = 'mcp_post';
                $user->add_lang(array('posting', 'viewtopic'));
                $post_id = request_var('p', 0);
                $topic_id = request_var('t', 0);
                if ($topic_id) {
                    $topic_info = get_topic_data(array($topic_id), 'm_approve');
                    if (isset($topic_info[$topic_id]['topic_first_post_id'])) {
                        $post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];
                    } else {
                        $topic_id = 0;
                    }
                }
                $post_info = get_post_data(array($post_id), 'm_approve', true);
                if (!sizeof($post_info)) {
                    trigger_error('NO_POST_SELECTED');
                }
                $post_info = $post_info[$post_id];
                if ($post_info['topic_first_post_id'] != $post_id && topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false)) {
                    $template->assign_vars(array('S_TOPIC_REVIEW' => true, 'TOPIC_TITLE' => $post_info['topic_title']));
                }
                $extensions = $attachments = $topic_tracking_info = array();
                // Get topic tracking info
                if ($config['load_db_lastread']) {
                    $tmp_topic_data = array($post_info['topic_id'] => $post_info);
                    $topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time']));
                    unset($tmp_topic_data);
                } else {
                    $topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
                }
                $post_unread = isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']] ? true : false;
                // Process message, leave it uncensored
                $message = $post_info['post_text'];
                if ($post_info['bbcode_bitfield']) {
                    include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
                    $bbcode = new bbcode($post_info['bbcode_bitfield']);
                    $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
                }
                $message = bbcode_nl2br($message);
                $message = smiley_text($message);
                if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) {
                    $extensions = $cache->obtain_attach_extensions($post_info['forum_id']);
                    $sql = 'SELECT *
						FROM ' . ATTACHMENTS_TABLE . '
						WHERE post_msg_id = ' . $post_id . '
							AND in_message = 0
						ORDER BY filetime DESC, post_msg_id ASC';
                    $result = $db->sql_query($sql);
                    while ($row = $db->sql_fetchrow($result)) {
                        $attachments[] = $row;
                    }
                    $db->sql_freeresult($result);
                    if (sizeof($attachments)) {
                        $update_count = array();
                        parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
                    }
                    // Display not already displayed Attachments for this post, we already parsed them. ;)
                    if (!empty($attachments)) {
                        $template->assign_var('S_HAS_ATTACHMENTS', true);
                        foreach ($attachments as $attachment) {
                            $template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
                        }
                    }
                }
                $post_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&amp;p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
                $topic_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']);
                $template->assign_vars(array('S_MCP_QUEUE' => true, 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=queue&amp;p={$post_id}&amp;f={$forum_id}"), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => !$post_info['post_approved'], 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, 'U_EDIT' => $auth->acl_get('m_edit', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '', 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&amp;mode=user_notes&amp;u=' . $post_info['user_id']), 'U_MCP_WARN_USER' => $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&amp;mode=warn_user&amp;u=' . $post_info['user_id']) : '', 'U_VIEW_POST' => $post_url, 'U_VIEW_TOPIC' => $topic_url, 'MINI_POST_IMG' => $post_unread ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue' . ($topic_id ? '&amp;mode=unapproved_topics' : '&amp;mode=unapproved_posts')) . "&amp;start={$start}\">", '</a>'), 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'), 'RETURN_TOPIC_SIMPLE' => sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '<a href="' . $topic_url . '">', '</a>'), 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), 'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => $auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '') ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], 'U_LOOKUP_IP' => $auth->acl_get('m_info', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id . '&amp;lookup=' . $post_info['poster_ip']) . '#ip' : ''));
                break;
            case 'unapproved_topics':
            case 'unapproved_posts':
                $user->add_lang(array('viewtopic', 'viewforum'));
                $topic_id = request_var('t', 0);
                $forum_info = array();
                if ($topic_id) {
                    $topic_info = get_topic_data(array($topic_id));
                    if (!sizeof($topic_info)) {
                        trigger_error('TOPIC_NOT_EXIST');
                    }
                    $topic_info = $topic_info[$topic_id];
                    $forum_id = $topic_info['forum_id'];
                }
                $forum_list_approve = get_forum_list('m_approve', false, true);
                $forum_list_read = array_flip(get_forum_list('f_read', true, true));
                // Flipped so we can isset() the forum IDs
                // Remove forums we cannot read
                foreach ($forum_list_approve as $k => $forum_data) {
                    if (!isset($forum_list_read[$forum_data['forum_id']])) {
                        unset($forum_list_approve[$k]);
                    }
                }
                unset($forum_list_read);
                if (!$forum_id) {
                    $forum_list = array();
                    foreach ($forum_list_approve as $row) {
                        $forum_list[] = $row['forum_id'];
                    }
                    if (!sizeof($forum_list)) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $global_id = $forum_list[0];
                    $forum_list = implode(', ', $forum_list);
                    $sql = 'SELECT SUM(forum_topics) as sum_forum_topics
						FROM ' . FORUMS_TABLE . "\n\t\t\t\t\t\tWHERE forum_id IN (0, {$forum_list})";
                    $result = $db->sql_query($sql);
                    $forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics');
                    $db->sql_freeresult($result);
                } else {
                    $forum_info = get_forum_data(array($forum_id), 'm_approve');
                    if (!sizeof($forum_info)) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $forum_info = $forum_info[$forum_id];
                    $forum_list = $forum_id;
                    $global_id = $forum_id;
                }
                $forum_options = '<option value="0"' . ($forum_id == 0 ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
                foreach ($forum_list_approve as $row) {
                    $forum_options .= '<option value="' . $row['forum_id'] . '"' . ($forum_id == $row['forum_id'] ? ' selected="selected"' : '') . '>' . str_repeat('&nbsp; &nbsp;', $row['padding']) . $row['forum_name'] . '</option>';
                }
                $sort_days = $total = 0;
                $sort_key = $sort_dir = '';
                $sort_by_sql = $sort_order_sql = array();
                mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
                $forum_topics = $total == -1 ? $forum_info['forum_topics'] : $total;
                $limit_time_sql = $sort_days ? 'AND t.topic_last_post_time >= ' . (time() - $sort_days * 86400) : '';
                $forum_names = array();
                if ($mode == 'unapproved_posts') {
                    $sql = 'SELECT p.post_id
						FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . ($sort_order_sql[0] == 'u' ? ', ' . USERS_TABLE . ' u' : '') . "\n\t\t\t\t\t\tWHERE p.forum_id IN (0, {$forum_list})\n\t\t\t\t\t\t\tAND p.post_approved = 0\n\t\t\t\t\t\t\t" . ($sort_order_sql[0] == 'u' ? 'AND u.user_id = p.poster_id' : '') . '
							' . ($topic_id ? 'AND p.topic_id = ' . $topic_id : '') . "\n\t\t\t\t\t\t\tAND t.topic_id = p.topic_id\n\t\t\t\t\t\t\tAND t.topic_first_post_id <> p.post_id\n\t\t\t\t\t\t\t{$limit_time_sql}\n\t\t\t\t\t\tORDER BY {$sort_order_sql}";
                    $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
                    $i = 0;
                    $post_ids = array();
                    while ($row = $db->sql_fetchrow($result)) {
                        $post_ids[] = $row['post_id'];
                        $row_num[$row['post_id']] = $i++;
                    }
                    $db->sql_freeresult($result);
                    if (sizeof($post_ids)) {
                        $sql = 'SELECT t.topic_id, t.topic_title, t.forum_id, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, u.username, u.username_clean, u.user_colour
							FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
							WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . '
								AND t.topic_id = p.topic_id
								AND u.user_id = p.poster_id
							ORDER BY ' . $sort_order_sql;
                        $result = $db->sql_query($sql);
                        $post_data = $rowset = array();
                        while ($row = $db->sql_fetchrow($result)) {
                            if ($row['forum_id']) {
                                $forum_names[] = $row['forum_id'];
                            }
                            $post_data[$row['post_id']] = $row;
                        }
                        $db->sql_freeresult($result);
                        foreach ($post_ids as $post_id) {
                            $rowset[] = $post_data[$post_id];
                        }
                        unset($post_data, $post_ids);
                    } else {
                        $rowset = array();
                    }
                } else {
                    $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_first_poster_name AS username, t.topic_first_poster_colour AS user_colour
						FROM ' . TOPICS_TABLE . " t\n\t\t\t\t\t\tWHERE forum_id IN (0, {$forum_list})\n\t\t\t\t\t\t\tAND topic_approved = 0\n\t\t\t\t\t\t\t{$limit_time_sql}\n\t\t\t\t\t\tORDER BY {$sort_order_sql}";
                    $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
                    $rowset = array();
                    while ($row = $db->sql_fetchrow($result)) {
                        if ($row['forum_id']) {
                            $forum_names[] = $row['forum_id'];
                        }
                        $rowset[] = $row;
                    }
                    $db->sql_freeresult($result);
                }
                if (sizeof($forum_names)) {
                    // Select the names for the forum_ids
                    $sql = 'SELECT forum_id, forum_name
						FROM ' . FORUMS_TABLE . '
						WHERE ' . $db->sql_in_set('forum_id', $forum_names);
                    $result = $db->sql_query($sql, 3600);
                    $forum_names = array();
                    while ($row = $db->sql_fetchrow($result)) {
                        $forum_names[$row['forum_id']] = $row['forum_name'];
                    }
                    $db->sql_freeresult($result);
                }
                foreach ($rowset as $row) {
                    $global_topic = $row['forum_id'] ? false : true;
                    if ($global_topic) {
                        $row['forum_id'] = $global_id;
                    }
                    if (empty($row['post_username'])) {
                        $row['post_username'] = $user->lang['GUEST'];
                    }
                    $template->assign_block_vars('postrow', array('U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']), 'U_VIEWFORUM' => !$global_topic ? append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $row['forum_id']) : '', 'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']) . ($mode == 'unapproved_posts' ? '#p' . $row['post_id'] : ''), 'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=queue&amp;start={$start}&amp;mode=approve_details&amp;f={$row['forum_id']}&amp;p={$row['post_id']}" . ($mode == 'unapproved_topics' ? "&amp;t={$row['topic_id']}" : '')), 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_ID' => $row['post_id'], 'FORUM_NAME' => !$global_topic ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'], 'POST_SUBJECT' => $row['post_subject'], 'TOPIC_TITLE' => $row['topic_title'], 'POST_TIME' => $user->format_date($row['post_time'])));
                }
                unset($rowset, $forum_names);
                // Now display the page
                $template->assign_vars(array('L_DISPLAY_ITEMS' => $mode == 'unapproved_posts' ? $user->lang['DISPLAY_POSTS'] : $user->lang['DISPLAY_TOPICS'], 'L_EXPLAIN' => $mode == 'unapproved_posts' ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS_EXPLAIN'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS_EXPLAIN'], 'L_TITLE' => $mode == 'unapproved_posts' ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS'], 'L_ONLY_TOPIC' => $topic_id ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '', 'S_FORUM_OPTIONS' => $forum_options, 'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')), 'S_TOPICS' => $mode == 'unapproved_posts' ? false : true, 'PAGINATION' => generate_pagination($this->u_action . "&amp;f={$forum_id}&amp;st={$sort_days}&amp;sk={$sort_key}&amp;sd={$sort_dir}", $total, $config['topics_per_page'], $start), 'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start), 'TOPIC_ID' => $topic_id, 'TOTAL' => $total == 1 ? $mode == 'unapproved_posts' ? $user->lang['VIEW_TOPIC_POST'] : $user->lang['VIEW_FORUM_TOPIC'] : sprintf($mode == 'unapproved_posts' ? $user->lang['VIEW_TOPIC_POSTS'] : $user->lang['VIEW_FORUM_TOPICS'], $total)));
                $this->tpl_name = 'mcp_queue';
                break;
        }
    }
示例#5
0
    function main($id, $mode)
    {
        global $auth, $db, $user, $template;
        global $config, $phpbb_root_path, $phpEx, $action;
        include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
        $forum_id = request_var('f', 0);
        $start = request_var('start', 0);
        $this->page_title = 'MCP_QUEUE';
        switch ($action) {
            case 'approve':
            case 'disapprove':
                include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                $post_id_list = request_var('post_id_list', array(0));
                if (!sizeof($post_id_list)) {
                    trigger_error('NO_POST_SELECTED');
                }
                if ($action == 'approve') {
                    approve_post($post_id_list, $mode);
                } else {
                    disapprove_post($post_id_list, $mode);
                }
                break;
        }
        switch ($mode) {
            case 'approve_details':
                $user->add_lang('posting');
                $post_id = request_var('p', 0);
                $topic_id = request_var('t', 0);
                if ($topic_id) {
                    $topic_info = get_topic_data(array($topic_id), 'm_approve');
                    if (isset($topic_info[$topic_id]['topic_first_post_id'])) {
                        $post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];
                    } else {
                        $topic_id = 0;
                    }
                }
                $post_info = get_post_data(array($post_id), 'm_approve');
                if (!sizeof($post_info)) {
                    trigger_error('NO_POST_SELECTED');
                }
                $post_info = $post_info[$post_id];
                if ($post_info['topic_first_post_id'] != $post_id && topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false)) {
                    $template->assign_vars(array('S_TOPIC_REVIEW' => true, 'TOPIC_TITLE' => $post_info['topic_title']));
                }
                // Set some vars
                if ($post_info['user_id'] == ANONYMOUS) {
                    $poster = $post_info['post_username'] ? $post_info['post_username'] : $user->lang['GUEST'];
                }
                $poster = $post_info['user_colour'] ? '<span style="color:#' . $post_info['user_colour'] . '">' . $post_info['username'] . '</span>' : $post_info['username'];
                // Process message, leave it uncensored
                $message = $post_info['post_text'];
                if ($post_info['bbcode_bitfield']) {
                    include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
                    $bbcode = new bbcode($post_info['bbcode_bitfield']);
                    $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
                }
                $message = smiley_text($message);
                $template->assign_vars(array('S_MCP_QUEUE' => true, 'S_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=queue&amp;p={$post_id}&amp;f={$forum_id}"), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => !$post_info['post_approved'], 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, 'U_EDIT' => $auth->acl_get('m_edit', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '', 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&amp;mode=user_notes&amp;u=' . $post_info['user_id']), 'U_MCP_WARN_USER' => $auth->acl_getf_global('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&amp;mode=warn_user&amp;u=' . $post_info['user_id']) : '', 'U_VIEW_PROFILE' => $post_info['user_id'] != ANONYMOUS ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=viewprofile&amp;u=' . $post_info['user_id']) : '', 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue' . ($topic_id ? '&amp;mode=unapproved_topics' : '&amp;mode=unapproved_posts')) . "&amp;start={$start}\">", '</a>'), 'REPORTED_IMG' => $user->img('icon_reported', $user->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $user->img('icon_unapproved', $user->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $user->img('btn_edit', $user->lang['EDIT_POST']), 'POSTER_NAME' => $poster, 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => @gethostbyaddr($post_info['poster_ip']), 'POST_ID' => $post_info['post_id']));
                $this->tpl_name = 'mcp_post';
                break;
            case 'unapproved_topics':
            case 'unapproved_posts':
                $topic_id = request_var('t', 0);
                $forum_info = array();
                if ($topic_id) {
                    $topic_info = get_topic_data(array($topic_id));
                    if (!sizeof($topic_info)) {
                        trigger_error($user->lang['TOPIC_NOT_EXIST']);
                    }
                    $topic_info = $topic_info[$topic_id];
                    $forum_id = $topic_info['forum_id'];
                }
                $forum_list_approve = get_forum_list('m_approve', false, true);
                if (!$forum_id) {
                    $forum_list = array();
                    foreach ($forum_list_approve as $row) {
                        $forum_list[] = $row['forum_id'];
                    }
                    if (!($forum_list = implode(', ', $forum_list))) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $sql = 'SELECT SUM(forum_topics) as sum_forum_topics
						FROM ' . FORUMS_TABLE . "\n\t\t\t\t\t\tWHERE forum_id IN (0, {$forum_list})";
                    $result = $db->sql_query($sql);
                    $forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics');
                    $db->sql_freeresult($result);
                    $global_id = $forum_list[0];
                } else {
                    $forum_info = get_forum_data(array($forum_id), 'm_approve');
                    if (!sizeof($forum_info)) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $forum_info = $forum_info[$forum_id];
                    $forum_list = $forum_id;
                    $global_id = $forum_id;
                }
                $forum_options = '<option value="0"' . ($forum_id == 0 ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
                foreach ($forum_list_approve as $row) {
                    $forum_options .= '<option value="' . $row['forum_id'] . '"' . ($forum_id == $row['forum_id'] ? ' selected="selected"' : '') . '>' . $row['forum_name'] . '</option>';
                }
                $sort_days = $total = 0;
                $sort_key = $sort_dir = '';
                $sort_by_sql = $sort_order_sql = array();
                mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
                $forum_topics = $total == -1 ? $forum_info['forum_topics'] : $total;
                $limit_time_sql = $sort_days ? 'AND t.topic_last_post_time >= ' . (time() - $sort_days * 86400) : '';
                $forum_names = array();
                if ($mode == 'unapproved_posts') {
                    $sql = 'SELECT p.post_id
						FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . ($sort_order_sql[0] == 'u' ? ', ' . USERS_TABLE . ' u' : '') . "\n\t\t\t\t\t\tWHERE p.forum_id IN (0, {$forum_list})\n\t\t\t\t\t\t\tAND p.post_approved = 0\n\t\t\t\t\t\t\t" . ($sort_order_sql[0] == 'u' ? 'AND u.user_id = p.poster_id' : '') . '
							' . ($topic_id ? 'AND p.topic_id = ' . $topic_id : '') . "\n\t\t\t\t\t\t\tAND t.topic_id = p.topic_id\n\t\t\t\t\t\t\tAND t.topic_first_post_id <> p.post_id\n\t\t\t\t\t\t\t{$limit_time_sql}\n\t\t\t\t\t\tORDER BY {$sort_order_sql}";
                    $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
                    $i = 0;
                    $post_ids = array();
                    while ($row = $db->sql_fetchrow($result)) {
                        $post_ids[] = $row['post_id'];
                        $row_num[$row['post_id']] = $i++;
                    }
                    $db->sql_freeresult($result);
                    if (sizeof($post_ids)) {
                        $sql = 'SELECT t.topic_id, t.topic_title, t.forum_id, p.post_id, p.post_username, p.poster_id, p.post_time, u.username
							FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . " u\n\t\t\t\t\t\t\tWHERE p.post_id IN (" . implode(', ', $post_ids) . ")\n\t\t\t\t\t\t\t\tAND t.topic_id = p.topic_id\n\t\t\t\t\t\t\t\tAND u.user_id = p.poster_id";
                        $result = $db->sql_query($sql);
                        $post_data = $rowset = array();
                        while ($row = $db->sql_fetchrow($result)) {
                            if ($row['forum_id']) {
                                $forum_names[] = $row['forum_id'];
                            }
                            $post_data[$row['post_id']] = $row;
                        }
                        $db->sql_freeresult($result);
                        foreach ($post_ids as $post_id) {
                            $rowset[] = $post_data[$post_id];
                        }
                        unset($post_data, $post_ids);
                    } else {
                        $rowset = array();
                    }
                } else {
                    $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_first_poster_name AS username
						FROM ' . TOPICS_TABLE . " t\n\t\t\t\t\t\tWHERE topic_approved = 0\n\t\t\t\t\t\t\tAND forum_id IN (0, {$forum_list})\n\t\t\t\t\t\t\t{$limit_time_sql}\n\t\t\t\t\t\tORDER BY {$sort_order_sql}";
                    $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
                    $rowset = array();
                    while ($row = $db->sql_fetchrow($result)) {
                        if ($row['forum_id']) {
                            $forum_names[] = $row['forum_id'];
                        }
                        $rowset[] = $row;
                    }
                    $db->sql_freeresult($result);
                }
                if (sizeof($forum_names)) {
                    // Select the names for the forum_ids
                    $sql = 'SELECT forum_id, forum_name
						FROM ' . FORUMS_TABLE . '
						WHERE forum_id IN (' . implode(',', $forum_names) . ')';
                    $result = $db->sql_query($sql, 3600);
                    $forum_names = array();
                    while ($row = $db->sql_fetchrow($result)) {
                        $forum_names[$row['forum_id']] = $row['forum_name'];
                    }
                    $db->sql_freeresult($result);
                }
                foreach ($rowset as $row) {
                    if ($row['poster_id'] == ANONYMOUS) {
                        $poster = !empty($row['post_username']) ? $row['post_username'] : $user->lang['GUEST'];
                    } else {
                        $poster = $row['username'];
                    }
                    $global_topic = $row['forum_id'] ? false : true;
                    if ($global_topic) {
                        $row['forum_id'] = $global_id;
                    }
                    $template->assign_block_vars('postrow', array('U_VIEWFORUM' => !$global_topic ? append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $row['forum_id']) : '', 'U_VIEWTOPIC' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']) . ($mode == 'unapproved_posts' ? '#p' . $row['post_id'] : ''), 'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=queue&amp;start={$start}&amp;mode=approve_details&amp;f={$row['forum_id']}&amp;p={$row['post_id']}" . ($mode == 'unapproved_topics' ? "&amp;t={$row['topic_id']}" : '')), 'U_VIEWPROFILE' => $row['poster_id'] != ANONYMOUS ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=viewprofile&amp;u=' . $row['poster_id']) : '', 'POST_ID' => $row['post_id'], 'FORUM_NAME' => !$global_topic ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'], 'TOPIC_TITLE' => $row['topic_title'], 'POSTER' => $poster, 'POST_TIME' => $user->format_date($row['post_time'])));
                }
                unset($rowset, $forum_names);
                // Now display the page
                $template->assign_vars(array('L_DISPLAY_ITEMS' => $mode == 'unapproved_posts' ? $user->lang['DISPLAY_POSTS'] : $user->lang['DISPLAY_TOPICS'], 'L_EXPLAIN' => $mode == 'unapproved_posts' ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS_EXPLAIN'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS_EXPLAIN'], 'L_TITLE' => $mode == 'unapproved_posts' ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS'], 'L_ONLY_TOPIC' => $topic_id ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '', 'S_FORUM_OPTIONS' => $forum_options, 'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')), 'PAGINATION' => generate_pagination($this->u_action . "&amp;f={$forum_id}", $total, $config['topics_per_page'], $start), 'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start), 'TOPIC_ID' => $topic_id, 'TOTAL' => $total));
                $this->tpl_name = 'mcp_queue';
                break;
        }
    }
示例#6
0
$template->assign_block_vars('switch_not_privmsg', array());
//
// Output the data to the template
//
$template->assign_vars(array('USERNAME' => $username, 'SUBJECT' => $subject, 'MESSAGE' => $message, 'HTML_STATUS' => $html_status, 'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.{$phpEx}?mode=bbcode") . '" target="_phpbbcode">', '</a>'), 'SMILIES_STATUS' => $smilies_status, 'L_SUBJECT' => $lang['Subject'], 'L_MESSAGE_BODY' => $lang['Message_body'], 'L_OPTIONS' => $lang['Options'], 'L_PREVIEW' => $lang['Preview'], 'L_SPELLCHECK' => $lang['Spellcheck'], 'L_SUBMIT' => $lang['Submit'], 'L_CANCEL' => $lang['Cancel'], 'L_CONFIRM_DELETE' => $lang['Confirm_delete'], 'L_DISABLE_HTML' => $lang['Disable_HTML_post'], 'L_DISABLE_BBCODE' => $lang['Disable_BBCode_post'], 'L_DISABLE_SMILIES' => $lang['Disable_Smilies_post'], 'L_ATTACH_SIGNATURE' => $lang['Attach_signature'], 'L_NOTIFY_ON_REPLY' => $lang['Notify'], 'L_DELETE_POST' => $lang['Delete_post'], 'L_BBCODE_B_HELP' => $lang['bbcode_b_help'], 'L_BBCODE_I_HELP' => $lang['bbcode_i_help'], 'L_BBCODE_U_HELP' => $lang['bbcode_u_help'], 'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'], 'L_BBCODE_C_HELP' => $lang['bbcode_c_help'], 'L_BBCODE_L_HELP' => $lang['bbcode_l_help'], 'L_BBCODE_O_HELP' => $lang['bbcode_o_help'], 'L_BBCODE_P_HELP' => $lang['bbcode_p_help'], 'L_BBCODE_W_HELP' => $lang['bbcode_w_help'], 'L_BBCODE_A_HELP' => $lang['bbcode_a_help'], 'L_BBCODE_S_HELP' => $lang['bbcode_s_help'], 'L_BBCODE_F_HELP' => $lang['bbcode_f_help'], 'L_EMPTY_MESSAGE' => $lang['Empty_message'], 'L_FONT_COLOR' => $lang['Font_color'], 'L_COLOR_DEFAULT' => $lang['color_default'], 'L_COLOR_DARK_RED' => $lang['color_dark_red'], 'L_COLOR_RED' => $lang['color_red'], 'L_COLOR_ORANGE' => $lang['color_orange'], 'L_COLOR_BROWN' => $lang['color_brown'], 'L_COLOR_YELLOW' => $lang['color_yellow'], 'L_COLOR_GREEN' => $lang['color_green'], 'L_COLOR_OLIVE' => $lang['color_olive'], 'L_COLOR_CYAN' => $lang['color_cyan'], 'L_COLOR_BLUE' => $lang['color_blue'], 'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'], 'L_COLOR_INDIGO' => $lang['color_indigo'], 'L_COLOR_VIOLET' => $lang['color_violet'], 'L_COLOR_WHITE' => $lang['color_white'], 'L_COLOR_BLACK' => $lang['color_black'], 'L_FONT_SIZE' => $lang['Font_size'], 'L_FONT_TINY' => $lang['font_tiny'], 'L_FONT_SMALL' => $lang['font_small'], 'L_FONT_NORMAL' => $lang['font_normal'], 'L_FONT_LARGE' => $lang['font_large'], 'L_FONT_HUGE' => $lang['font_huge'], 'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'], 'L_STYLES_TIP' => $lang['Styles_tip'], 'U_VIEWTOPIC' => $mode == 'reply' ? append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . "={$topic_id}&amp;postorder=desc") : '', 'U_REVIEW_TOPIC' => $mode == 'reply' ? append_sid("posting.{$phpEx}?mode=topicreview&amp;" . POST_TOPIC_URL . "={$topic_id}") : '', 'S_HTML_CHECKED' => !$html_on ? 'checked="checked"' : '', 'S_BBCODE_CHECKED' => !$bbcode_on ? 'checked="checked"' : '', 'S_SMILIES_CHECKED' => !$smilies_on ? 'checked="checked"' : '', 'S_SIGNATURE_CHECKED' => $attach_sig ? 'checked="checked"' : '', 'S_NOTIFY_CHECKED' => $notify_user ? 'checked="checked"' : '', 'S_TYPE_TOGGLE' => $topic_type_toggle, 'S_TOPIC_ID' => $topic_id, 'S_POST_ACTION' => append_sid("posting.{$phpEx}"), 'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields));
//
// Poll entry switch/output
//
if (($mode == 'newtopic' || $mode == 'editpost' && $post_data['edit_poll']) && $is_auth['auth_pollcreate']) {
    $template->assign_vars(array('L_ADD_A_POLL' => $lang['Add_poll'], 'L_ADD_POLL_EXPLAIN' => $lang['Add_poll_explain'], 'L_POLL_QUESTION' => $lang['Poll_question'], 'L_POLL_OPTION' => $lang['Poll_option'], 'L_ADD_OPTION' => $lang['Add_option'], 'L_UPDATE_OPTION' => $lang['Update'], 'L_DELETE_OPTION' => $lang['Delete'], 'L_POLL_LENGTH' => $lang['Poll_for'], 'L_DAYS' => $lang['Days'], 'L_POLL_LENGTH_EXPLAIN' => $lang['Poll_for_explain'], 'L_POLL_DELETE' => $lang['Delete_poll'], 'POLL_TITLE' => $poll_title, 'POLL_LENGTH' => $poll_length));
    if ($mode == 'editpost' && $post_data['edit_poll'] && $post_data['has_poll']) {
        $template->assign_block_vars('switch_poll_delete_toggle', array());
    }
    if (!empty($poll_options)) {
        while (list($option_id, $option_text) = each($poll_options)) {
            $template->assign_block_vars('poll_option_rows', array('POLL_OPTION' => str_replace('"', '&quot;', $option_text), 'S_POLL_OPTION_NUM' => $option_id));
        }
    }
    $template->assign_var_from_handle('POLLBOX', 'pollbody');
}
//
// Topic review
//
if ($mode == 'reply' && $is_auth['auth_read']) {
    require $phpbb_root_path . 'includes/topic_review.' . $phpEx;
    topic_review($topic_id, true);
    $template->assign_block_vars('switch_inline_mode', array());
    $template->assign_var_from_handle('TOPIC_REVIEW_BOX', 'reviewbody');
}
$template->pparse('body');
include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
示例#7
0
    public function main($id, $mode)
    {
        global $auth, $db, $user, $template, $cache, $request;
        global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container;
        global $phpbb_dispatcher;
        include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
        $forum_id = $request->variable('f', 0);
        $start = $request->variable('start', 0);
        $this->page_title = 'MCP_QUEUE';
        switch ($action) {
            case 'approve':
            case 'restore':
                include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                $post_id_list = $request->variable('post_id_list', array(0));
                $topic_id_list = $request->variable('topic_id_list', array(0));
                if (!empty($post_id_list)) {
                    self::approve_posts($action, $post_id_list, 'queue', $mode);
                } else {
                    if (!empty($topic_id_list)) {
                        self::approve_topics($action, $topic_id_list, 'queue', $mode);
                    } else {
                        trigger_error('NO_POST_SELECTED');
                    }
                }
                break;
            case 'delete':
                $post_id_list = $request->variable('post_id_list', array(0));
                $topic_id_list = $request->variable('topic_id_list', array(0));
                if (!empty($post_id_list)) {
                    if (!function_exists('mcp_delete_post')) {
                        global $phpbb_root_path, $phpEx;
                        include $phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx;
                    }
                    mcp_delete_post($post_id_list, false, '', $action);
                } else {
                    if (!empty($topic_id_list)) {
                        if (!function_exists('mcp_delete_topic')) {
                            global $phpbb_root_path, $phpEx;
                            include $phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx;
                        }
                        mcp_delete_topic($topic_id_list, false, '', $action);
                    } else {
                        trigger_error('NO_POST_SELECTED');
                    }
                }
                break;
            case 'disapprove':
                $post_id_list = $request->variable('post_id_list', array(0));
                $topic_id_list = $request->variable('topic_id_list', array(0));
                if (!empty($topic_id_list) && $mode == 'deleted_topics') {
                    if (!function_exists('mcp_delete_topics')) {
                        global $phpbb_root_path, $phpEx;
                        include $phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx;
                    }
                    mcp_delete_topic($topic_id_list, false, '', 'disapprove');
                    return;
                }
                if (!class_exists('messenger')) {
                    include $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                }
                if (!empty($topic_id_list)) {
                    $post_visibility = $mode == 'deleted_topics' ? ITEM_DELETED : array(ITEM_UNAPPROVED, ITEM_REAPPROVE);
                    $sql = 'SELECT post_id
						FROM ' . POSTS_TABLE . '
						WHERE ' . $db->sql_in_set('post_visibility', $post_visibility) . '
							AND ' . $db->sql_in_set('topic_id', $topic_id_list);
                    $result = $db->sql_query($sql);
                    $post_id_list = array();
                    while ($row = $db->sql_fetchrow($result)) {
                        $post_id_list[] = (int) $row['post_id'];
                    }
                    $db->sql_freeresult($result);
                }
                if (!empty($post_id_list)) {
                    self::disapprove_posts($post_id_list, 'queue', $mode);
                } else {
                    trigger_error('NO_POST_SELECTED');
                }
                break;
        }
        switch ($mode) {
            case 'approve_details':
                $this->tpl_name = 'mcp_post';
                $user->add_lang(array('posting', 'viewtopic'));
                $post_id = $request->variable('p', 0);
                $topic_id = $request->variable('t', 0);
                /* @var $phpbb_notifications \phpbb\notification\manager */
                $phpbb_notifications = $phpbb_container->get('notification_manager');
                if ($topic_id) {
                    $topic_info = phpbb_get_topic_data(array($topic_id), 'm_approve');
                    if (isset($topic_info[$topic_id]['topic_first_post_id'])) {
                        $post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];
                        $phpbb_notifications->mark_notifications('topic_in_queue', $topic_id, $user->data['user_id']);
                    } else {
                        $topic_id = 0;
                    }
                }
                $phpbb_notifications->mark_notifications('post_in_queue', $post_id, $user->data['user_id']);
                $post_info = phpbb_get_post_data(array($post_id), 'm_approve', true);
                if (!sizeof($post_info)) {
                    trigger_error('NO_POST_SELECTED');
                }
                $post_info = $post_info[$post_id];
                if ($post_info['topic_first_post_id'] != $post_id && topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false)) {
                    $template->assign_vars(array('S_TOPIC_REVIEW' => true, 'S_BBCODE_ALLOWED' => $post_info['enable_bbcode'], 'TOPIC_TITLE' => $post_info['topic_title']));
                }
                $extensions = $attachments = $topic_tracking_info = array();
                // Get topic tracking info
                if ($config['load_db_lastread']) {
                    $tmp_topic_data = array($post_info['topic_id'] => $post_info);
                    $topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time']));
                    unset($tmp_topic_data);
                } else {
                    $topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
                }
                $post_unread = isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']] ? true : false;
                // Process message, leave it uncensored
                $parse_flags = ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
                $message = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], $parse_flags, false);
                if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) {
                    $extensions = $cache->obtain_attach_extensions($post_info['forum_id']);
                    $sql = 'SELECT *
						FROM ' . ATTACHMENTS_TABLE . '
						WHERE post_msg_id = ' . $post_id . '
							AND in_message = 0
						ORDER BY filetime DESC, post_msg_id ASC';
                    $result = $db->sql_query($sql);
                    while ($row = $db->sql_fetchrow($result)) {
                        $attachments[] = $row;
                    }
                    $db->sql_freeresult($result);
                    if (sizeof($attachments)) {
                        $update_count = array();
                        parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
                    }
                    // Display not already displayed Attachments for this post, we already parsed them. ;)
                    if (!empty($attachments)) {
                        $template->assign_var('S_HAS_ATTACHMENTS', true);
                        foreach ($attachments as $attachment) {
                            $template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
                        }
                    }
                }
                // Deleting information
                if ($post_info['post_visibility'] == ITEM_DELETED && $post_info['post_delete_user']) {
                    // User having deleted the post also being the post author?
                    if (!$post_info['post_delete_user'] || $post_info['post_delete_user'] == $post_info['poster_id']) {
                        $display_username = get_username_string('full', $post_info['poster_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']);
                    } else {
                        $sql = 'SELECT u.user_id, u.username, u.user_colour
							FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
							WHERE p.post_id =  ' . $post_info['post_id'] . '
								AND p.post_delete_user = u.user_id';
                        $result = $db->sql_query($sql);
                        $post_delete_userinfo = $db->sql_fetchrow($result);
                        $db->sql_freeresult($result);
                        $display_username = get_username_string('full', $post_info['post_delete_user'], $post_delete_userinfo['username'], $post_delete_userinfo['user_colour']);
                    }
                    $l_deleted_by = $user->lang('DELETED_INFORMATION', $display_username, $user->format_date($post_info['post_delete_time'], false, true));
                } else {
                    $l_deleted_by = '';
                }
                $post_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&amp;p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
                $topic_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']);
                $template->assign_vars(array('S_MCP_QUEUE' => true, 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=queue&amp;p={$post_id}&amp;f={$forum_id}"), 'S_CAN_DELETE_POST' => $auth->acl_get('m_delete', $post_info['forum_id']), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => $post_info['post_visibility'] == ITEM_UNAPPROVED || $post_info['post_visibility'] == ITEM_REAPPROVE, 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, 'S_POST_DELETED' => $post_info['post_visibility'] == ITEM_DELETED, 'DELETED_MESSAGE' => $l_deleted_by, 'DELETE_REASON' => $post_info['post_delete_reason'], 'U_EDIT' => $auth->acl_get('m_edit', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '', 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&amp;mode=user_notes&amp;u=' . $post_info['user_id']), 'U_MCP_WARN_USER' => $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&amp;mode=warn_user&amp;u=' . $post_info['user_id']) : '', 'U_VIEW_POST' => $post_url, 'U_VIEW_TOPIC' => $topic_url, 'MINI_POST_IMG' => $post_unread ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue' . ($topic_id ? '&amp;mode=unapproved_topics' : '&amp;mode=unapproved_posts')) . '&amp;start=' . $start . '">', '</a>'), 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'), 'RETURN_TOPIC_SIMPLE' => sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '<a href="' . $topic_url . '">', '</a>'), 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), 'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => $auth->acl_get('m_info', $post_info['forum_id']) && $request->variable('lookup', '') ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], 'S_FIRST_POST' => $post_info['topic_first_post_id'] == $post_id, 'U_LOOKUP_IP' => $auth->acl_get('m_info', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id . '&amp;lookup=' . $post_info['poster_ip']) . '#ip' : ''));
                break;
            case 'unapproved_topics':
            case 'unapproved_posts':
            case 'deleted_topics':
            case 'deleted_posts':
                $m_perm = 'm_approve';
                $is_topics = $mode == 'unapproved_topics' || $mode == 'deleted_topics' ? true : false;
                $is_restore = $mode == 'deleted_posts' || $mode == 'deleted_topics' ? true : false;
                $visibility_const = !$is_restore ? array(ITEM_UNAPPROVED, ITEM_REAPPROVE) : ITEM_DELETED;
                $user->add_lang(array('viewtopic', 'viewforum'));
                $topic_id = $request->variable('t', 0);
                $forum_info = array();
                /* @var $pagination \phpbb\pagination */
                $pagination = $phpbb_container->get('pagination');
                if ($topic_id) {
                    $topic_info = phpbb_get_topic_data(array($topic_id));
                    if (!sizeof($topic_info)) {
                        trigger_error('TOPIC_NOT_EXIST');
                    }
                    $topic_info = $topic_info[$topic_id];
                    $forum_id = $topic_info['forum_id'];
                }
                $forum_list_approve = get_forum_list($m_perm, false, true);
                $forum_list_read = array_flip(get_forum_list('f_read', true, true));
                // Flipped so we can isset() the forum IDs
                // Remove forums we cannot read
                foreach ($forum_list_approve as $k => $forum_data) {
                    if (!isset($forum_list_read[$forum_data['forum_id']])) {
                        unset($forum_list_approve[$k]);
                    }
                }
                unset($forum_list_read);
                if (!$forum_id) {
                    $forum_list = array();
                    foreach ($forum_list_approve as $row) {
                        $forum_list[] = $row['forum_id'];
                    }
                    if (!sizeof($forum_list)) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $sql = 'SELECT SUM(forum_topics_approved) as sum_forum_topics
						FROM ' . FORUMS_TABLE . '
						WHERE ' . $db->sql_in_set('forum_id', $forum_list);
                    $result = $db->sql_query($sql);
                    $forum_info['forum_topics_approved'] = (int) $db->sql_fetchfield('sum_forum_topics');
                    $db->sql_freeresult($result);
                } else {
                    $forum_info = phpbb_get_forum_data(array($forum_id), $m_perm);
                    if (!sizeof($forum_info)) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $forum_info = $forum_info[$forum_id];
                    $forum_list = $forum_id;
                }
                $forum_options = '<option value="0"' . ($forum_id == 0 ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
                foreach ($forum_list_approve as $row) {
                    $forum_options .= '<option value="' . $row['forum_id'] . '"' . ($forum_id == $row['forum_id'] ? ' selected="selected"' : '') . '>' . str_repeat('&nbsp; &nbsp;', $row['padding']) . truncate_string($row['forum_name'], 30, 255, false, $user->lang['ELLIPSIS']) . '</option>';
                }
                $sort_days = $total = 0;
                $sort_key = $sort_dir = '';
                $sort_by_sql = $sort_order_sql = array();
                phpbb_mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
                $forum_topics = $total == -1 ? $forum_info['forum_topics_approved'] : $total;
                $limit_time_sql = $sort_days ? 'AND t.topic_last_post_time >= ' . (time() - $sort_days * 86400) : '';
                $forum_names = array();
                if (!$is_topics) {
                    $sql = 'SELECT p.post_id
						FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . ($sort_order_sql[0] == 'u' ? ', ' . USERS_TABLE . ' u' : '') . '
						WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . '
							AND ' . $db->sql_in_set('p.post_visibility', $visibility_const) . '
							' . ($sort_order_sql[0] == 'u' ? 'AND u.user_id = p.poster_id' : '') . '
							' . ($topic_id ? 'AND p.topic_id = ' . $topic_id : '') . "\n\t\t\t\t\t\t\tAND t.topic_id = p.topic_id\n\t\t\t\t\t\t\tAND (t.topic_visibility <> p.post_visibility\n\t\t\t\t\t\t\t\tOR t.topic_delete_user = 0)\n\t\t\t\t\t\t\t{$limit_time_sql}\n\t\t\t\t\t\tORDER BY {$sort_order_sql}";
                    /**
                     * Alter sql query to get posts in queue to be accepted
                     *
                     * @event core.mcp_queue_get_posts_query_before
                     * @var	string	sql						Associative array with the query to be executed
                     * @var	array	forum_list				List of forums that contain the posts
                     * @var	int		visibility_const		Integer with one of the possible ITEM_* constant values
                     * @var	int		topic_id				If topic_id not equal to 0, the topic id to filter the posts to display
                     * @var	string	limit_time_sql			String with the SQL code to limit the time interval of the post (Note: May be empty string)
                     * @var	string	sort_order_sql			String with the ORDER BY SQL code used in this query
                     * @since 3.1.0-RC3
                     */
                    $vars = array('sql', 'forum_list', 'visibility_const', 'topic_id', 'limit_time_sql', 'sort_order_sql');
                    extract($phpbb_dispatcher->trigger_event('core.mcp_queue_get_posts_query_before', compact($vars)));
                    $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
                    $i = 0;
                    $post_ids = array();
                    while ($row = $db->sql_fetchrow($result)) {
                        $post_ids[] = $row['post_id'];
                        $row_num[$row['post_id']] = $i++;
                    }
                    $db->sql_freeresult($result);
                    if (sizeof($post_ids)) {
                        $sql = 'SELECT t.topic_id, t.topic_title, t.forum_id, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, p.post_attachment, u.username, u.username_clean, u.user_colour
							FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
							WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . '
								AND t.topic_id = p.topic_id
								AND u.user_id = p.poster_id
							ORDER BY ' . $sort_order_sql;
                        $result = $db->sql_query($sql);
                        $post_data = $rowset = array();
                        while ($row = $db->sql_fetchrow($result)) {
                            $forum_names[] = $row['forum_id'];
                            $post_data[$row['post_id']] = $row;
                        }
                        $db->sql_freeresult($result);
                        foreach ($post_ids as $post_id) {
                            $rowset[] = $post_data[$post_id];
                        }
                        unset($post_data, $post_ids);
                    } else {
                        $rowset = array();
                    }
                } else {
                    $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_attachment AS post_attachment, t.topic_first_poster_name AS username, t.topic_first_poster_colour AS user_colour
						FROM ' . TOPICS_TABLE . ' t
						WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '
							AND  ' . $db->sql_in_set('topic_visibility', $visibility_const) . "\n\t\t\t\t\t\t\tAND topic_delete_user <> 0\n\t\t\t\t\t\t\t{$limit_time_sql}\n\t\t\t\t\t\tORDER BY {$sort_order_sql}";
                    /**
                     * Alter sql query to get information on all topics in the list of forums provided.
                     *
                     * @event core.mcp_queue_get_posts_for_topics_query_before
                     * @var	string	sql						String with the query to be executed
                     * @var	array	forum_list				List of forums that contain the posts
                     * @var	int		visibility_const		Integer with one of the possible ITEM_* constant values
                     * @var	int		topic_id				topic_id in the page request
                     * @var	string	limit_time_sql			String with the SQL code to limit the time interval of the post (Note: May be empty string)
                     * @var	string	sort_order_sql			String with the ORDER BY SQL code used in this query
                     * @since 3.1.0-RC3
                     */
                    $vars = array('sql', 'forum_list', 'visibility_const', 'topic_id', 'limit_time_sql', 'sort_order_sql');
                    extract($phpbb_dispatcher->trigger_event('core.mcp_queue_get_posts_for_topics_query_before', compact($vars)));
                    $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
                    $rowset = array();
                    while ($row = $db->sql_fetchrow($result)) {
                        $forum_names[] = $row['forum_id'];
                        $rowset[] = $row;
                    }
                    $db->sql_freeresult($result);
                }
                if (sizeof($forum_names)) {
                    // Select the names for the forum_ids
                    $sql = 'SELECT forum_id, forum_name
						FROM ' . FORUMS_TABLE . '
						WHERE ' . $db->sql_in_set('forum_id', $forum_names);
                    $result = $db->sql_query($sql, 3600);
                    $forum_names = array();
                    while ($row = $db->sql_fetchrow($result)) {
                        $forum_names[$row['forum_id']] = $row['forum_name'];
                    }
                    $db->sql_freeresult($result);
                }
                foreach ($rowset as $row) {
                    if (empty($row['post_username'])) {
                        $row['post_username'] = $row['username'] ?: $user->lang['GUEST'];
                    }
                    $template->assign_block_vars('postrow', array('U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']), 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $row['forum_id']), 'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']) . ($mode == 'unapproved_posts' ? '#p' . $row['post_id'] : ''), 'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=queue&amp;start={$start}&amp;mode=approve_details&amp;f={$row['forum_id']}&amp;p={$row['post_id']}" . ($mode == 'unapproved_topics' ? "&amp;t={$row['topic_id']}" : '')), 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_ID' => $row['post_id'], 'TOPIC_ID' => $row['topic_id'], 'FORUM_NAME' => $forum_names[$row['forum_id']], 'POST_SUBJECT' => $row['post_subject'] != '' ? $row['post_subject'] : $user->lang['NO_SUBJECT'], 'TOPIC_TITLE' => $row['topic_title'], 'POST_TIME' => $user->format_date($row['post_time']), 'ATTACH_ICON_IMG' => $auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment'] ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : ''));
                }
                unset($rowset, $forum_names);
                $base_url = $this->u_action . "&amp;f={$forum_id}&amp;st={$sort_days}&amp;sk={$sort_key}&amp;sd={$sort_dir}";
                $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
                // Now display the page
                $template->assign_vars(array('L_DISPLAY_ITEMS' => !$is_topics ? $user->lang['DISPLAY_POSTS'] : $user->lang['DISPLAY_TOPICS'], 'L_EXPLAIN' => $user->lang['MCP_QUEUE_' . strtoupper($mode) . '_EXPLAIN'], 'L_TITLE' => $user->lang['MCP_QUEUE_' . strtoupper($mode)], 'L_ONLY_TOPIC' => $topic_id ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '', 'S_FORUM_OPTIONS' => $forum_options, 'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')), 'S_TOPICS' => $is_topics, 'S_RESTORE' => $is_restore, 'TOPIC_ID' => $topic_id, 'TOTAL' => $user->lang(!$is_topics ? 'VIEW_TOPIC_POSTS' : 'VIEW_FORUM_TOPICS', (int) $total)));
                $this->tpl_name = 'mcp_queue';
                break;
        }
    }
示例#8
0
		'L_REG_LENGTH' => $lang['Reg_for'],
		'L_REG_LENGTH_EXPLAIN' => $lang['Reg_for_explain'],
		'L_REG_DAYS' => $lang['Days']
		)
	);

	$template->assign_var_from_handle('REGBOX', 'regbody');
}
// Event Registration - END

// Topic review
if($mode == 'reply' && $is_auth['auth_read'])
{
	require(IP_ROOT_PATH . 'includes/topic_review.' . PHP_EXT);
	topic_review($forum_id, $topic_id, true);
	$template->assign_block_vars('switch_inline_mode', array());
	$template->assign_var_from_handle('TOPIC_REVIEW_BOX', 'reviewbody');
}

// BBCBMG - BEGIN
include(IP_ROOT_PATH . 'includes/bbcb_mg.' . PHP_EXT);
$template->assign_var_from_handle('BBCB_MG', 'bbcb_mg');
// BBCBMG - END
// BBCBMG SMILEYS - BEGIN
generate_smilies('inline');
include(IP_ROOT_PATH . 'includes/bbcb_smileys_mg.' . PHP_EXT);
$template->assign_var_from_handle('BBCB_SMILEYS_MG', 'bbcb_smileys_mg');
// BBCBMG SMILEYS - END

page_footer();
    function mcp_queue($id, $mode, $url)
    {
        global $_CLASS, $site_file_root, $config;
        $forum_id = request_var('f', 0);
        $start = request_var('start', 0);
        switch ($mode) {
            case 'approve':
            case 'disapprove':
                require_once $site_file_root . 'includes/forums/functions_messenger.php';
                require_once $site_file_root . 'includes/forums/functions_posting.php';
                $post_id_list = request_var('post_id_list', array(0));
                if (!sizeof($post_id_list)) {
                    trigger_error('NO_POST_SELECTED');
                }
                if ($mode == 'approve') {
                    approve_post($post_id_list);
                } else {
                    disapprove_post($post_id_list);
                }
                break;
            case 'approve_details':
                $_CLASS['core_user']->add_lang('posting');
                require_once $site_file_root . 'includes/forums/functions_posting.php';
                $post_id = request_var('p', 0);
                $topic_id = request_var('t', 0);
                if ($topic_id) {
                    $topic_info = get_topic_data(array($topic_id), 'm_approve');
                    $post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];
                }
                $post_info = get_post_data(array($post_id), 'm_approve');
                if (!sizeof($post_info)) {
                    trigger_error('NO_POST_SELECTED');
                }
                $post_info = $post_info[$post_id];
                if ($post_info['topic_first_post_id'] != $post_id && topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false)) {
                    $_CLASS['core_template']->assign_array(array('S_TOPIC_REVIEW' => true, 'TOPIC_TITLE' => $post_info['topic_title']));
                }
                // Set some vars
                $poster = $post_info['user_colour'] ? '<span style="color:#' . $post_info['user_colour'] . '">' . $post_info['username'] . '</span>' : $post_info['username'];
                // Process message, leave it uncensored
                $message = $post_info['post_text'];
                if ($post_info['bbcode_bitfield']) {
                    require_once $site_file_root . 'includes/forums/bbcode.php';
                    $bbcode = new bbcode($post_info['bbcode_bitfield']);
                    $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
                }
                $message = smiley_text($message);
                $_CLASS['core_template']->assign_array(array('S_MCP_QUEUE' => true, 'S_APPROVE_ACTION' => generate_link("Forums&amp;file=mcp&amp;i=queue&amp;p={$post_id}&amp;f={$forum_id}"), 'S_CAN_VIEWIP' => $_CLASS['auth']->acl_get('m_ip', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => !$post_info['post_approved'], 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_WARNINGS' => $post_info['user_warnings'] ? true : false, 'U_VIEW_PROFILE' => generate_link('Members_List&amp;mode=viewprofile&amp;u=' . $post_info['user_id']), 'U_MCP_USERNOTES' => generate_link('Forums&amp;file=mcp&amp;i=notes&amp;mode=user_notes&amp;u=' . $post_info['user_id']), 'U_MCP_WARNINGS' => generate_link('Forums&amp;file=mcp&amp;i=warnings&amp;mode=view_user&amp;u=' . $post_info['user_id']), 'U_EDIT' => $_CLASS['auth']->acl_get('m_edit', $post_info['forum_id']) ? generate_link("Forums&amp;file=posting&amp;mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '', 'REPORTED_IMG' => $_CLASS['core_user']->img('icon_reported', $_CLASS['core_user']->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $_CLASS['core_user']->img('icon_unapproved', $_CLASS['core_user']->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $_CLASS['core_user']->img('btn_edit', $_CLASS['core_user']->lang['EDIT_POST']), 'POSTER_NAME' => $poster, 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $_CLASS['core_user']->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => @gethostbyaddr($post_info['poster_ip']), 'POST_ID' => $post_info['post_id']));
                $this->display($_CLASS['core_user']->lang['MCP_QUEUE'], 'mcp_post.html');
                break;
            case 'unapproved_topics':
            case 'unapproved_posts':
                $forum_info = array();
                $forum_list_approve = get_forum_list('m_approve', false, true);
                if (!$forum_id) {
                    $forum_list = array();
                    foreach ($forum_list_approve as $row) {
                        $forum_list[] = $row['forum_id'];
                    }
                    if (!($forum_list = implode(', ', $forum_list))) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $sql = 'SELECT SUM(forum_topics) as sum_forum_topics 
						FROM ' . FORUMS_FORUMS_TABLE . "\n\t\t\t\t\t\tWHERE forum_id IN ({$forum_list})";
                    $result = $_CLASS['core_db']->query($sql);
                    $row = $_CLASS['core_db']->fetch_row_assoc($result);
                    $_CLASS['core_db']->free_result($result);
                    $forum_info['forum_topics'] = (int) $row['sum_forum_topics'];
                } else {
                    $forum_info = get_forum_data(array($forum_id), 'm_approve');
                    if (!sizeof($forum_info)) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $forum_info = $forum_info[$forum_id];
                    $forum_list = $forum_id;
                }
                $forum_options = '<option value="0"' . ($forum_id == 0 ? ' selected="selected"' : '') . '>' . $_CLASS['core_user']->lang['ALL_FORUMS'] . '</option>';
                foreach ($forum_list_approve as $row) {
                    $forum_options .= '<option value="' . $row['forum_id'] . '"' . ($forum_id == $row['forum_id'] ? ' selected="selected"' : '') . '>' . $row['forum_name'] . '</option>';
                }
                mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id);
                $forum_topics = $total == -1 ? $forum_info['forum_topics'] : $total;
                $limit_time_sql = $sort_days ? 'AND t.topic_last_post_time >= ' . (time() - $sort_days * 86400) : '';
                if ($mode == 'unapproved_posts') {
                    $sql = 'SELECT p.post_id
						FROM ' . FORUMS_POSTS_TABLE . ' p, ' . FORUMS_TOPICS_TABLE . ' t' . ($sort_order_sql[0] == 'u' ? ', ' . USERS_TABLE . ' u' : '') . "\n\t\t\t\t\t\tWHERE p.forum_id IN ({$forum_list})\n\t\t\t\t\t\t\tAND p.post_approved = 0\n\t\t\t\t\t\t\t" . ($sort_order_sql[0] == 'u' ? 'AND u.user_id = p.poster_id' : '') . "\n\t\t\t\t\t\t\tAND t.topic_id = p.topic_id\n\t\t\t\t\t\t\tAND t.topic_first_post_id <> p.post_id\n\t\t\t\t\t\tORDER BY {$sort_order_sql}";
                    $result = $_CLASS['core_db']->query_limit($sql, $config['topics_per_page'], $start);
                    $i = 0;
                    $post_ids = array();
                    while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
                        $post_ids[] = $row['post_id'];
                        $row_num[$row['post_id']] = $i++;
                    }
                    if (sizeof($post_ids)) {
                        $sql = 'SELECT f.forum_id, f.forum_name, t.topic_id, t.topic_title, p.post_id, p.post_username, p.poster_id, p.post_time, u.username
							FROM ' . FORUMS_POSTS_TABLE . ' p, ' . FORUMS_FORUMS_TABLE . ' f, ' . FORUMS_TOPICS_TABLE . ' t, ' . USERS_TABLE . " u\n\t\t\t\t\t\t\tWHERE p.post_id IN (" . implode(', ', $post_ids) . ")\n\t\t\t\t\t\t\t\tAND t.topic_id = p.topic_id\n\t\t\t\t\t\t\t\tAND f.forum_id = p.forum_id\n\t\t\t\t\t\t\t\tAND u.user_id = p.poster_id";
                        $result = $_CLASS['core_db']->query($sql);
                        $post_data = $rowset = array();
                        while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
                            $post_data[$row['post_id']] = $row;
                        }
                        $_CLASS['core_db']->free_result($result);
                        foreach ($post_ids as $post_id) {
                            $rowset[] = $post_data[$post_id];
                        }
                        unset($post_data, $post_ids);
                    } else {
                        $rowset = array();
                    }
                } else {
                    $sql = 'SELECT f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_first_poster_name AS username
						FROM ' . FORUMS_TOPICS_TABLE . ' t, ' . FORUMS_FORUMS_TABLE . " f\n\t\t\t\t\t\tWHERE t.topic_approved = 0\n\t\t\t\t\t\t\tAND t.forum_id IN ({$forum_list})\n\t\t\t\t\t\t\tAND f.forum_id = t.forum_id\n\t\t\t\t\t\tORDER BY {$sort_order_sql}";
                    $result = $_CLASS['core_db']->query_limit($sql, $config['topics_per_page'], $start);
                    $rowset = array();
                    while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
                        $rowset[] = $row;
                    }
                    $_CLASS['core_db']->free_result($result);
                }
                foreach ($rowset as $row) {
                    if ($row['poster_id'] == ANONYMOUS) {
                        $poster = !empty($row['post_username']) ? $row['post_username'] : $_CLASS['core_user']->lang['GUEST'];
                    } else {
                        $poster = $row['username'];
                    }
                    $s_checkbox = '<input type="checkbox" name="post_id_list[]" value="' . $row['post_id'] . '" />';
                    $_CLASS['core_template']->assign_vars_array('postrow', array('U_VIEWFORUM' => generate_link('Forums&amp;file=viewforum&amp;f=' . $row['forum_id']), 'U_VIEWTOPIC' => generate_link('Forums&amp;file=viewtopic&amp;f=' . $row['forum_id'] . '&amp;p=' . $row['post_id'] . ($mode == 'unapproved_posts' ? '#' . $row['post_id'] : '')), 'U_VIEW_DETAILS' => generate_link("Forums&amp;file=mcp&amp;i=queue&amp;start={$start}&amp;mode=approve_details&amp;f={$forum_id}&amp;p={$row['post_id']}"), 'U_VIEWPROFILE' => $row['poster_id'] != ANONYMOUS ? generate_link("Members_List&amp;mode=viewprofile&amp;u={$row['poster_id']}") : '', 'FORUM_NAME' => $row['forum_name'], 'TOPIC_TITLE' => $row['topic_title'], 'POSTER' => $poster, 'POST_TIME' => $_CLASS['core_user']->format_date($row['post_time']), 'S_CHECKBOX' => $s_checkbox));
                }
                unset($rowset);
                // Now display the page
                $_CLASS['core_template']->assign_array(array('L_DISPLAY_ITEMS' => $mode == 'unapproved_posts' ? $_CLASS['core_user']->lang['DISPLAY_POSTS'] : $_CLASS['core_user']->lang['DISPLAY_TOPICS'], 'S_FORUM_OPTIONS' => $forum_options));
                $this->display($_CLASS['core_user']->lang['MCP_QUEUE'], 'mcp_queue.html');
                break;
        }
    }
示例#10
0
switch ($mode) {
    case 'approve_details':
        $_CLASS['core_user']->add_lang('posting');
        require_once SITE_FILE_ROOT . 'includes/forums/functions_posting.php';
        $post_id = get_variable('p', 'REQUEST', false, 'int');
        $topic_id = get_variable('t', 'REQUEST', false, 'int');
        if ($topic_id) {
            $topic_info = get_topic_data(array($topic_id), 'm_approve');
            $post_id = isset($topic_info[$topic_id]['topic_first_post_id']) ? (int) $topic_info[$topic_id]['topic_first_post_id'] : false;
        }
        $post_info = $post_id ? get_post_data(array($post_id), 'm_approve') : false;
        if (!$post_id || empty($post_info[$post_id])) {
            trigger_error('NO_POST_SELECTED');
        }
        $post_info = $post_info[$post_id];
        if ($post_info['topic_first_post_id'] != $post_id && topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false)) {
            $_CLASS['core_template']->assign_array(array('S_TOPIC_REVIEW' => true, 'TOPIC_TITLE' => $post_info['topic_title']));
        }
        // Set some vars
        if ($post_info['user_id'] == ANONYMOUS) {
            $post_info['username'] = $post_info['post_username'] ? $post_info['post_username'] : $_CLASS['core_user']->lang['GUEST'];
        }
        $poster = $post_info['user_colour'] ? '<span style="color:#' . $post_info['user_colour'] . '">' . $post_info['username'] . '</span>' : $post_info['username'];
        // Process message, leave it uncensored
        $post_info['post_text'] = $post_info['post_text'];
        if ($post_info['bbcode_bitfield']) {
            require_once SITE_FILE_ROOT . 'includes/forums/bbcode.php';
            $bbcode = new bbcode($post_info['bbcode_bitfield']);
            $bbcode->bbcode_second_pass($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
        }
        $post_info['post_text'] = smiley_text($post_info['post_text']);
示例#11
0
    }
}
$refresh = $preview || $poll_add || $poll_edit || $poll_delete;
$orig_word = $replacement_word = array();
//
// Set topic type
//
$topic_type = !empty($HTTP_POST_VARS['topictype']) ? intval($HTTP_POST_VARS['topictype']) : POST_NORMAL;
$topic_type = in_array($topic_type, array(POST_NORMAL, POST_STICKY, POST_ANNOUNCE)) ? $topic_type : POST_NORMAL;
//
// If the mode is set to topic review then output
// that review ...
//
if ($mode == 'topicreview') {
    require $phpbb_root_path . 'includes/topic_review.' . $phpEx;
    topic_review($topic_id, false);
    exit;
} else {
    if ($mode == 'smilies') {
        generate_smilies('window', PAGE_POSTING);
        exit;
    }
}
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_POSTING);
init_userprefs($userdata);
//
// End session management
//
示例#12
0
	function main($id, $mode)
	{
		global $auth, $db, $user, $template, $cache;
		global $config, $phpbb_root_path, $phpEx, $action;

		include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);

		$forum_id = request_var('f', 0);
		$start = request_var('start', 0);

		$this->page_title = 'MCP_REPORTS';

		switch ($action)
		{
			case 'close':
			case 'delete':
				include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);

				$report_id_list = request_var('report_id_list', array(0));

				if (!sizeof($report_id_list))
				{
					trigger_error('NO_REPORT_SELECTED');
				}

				close_report($report_id_list, $mode, $action);

			break;
		}

		switch ($mode)
		{
			case 'report_details':

				$user->add_lang('posting');

				$post_id = request_var('p', 0);

				// closed reports are accessed by report id
				$report_id = request_var('r', 0);

				$sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour
					FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u
					WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . '
						AND rr.reason_id = r.reason_id
						AND r.user_id = u.user_id
					ORDER BY report_closed ASC';
				$result = $db->sql_query_limit($sql, 1);
				$report = $db->sql_fetchrow($result);
				$db->sql_freeresult($result);

				if (!$report)
				{
					trigger_error('NO_REPORT');
				}

				if (!$report_id && $report['report_closed'])
				{
					trigger_error('REPORT_CLOSED');
				}

				$post_id = $report['post_id'];
				$report_id = $report['report_id'];

				$post_info = get_post_data(array($post_id), 'm_report', true);

				if (!sizeof($post_info))
				{
					trigger_error('NO_REPORT_SELECTED');
				}

				$post_info = $post_info[$post_id];

				$reason = array('title' => $report['reason_title'], 'description' => $report['reason_description']);
				if (isset($user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])]))
				{
					$reason['description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])];
					$reason['title'] = $user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])];
				}

				if (topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false))
				{
					$template->assign_vars(array(
						'S_TOPIC_REVIEW'	=> true,
						'TOPIC_TITLE'		=> $post_info['topic_title'])
					);
				}

				$topic_tracking_info = $extensions = $attachments = array();
				// Get topic tracking info
				if ($config['load_db_lastread'])
				{
					$tmp_topic_data = array($post_info['topic_id'] => $post_info);
					$topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time']));
					unset($tmp_topic_data);
				}
				else
				{
					$topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
				}

				$post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false;

				// Process message, leave it uncensored
				$message = $post_info['post_text'];

				if ($post_info['bbcode_bitfield'])
				{
					include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
					$bbcode = new bbcode($post_info['bbcode_bitfield']);
					$bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
				}

				$message = bbcode_nl2br($message);
				$message = smiley_text($message);

				if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
				{
					$extensions = $cache->obtain_attach_extensions($post_info['forum_id']);

					$sql = 'SELECT *
						FROM ' . ATTACHMENTS_TABLE . '
						WHERE post_msg_id = ' . $post_id . '
							AND in_message = 0
						ORDER BY filetime DESC, post_msg_id ASC';
					$result = $db->sql_query($sql);

					while ($row = $db->sql_fetchrow($result))
					{
						$attachments[] = $row;
					}
					$db->sql_freeresult($result);

					if (sizeof($attachments))
					{
						$update_count = array();
						parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
					}

					// Display not already displayed Attachments for this post, we already parsed them. ;)
					if (!empty($attachments))
					{
						$template->assign_var('S_HAS_ATTACHMENTS', true);

						foreach ($attachments as $attachment)
						{
							$template->assign_block_vars('attachment', array(
								'DISPLAY_ATTACHMENT'	=> $attachment)
							);
						}
					}
				}

				$template->assign_vars(array(
					'S_MCP_REPORT'			=> true,
					'S_CLOSE_ACTION'		=> $this->u_action . '&amp;p=' . $post_id . '&amp;f=' . $forum_id,
					'S_CAN_VIEWIP'			=> $auth->acl_get('m_info', $post_info['forum_id']),
					'S_POST_REPORTED'		=> $post_info['post_reported'],
					'S_POST_UNAPPROVED'		=> !$post_info['post_approved'],
					'S_POST_LOCKED'			=> $post_info['post_edit_locked'],
					'S_USER_NOTES'			=> true,

					'U_EDIT'					=> ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '',
					'U_MCP_APPROVE'				=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
					'U_MCP_REPORT'				=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
					'U_MCP_REPORTER_NOTES'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&amp;mode=user_notes&amp;u=' . $report['user_id']),
					'U_MCP_USER_NOTES'			=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&amp;mode=user_notes&amp;u=' . $post_info['user_id']),
					'U_MCP_WARN_REPORTER'		=> ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&amp;mode=warn_user&amp;u=' . $report['user_id']) : '',
					'U_MCP_WARN_USER'			=> ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&amp;mode=warn_user&amp;u=' . $post_info['user_id']) : '',
					'U_VIEW_POST'				=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;p=' . $post_info['post_id'] . '#p' . $post_info['post_id']),
					'U_VIEW_TOPIC'				=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']),

					'EDIT_IMG'				=> $user->img('icon_post_edit', $user->lang['EDIT_POST']),
					'MINI_POST_IMG'			=> ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'),
					'UNAPPROVED_IMG'		=> $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']),

					'RETURN_REPORTS'			=> sprintf($user->lang['RETURN_REPORTS'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports' . (($post_info['post_reported']) ? '&amp;mode=reports' : '&amp;mode=reports_closed') . '&amp;start=' . $start . '&amp;f=' . $post_info['forum_id']) . '">', '</a>'),
					'REPORTED_IMG'				=> $user->img('icon_topic_reported', $user->lang['POST_REPORTED']),
					'REPORT_DATE'				=> $user->format_date($report['report_time']),
					'REPORT_ID'					=> $report_id,
					'REPORT_REASON_TITLE'		=> $reason['title'],
					'REPORT_REASON_DESCRIPTION'	=> $reason['description'],
					'REPORT_TEXT'				=> $report['report_text'],

					'POST_AUTHOR_FULL'		=> get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
					'POST_AUTHOR_COLOUR'	=> get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
					'POST_AUTHOR'			=> get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
					'U_POST_AUTHOR'			=> get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),

					'REPORTER_FULL'				=> get_username_string('full', $report['user_id'], $report['username'], $report['user_colour']),
					'REPORTER_COLOUR'			=> get_username_string('colour', $report['user_id'], $report['username'], $report['user_colour']),
					'REPORTER_NAME'				=> get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']),
					'U_VIEW_REPORTER_PROFILE'	=> get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']),

					'POST_PREVIEW'			=> $message,
					'POST_SUBJECT'			=> ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'],
					'POST_DATE'				=> $user->format_date($post_info['post_time']),
					'POST_IP'				=> $post_info['poster_ip'],
					'POST_IPADDR'			=> ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
					'POST_ID'				=> $post_info['post_id'],

					'U_LOOKUP_IP'			=> ($auth->acl_get('m_info', $post_info['forum_id'])) ? $this->u_action . '&amp;r=' . $report_id . '&amp;p=' . $post_id . '&amp;f=' . $forum_id . '&amp;lookup=' . $post_info['poster_ip'] . '#ip' : '',
				));

				$this->tpl_name = 'mcp_post';

			break;

			case 'reports':
			case 'reports_closed':
				$topic_id = request_var('t', 0);

				$forum_info = array();
				$forum_list_reports = get_forum_list('m_report', false, true);

				if ($topic_id && $forum_id)
				{
					$topic_info = get_topic_data(array($topic_id));

					if (!sizeof($topic_info))
					{
						trigger_error('TOPIC_NOT_EXIST');
					}

					$topic_info = $topic_info[$topic_id];
					$forum_id = $topic_info['forum_id'];
				}
				else if ($topic_id && !$forum_id)
				{
					$topic_id = 0;
				}

				$forum_list = array();

				if (!$forum_id)
				{
					foreach ($forum_list_reports as $row)
					{
						$forum_list[] = $row['forum_id'];
					}

					if (!sizeof($forum_list))
					{
						trigger_error('NOT_MODERATOR');
					}

					$global_id = $forum_list[0];

					$sql = 'SELECT SUM(forum_topics) as sum_forum_topics
						FROM ' . FORUMS_TABLE . '
						WHERE ' . $db->sql_in_set('forum_id', $forum_list);
					$result = $db->sql_query($sql);
					$forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics');
					$db->sql_freeresult($result);
				}
				else
				{
					$forum_info = get_forum_data(array($forum_id), 'm_report');

					if (!sizeof($forum_info))
					{
						trigger_error('NOT_MODERATOR');
					}

					$forum_info = $forum_info[$forum_id];
					$forum_list = array($forum_id);
					$global_id = $forum_id;
				}

				$forum_list[] = 0;
				$forum_data = array();

				$forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
				foreach ($forum_list_reports as $row)
				{
					$forum_options .= '<option value="' . $row['forum_id'] . '"' . (($forum_id == $row['forum_id']) ? ' selected="selected"' : '') . '>' . str_repeat('&nbsp; &nbsp;', $row['padding']) . $row['forum_name'] . '</option>';
					$forum_data[$row['forum_id']] = $row;
				}
				unset($forum_list_reports);

				$sort_days = $total = 0;
				$sort_key = $sort_dir = '';
				$sort_by_sql = $sort_order_sql = array();
				mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);

				$forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total;
				$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';

				if ($mode == 'reports')
				{
					$report_state = 'AND p.post_reported = 1 AND r.report_closed = 0';
				}
				else
				{
					$report_state = 'AND r.report_closed = 1';
				}

				$sql = 'SELECT r.report_id
					FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . REPORTS_TABLE . ' r ' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . (($sort_order_sql[0] == 'r') ? ', ' . USERS_TABLE . ' ru' : '') . '
					WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . "
						$report_state
						AND r.post_id = p.post_id
						" . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . '
						' . (($sort_order_sql[0] == 'r') ? 'AND ru.user_id = p.poster_id' : '') . '
						' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . "
						AND t.topic_id = p.topic_id
						$limit_time_sql
					ORDER BY $sort_order_sql";
				$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);

				$i = 0;
				$report_ids = array();
				while ($row = $db->sql_fetchrow($result))
				{
					$report_ids[] = $row['report_id'];
					$row_num[$row['report_id']] = $i++;
				}
				$db->sql_freeresult($result);

				if (sizeof($report_ids))
				{
					$sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, u.username, u.username_clean, u.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id
						FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru
						WHERE ' . $db->sql_in_set('r.report_id', $report_ids) . '
							AND t.topic_id = p.topic_id
							AND r.post_id = p.post_id
							AND u.user_id = p.poster_id
							AND ru.user_id = r.user_id
						ORDER BY ' . $sort_order_sql;
					$result = $db->sql_query($sql);

					$report_data = $rowset = array();
					while ($row = $db->sql_fetchrow($result))
					{
						$global_topic = ($row['forum_id']) ? false : true;
						if ($global_topic)
						{
							$row['forum_id'] = $global_id;
						}

						$template->assign_block_vars('postrow', array(
							'U_VIEWFORUM'				=> (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
							'U_VIEWPOST'				=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']) . '#p' . $row['post_id'],
							'U_VIEW_DETAILS'			=> append_sid("{$phpbb_root_path}mcp.$phpEx", "i=reports&amp;start=$start&amp;mode=report_details&amp;f={$row['forum_id']}&amp;r={$row['report_id']}"),

							'POST_AUTHOR_FULL'		=> get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
							'POST_AUTHOR_COLOUR'	=> get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
							'POST_AUTHOR'			=> get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
							'U_POST_AUTHOR'			=> get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),

							'REPORTER_FULL'			=> get_username_string('full', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
							'REPORTER_COLOUR'		=> get_username_string('colour', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
							'REPORTER'				=> get_username_string('username', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
							'U_REPORTER'			=> get_username_string('profile', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),

							'FORUM_NAME'	=> (!$global_topic) ? $forum_data[$row['forum_id']]['forum_name'] : $user->lang['GLOBAL_ANNOUNCEMENT'],
							'POST_ID'		=> $row['post_id'],
							'POST_SUBJECT'	=> ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
							'POST_TIME'		=> $user->format_date($row['post_time']),
							'REPORT_ID'		=> $row['report_id'],
							'REPORT_TIME'	=> $user->format_date($row['report_time']),
							'TOPIC_TITLE'	=> $row['topic_title'])
						);
					}
					$db->sql_freeresult($result);
					unset($report_ids, $row);
				}

				// Now display the page
				$template->assign_vars(array(
					'L_EXPLAIN'				=> ($mode == 'reports') ? $user->lang['MCP_REPORTS_OPEN_EXPLAIN'] : $user->lang['MCP_REPORTS_CLOSED_EXPLAIN'],
					'L_TITLE'				=> ($mode == 'reports') ? $user->lang['MCP_REPORTS_OPEN'] : $user->lang['MCP_REPORTS_CLOSED'],
					'L_ONLY_TOPIC'			=> ($topic_id) ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '',

					'S_MCP_ACTION'			=> $this->u_action,
					'S_FORUM_OPTIONS'		=> $forum_options,
					'S_CLOSED'				=> ($mode == 'reports_closed') ? true : false,

					'PAGINATION'			=> generate_pagination($this->u_action . "&amp;f=$forum_id&amp;t=$topic_id&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir", $total, $config['topics_per_page'], $start),
					'PAGE_NUMBER'			=> on_page($total, $config['topics_per_page'], $start),
					'TOPIC_ID'				=> $topic_id,
					'TOTAL'					=> $total,
					'TOTAL_REPORTS'			=> ($total == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $total),					
					)
				);

				$this->tpl_name = 'mcp_reports';
			break;
		}
	}
示例#13
0
        $page_title = $lang['POST_A_NEW_TOPIC'];
        $hidden_form_fields .= '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
        break;
    case 'reply':
        $page_title = $lang['POST_A_REPLY'];
        $hidden_form_fields .= '<input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" />';
        break;
    case 'editpost':
        $page_title = $lang['EDIT_POST'];
        $hidden_form_fields .= '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post_id . '" />';
        break;
}
// Generate smilies listing for page output
generate_smilies('inline');
$template->set_filenames(array('body' => 'posting.tpl'));
// Output the data to the template
$template->assign_vars(array('FORUM_NAME' => htmlCHR($forum_name), 'PAGE_TITLE' => $page_title, 'POSTING_TYPE_TITLE' => $page_title, 'POSTING_TOPIC_ID' => $mode != 'newtopic' ? $topic_id : '', 'POSTING_TOPIC_TITLE' => $mode != 'newtopic' ? wbr($post_info['topic_title']) : '', 'U_VIEW_FORUM' => "viewforum.php?" . POST_FORUM_URL . "={$forum_id}", 'USERNAME' => @$username, 'CAPTCHA_HTML' => IS_GUEST ? bb_captcha('get') : '', 'SUBJECT' => $subject, 'MESSAGE' => $message, 'POSTER_RGROUPS' => isset($poster_rgroups) && !empty($poster_rgroups) ? $poster_rgroups : '', 'ATTACH_RG_SIG' => $switch_rg_sig ? $switch_rg_sig : false, 'U_VIEWTOPIC' => $mode == 'reply' ? "viewtopic.php?" . POST_TOPIC_URL . "={$topic_id}&amp;postorder=desc" : '', 'S_NOTIFY_CHECKED' => $notify_user ? 'checked="checked"' : '', 'S_TYPE_TOGGLE' => $topic_type_toggle, 'S_TOPIC_ID' => $topic_id, 'S_POST_ACTION' => POSTING_URL, 'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields));
if ($mode == 'newtopic' || $post_data['first_post']) {
    $template->assign_var('POSTING_SUBJECT');
}
// Update post time
if ($mode == 'editpost' && $post_data['last_post'] && !$post_data['first_post']) {
    $template->assign_vars(array('SHOW_UPDATE_POST_TIME' => $is_auth['auth_mod'] || $post_data['poster_post'] && $post_info['post_time'] + 3600 * 3 > TIMENOW, 'UPDATE_POST_TIME_CHECKED' => $post_data['poster_post'] && $post_info['post_time'] + 3600 * 2 > TIMENOW));
}
// Topic review
if ($mode == 'reply' && $is_auth['auth_read']) {
    topic_review($topic_id);
}
require PAGE_HEADER;
$template->pparse('body');
require PAGE_FOOTER;