/**
  * Event: tierra.topicsolved.mark_solved_after
  *
  * @param Event $event
  */
 public function topic_solved_after($event)
 {
     if ($event['column_data']['topic_status'] == ITEM_LOCKED) {
         if (!function_exists('phpbb_get_topic_data')) {
             include $this->root_path . 'includes/functions_mcp.' . $this->php_ext;
         }
         $topic_id = $event['topic_data']['topic_id'];
         $topic_data = phpbb_get_topic_data(array($topic_id));
         $this->topic_mover->move_topics($topic_data, 'move_topics_when_locked_solved');
     }
 }
Ejemplo n.º 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;
        }
    }
Ejemplo n.º 3
0
/**
* Fork Topic
*/
function mcp_fork_topic($topic_ids)
{
    global $auth, $user, $db, $template, $config;
    global $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher;
    if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_'))) {
        return;
    }
    $to_forum_id = $request->variable('to_forum_id', 0);
    $forum_id = $request->variable('f', 0);
    $redirect = $request->variable('redirect', build_url(array('action', 'quickmod')));
    $additional_msg = $success_msg = '';
    $counter = array();
    $s_hidden_fields = build_hidden_fields(array('topic_id_list' => $topic_ids, 'f' => $forum_id, 'action' => 'fork', 'redirect' => $redirect));
    if ($to_forum_id) {
        $forum_data = phpbb_get_forum_data($to_forum_id, 'f_post');
        if (!sizeof($topic_ids)) {
            $additional_msg = $user->lang['NO_TOPIC_SELECTED'];
        } else {
            if (!sizeof($forum_data)) {
                $additional_msg = $user->lang['FORUM_NOT_EXIST'];
            } else {
                $forum_data = $forum_data[$to_forum_id];
                if ($forum_data['forum_type'] != FORUM_POST) {
                    $additional_msg = $user->lang['FORUM_NOT_POSTABLE'];
                } else {
                    if (!$auth->acl_get('f_post', $to_forum_id)) {
                        $additional_msg = $user->lang['USER_CANNOT_POST'];
                    }
                }
            }
        }
    } else {
        if (isset($_POST['confirm'])) {
            $additional_msg = $user->lang['FORUM_NOT_EXIST'];
        }
    }
    if ($additional_msg) {
        $request->overwrite('confirm', null, \phpbb\request\request_interface::POST);
        $request->overwrite('confirm_key', null);
    }
    if (confirm_box(true)) {
        $topic_data = phpbb_get_topic_data($topic_ids, 'f_post');
        $total_topics = $total_topics_unapproved = $total_topics_softdeleted = 0;
        $total_posts = $total_posts_unapproved = $total_posts_softdeleted = 0;
        $new_topic_id_list = array();
        foreach ($topic_data as $topic_id => $topic_row) {
            if (!isset($search_type) && $topic_row['enable_indexing']) {
                // Select the search method and do some additional checks to ensure it can actually be utilised
                $search_type = $config['search_type'];
                if (!class_exists($search_type)) {
                    trigger_error('NO_SUCH_SEARCH_MODULE');
                }
                $error = false;
                $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
                $search_mode = 'post';
                if ($error) {
                    trigger_error($error);
                }
            } else {
                if (!isset($search_type) && !$topic_row['enable_indexing']) {
                    $search_type = false;
                }
            }
            $sql_ary = array('forum_id' => (int) $to_forum_id, 'icon_id' => (int) $topic_row['icon_id'], 'topic_attachment' => (int) $topic_row['topic_attachment'], 'topic_visibility' => (int) $topic_row['topic_visibility'], 'topic_reported' => 0, 'topic_title' => (string) $topic_row['topic_title'], 'topic_poster' => (int) $topic_row['topic_poster'], 'topic_time' => (int) $topic_row['topic_time'], 'topic_posts_approved' => (int) $topic_row['topic_posts_approved'], 'topic_posts_unapproved' => (int) $topic_row['topic_posts_unapproved'], 'topic_posts_softdeleted' => (int) $topic_row['topic_posts_softdeleted'], 'topic_status' => (int) $topic_row['topic_status'], 'topic_type' => (int) $topic_row['topic_type'], 'topic_first_poster_name' => (string) $topic_row['topic_first_poster_name'], 'topic_last_poster_id' => (int) $topic_row['topic_last_poster_id'], 'topic_last_poster_name' => (string) $topic_row['topic_last_poster_name'], 'topic_last_post_time' => (int) $topic_row['topic_last_post_time'], 'topic_last_view_time' => (int) $topic_row['topic_last_view_time'], 'topic_bumped' => (int) $topic_row['topic_bumped'], 'topic_bumper' => (int) $topic_row['topic_bumper'], 'poll_title' => (string) $topic_row['poll_title'], 'poll_start' => (int) $topic_row['poll_start'], 'poll_length' => (int) $topic_row['poll_length'], 'poll_max_options' => (int) $topic_row['poll_max_options'], 'poll_vote_change' => (int) $topic_row['poll_vote_change']);
            $db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
            $new_topic_id = $db->sql_nextid();
            $new_topic_id_list[$topic_id] = $new_topic_id;
            switch ($topic_row['topic_visibility']) {
                case ITEM_APPROVED:
                    $total_topics++;
                    break;
                case ITEM_UNAPPROVED:
                case ITEM_REAPPROVE:
                    $total_topics_unapproved++;
                    break;
                case ITEM_DELETED:
                    $total_topics_softdeleted++;
                    break;
            }
            if ($topic_row['poll_start']) {
                $poll_rows = array();
                $sql = 'SELECT *
					FROM ' . POLL_OPTIONS_TABLE . "\n\t\t\t\t\tWHERE topic_id = {$topic_id}";
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $sql_ary = array('poll_option_id' => (int) $row['poll_option_id'], 'topic_id' => (int) $new_topic_id, 'poll_option_text' => (string) $row['poll_option_text'], 'poll_option_total' => 0);
                    $db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
                }
                $db->sql_freeresult($result);
            }
            $sql = 'SELECT *
				FROM ' . POSTS_TABLE . "\n\t\t\t\tWHERE topic_id = {$topic_id}\n\t\t\t\tORDER BY post_time ASC, post_id ASC";
            $result = $db->sql_query($sql);
            $post_rows = array();
            while ($row = $db->sql_fetchrow($result)) {
                $post_rows[] = $row;
            }
            $db->sql_freeresult($result);
            if (!sizeof($post_rows)) {
                continue;
            }
            foreach ($post_rows as $row) {
                $sql_ary = array('topic_id' => (int) $new_topic_id, 'forum_id' => (int) $to_forum_id, 'poster_id' => (int) $row['poster_id'], 'icon_id' => (int) $row['icon_id'], 'poster_ip' => (string) $row['poster_ip'], 'post_time' => (int) $row['post_time'], 'post_visibility' => (int) $row['post_visibility'], 'post_reported' => 0, 'enable_bbcode' => (int) $row['enable_bbcode'], 'enable_smilies' => (int) $row['enable_smilies'], 'enable_magic_url' => (int) $row['enable_magic_url'], 'enable_sig' => (int) $row['enable_sig'], 'post_username' => (string) $row['post_username'], 'post_subject' => (string) $row['post_subject'], 'post_text' => (string) $row['post_text'], 'post_edit_reason' => (string) $row['post_edit_reason'], 'post_edit_user' => (int) $row['post_edit_user'], 'post_checksum' => (string) $row['post_checksum'], 'post_attachment' => (int) $row['post_attachment'], 'bbcode_bitfield' => $row['bbcode_bitfield'], 'bbcode_uid' => (string) $row['bbcode_uid'], 'post_edit_time' => (int) $row['post_edit_time'], 'post_edit_count' => (int) $row['post_edit_count'], 'post_edit_locked' => (int) $row['post_edit_locked'], 'post_postcount' => $row['post_postcount']);
                // Adjust post count only if the post can be incremented to the user counter
                if ($row['post_postcount']) {
                    if (isset($counter[$row['poster_id']])) {
                        ++$counter[$row['poster_id']];
                    } else {
                        $counter[$row['poster_id']] = 1;
                    }
                }
                $db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
                $new_post_id = $db->sql_nextid();
                switch ($row['post_visibility']) {
                    case ITEM_APPROVED:
                        $total_posts++;
                        break;
                    case ITEM_UNAPPROVED:
                    case ITEM_REAPPROVE:
                        $total_posts_unapproved++;
                        break;
                    case ITEM_DELETED:
                        $total_posts_softdeleted++;
                        break;
                }
                // Copy whether the topic is dotted
                markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']);
                if (!empty($search_type)) {
                    $search->index($search_mode, $new_post_id, $sql_ary['post_text'], $sql_ary['post_subject'], $sql_ary['poster_id'], $topic_row['topic_type'] == POST_GLOBAL ? 0 : $to_forum_id);
                    $search_mode = 'reply';
                    // After one we index replies
                }
                // Copy Attachments
                if ($row['post_attachment']) {
                    $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . "\n\t\t\t\t\t\tWHERE post_msg_id = {$row['post_id']}\n\t\t\t\t\t\t\tAND topic_id = {$topic_id}\n\t\t\t\t\t\t\tAND in_message = 0";
                    $result = $db->sql_query($sql);
                    $sql_ary = array();
                    while ($attach_row = $db->sql_fetchrow($result)) {
                        $sql_ary[] = array('post_msg_id' => (int) $new_post_id, 'topic_id' => (int) $new_topic_id, 'in_message' => 0, 'is_orphan' => (int) $attach_row['is_orphan'], 'poster_id' => (int) $attach_row['poster_id'], 'physical_filename' => (string) utf8_basename($attach_row['physical_filename']), 'real_filename' => (string) utf8_basename($attach_row['real_filename']), 'download_count' => (int) $attach_row['download_count'], 'attach_comment' => (string) $attach_row['attach_comment'], 'extension' => (string) $attach_row['extension'], 'mimetype' => (string) $attach_row['mimetype'], 'filesize' => (int) $attach_row['filesize'], 'filetime' => (int) $attach_row['filetime'], 'thumbnail' => (int) $attach_row['thumbnail']);
                    }
                    $db->sql_freeresult($result);
                    if (sizeof($sql_ary)) {
                        $db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary);
                    }
                }
            }
            // Copy topic subscriptions to new topic
            $sql = 'SELECT user_id, notify_status
				FROM ' . TOPICS_WATCH_TABLE . '
				WHERE topic_id = ' . $topic_id;
            $result = $db->sql_query($sql);
            $sql_ary = array();
            while ($row = $db->sql_fetchrow($result)) {
                $sql_ary[] = array('topic_id' => (int) $new_topic_id, 'user_id' => (int) $row['user_id'], 'notify_status' => (int) $row['notify_status']);
            }
            $db->sql_freeresult($result);
            if (sizeof($sql_ary)) {
                $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary);
            }
            // Copy bookmarks to new topic
            $sql = 'SELECT user_id
				FROM ' . BOOKMARKS_TABLE . '
				WHERE topic_id = ' . $topic_id;
            $result = $db->sql_query($sql);
            $sql_ary = array();
            while ($row = $db->sql_fetchrow($result)) {
                $sql_ary[] = array('topic_id' => (int) $new_topic_id, 'user_id' => (int) $row['user_id']);
            }
            $db->sql_freeresult($result);
            if (sizeof($sql_ary)) {
                $db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary);
            }
        }
        // Sync new topics, parent forums and board stats
        $sql = 'UPDATE ' . FORUMS_TABLE . '
			SET forum_posts_approved = forum_posts_approved + ' . $total_posts . ',
				forum_posts_unapproved = forum_posts_unapproved + ' . $total_posts_unapproved . ',
				forum_posts_softdeleted = forum_posts_softdeleted + ' . $total_posts_softdeleted . ',
				forum_topics_approved = forum_topics_approved + ' . $total_topics . ',
				forum_topics_unapproved = forum_topics_unapproved + ' . $total_topics_unapproved . ',
				forum_topics_softdeleted = forum_topics_softdeleted + ' . $total_topics_softdeleted . '
			WHERE forum_id = ' . $to_forum_id;
        $db->sql_query($sql);
        if (!empty($counter)) {
            // Do only one query per user and not a query per post.
            foreach ($counter as $user_id => $count) {
                $sql = 'UPDATE ' . USERS_TABLE . '
					SET user_posts = user_posts + ' . (int) $count . '
					WHERE user_id = ' . (int) $user_id;
                $db->sql_query($sql);
            }
        }
        sync('topic', 'topic_id', $new_topic_id_list);
        sync('forum', 'forum_id', $to_forum_id);
        $config->increment('num_topics', sizeof($new_topic_id_list), false);
        $config->increment('num_posts', $total_posts, false);
        foreach ($new_topic_id_list as $topic_id => $new_topic_id) {
            $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_FORK', false, array('forum_id' => $to_forum_id, 'topic_id' => $new_topic_id, $topic_row['forum_name']));
        }
        $success_msg = sizeof($topic_ids) == 1 ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS';
    } else {
        $template->assign_vars(array('S_FORUM_SELECT' => make_forum_select($to_forum_id, false, false, true, true, true), 'S_CAN_LEAVE_SHADOW' => false, 'ADDITIONAL_MSG' => $additional_msg));
        confirm_box(false, 'FORK_TOPIC' . (sizeof($topic_ids) == 1 ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');
    }
    $redirect = $request->variable('redirect', "index.{$phpEx}");
    $redirect = reapply_sid($redirect);
    if (!$success_msg) {
        redirect($redirect);
    } else {
        $redirect_url = append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id);
        meta_refresh(3, $redirect_url);
        $return_link = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>');
        if ($forum_id != $to_forum_id) {
            $return_link .= '<br /><br />' . sprintf($user->lang['RETURN_NEW_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $to_forum_id) . '">', '</a>');
        }
        trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);
    }
}
Ejemplo n.º 4
0
/**
* Merge selected topics into selected topic
*/
function merge_topics($forum_id, $topic_ids, $to_topic_id)
{
    global $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_log, $request;
    if (!sizeof($topic_ids)) {
        $template->assign_var('MESSAGE', $user->lang['NO_TOPIC_SELECTED']);
        return;
    }
    if (!$to_topic_id) {
        $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
        return;
    }
    $sync_topics = array_merge($topic_ids, array($to_topic_id));
    $topic_data = phpbb_get_topic_data($sync_topics, 'm_merge');
    if (!sizeof($topic_data) || empty($topic_data[$to_topic_id])) {
        $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
        return;
    }
    $sync_forums = array();
    foreach ($topic_data as $data) {
        $sync_forums[$data['forum_id']] = $data['forum_id'];
    }
    $topic_data = $topic_data[$to_topic_id];
    $post_id_list = $request->variable('post_id_list', array(0));
    $start = $request->variable('start', 0);
    if (!sizeof($post_id_list) && sizeof($topic_ids)) {
        $sql = 'SELECT post_id
			FROM ' . POSTS_TABLE . '
			WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
        $result = $db->sql_query($sql);
        $post_id_list = array();
        while ($row = $db->sql_fetchrow($result)) {
            $post_id_list[] = $row['post_id'];
        }
        $db->sql_freeresult($result);
    }
    if (!sizeof($post_id_list)) {
        $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
        return;
    }
    if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_merge'))) {
        return;
    }
    $redirect = $request->variable('redirect', build_url(array('quickmod')));
    $s_hidden_fields = build_hidden_fields(array('i' => 'main', 'f' => $forum_id, 'post_id_list' => $post_id_list, 'to_topic_id' => $to_topic_id, 'mode' => 'forum_view', 'action' => 'merge_topics', 'start' => $start, 'redirect' => $redirect, 'topic_id_list' => $topic_ids));
    $return_link = '';
    if (confirm_box(true)) {
        $to_forum_id = $topic_data['forum_id'];
        move_posts($post_id_list, $to_topic_id, false);
        $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MERGE', false, array('forum_id' => $to_forum_id, 'topic_id' => $to_topic_id, $topic_data['topic_title']));
        // Message and return links
        $success_msg = 'POSTS_MERGED_SUCCESS';
        if (!function_exists('phpbb_update_rows_avoiding_duplicates_notify_status')) {
            include $phpbb_root_path . 'includes/functions_database_helper.' . $phpEx;
        }
        // Update the topic watch table.
        phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', $topic_ids, $to_topic_id);
        // Update the bookmarks table.
        phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_ids, $to_topic_id);
        // Re-sync the topics and forums because the auto-sync was deactivated in the call of  move_posts()
        sync('topic_reported', 'topic_id', $sync_topics);
        sync('topic_attachment', 'topic_id', $sync_topics);
        sync('topic', 'topic_id', $sync_topics, true);
        sync('forum', 'forum_id', $sync_forums, true, true);
        // Link to the new topic
        $return_link .= ($return_link ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
        $redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.{$phpEx}?f={$to_forum_id}&amp;t={$to_topic_id}");
        $redirect = reapply_sid($redirect);
        meta_refresh(3, $redirect);
        trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);
    } else {
        confirm_box(false, 'MERGE_TOPICS', $s_hidden_fields);
    }
}
Ejemplo n.º 5
0
// If the user doesn't have any moderator powers (globally or locally) he can't access the mcp
if (!$auth->acl_getf_global('m_'))
{
	// Except he is using one of the quickmod tools for users
	$user_quickmod_actions = array(
		'lock'			=> 'f_user_lock',
		'make_sticky'	=> 'f_sticky',
		'make_announce'	=> 'f_announce',
		'make_global'	=> 'f_announce',
		'make_normal'	=> array('f_announce', 'f_sticky')
	);

	$allow_user = false;
	if ($quickmod && isset($user_quickmod_actions[$action]) && $user->data['is_registered'] && $auth->acl_gets($user_quickmod_actions[$action], $forum_id))
	{
		$topic_info = phpbb_get_topic_data(array($topic_id));
		if ($topic_info[$topic_id]['topic_poster'] == $user->data['user_id'])
		{
			$allow_user = true;
		}
	}

	if (!$allow_user)
	{
		trigger_error('NOT_AUTHORISED');
	}
}

