indvdum@0: p_master = &$p_master; indvdum@0: } indvdum@0: indvdum@0: function main($id, $mode) indvdum@0: { indvdum@0: global $auth, $db, $user, $template, $cache; indvdum@0: global $config, $phpbb_root_path, $phpEx, $action; indvdum@0: indvdum@0: include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); indvdum@0: indvdum@0: $forum_id = request_var('f', 0); indvdum@0: $start = request_var('start', 0); indvdum@0: indvdum@0: $this->page_title = 'MCP_QUEUE'; indvdum@0: indvdum@0: switch ($action) indvdum@0: { indvdum@0: case 'approve': indvdum@0: case 'disapprove': indvdum@0: include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); indvdum@0: indvdum@0: $post_id_list = request_var('post_id_list', array(0)); indvdum@0: indvdum@0: if (!sizeof($post_id_list)) indvdum@0: { indvdum@0: trigger_error('NO_POST_SELECTED'); indvdum@0: } indvdum@0: indvdum@0: if ($action == 'approve') indvdum@0: { indvdum@0: approve_post($post_id_list, 'queue', $mode); indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: disapprove_post($post_id_list, 'queue', $mode); indvdum@0: } indvdum@0: indvdum@0: break; indvdum@0: } indvdum@0: indvdum@0: switch ($mode) indvdum@0: { indvdum@0: case 'approve_details': indvdum@0: indvdum@0: $this->tpl_name = 'mcp_post'; indvdum@0: indvdum@0: $user->add_lang(array('posting', 'viewtopic')); indvdum@0: indvdum@0: $post_id = request_var('p', 0); indvdum@0: $topic_id = request_var('t', 0); indvdum@0: indvdum@0: if ($topic_id) indvdum@0: { indvdum@0: $topic_info = get_topic_data(array($topic_id), 'm_approve'); indvdum@0: if (isset($topic_info[$topic_id]['topic_first_post_id'])) indvdum@0: { indvdum@0: $post_id = (int) $topic_info[$topic_id]['topic_first_post_id']; indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: $topic_id = 0; indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: $post_info = get_post_data(array($post_id), 'm_approve', true); indvdum@0: indvdum@0: if (!sizeof($post_info)) indvdum@0: { indvdum@0: trigger_error('NO_POST_SELECTED'); indvdum@0: } indvdum@0: indvdum@0: $post_info = $post_info[$post_id]; indvdum@0: indvdum@0: if ($post_info['topic_first_post_id'] != $post_id && topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false)) indvdum@0: { indvdum@0: $template->assign_vars(array( indvdum@0: 'S_TOPIC_REVIEW' => true, indvdum@0: 'S_BBCODE_ALLOWED' => $post_info['enable_bbcode'], indvdum@0: 'TOPIC_TITLE' => $post_info['topic_title']) indvdum@0: ); indvdum@0: } indvdum@0: indvdum@0: $extensions = $attachments = $topic_tracking_info = array(); indvdum@0: indvdum@0: // Get topic tracking info indvdum@0: if ($config['load_db_lastread']) indvdum@0: { indvdum@0: $tmp_topic_data = array($post_info['topic_id'] => $post_info); indvdum@0: $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'])); indvdum@0: unset($tmp_topic_data); indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: $topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']); indvdum@0: } indvdum@0: indvdum@0: $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false; indvdum@0: indvdum@0: // Process message, leave it uncensored indvdum@0: $message = $post_info['post_text']; indvdum@0: indvdum@0: if ($post_info['bbcode_bitfield']) indvdum@0: { indvdum@0: include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); indvdum@0: $bbcode = new bbcode($post_info['bbcode_bitfield']); indvdum@0: $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); indvdum@0: } indvdum@0: indvdum@0: $message = bbcode_nl2br($message); indvdum@0: $message = smiley_text($message); indvdum@0: indvdum@0: if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) indvdum@0: { indvdum@0: $extensions = $cache->obtain_attach_extensions($post_info['forum_id']); indvdum@0: indvdum@0: $sql = 'SELECT * indvdum@0: FROM ' . ATTACHMENTS_TABLE . ' indvdum@0: WHERE post_msg_id = ' . $post_id . ' indvdum@0: AND in_message = 0 indvdum@0: ORDER BY filetime DESC, post_msg_id ASC'; indvdum@0: $result = $db->sql_query($sql); indvdum@0: indvdum@0: while ($row = $db->sql_fetchrow($result)) indvdum@0: { indvdum@0: $attachments[] = $row; indvdum@0: } indvdum@0: $db->sql_freeresult($result); indvdum@0: indvdum@0: if (sizeof($attachments)) indvdum@0: { indvdum@0: $update_count = array(); indvdum@0: parse_attachments($post_info['forum_id'], $message, $attachments, $update_count); indvdum@0: } indvdum@0: indvdum@0: // Display not already displayed Attachments for this post, we already parsed them. ;) indvdum@0: if (!empty($attachments)) indvdum@0: { indvdum@0: $template->assign_var('S_HAS_ATTACHMENTS', true); indvdum@0: indvdum@0: foreach ($attachments as $attachment) indvdum@0: { indvdum@0: $template->assign_block_vars('attachment', array( indvdum@0: 'DISPLAY_ATTACHMENT' => $attachment) indvdum@0: ); indvdum@0: } indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: $post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']); indvdum@0: $topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']); indvdum@0: indvdum@0: $template->assign_vars(array( indvdum@0: 'S_MCP_QUEUE' => true, indvdum@0: 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f=$forum_id"), indvdum@0: 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), indvdum@0: 'S_POST_REPORTED' => $post_info['post_reported'], indvdum@0: 'S_POST_UNAPPROVED' => !$post_info['post_approved'], indvdum@0: 'S_POST_LOCKED' => $post_info['post_edit_locked'], indvdum@0: 'S_USER_NOTES' => true, indvdum@0: indvdum@0: 'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '', indvdum@0: 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), indvdum@0: 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), indvdum@0: 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), indvdum@0: 'U_MCP_WARN_USER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', indvdum@0: 'U_VIEW_POST' => $post_url, indvdum@0: 'U_VIEW_TOPIC' => $topic_url, indvdum@0: indvdum@0: 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), indvdum@0: indvdum@0: 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '", ''), indvdum@0: 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '', ''), indvdum@0: 'RETURN_TOPIC_SIMPLE' => sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '', ''), indvdum@0: 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), indvdum@0: 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), indvdum@0: 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), indvdum@0: indvdum@0: 'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), indvdum@0: 'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), indvdum@0: 'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), indvdum@0: 'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), indvdum@0: indvdum@0: 'POST_PREVIEW' => $message, indvdum@0: 'POST_SUBJECT' => $post_info['post_subject'], indvdum@0: 'POST_DATE' => $user->format_date($post_info['post_time']), indvdum@0: 'POST_IP' => $post_info['poster_ip'], indvdum@0: 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '', indvdum@0: 'POST_ID' => $post_info['post_id'], indvdum@0: 'S_FIRST_POST' => ($post_info['topic_first_post_id'] == $post_id), indvdum@0: indvdum@0: 'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id . '&lookup=' . $post_info['poster_ip']) . '#ip' : '', indvdum@0: )); indvdum@0: indvdum@0: break; indvdum@0: indvdum@0: case 'unapproved_topics': indvdum@0: case 'unapproved_posts': indvdum@0: $user->add_lang(array('viewtopic', 'viewforum')); indvdum@0: indvdum@0: $topic_id = request_var('t', 0); indvdum@0: $forum_info = array(); indvdum@0: indvdum@0: if ($topic_id) indvdum@0: { indvdum@0: $topic_info = get_topic_data(array($topic_id)); indvdum@0: indvdum@0: if (!sizeof($topic_info)) indvdum@0: { indvdum@0: trigger_error('TOPIC_NOT_EXIST'); indvdum@0: } indvdum@0: indvdum@0: $topic_info = $topic_info[$topic_id]; indvdum@0: $forum_id = $topic_info['forum_id']; indvdum@0: } indvdum@0: indvdum@0: $forum_list_approve = get_forum_list('m_approve', false, true); indvdum@0: $forum_list_read = array_flip(get_forum_list('f_read', true, true)); // Flipped so we can isset() the forum IDs indvdum@0: indvdum@0: // Remove forums we cannot read indvdum@0: foreach ($forum_list_approve as $k => $forum_data) indvdum@0: { indvdum@0: if (!isset($forum_list_read[$forum_data['forum_id']])) indvdum@0: { indvdum@0: unset($forum_list_approve[$k]); indvdum@0: } indvdum@0: } indvdum@0: unset($forum_list_read); indvdum@0: indvdum@0: if (!$forum_id) indvdum@0: { indvdum@0: $forum_list = array(); indvdum@0: foreach ($forum_list_approve as $row) indvdum@0: { indvdum@0: $forum_list[] = $row['forum_id']; indvdum@0: } indvdum@0: indvdum@0: if (!sizeof($forum_list)) indvdum@0: { indvdum@0: trigger_error('NOT_MODERATOR'); indvdum@0: } indvdum@0: indvdum@0: $global_id = $forum_list[0]; indvdum@0: indvdum@0: $forum_list = implode(', ', $forum_list); indvdum@0: indvdum@0: $sql = 'SELECT SUM(forum_topics) as sum_forum_topics indvdum@0: FROM ' . FORUMS_TABLE . " indvdum@0: WHERE forum_id IN (0, $forum_list)"; indvdum@0: $result = $db->sql_query($sql); indvdum@0: $forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics'); indvdum@0: $db->sql_freeresult($result); indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: $forum_info = get_forum_data(array($forum_id), 'm_approve'); indvdum@0: indvdum@0: if (!sizeof($forum_info)) indvdum@0: { indvdum@0: trigger_error('NOT_MODERATOR'); indvdum@0: } indvdum@0: indvdum@0: $forum_info = $forum_info[$forum_id]; indvdum@0: $forum_list = $forum_id; indvdum@0: $global_id = $forum_id; indvdum@0: } indvdum@0: indvdum@0: $forum_options = ''; indvdum@0: foreach ($forum_list_approve as $row) indvdum@0: { indvdum@0: $forum_options .= ''; indvdum@0: } indvdum@0: indvdum@0: $sort_days = $total = 0; indvdum@0: $sort_key = $sort_dir = ''; indvdum@0: $sort_by_sql = $sort_order_sql = array(); indvdum@0: mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id); indvdum@0: indvdum@0: $forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total; indvdum@0: $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : ''; indvdum@0: indvdum@0: $forum_names = array(); indvdum@0: indvdum@0: if ($mode == 'unapproved_posts') indvdum@0: { indvdum@0: $sql = 'SELECT p.post_id indvdum@0: FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . " indvdum@0: WHERE p.forum_id IN (0, $forum_list) indvdum@0: AND p.post_approved = 0 indvdum@0: " . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . ' indvdum@0: ' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . " indvdum@0: AND t.topic_id = p.topic_id indvdum@0: AND t.topic_first_post_id <> p.post_id indvdum@0: $limit_time_sql indvdum@0: ORDER BY $sort_order_sql"; indvdum@0: $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); indvdum@0: indvdum@0: $i = 0; indvdum@0: $post_ids = array(); indvdum@0: while ($row = $db->sql_fetchrow($result)) indvdum@0: { indvdum@0: $post_ids[] = $row['post_id']; indvdum@0: $row_num[$row['post_id']] = $i++; indvdum@0: } indvdum@0: $db->sql_freeresult($result); indvdum@0: indvdum@0: if (sizeof($post_ids)) indvdum@0: { indvdum@0: $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 indvdum@0: FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u indvdum@0: WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' indvdum@0: AND t.topic_id = p.topic_id indvdum@0: AND u.user_id = p.poster_id indvdum@0: ORDER BY ' . $sort_order_sql; indvdum@0: $result = $db->sql_query($sql); indvdum@0: indvdum@0: $post_data = $rowset = array(); indvdum@0: while ($row = $db->sql_fetchrow($result)) indvdum@0: { indvdum@0: if ($row['forum_id']) indvdum@0: { indvdum@0: $forum_names[] = $row['forum_id']; indvdum@0: } indvdum@0: $post_data[$row['post_id']] = $row; indvdum@0: } indvdum@0: $db->sql_freeresult($result); indvdum@0: indvdum@0: foreach ($post_ids as $post_id) indvdum@0: { indvdum@0: $rowset[] = $post_data[$post_id]; indvdum@0: } indvdum@0: unset($post_data, $post_ids); indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: $rowset = array(); indvdum@0: } indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: $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 indvdum@0: FROM ' . TOPICS_TABLE . " t indvdum@0: WHERE forum_id IN (0, $forum_list) indvdum@0: AND topic_approved = 0 indvdum@0: $limit_time_sql indvdum@0: ORDER BY $sort_order_sql"; indvdum@0: $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); indvdum@0: indvdum@0: $rowset = array(); indvdum@0: while ($row = $db->sql_fetchrow($result)) indvdum@0: { indvdum@0: if ($row['forum_id']) indvdum@0: { indvdum@0: $forum_names[] = $row['forum_id']; indvdum@0: } indvdum@0: $rowset[] = $row; indvdum@0: } indvdum@0: $db->sql_freeresult($result); indvdum@0: } indvdum@0: indvdum@0: if (sizeof($forum_names)) indvdum@0: { indvdum@0: // Select the names for the forum_ids indvdum@0: $sql = 'SELECT forum_id, forum_name indvdum@0: FROM ' . FORUMS_TABLE . ' indvdum@0: WHERE ' . $db->sql_in_set('forum_id', $forum_names); indvdum@0: $result = $db->sql_query($sql, 3600); indvdum@0: indvdum@0: $forum_names = array(); indvdum@0: while ($row = $db->sql_fetchrow($result)) indvdum@0: { indvdum@0: $forum_names[$row['forum_id']] = $row['forum_name']; indvdum@0: } indvdum@0: $db->sql_freeresult($result); indvdum@0: } indvdum@0: indvdum@0: foreach ($rowset as $row) indvdum@0: { indvdum@0: $global_topic = ($row['forum_id']) ? false : true; indvdum@0: if ($global_topic) indvdum@0: { indvdum@0: $row['forum_id'] = $global_id; indvdum@0: } indvdum@0: indvdum@0: if (empty($row['post_username'])) indvdum@0: { indvdum@0: $row['post_username'] = $user->lang['GUEST']; indvdum@0: } indvdum@0: indvdum@0: $template->assign_block_vars('postrow', array( indvdum@0: 'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']), indvdum@0: 'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', indvdum@0: 'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''), indvdum@0: 'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&start=$start&mode=approve_details&f={$row['forum_id']}&p={$row['post_id']}" . (($mode == 'unapproved_topics') ? "&t={$row['topic_id']}" : '')), indvdum@0: indvdum@0: 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), indvdum@0: 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), indvdum@0: 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), indvdum@0: 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), indvdum@0: indvdum@0: 'POST_ID' => $row['post_id'], indvdum@0: 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'], indvdum@0: 'POST_SUBJECT' => ($row['post_subject'] != '') ? $row['post_subject'] : $user->lang['NO_SUBJECT'], indvdum@0: 'TOPIC_TITLE' => $row['topic_title'], indvdum@0: 'POST_TIME' => $user->format_date($row['post_time'])) indvdum@0: ); indvdum@0: } indvdum@0: unset($rowset, $forum_names); indvdum@0: indvdum@0: // Now display the page indvdum@0: $template->assign_vars(array( indvdum@0: 'L_DISPLAY_ITEMS' => ($mode == 'unapproved_posts') ? $user->lang['DISPLAY_POSTS'] : $user->lang['DISPLAY_TOPICS'], indvdum@0: 'L_EXPLAIN' => ($mode == 'unapproved_posts') ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS_EXPLAIN'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS_EXPLAIN'], indvdum@0: 'L_TITLE' => ($mode == 'unapproved_posts') ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS'], indvdum@0: 'L_ONLY_TOPIC' => ($topic_id) ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '', indvdum@0: indvdum@0: 'S_FORUM_OPTIONS' => $forum_options, indvdum@0: 'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')), indvdum@0: 'S_TOPICS' => ($mode == 'unapproved_posts') ? false : true, indvdum@0: indvdum@0: 'PAGINATION' => generate_pagination($this->u_action . "&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $config['topics_per_page'], $start), indvdum@0: 'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start), indvdum@0: 'TOPIC_ID' => $topic_id, indvdum@0: '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), indvdum@0: )); indvdum@0: indvdum@0: $this->tpl_name = 'mcp_queue'; indvdum@0: break; indvdum@0: } indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: /** indvdum@0: * Approve Post/Topic indvdum@0: */ indvdum@0: function approve_post($post_id_list, $id, $mode) indvdum@0: { indvdum@0: global $db, $template, $user, $config; indvdum@0: global $phpEx, $phpbb_root_path; indvdum@0: indvdum@0: if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) indvdum@0: { indvdum@0: trigger_error('NOT_AUTHORISED'); indvdum@0: } indvdum@0: indvdum@0: $redirect = request_var('redirect', build_url(array('quickmod'))); indvdum@0: $success_msg = ''; indvdum@0: indvdum@0: $s_hidden_fields = build_hidden_fields(array( indvdum@0: 'i' => $id, indvdum@0: 'mode' => $mode, indvdum@0: 'post_id_list' => $post_id_list, indvdum@0: 'action' => 'approve', indvdum@0: 'redirect' => $redirect) indvdum@0: ); indvdum@0: indvdum@0: $post_info = get_post_data($post_id_list, 'm_approve'); indvdum@0: indvdum@0: if (confirm_box(true)) indvdum@0: { indvdum@0: $notify_poster = (isset($_REQUEST['notify_poster'])) ? true : false; indvdum@0: indvdum@0: // If Topic -> total_topics = total_topics+1, total_posts = total_posts+1, forum_topics = forum_topics+1, forum_posts = forum_posts+1 indvdum@0: // If Post -> total_posts = total_posts+1, forum_posts = forum_posts+1, topic_replies = topic_replies+1 indvdum@0: indvdum@0: $total_topics = $total_posts = 0; indvdum@0: $topic_approve_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array(); indvdum@0: $user_posts_sql = $post_approved_list = array(); indvdum@0: indvdum@0: foreach ($post_info as $post_id => $post_data) indvdum@0: { indvdum@0: if ($post_data['post_approved']) indvdum@0: { indvdum@0: $post_approved_list[] = $post_id; indvdum@0: continue; indvdum@0: } indvdum@0: indvdum@0: $topic_id_list[$post_data['topic_id']] = 1; indvdum@0: indvdum@0: if ($post_data['forum_id']) indvdum@0: { indvdum@0: $forum_id_list[$post_data['forum_id']] = 1; indvdum@0: } indvdum@0: indvdum@0: // User post update (we do not care about topic or post, since user posts are strictly connected to posts) indvdum@0: // But we care about forums where post counts get not increased. ;) indvdum@0: if ($post_data['post_postcount']) indvdum@0: { indvdum@0: $user_posts_sql[$post_data['poster_id']] = (empty($user_posts_sql[$post_data['poster_id']])) ? 1 : $user_posts_sql[$post_data['poster_id']] + 1; indvdum@0: } indvdum@0: indvdum@0: // Topic or Post. ;) indvdum@0: if ($post_data['topic_first_post_id'] == $post_id) indvdum@0: { indvdum@0: if ($post_data['forum_id']) indvdum@0: { indvdum@0: $total_topics++; indvdum@0: } indvdum@0: $topic_approve_sql[] = $post_data['topic_id']; indvdum@0: indvdum@0: $approve_log[] = array( indvdum@0: 'type' => 'topic', indvdum@0: 'post_subject' => $post_data['post_subject'], indvdum@0: 'forum_id' => $post_data['forum_id'], indvdum@0: 'topic_id' => $post_data['topic_id'], indvdum@0: ); indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: $approve_log[] = array( indvdum@0: 'type' => 'post', indvdum@0: 'post_subject' => $post_data['post_subject'], indvdum@0: 'forum_id' => $post_data['forum_id'], indvdum@0: 'topic_id' => $post_data['topic_id'], indvdum@0: ); indvdum@0: } indvdum@0: indvdum@0: if ($post_data['forum_id']) indvdum@0: { indvdum@0: $total_posts++; indvdum@0: indvdum@0: // Increment by topic_replies if we approve a topic... indvdum@0: // This works because we do not adjust the topic_replies when re-approving a topic after an edit. indvdum@0: if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_replies']) indvdum@0: { indvdum@0: $total_posts += $post_data['topic_replies']; indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: $post_approve_sql[] = $post_id; indvdum@0: } indvdum@0: indvdum@0: $post_id_list = array_values(array_diff($post_id_list, $post_approved_list)); indvdum@0: for ($i = 0, $size = sizeof($post_approved_list); $i < $size; $i++) indvdum@0: { indvdum@0: unset($post_info[$post_approved_list[$i]]); indvdum@0: } indvdum@0: indvdum@0: if (sizeof($topic_approve_sql)) indvdum@0: { indvdum@0: $sql = 'UPDATE ' . TOPICS_TABLE . ' indvdum@0: SET topic_approved = 1 indvdum@0: WHERE ' . $db->sql_in_set('topic_id', $topic_approve_sql); indvdum@0: $db->sql_query($sql); indvdum@0: } indvdum@0: indvdum@0: if (sizeof($post_approve_sql)) indvdum@0: { indvdum@0: $sql = 'UPDATE ' . POSTS_TABLE . ' indvdum@0: SET post_approved = 1 indvdum@0: WHERE ' . $db->sql_in_set('post_id', $post_approve_sql); indvdum@0: $db->sql_query($sql); indvdum@0: } indvdum@0: indvdum@0: unset($topic_approve_sql, $post_approve_sql); indvdum@0: indvdum@0: foreach ($approve_log as $log_data) indvdum@0: { indvdum@0: add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_APPROVED' : 'LOG_POST_APPROVED', $log_data['post_subject']); indvdum@0: } indvdum@0: indvdum@0: if (sizeof($user_posts_sql)) indvdum@0: { indvdum@0: // Try to minimize the query count by merging users with the same post count additions indvdum@0: $user_posts_update = array(); indvdum@0: indvdum@0: foreach ($user_posts_sql as $user_id => $user_posts) indvdum@0: { indvdum@0: $user_posts_update[$user_posts][] = $user_id; indvdum@0: } indvdum@0: indvdum@0: foreach ($user_posts_update as $user_posts => $user_id_ary) indvdum@0: { indvdum@0: $sql = 'UPDATE ' . USERS_TABLE . ' indvdum@0: SET user_posts = user_posts + ' . $user_posts . ' indvdum@0: WHERE ' . $db->sql_in_set('user_id', $user_id_ary); indvdum@0: $db->sql_query($sql); indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: if ($total_topics) indvdum@0: { indvdum@0: set_config_count('num_topics', $total_topics, true); indvdum@0: } indvdum@0: indvdum@0: if ($total_posts) indvdum@0: { indvdum@0: set_config_count('num_posts', $total_posts, true); indvdum@0: } indvdum@0: indvdum@0: sync('topic', 'topic_id', array_keys($topic_id_list), true); indvdum@0: sync('forum', 'forum_id', array_keys($forum_id_list), true, true); indvdum@0: unset($topic_id_list, $forum_id_list); indvdum@0: indvdum@0: $messenger = new messenger(); indvdum@0: indvdum@0: // Notify Poster? indvdum@0: if ($notify_poster) indvdum@0: { indvdum@0: foreach ($post_info as $post_id => $post_data) indvdum@0: { indvdum@0: if ($post_data['poster_id'] == ANONYMOUS) indvdum@0: { indvdum@0: continue; indvdum@0: } indvdum@0: indvdum@0: $email_template = ($post_data['post_id'] == $post_data['topic_first_post_id'] && $post_data['post_id'] == $post_data['topic_last_post_id']) ? 'topic_approved' : 'post_approved'; indvdum@0: indvdum@0: $messenger->template($email_template, $post_data['user_lang']); indvdum@0: indvdum@0: $messenger->to($post_data['user_email'], $post_data['username']); indvdum@0: $messenger->im($post_data['user_jabber'], $post_data['username']); indvdum@0: indvdum@0: $messenger->assign_vars(array( indvdum@0: 'USERNAME' => htmlspecialchars_decode($post_data['username']), indvdum@0: 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_data['post_subject'])), indvdum@0: 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_data['topic_title'])), indvdum@0: indvdum@0: 'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f={$post_data['forum_id']}&t={$post_data['topic_id']}&e=0", indvdum@0: 'U_VIEW_POST' => generate_board_url() . "/viewtopic.$phpEx?f={$post_data['forum_id']}&t={$post_data['topic_id']}&p=$post_id&e=$post_id") indvdum@0: ); indvdum@0: indvdum@0: $messenger->send($post_data['user_notify_type']); indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: $messenger->save_queue(); indvdum@0: indvdum@0: // Send out normal user notifications indvdum@0: $email_sig = str_replace('
', "\n", "-- \n" . $config['board_email_sig']); indvdum@0: indvdum@0: foreach ($post_info as $post_id => $post_data) indvdum@0: { indvdum@0: if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) indvdum@0: { indvdum@0: // Forum Notifications indvdum@0: user_notification('post', $post_data['topic_title'], $post_data['topic_title'], $post_data['forum_name'], $post_data['forum_id'], $post_data['topic_id'], $post_id); indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: // Topic Notifications indvdum@0: user_notification('reply', $post_data['post_subject'], $post_data['topic_title'], $post_data['forum_name'], $post_data['forum_id'], $post_data['topic_id'], $post_id); indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: if (sizeof($post_id_list) == 1) indvdum@0: { indvdum@0: $post_data = $post_info[$post_id_list[0]]; indvdum@0: $post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$post_data['forum_id']}&t={$post_data['topic_id']}&p={$post_data['post_id']}") . '#p' . $post_data['post_id']; indvdum@0: } indvdum@0: unset($post_info); indvdum@0: indvdum@0: if ($total_topics) indvdum@0: { indvdum@0: $success_msg = ($total_topics == 1) ? 'TOPIC_APPROVED_SUCCESS' : 'TOPICS_APPROVED_SUCCESS'; indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: $success_msg = (sizeof($post_id_list) + sizeof($post_approved_list) == 1) ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS'; indvdum@0: } indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: $show_notify = false; indvdum@0: indvdum@0: if ($config['email_enable'] || $config['jab_enable']) indvdum@0: { indvdum@0: foreach ($post_info as $post_data) indvdum@0: { indvdum@0: if ($post_data['poster_id'] == ANONYMOUS) indvdum@0: { indvdum@0: continue; indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: $show_notify = true; indvdum@0: break; indvdum@0: } indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: $template->assign_vars(array( indvdum@0: 'S_NOTIFY_POSTER' => $show_notify, indvdum@0: 'S_APPROVE' => true) indvdum@0: ); indvdum@0: indvdum@0: confirm_box(false, 'APPROVE_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); indvdum@0: } indvdum@0: indvdum@0: $redirect = request_var('redirect', "index.$phpEx"); indvdum@0: $redirect = reapply_sid($redirect); indvdum@0: indvdum@0: if (!$success_msg) indvdum@0: { indvdum@0: redirect($redirect); indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: meta_refresh(3, $redirect); indvdum@0: indvdum@0: // If approving one post, also give links back to post... indvdum@0: $add_message = ''; indvdum@0: if (sizeof($post_id_list) == 1 && !empty($post_url)) indvdum@0: { indvdum@0: $add_message = '

' . sprintf($user->lang['RETURN_POST'], '', ''); indvdum@0: } indvdum@0: indvdum@0: trigger_error($user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_PAGE'], "", '') . $add_message); indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: /** indvdum@0: * Disapprove Post/Topic indvdum@0: */ indvdum@0: function disapprove_post($post_id_list, $id, $mode) indvdum@0: { indvdum@0: global $db, $template, $user, $config; indvdum@0: global $phpEx, $phpbb_root_path; indvdum@0: indvdum@0: if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) indvdum@0: { indvdum@0: trigger_error('NOT_AUTHORISED'); indvdum@0: } indvdum@0: indvdum@0: $redirect = request_var('redirect', build_url(array('t', 'mode', 'quickmod')) . "&mode=$mode"); indvdum@0: $reason = utf8_normalize_nfc(request_var('reason', '', true)); indvdum@0: $reason_id = request_var('reason_id', 0); indvdum@0: $success_msg = $additional_msg = ''; indvdum@0: indvdum@0: $s_hidden_fields = build_hidden_fields(array( indvdum@0: 'i' => $id, indvdum@0: 'mode' => $mode, indvdum@0: 'post_id_list' => $post_id_list, indvdum@0: 'action' => 'disapprove', indvdum@0: 'redirect' => $redirect) indvdum@0: ); indvdum@0: indvdum@0: $notify_poster = (isset($_REQUEST['notify_poster'])) ? true : false; indvdum@0: $disapprove_reason = ''; indvdum@0: indvdum@0: if ($reason_id) indvdum@0: { indvdum@0: $sql = 'SELECT reason_title, reason_description indvdum@0: FROM ' . REPORTS_REASONS_TABLE . " indvdum@0: WHERE reason_id = $reason_id"; indvdum@0: $result = $db->sql_query($sql); indvdum@0: $row = $db->sql_fetchrow($result); indvdum@0: $db->sql_freeresult($result); indvdum@0: indvdum@0: if (!$row || (!$reason && strtolower($row['reason_title']) == 'other')) indvdum@0: { indvdum@0: $additional_msg = $user->lang['NO_REASON_DISAPPROVAL']; indvdum@0: unset($_REQUEST['confirm_key']); indvdum@0: unset($_POST['confirm_key']); indvdum@0: unset($_POST['confirm']); indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: // If the reason is defined within the language file, we will use the localized version, else just use the database entry... indvdum@0: $disapprove_reason = (strtolower($row['reason_title']) != 'other') ? ((isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) ? $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])] : $row['reason_description']) : ''; indvdum@0: $disapprove_reason .= ($reason) ? "\n\n" . $reason : ''; indvdum@0: indvdum@0: if (isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) indvdum@0: { indvdum@0: $disapprove_reason_lang = strtoupper($row['reason_title']); indvdum@0: } indvdum@0: indvdum@0: $email_disapprove_reason = $disapprove_reason; indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: $post_info = get_post_data($post_id_list, 'm_approve'); indvdum@0: indvdum@0: if (confirm_box(true)) indvdum@0: { indvdum@0: $disapprove_log = $disapprove_log_topics = $disapprove_log_posts = array(); indvdum@0: $topic_replies_real = $post_disapprove_list = array(); indvdum@0: indvdum@0: // Build a list of posts to be unapproved and get the related topics real replies count indvdum@0: foreach ($post_info as $post_id => $post_data) indvdum@0: { indvdum@0: $post_disapprove_list[$post_id] = $post_data['topic_id']; indvdum@0: if (!isset($topic_replies_real[$post_data['topic_id']])) indvdum@0: { indvdum@0: $topic_replies_real[$post_data['topic_id']] = $post_data['topic_replies_real']; indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: // Now we build the log array indvdum@0: foreach ($post_disapprove_list as $post_id => $topic_id) indvdum@0: { indvdum@0: // If the count of disapproved posts for the topic is greater indvdum@0: // than topic's real replies count, the whole topic is disapproved/deleted indvdum@0: if (sizeof(array_keys($post_disapprove_list, $topic_id)) > $topic_replies_real[$topic_id]) indvdum@0: { indvdum@0: // Don't write the log more than once for every topic indvdum@0: if (!isset($disapprove_log_topics[$topic_id])) indvdum@0: { indvdum@0: // Build disapproved topics log indvdum@0: $disapprove_log_topics[$topic_id] = array( indvdum@0: 'type' => 'topic', indvdum@0: 'post_subject' => $post_info[$post_id]['topic_title'], indvdum@0: 'forum_id' => $post_info[$post_id]['forum_id'], indvdum@0: 'topic_id' => 0, // useless to log a topic id, as it will be deleted indvdum@0: ); indvdum@0: } indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: // Build disapproved posts log indvdum@0: $disapprove_log_posts[] = array( indvdum@0: 'type' => 'post', indvdum@0: 'post_subject' => $post_info[$post_id]['post_subject'], indvdum@0: 'forum_id' => $post_info[$post_id]['forum_id'], indvdum@0: 'topic_id' => $post_info[$post_id]['topic_id'], indvdum@0: ); indvdum@0: indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: // Get disapproved posts/topics counts separately indvdum@0: $num_disapproved_topics = sizeof($disapprove_log_topics); indvdum@0: $num_disapproved_posts = sizeof($disapprove_log_posts); indvdum@0: indvdum@0: // Build the whole log indvdum@0: $disapprove_log = array_merge($disapprove_log_topics, $disapprove_log_posts); indvdum@0: indvdum@0: // Unset unneeded arrays indvdum@0: unset($post_data, $disapprove_log_topics, $disapprove_log_posts); indvdum@0: indvdum@0: // Let's do the job - delete disapproved posts indvdum@0: if (sizeof($post_disapprove_list)) indvdum@0: { indvdum@0: if (!function_exists('delete_posts')) indvdum@0: { indvdum@0: include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); indvdum@0: } indvdum@0: indvdum@0: // We do not check for permissions here, because the moderator allowed approval/disapproval should be allowed to delete the disapproved posts indvdum@0: // Note: function delete_posts triggers related forums/topics sync, indvdum@0: // so we don't need to call update_post_information later and to adjust real topic replies or forum topics count manually indvdum@0: delete_posts('post_id', array_keys($post_disapprove_list)); indvdum@0: indvdum@0: foreach ($disapprove_log as $log_data) indvdum@0: { indvdum@0: add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_DISAPPROVED' : 'LOG_POST_DISAPPROVED', $log_data['post_subject'], $disapprove_reason); indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: $messenger = new messenger(); indvdum@0: indvdum@0: // Notify Poster? indvdum@0: if ($notify_poster) indvdum@0: { indvdum@0: $lang_reasons = array(); indvdum@0: indvdum@0: foreach ($post_info as $post_id => $post_data) indvdum@0: { indvdum@0: if ($post_data['poster_id'] == ANONYMOUS) indvdum@0: { indvdum@0: continue; indvdum@0: } indvdum@0: indvdum@0: if (isset($disapprove_reason_lang)) indvdum@0: { indvdum@0: // Okay we need to get the reason from the posters language indvdum@0: if (!isset($lang_reasons[$post_data['user_lang']])) indvdum@0: { indvdum@0: // Assign the current users translation as the default, this is not ideal but getting the board default adds another layer of complexity. indvdum@0: $lang_reasons[$post_data['user_lang']] = $user->lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang]; indvdum@0: indvdum@0: // Only load up the language pack if the language is different to the current one indvdum@0: if ($post_data['user_lang'] != $user->lang_name && file_exists($phpbb_root_path . '/language/' . $post_data['user_lang'] . '/mcp.' . $phpEx)) indvdum@0: { indvdum@0: // Load up the language pack indvdum@0: $lang = array(); indvdum@0: @include($phpbb_root_path . '/language/' . basename($post_data['user_lang']) . '/mcp.' . $phpEx); indvdum@0: indvdum@0: // If we find the reason in this language pack use it indvdum@0: if (isset($lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang])) indvdum@0: { indvdum@0: $lang_reasons[$post_data['user_lang']] = $lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang]; indvdum@0: } indvdum@0: indvdum@0: unset($lang); // Free memory indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: $email_disapprove_reason = $lang_reasons[$post_data['user_lang']]; indvdum@0: $email_disapprove_reason .= ($reason) ? "\n\n" . $reason : ''; indvdum@0: } indvdum@0: indvdum@0: $email_template = ($post_data['post_id'] == $post_data['topic_first_post_id'] && $post_data['post_id'] == $post_data['topic_last_post_id']) ? 'topic_disapproved' : 'post_disapproved'; indvdum@0: indvdum@0: $messenger->template($email_template, $post_data['user_lang']); indvdum@0: indvdum@0: $messenger->to($post_data['user_email'], $post_data['username']); indvdum@0: $messenger->im($post_data['user_jabber'], $post_data['username']); indvdum@0: indvdum@0: $messenger->assign_vars(array( indvdum@0: 'USERNAME' => htmlspecialchars_decode($post_data['username']), indvdum@0: 'REASON' => htmlspecialchars_decode($email_disapprove_reason), indvdum@0: 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_data['post_subject'])), indvdum@0: 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_data['topic_title']))) indvdum@0: ); indvdum@0: indvdum@0: $messenger->send($post_data['user_notify_type']); indvdum@0: } indvdum@0: indvdum@0: unset($lang_reasons); indvdum@0: } indvdum@0: unset($post_info, $disapprove_reason, $email_disapprove_reason, $disapprove_reason_lang); indvdum@0: indvdum@0: $messenger->save_queue(); indvdum@0: indvdum@0: if ($num_disapproved_topics) indvdum@0: { indvdum@0: $success_msg = ($num_disapproved_topics == 1) ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS'; indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: $success_msg = ($num_disapproved_posts == 1) ? 'POST_DISAPPROVED_SUCCESS' : 'POSTS_DISAPPROVED_SUCCESS'; indvdum@0: } indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx); indvdum@0: indvdum@0: display_reasons($reason_id); indvdum@0: indvdum@0: $show_notify = false; indvdum@0: indvdum@0: foreach ($post_info as $post_data) indvdum@0: { indvdum@0: if ($post_data['poster_id'] == ANONYMOUS) indvdum@0: { indvdum@0: continue; indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: $show_notify = true; indvdum@0: break; indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: $template->assign_vars(array( indvdum@0: 'S_NOTIFY_POSTER' => $show_notify, indvdum@0: 'S_APPROVE' => false, indvdum@0: 'REASON' => $reason, indvdum@0: 'ADDITIONAL_MSG' => $additional_msg) indvdum@0: ); indvdum@0: indvdum@0: confirm_box(false, 'DISAPPROVE_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); indvdum@0: } indvdum@0: indvdum@0: $redirect = request_var('redirect', "index.$phpEx"); indvdum@0: $redirect = reapply_sid($redirect); indvdum@0: indvdum@0: if (!$success_msg) indvdum@0: { indvdum@0: redirect($redirect); indvdum@0: } indvdum@0: else indvdum@0: { indvdum@0: meta_refresh(3, $redirect); indvdum@0: trigger_error($user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_PAGE'], "", '')); indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: ?>