// if the user cannot read the forum he tries to access then we won't allow mcp access either
if ($forum_id && !$auth->acl_get('f_read', $forum_id))
{
Ejemplo n.º 6
0
    /**
     * Approve/Restore topics
     *
     * @param $action		string	Action we perform on the posts ('approve' or 'restore')
     * @param $topic_id_list	array	IDs of the topics to approve/restore
     * @param $id			mixed	Category of the current active module
     * @param $mode			string	Active module
     * @return null
     */
    public static function approve_topics($action, $topic_id_list, $id, $mode)
    {
        global $db, $template, $user, $config, $phpbb_log;
        global $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_dispatcher;
        if (!phpbb_check_ids($topic_id_list, TOPICS_TABLE, 'topic_id', array('m_approve'))) {
            trigger_error('NOT_AUTHORISED');
        }
        $redirect = $request->variable('redirect', build_url(array('quickmod')));
        $redirect = reapply_sid($redirect);
        $success_msg = $topic_url = '';
        $approve_log = array();
        $s_hidden_fields = build_hidden_fields(array('i' => $id, 'mode' => $mode, 'topic_id_list' => $topic_id_list, 'action' => $action, 'redirect' => $redirect));
        $topic_info = phpbb_get_topic_data($topic_id_list, 'm_approve');
        if (confirm_box(true)) {
            $notify_poster = $action == 'approve' && isset($_REQUEST['notify_poster']) ? true : false;
            /* @var $phpbb_content_visibility \phpbb\content_visibility */
            $phpbb_content_visibility = $phpbb_container->get('content.visibility');
            $first_post_ids = array();
            foreach ($topic_info as $topic_id => $topic_data) {
                $phpbb_content_visibility->set_topic_visibility(ITEM_APPROVED, $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), '');
                $first_post_ids[$topic_id] = (int) $topic_data['topic_first_post_id'];
                $topic_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$topic_data['forum_id']}&amp;t={$topic_id}");
                $approve_log[] = array('forum_id' => $topic_data['forum_id'], 'topic_id' => $topic_data['topic_id'], 'topic_title' => $topic_data['topic_title']);
            }
            if (sizeof($topic_info) >= 1) {
                $success_msg = sizeof($topic_info) == 1 ? 'TOPIC_' . strtoupper($action) . 'D_SUCCESS' : 'TOPICS_' . strtoupper($action) . 'D_SUCCESS';
            }
            foreach ($approve_log as $log_data) {
                $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_TOPIC_' . strtoupper($action) . 'D', false, array('forum_id' => $log_data['forum_id'], 'topic_id' => $log_data['topic_id'], $log_data['topic_title']));
            }
            // Only send out the mails, when the posts are being approved
            if ($action == 'approve') {
                // Grab the first post text as it's needed for the quote notification.
                $sql = 'SELECT topic_id, post_text
					FROM ' . POSTS_TABLE . '
					WHERE ' . $db->sql_in_set('post_id', $first_post_ids);
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $topic_info[$row['topic_id']]['post_text'] = $row['post_text'];
                }
                $db->sql_freeresult($result);
                // Handle notifications
                /* @var $phpbb_notifications \phpbb\notification\manager */
                $phpbb_notifications = $phpbb_container->get('notification_manager');
                foreach ($topic_info as $topic_id => $topic_data) {
                    $topic_data = array_merge($topic_data, array('post_id' => $topic_data['topic_first_post_id'], 'post_subject' => $topic_data['topic_title'], 'post_time' => $topic_data['topic_time'], 'poster_id' => $topic_data['topic_poster'], 'post_username' => $topic_data['topic_first_poster_name']));
                    $phpbb_notifications->delete_notifications('notification.type.topic_in_queue', $topic_id);
                    // Only add notifications, if we are not reapproving post
                    // When the topic was already approved, but was edited and
                    // now needs re-approval, we don't want to notify the users
                    // again.
                    if ($topic_data['topic_visibility'] == ITEM_UNAPPROVED) {
                        $phpbb_notifications->add_notifications(array('notification.type.quote', 'notification.type.topic'), $topic_data);
                    }
                    $phpbb_notifications->mark_notifications('quote', $topic_data['post_id'], $user->data['user_id']);
                    $phpbb_notifications->mark_notifications('topic', $topic_id, $user->data['user_id']);
                    if ($notify_poster) {
                        $phpbb_notifications->add_notifications('notification.type.approve_topic', $topic_data);
                    }
                }
            }
            /**
             * Perform additional actions during topics(s) approval
             *
             * @event core.approve_topics_after
             * @var	string	action				Variable containing the action we perform on the posts ('approve' or 'restore')
             * @var	mixed	topic_info			Array containing info for all topics being approved
             * @var	array	first_post_ids		Array containing ids of all first posts
             * @var bool	notify_poster		Variable telling if the poster should be notified or not
             * @var	string	success_msg			Variable containing the language key for the success message
             * @var string	redirect			Variable containing the redirect url
             * @since 3.1.4-RC1
             */
            $vars = array('action', 'topic_info', 'first_post_ids', 'notify_poster', 'success_msg', 'redirect');
            extract($phpbb_dispatcher->trigger_event('core.approve_topics_after', compact($vars)));
            meta_refresh(3, $redirect);
            $message = $user->lang[$success_msg];
            if ($request->is_ajax()) {
                $json_response = new \phpbb\json_response();
                $json_response->send(array('MESSAGE_TITLE' => $user->lang['INFORMATION'], 'MESSAGE_TEXT' => $message, 'REFRESH_DATA' => null, 'visible' => true));
            }
            $message .= '<br /><br />' . $user->lang('RETURN_PAGE', '<a href="' . $redirect . '">', '</a>');
            // If approving one topic, also give links back to topic...
            if (sizeof($topic_info) == 1 && $topic_url) {
                $message .= '<br /><br />' . $user->lang('RETURN_TOPIC', '<a href="' . $topic_url . '">', '</a>');
            }
            trigger_error($message);
        } else {
            $show_notify = false;
            if ($action == 'approve') {
                foreach ($topic_info as $topic_data) {
                    if ($topic_data['topic_poster'] == ANONYMOUS) {
                        continue;
                    } else {
                        $show_notify = true;
                        break;
                    }
                }
            }
            $template->assign_vars(array('S_NOTIFY_POSTER' => $show_notify, 'S_' . strtoupper($action) => true));
            confirm_box(false, strtoupper($action) . '_TOPIC' . (sizeof($topic_id_list) == 1 ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
        }
        redirect($redirect);
    }