aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/modules/mcp
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/modules/mcp')
-rw-r--r--phpBB/modules/mcp/info/mcp_ban.php39
-rw-r--r--phpBB/modules/mcp/info/mcp_logs.php39
-rw-r--r--phpBB/modules/mcp/info/mcp_main.php40
-rw-r--r--phpBB/modules/mcp/info/mcp_notes.php38
-rw-r--r--phpBB/modules/mcp/info/mcp_queue.php39
-rw-r--r--phpBB/modules/mcp/info/mcp_reports.php39
-rw-r--r--phpBB/modules/mcp/info/mcp_warn.php40
-rw-r--r--phpBB/modules/mcp/mcp_ban.php214
-rw-r--r--phpBB/modules/mcp/mcp_forum.php445
-rw-r--r--phpBB/modules/mcp/mcp_front.php282
-rw-r--r--phpBB/modules/mcp/mcp_logs.php209
-rw-r--r--phpBB/modules/mcp/mcp_main.php1211
-rw-r--r--phpBB/modules/mcp/mcp_notes.php240
-rw-r--r--phpBB/modules/mcp/mcp_post.php497
-rw-r--r--phpBB/modules/mcp/mcp_queue.php1078
-rw-r--r--phpBB/modules/mcp/mcp_reports.php652
-rw-r--r--phpBB/modules/mcp/mcp_topic.php627
-rw-r--r--phpBB/modules/mcp/mcp_warn.php495
18 files changed, 0 insertions, 6224 deletions
diff --git a/phpBB/modules/mcp/info/mcp_ban.php b/phpBB/modules/mcp/info/mcp_ban.php
deleted file mode 100644
index 383df30498..0000000000
--- a/phpBB/modules/mcp/info/mcp_ban.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @package module_install
-*/
-class mcp_ban_info
-{
- function module()
- {
- return array(
- 'filename' => 'mcp_ban',
- 'title' => 'MCP_BAN',
- 'version' => '1.0.0',
- 'modes' => array(
- 'user' => array('title' => 'MCP_BAN_USERNAMES', 'auth' => 'acl_m_ban', 'cat' => array('MCP_BAN')),
- 'ip' => array('title' => 'MCP_BAN_IPS', 'auth' => 'acl_m_ban', 'cat' => array('MCP_BAN')),
- 'email' => array('title' => 'MCP_BAN_EMAILS', 'auth' => 'acl_m_ban', 'cat' => array('MCP_BAN')),
- ),
- );
- }
-
- function install()
- {
- }
-
- function uninstall()
- {
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/info/mcp_logs.php b/phpBB/modules/mcp/info/mcp_logs.php
deleted file mode 100644
index fe2f9fa1d7..0000000000
--- a/phpBB/modules/mcp/info/mcp_logs.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @package module_install
-*/
-class mcp_logs_info
-{
- function module()
- {
- return array(
- 'filename' => 'mcp_logs',
- 'title' => 'MCP_LOGS',
- 'version' => '1.0.0',
- 'modes' => array(
- 'front' => array('title' => 'MCP_LOGS_FRONT', 'auth' => 'acl_m_ || aclf_m_', 'cat' => array('MCP_LOGS')),
- 'forum_logs' => array('title' => 'MCP_LOGS_FORUM_VIEW', 'auth' => 'acl_m_,$id', 'cat' => array('MCP_LOGS')),
- 'topic_logs' => array('title' => 'MCP_LOGS_TOPIC_VIEW', 'auth' => 'acl_m_,$id', 'cat' => array('MCP_LOGS')),
- ),
- );
- }
-
- function install()
- {
- }
-
- function uninstall()
- {
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/info/mcp_main.php b/phpBB/modules/mcp/info/mcp_main.php
deleted file mode 100644
index 9755cdfc07..0000000000
--- a/phpBB/modules/mcp/info/mcp_main.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @package module_install
-*/
-class mcp_main_info
-{
- function module()
- {
- return array(
- 'filename' => 'mcp_main',
- 'title' => 'MCP_MAIN',
- 'version' => '1.0.0',
- 'modes' => array(
- 'front' => array('title' => 'MCP_MAIN_FRONT', 'auth' => '', 'cat' => array('MCP_MAIN')),
- 'forum_view' => array('title' => 'MCP_MAIN_FORUM_VIEW', 'auth' => 'acl_m_,$id', 'cat' => array('MCP_MAIN')),
- 'topic_view' => array('title' => 'MCP_MAIN_TOPIC_VIEW', 'auth' => 'acl_m_,$id', 'cat' => array('MCP_MAIN')),
- 'post_details' => array('title' => 'MCP_MAIN_POST_DETAILS', 'auth' => 'acl_m_,$id || (!$id && aclf_m_)', 'cat' => array('MCP_MAIN')),
- ),
- );
- }
-
- function install()
- {
- }
-
- function uninstall()
- {
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/info/mcp_notes.php b/phpBB/modules/mcp/info/mcp_notes.php
deleted file mode 100644
index afe232e5b5..0000000000
--- a/phpBB/modules/mcp/info/mcp_notes.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @package module_install
-*/
-class mcp_notes_info
-{
- function module()
- {
- return array(
- 'filename' => 'mcp_notes',
- 'title' => 'MCP_NOTES',
- 'version' => '1.0.0',
- 'modes' => array(
- 'front' => array('title' => 'MCP_NOTES_FRONT', 'auth' => '', 'cat' => array('MCP_NOTES')),
- 'user_notes' => array('title' => 'MCP_NOTES_USER', 'auth' => '', 'cat' => array('MCP_NOTES')),
- ),
- );
- }
-
- function install()
- {
- }
-
- function uninstall()
- {
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/info/mcp_queue.php b/phpBB/modules/mcp/info/mcp_queue.php
deleted file mode 100644
index 7a256642b9..0000000000
--- a/phpBB/modules/mcp/info/mcp_queue.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @package module_install
-*/
-class mcp_queue_info
-{
- function module()
- {
- return array(
- 'filename' => 'mcp_queue',
- 'title' => 'MCP_QUEUE',
- 'version' => '1.0.0',
- 'modes' => array(
- 'unapproved_topics' => array('title' => 'MCP_QUEUE_UNAPPROVED_TOPICS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')),
- 'unapproved_posts' => array('title' => 'MCP_QUEUE_UNAPPROVED_POSTS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')),
- 'approve_details' => array('title' => 'MCP_QUEUE_APPROVE_DETAILS', 'auth' => 'acl_m_approve,$id || (!$id && aclf_m_approve)', 'cat' => array('MCP_QUEUE')),
- ),
- );
- }
-
- function install()
- {
- }
-
- function uninstall()
- {
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/info/mcp_reports.php b/phpBB/modules/mcp/info/mcp_reports.php
deleted file mode 100644
index 3893ba5abb..0000000000
--- a/phpBB/modules/mcp/info/mcp_reports.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @package module_install
-*/
-class mcp_reports_info
-{
- function module()
- {
- return array(
- 'filename' => 'mcp_reports',
- 'title' => 'MCP_REPORTS',
- 'version' => '1.0.0',
- 'modes' => array(
- 'reports' => array('title' => 'MCP_REPORTS_OPEN', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')),
- 'reports_closed' => array('title' => 'MCP_REPORTS_CLOSED', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')),
- 'report_details' => array('title' => 'MCP_REPORT_DETAILS', 'auth' => 'acl_m_report,$id || (!$id && aclf_m_report)', 'cat' => array('MCP_REPORTS')),
- ),
- );
- }
-
- function install()
- {
- }
-
- function uninstall()
- {
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/info/mcp_warn.php b/phpBB/modules/mcp/info/mcp_warn.php
deleted file mode 100644
index 2b0b09f75a..0000000000
--- a/phpBB/modules/mcp/info/mcp_warn.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @package module_install
-*/
-class mcp_warn_info
-{
- function module()
- {
- return array(
- 'filename' => 'mcp_warn',
- 'title' => 'MCP_WARN',
- 'version' => '1.0.0',
- 'modes' => array(
- 'front' => array('title' => 'MCP_WARN_FRONT', 'auth' => 'aclf_m_warn', 'cat' => array('MCP_WARN')),
- 'list' => array('title' => 'MCP_WARN_LIST', 'auth' => 'aclf_m_warn', 'cat' => array('MCP_WARN')),
- 'warn_user' => array('title' => 'MCP_WARN_USER', 'auth' => 'aclf_m_warn', 'cat' => array('MCP_WARN')),
- 'warn_post' => array('title' => 'MCP_WARN_POST', 'auth' => 'acl_m_warn && acl_f_read,$id', 'cat' => array('MCP_WARN')),
- ),
- );
- }
-
- function install()
- {
- }
-
- function uninstall()
- {
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/mcp_ban.php b/phpBB/modules/mcp/mcp_ban.php
deleted file mode 100644
index bcf895ebeb..0000000000
--- a/phpBB/modules/mcp/mcp_ban.php
+++ /dev/null
@@ -1,214 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* @package mcp
-*/
-class mcp_ban
-{
- var $u_action;
-
- function main($id, $mode)
- {
- include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
-
- // Include the admin banning interface...
- include(PHPBB_ROOT_PATH . 'includes/acp/acp_ban.' . PHP_EXT);
-
- $bansubmit = phpbb_request::is_set_post('bansubmit');
- $unbansubmit = phpbb_request::is_set_post('unbansubmit');
- $current_time = time();
-
- phpbb::$user->add_lang(array('acp/ban', 'acp/users'));
- $this->tpl_name = 'mcp_ban';
-
- // Ban submitted?
- if ($bansubmit)
- {
- // Grab the list of entries
- $ban = request_var('ban', '', ($mode === 'user') ? true : false);
-
- if ($mode === 'user')
- {
- $ban = utf8_normalize_nfc($ban);
- }
-
- $ban_len = request_var('banlength', 0);
- $ban_len_other = request_var('banlengthother', '');
- $ban_exclude = request_var('banexclude', 0);
- $ban_reason = utf8_normalize_nfc(request_var('banreason', '', true));
- $ban_give_reason = utf8_normalize_nfc(request_var('bangivereason', '', true));
-
- if ($ban)
- {
- if (confirm_box(true))
- {
- user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason);
-
- trigger_error(phpbb::$user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">&laquo; ' . phpbb::$user->lang['BACK_TO_PREV'] . '</a>');
- }
- else
- {
- confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
- 'mode' => $mode,
- 'ban' => $ban,
- 'bansubmit' => true,
- 'banlength' => $ban_len,
- 'banlengthother' => $ban_len_other,
- 'banexclude' => $ban_exclude,
- 'banreason' => $ban_reason,
- 'bangivereason' => $ban_give_reason)));
- }
- }
- }
- else if ($unbansubmit)
- {
- $ban = request_var('unban', array(''));
-
- if ($ban)
- {
- if (confirm_box(true))
- {
- user_unban($mode, $ban);
-
- trigger_error(phpbb::$user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">&laquo; ' . phpbb::$user->lang['BACK_TO_PREV'] . '</a>');
- }
- else
- {
- confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
- 'mode' => $mode,
- 'unbansubmit' => true,
- 'unban' => $ban)));
- }
- }
- }
-
- // Ban length options
- $ban_end_text = array(0 => phpbb::$user->lang['PERMANENT'], 30 => phpbb::$user->lang['30_MINS'], 60 => phpbb::$user->lang['1_HOUR'], 360 => phpbb::$user->lang['6_HOURS'], 1440 => phpbb::$user->lang['1_DAY'], 10080 => phpbb::$user->lang['7_DAYS'], 20160 => phpbb::$user->lang['2_WEEKS'], 40320 => phpbb::$user->lang['1_MONTH'], -1 => phpbb::$user->lang['UNTIL'] . ' -&gt; ');
-
- $ban_end_options = '';
- foreach ($ban_end_text as $length => $text)
- {
- $ban_end_options .= '<option value="' . $length . '">' . $text . '</option>';
- }
-
- // Define language vars
- $this->page_title = phpbb::$user->lang[strtoupper($mode) . '_BAN'];
-
- $l_ban_explain = phpbb::$user->lang[strtoupper($mode) . '_BAN_EXPLAIN'];
- $l_ban_exclude_explain = phpbb::$user->lang[strtoupper($mode) . '_BAN_EXCLUDE_EXPLAIN'];
- $l_unban_title = phpbb::$user->lang[strtoupper($mode) . '_UNBAN'];
- $l_unban_explain = phpbb::$user->lang[strtoupper($mode) . '_UNBAN_EXPLAIN'];
- $l_no_ban_cell = phpbb::$user->lang[strtoupper($mode) . '_NO_BANNED'];
-
- switch ($mode)
- {
- case 'user':
- $l_ban_cell = phpbb::$user->lang['USERNAME'];
- break;
-
- case 'ip':
- $l_ban_cell = phpbb::$user->lang['IP_HOSTNAME'];
- break;
-
- case 'email':
- $l_ban_cell = phpbb::$user->lang['EMAIL_ADDRESS'];
- break;
- }
-
- acp_ban::display_ban_options($mode);
-
- phpbb::$template->assign_vars(array(
- 'L_TITLE' => $this->page_title,
- 'L_EXPLAIN' => $l_ban_explain,
- 'L_UNBAN_TITLE' => $l_unban_title,
- 'L_UNBAN_EXPLAIN' => $l_unban_explain,
- 'L_BAN_CELL' => $l_ban_cell,
- 'L_BAN_EXCLUDE_EXPLAIN' => $l_ban_exclude_explain,
- 'L_NO_BAN_CELL' => $l_no_ban_cell,
-
- 'S_USERNAME_BAN' => ($mode == 'user') ? true : false,
-
- 'U_ACTION' => $this->u_action,
- 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&amp;form=mcp_ban&amp;field=ban'),
- ));
-
- if ($mode === 'email' && !phpbb::$acl->acl_get('a_user'))
- {
- return;
- }
-
- // As a "service" we will check if any post id is specified and populate the username of the poster id if given
- $post_id = request_var('p', 0);
- $user_id = request_var('u', 0);
- $username = $pre_fill = false;
-
- if ($user_id && $user_id <> ANONYMOUS)
- {
- $sql = 'SELECT username, user_email, user_ip
- FROM ' . USERS_TABLE . '
- WHERE user_id = ' . $user_id;
- $result = phpbb::$db->sql_query($sql);
- switch ($mode)
- {
- case 'user':
- $pre_fill = (string) phpbb::$db->sql_fetchfield('username');
- break;
-
- case 'ip':
- $pre_fill = (string) phpbb::$db->sql_fetchfield('user_ip');
- break;
-
- case 'email':
- $pre_fill = (string) phpbb::$db->sql_fetchfield('user_email');
- break;
- }
- phpbb::$db->sql_freeresult($result);
- }
- else if ($post_id)
- {
- $post_info = get_post_data($post_id, 'm_ban');
-
- if (sizeof($post_info) && !empty($post_info[$post_id]))
- {
- switch ($mode)
- {
- case 'user':
- $pre_fill = $post_info[$post_id]['username'];
- break;
-
- case 'ip':
- $pre_fill = $post_info[$post_id]['poster_ip'];
- break;
-
- case 'email':
- $pre_fill = $post_info[$post_id]['user_email'];
- break;
- }
-
- }
- }
-
- if ($pre_fill)
- {
- phpbb::$template->assign_var('BAN_QUANTIFIER', $pre_fill);
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/mcp_forum.php b/phpBB/modules/mcp/mcp_forum.php
deleted file mode 100644
index e09ed93923..0000000000
--- a/phpBB/modules/mcp/mcp_forum.php
+++ /dev/null
@@ -1,445 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* MCP Forum View
-*/
-function mcp_forum_view($id, $mode, $action, $forum_info)
-{
- global $module;
-
- phpbb::$user->add_lang(array('viewtopic', 'viewforum'));
-
- include_once(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT);
-
- // merge_topic is the quickmod action, merge_topics is the mcp_forum action, and merge_select is the mcp_topic action
- $merge_select = ($action == 'merge_select' || $action == 'merge_topic' || $action == 'merge_topics') ? true : false;
-
- if ($merge_select)
- {
- // Fixes a "bug" that makes forum_view use the same ordering as topic_view
- phpbb_request::overwrite('sk', null, phpbb_request::POST);
- phpbb_request::overwrite('sd', null, phpbb_request::POST);
- phpbb_request::overwrite('sk', null, phpbb_request::REQUEST);
- phpbb_request::overwrite('sd', null, phpbb_request::REQUEST);
- }
-
- $forum_id = $forum_info['forum_id'];
- $start = request_var('start', 0);
- $topic_id_list = request_var('topic_id_list', array(0));
- $post_id_list = request_var('post_id_list', array(0));
- $source_topic_ids = array(request_var('t', 0));
- $to_topic_id = request_var('to_topic_id', 0);
-
- $url_extra = '';
- $url_extra .= ($forum_id) ? "&amp;f=$forum_id" : '';
- $url_extra .= ($GLOBALS['topic_id']) ? '&amp;t=' . $GLOBALS['topic_id'] : '';
- $url_extra .= ($GLOBALS['post_id']) ? '&amp;p=' . $GLOBALS['post_id'] : '';
- $url_extra .= ($GLOBALS['user_id']) ? '&amp;u=' . $GLOBALS['user_id'] : '';
-
- $url = ($url_extra) ? append_sid('mcp', $url_extra) : append_sid('mcp');
-
- // Resync Topics
- switch ($action)
- {
- case 'resync':
- $topic_ids = request_var('topic_id_list', array(0));
- mcp_resync_topics($topic_ids);
- break;
-
- case 'merge_topics':
- $source_topic_ids = $topic_id_list;
- case 'merge_topic':
- if ($to_topic_id)
- {
- merge_topics($forum_id, $source_topic_ids, $to_topic_id);
- }
- break;
- }
-
- $selected_ids = '';
- if (sizeof($post_id_list) && $action != 'merge_topics')
- {
- foreach ($post_id_list as $num => $post_id)
- {
- $selected_ids .= '&amp;post_id_list[' . $num . ']=' . $post_id;
- }
- }
- else if (sizeof($topic_id_list) && $action == 'merge_topics')
- {
- foreach ($topic_id_list as $num => $topic_id)
- {
- $selected_ids .= '&amp;topic_id_list[' . $num . ']=' . $topic_id;
- }
- }
-
- make_jumpbox($url . "&amp;i=$id&amp;action=$action&amp;mode=$mode" . (($merge_select) ? $selected_ids : ''), $forum_id, false, 'm_', true);
-
- $topics_per_page = ($forum_info['forum_topics_per_page']) ? $forum_info['forum_topics_per_page'] : phpbb::$config['topics_per_page'];
-
- $sort_days = $total = 0;
- $sort_key = $sort_dir = '';
- $sort_by_sql = $sort_order_sql = array();
- mcp_sorting('viewforum', $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)) : '';
-
- phpbb::$template->assign_vars(array(
- 'ACTION' => $action,
- 'FORUM_NAME' => $forum_info['forum_name'],
- 'FORUM_DESCRIPTION' => generate_text_for_display($forum_info['forum_desc'], $forum_info['forum_desc_uid'], $forum_info['forum_desc_bitfield'], $forum_info['forum_desc_options']),
-
- 'REPORTED_IMG' => phpbb::$user->img('icon_topic_reported', 'TOPIC_REPORTED'),
- 'UNAPPROVED_IMG' => phpbb::$user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'),
- 'LAST_POST_IMG' => phpbb::$user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
- 'NEWEST_POST_IMG' => phpbb::$user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
-
- 'S_CAN_REPORT' => phpbb::$acl->acl_get('m_report', $forum_id),
- 'S_CAN_DELETE' => phpbb::$acl->acl_get('m_delete', $forum_id),
- 'S_CAN_MERGE' => phpbb::$acl->acl_get('m_merge', $forum_id),
- 'S_CAN_MOVE' => phpbb::$acl->acl_get('m_move', $forum_id),
- 'S_CAN_FORK' => phpbb::$acl->acl_get('m_', $forum_id),
- 'S_CAN_LOCK' => phpbb::$acl->acl_get('m_lock', $forum_id),
- 'S_CAN_SYNC' => phpbb::$acl->acl_get('m_', $forum_id),
- 'S_CAN_APPROVE' => phpbb::$acl->acl_get('m_approve', $forum_id),
- 'S_MERGE_SELECT' => ($merge_select) ? true : false,
- 'S_CAN_MAKE_NORMAL' => phpbb::$acl->acl_gets('f_sticky', 'f_announce', $forum_id),
- 'S_CAN_MAKE_STICKY' => phpbb::$acl->acl_get('f_sticky', $forum_id),
- 'S_CAN_MAKE_ANNOUNCE' => phpbb::$acl->acl_get('f_announce', $forum_id),
-
- 'U_VIEW_FORUM' => append_sid('viewforum', 'f=' . $forum_id),
- 'U_VIEW_FORUM_LOGS' => (phpbb::$acl->acl_gets('a_', 'm_', $forum_id) && $module->loaded('logs')) ? append_sid('mcp', 'i=logs&amp;mode=forum_logs&amp;f=' . $forum_id) : '',
-
- 'S_MCP_ACTION' => $url . "&amp;i=$id&amp;forum_action=$action&amp;mode=$mode&amp;start=$start" . (($merge_select) ? $selected_ids : ''),
-
- 'PAGINATION' => generate_pagination($url . "&amp;i=$id&amp;action=$action&amp;mode=$mode&amp;sd=$sort_dir&amp;sk=$sort_key&amp;st=$sort_days" . (($merge_select) ? $selected_ids : ''), $forum_topics, $topics_per_page, $start),
- 'PAGE_NUMBER' => on_page($forum_topics, $topics_per_page, $start),
- 'TOTAL_TOPICS' => ($forum_topics == 1) ? phpbb::$user->lang['VIEW_FORUM_TOPIC'] : sprintf(phpbb::$user->lang['VIEW_FORUM_TOPICS'], $forum_topics),
- ));
-
- // Grab icons
- $icons = phpbb_cache::obtain_icons();
-
- $topic_rows = array();
-
- if (phpbb::$config['load_db_lastread'])
- {
- $read_tracking_join = ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . phpbb::$user->data['user_id'] . ')';
- $read_tracking_select = ', tt.mark_time';
- }
- else
- {
- $read_tracking_join = $read_tracking_select = '';
- }
-
- $sql = "SELECT t.topic_id
- FROM " . TOPICS_TABLE . " t
- WHERE t.forum_id IN($forum_id, 0)
- " . ((phpbb::$acl->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
- $limit_time_sql
- ORDER BY t.topic_type DESC, $sort_order_sql";
- $result = phpbb::$db->sql_query_limit($sql, $topics_per_page, $start);
-
- $topic_list = $topic_tracking_info = array();
-
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $topic_list[] = $row['topic_id'];
- }
- phpbb::$db->sql_freeresult($result);
-
- $sql = "SELECT t.*$read_tracking_select
- FROM " . TOPICS_TABLE . " t $read_tracking_join
- WHERE " . phpbb::$db->sql_in_set('t.topic_id', $topic_list, false, true);
-
- $result = phpbb::$db->sql_query($sql);
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $topic_rows[$row['topic_id']] = $row;
- }
- phpbb::$db->sql_freeresult($result);
-
- // If there is more than one page, but we have no topic list, then the start parameter is... erm... out of sync
- if (!sizeof($topic_list) && $forum_topics && $start > 0)
- {
- redirect($url . "&amp;i=$id&amp;action=$action&amp;mode=$mode");
- }
-
- // Get topic tracking info
- if (sizeof($topic_list))
- {
- if (phpbb::$config['load_db_lastread'])
- {
- $topic_tracking_info = get_topic_tracking($forum_id, $topic_list, $topic_rows, array($forum_id => $forum_info['mark_time']), array());
- }
- else
- {
- $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_list, array());
- }
- }
-
- foreach ($topic_list as $topic_id)
- {
- $topic_title = '';
-
- $row = &$topic_rows[$topic_id];
-
- $replies = (phpbb::$acl->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
-
- if ($row['topic_status'] == ITEM_MOVED)
- {
- $unread_topic = false;
- }
- else
- {
- $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
- }
-
- // Get folder img, topic status/type related information
- $folder_img = $folder_alt = $topic_type = '';
- topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
-
- $topic_title = censor_text($row['topic_title']);
-
- $topic_unapproved = (!$row['topic_approved'] && phpbb::$acl->acl_get('m_approve', $row['forum_id'])) ? true : false;
- $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && phpbb::$acl->acl_get('m_approve', $row['forum_id'])) ? true : false;
- $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? $url . '&amp;i=queue&amp;mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . '&amp;t=' . $row['topic_id'] : '';
-
- $topic_row = array(
- 'ATTACH_ICON_IMG' => (phpbb::$acl->acl_get('u_download') && phpbb::$acl->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? phpbb::$user->img('icon_topic_attach', 'TOTAL_ATTACHMENTS') : '',
- 'TOPIC_FOLDER_IMG' => phpbb::$user->img($folder_img, $folder_alt),
- 'TOPIC_FOLDER_IMG_SRC' => phpbb::$user->img($folder_img, $folder_alt, 'src'),
- 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
- 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
- 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
- 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? phpbb::$user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',
-
- 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
- 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
- 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
- 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
-
- 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
- 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
- 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
- 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
-
- 'TOPIC_TYPE' => $topic_type,
- 'TOPIC_TITLE' => $topic_title,
- 'REPLIES' => (phpbb::$acl->acl_get('m_approve', $row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies'],
- 'LAST_POST_TIME' => phpbb::$user->format_date($row['topic_last_post_time']),
- 'FIRST_POST_TIME' => phpbb::$user->format_date($row['topic_time']),
- 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'],
- 'LAST_VIEW_TIME' => phpbb::$user->format_date($row['topic_last_view_time']),
-
- 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && empty($row['topic_moved_id']) && phpbb::$acl->acl_get('m_report', $row['forum_id'])) ? true : false,
- 'S_TOPIC_UNAPPROVED' => $topic_unapproved,
- 'S_POSTS_UNAPPROVED' => $posts_unapproved,
- 'S_UNREAD_TOPIC' => $unread_topic,
- );
-
- if ($row['topic_status'] == ITEM_MOVED)
- {
- $topic_row = array_merge($topic_row, array(
- 'U_VIEW_TOPIC' => append_sid('viewtopic', "t={$row['topic_moved_id']}"),
- 'U_DELETE_TOPIC' => (phpbb::$acl->acl_get('m_delete', $forum_id)) ? append_sid('mcp', "i=$id&amp;f=$forum_id&amp;topic_id_list[]={$row['topic_id']}&amp;mode=forum_view&amp;action=delete_topic") : '',
- 'S_MOVED_TOPIC' => true,
- 'TOPIC_ID' => $row['topic_moved_id'],
- ));
- }
- else
- {
- if ($action == 'merge_topic' || $action == 'merge_topics')
- {
- $u_select_topic = $url . "&amp;i=$id&amp;mode=forum_view&amp;action=$action&amp;to_topic_id=" . $row['topic_id'] . $selected_ids;
- }
- else
- {
- $u_select_topic = $url . "&amp;i=$id&amp;mode=topic_view&amp;action=merge&amp;to_topic_id=" . $row['topic_id'] . $selected_ids;
- }
- $topic_row = array_merge($topic_row, array(
- 'U_VIEW_TOPIC' => append_sid('mcp', "i=$id&amp;f=$forum_id&amp;t={$row['topic_id']}&amp;mode=topic_view"),
-
- 'S_SELECT_TOPIC' => ($merge_select && !in_array($row['topic_id'], $source_topic_ids)) ? true : false,
- 'U_SELECT_TOPIC' => $u_select_topic,
- 'U_MCP_QUEUE' => $u_mcp_queue,
- 'U_MCP_REPORT' => (phpbb::$acl->acl_get('m_report', $forum_id)) ? append_sid('mcp', 'i=main&amp;mode=topic_view&amp;t=' . $row['topic_id'] . '&amp;action=reports') : '',
- 'TOPIC_ID' => $row['topic_id'],
- 'S_TOPIC_CHECKED' => ($topic_id_list && in_array($row['topic_id'], $topic_id_list)) ? true : false,
- ));
- }
-
- phpbb::$template->assign_block_vars('topicrow', $topic_row);
- }
- unset($topic_rows);
-}
-
-/**
-* Resync topics
-*/
-function mcp_resync_topics($topic_ids)
-{
- if (!sizeof($topic_ids))
- {
- trigger_error('NO_TOPIC_SELECTED');
- }
-
- if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_')))
- {
- return;
- }
-
- // Sync everything and perform extra checks separately
- sync('topic_reported', 'topic_id', $topic_ids, false, true);
- sync('topic_attachment', 'topic_id', $topic_ids, false, true);
- sync('topic', 'topic_id', $topic_ids, true, false);
-
- $sql = 'SELECT topic_id, forum_id, topic_title
- FROM ' . TOPICS_TABLE . '
- WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids);
- $result = phpbb::$db->sql_query($sql);
-
- // Log this action
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_TOPIC_RESYNC', $row['topic_title']);
- }
- phpbb::$db->sql_freeresult($result);
-
- $msg = (sizeof($topic_ids) == 1) ? phpbb::$user->lang['TOPIC_RESYNC_SUCCESS'] : phpbb::$user->lang['TOPICS_RESYNC_SUCCESS'];
-
- $redirect = request_var('redirect', phpbb::$user->data['session_page']);
-
- meta_refresh(3, $redirect);
- trigger_error($msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
-
- return;
-}
-
-/**
-* Merge selected topics into selected topic
-*/
-function merge_topics($forum_id, $topic_ids, $to_topic_id)
-{
- if (!sizeof($topic_ids))
- {
- phpbb::$template->assign_var('MESSAGE', phpbb::$user->lang['NO_TOPIC_SELECTED']);
- return;
- }
- if (!$to_topic_id)
- {
- phpbb::$template->assign_var('MESSAGE', phpbb::$user->lang['NO_FINAL_TOPIC_SELECTED']);
- return;
- }
-
- $topic_data = get_topic_data(array($to_topic_id), 'm_merge');
-
- if (!sizeof($topic_data))
- {
- phpbb::$template->assign_var('MESSAGE', phpbb::$user->lang['NO_FINAL_TOPIC_SELECTED']);
- return;
- }
-
- $topic_data = $topic_data[$to_topic_id];
-
- $post_id_list = request_var('post_id_list', array(0));
- $start = request_var('start', 0);
-
- if (!sizeof($post_id_list) && sizeof($topic_ids))
- {
- $sql = 'SELECT post_id
- FROM ' . POSTS_TABLE . '
- WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids);
- $result = phpbb::$db->sql_query($sql);
-
- $post_id_list = array();
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $post_id_list[] = $row['post_id'];
- }
- phpbb::$db->sql_freeresult($result);
- }
-
- if (!sizeof($post_id_list))
- {
- phpbb::$template->assign_var('MESSAGE', phpbb::$user->lang['NO_POST_SELECTED']);
- return;
- }
-
- if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_merge')))
- {
- return;
- }
-
- $redirect = request_var('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)
- );
- $success_msg = $return_link = '';
-
- if (confirm_box(true))
- {
- $to_forum_id = $topic_data['forum_id'];
-
- move_posts($post_id_list, $to_topic_id);
- add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']);
-
- // Message and return links
- $success_msg = 'POSTS_MERGED_SUCCESS';
-
- // If the topic no longer exist, we will update the topic watch table.
- // To not let it error out on users watching both topics, we just return on an error...
- phpbb::$db->sql_return_on_error(true);
- phpbb::$db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids));
- phpbb::$db->sql_return_on_error(false);
-
- phpbb::$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids));
-
- // Link to the new topic
- $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf(phpbb::$user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
- }
- else
- {
- confirm_box(false, 'MERGE_TOPICS', $s_hidden_fields);
- }
-
- $redirect = request_var('redirect', 'index.' . PHP_EXT);
- $redirect = reapply_sid($redirect);
-
- if (!$success_msg)
- {
- return;
- }
- else
- {
- meta_refresh(3, append_sid('viewtopic', "f=$to_forum_id&amp;t=$to_topic_id"));
- trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . $return_link);
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/mcp_front.php b/phpBB/modules/mcp/mcp_front.php
deleted file mode 100644
index 65177792ae..0000000000
--- a/phpBB/modules/mcp/mcp_front.php
+++ /dev/null
@@ -1,282 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* MCP Front Panel
-*/
-function mcp_front_view($id, $mode, $action)
-{
- global $module;
-
- // Latest 5 unapproved
- if ($module->loaded('queue'))
- {
- $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_approve')));
- $post_list = array();
- $forum_names = array();
-
- $forum_id = request_var('f', 0);
-
- phpbb::$template->assign_var('S_SHOW_UNAPPROVED', (!empty($forum_list)) ? true : false);
-
- if (!empty($forum_list))
- {
- $sql = 'SELECT COUNT(post_id) AS total
- FROM ' . POSTS_TABLE . '
- WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ')
- AND post_approved = 0';
- $result = phpbb::$db->sql_query($sql);
- $total = (int) phpbb::$db->sql_fetchfield('total');
- phpbb::$db->sql_freeresult($result);
-
- if ($total)
- {
- $global_id = $forum_list[0];
-
- $sql = 'SELECT forum_id, forum_name
- FROM ' . FORUMS_TABLE . '
- WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_list);
- $result = phpbb::$db->sql_query($sql);
-
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $forum_names[$row['forum_id']] = $row['forum_name'];
- }
- phpbb::$db->sql_freeresult($result);
-
- $sql = 'SELECT post_id
- FROM ' . POSTS_TABLE . '
- WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ')
- AND post_approved = 0
- ORDER BY post_time DESC';
- $result = phpbb::$db->sql_query_limit($sql, 5);
-
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $post_list[] = $row['post_id'];
- }
- phpbb::$db->sql_freeresult($result);
-
- if (empty($post_list))
- {
- $total = 0;
- }
- }
-
- if ($total)
- {
- $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.username, u.username_clean, u.user_colour, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id
- FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
- WHERE ' . phpbb::$db->sql_in_set('p.post_id', $post_list) . '
- AND t.topic_id = p.topic_id
- AND p.poster_id = u.user_id
- ORDER BY p.post_time DESC';
- $result = phpbb::$db->sql_query($sql);
-
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $global_topic = ($row['forum_id']) ? false : true;
- if ($global_topic)
- {
- $row['forum_id'] = $global_id;
- }
-
- phpbb::$template->assign_block_vars('unapproved', array(
- 'U_POST_DETAILS' => append_sid('mcp', 'i=queue&amp;mode=approve_details&amp;f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']),
- 'U_MCP_FORUM' => (!$global_topic) ? append_sid('mcp', 'i=main&amp;mode=forum_view&amp;f=' . $row['forum_id']) : '',
- 'U_MCP_TOPIC' => append_sid('mcp', 'i=main&amp;mode=topic_view&amp;f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
- 'U_FORUM' => (!$global_topic) ? append_sid('viewforum', 'f=' . $row['forum_id']) : '',
- 'U_TOPIC' => append_sid('viewtopic', 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
-
- 'AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour']),
- 'AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour']),
- 'AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour']),
- 'U_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour']),
-
- 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : phpbb::$user->lang['GLOBAL_ANNOUNCEMENT'],
- 'POST_ID' => $row['post_id'],
- 'TOPIC_TITLE' => $row['topic_title'],
- 'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : phpbb::$user->lang['NO_SUBJECT'],
- 'POST_TIME' => phpbb::$user->format_date($row['post_time']),
- ));
- }
- phpbb::$db->sql_freeresult($result);
- }
-
- phpbb::$template->assign_vars(array(
- 'S_MCP_QUEUE_ACTION' => append_sid('mcp', 'i=queue'),
- ));
-
- if ($total == 0)
- {
- phpbb::$template->assign_vars(array(
- 'L_UNAPPROVED_TOTAL' => phpbb::$user->lang['UNAPPROVED_POSTS_ZERO_TOTAL'],
- 'S_HAS_UNAPPROVED_POSTS' => false,
- ));
- }
- else
- {
- phpbb::$template->assign_vars(array(
- 'L_UNAPPROVED_TOTAL' => ($total == 1) ? phpbb::$user->lang['UNAPPROVED_POST_TOTAL'] : sprintf(phpbb::$user->lang['UNAPPROVED_POSTS_TOTAL'], $total),
- 'S_HAS_UNAPPROVED_POSTS' => true,
- ));
- }
- }
- }
-
- // Latest 5 reported
- if ($module->loaded('reports'))
- {
- $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_report')));
-
- phpbb::$template->assign_var('S_SHOW_REPORTS', (!empty($forum_list)) ? true : false);
-
- if (!empty($forum_list))
- {
- $sql = 'SELECT COUNT(r.report_id) AS total
- FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p
- WHERE r.post_id = p.post_id
- AND r.report_closed = 0
- AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')';
- $result = phpbb::$db->sql_query($sql);
- $total = (int) phpbb::$db->sql_fetchfield('total');
- phpbb::$db->sql_freeresult($result);
-
- if ($total)
- {
- $global_id = $forum_list[0];
-
- $sql = phpbb::$db->sql_build_query('SELECT', array(
- 'SELECT' => 'r.report_time, p.post_id, p.post_subject, p.post_time, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id, t.topic_id, t.topic_title, f.forum_id, f.forum_name',
-
- 'FROM' => array(
- REPORTS_TABLE => 'r',
- REPORTS_REASONS_TABLE => 'rr',
- TOPICS_TABLE => 't',
- USERS_TABLE => array('u', 'u2'),
- POSTS_TABLE => 'p'
- ),
-
- 'LEFT_JOIN' => array(
- array(
- 'FROM' => array(FORUMS_TABLE => 'f'),
- 'ON' => 'f.forum_id = p.forum_id'
- )
- ),
-
- 'WHERE' => 'r.post_id = p.post_id
- AND r.report_closed = 0
- AND r.reason_id = rr.reason_id
- AND p.topic_id = t.topic_id
- AND r.user_id = u.user_id
- AND p.poster_id = u2.user_id
- AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')',
-
- 'ORDER_BY' => 'p.post_time DESC'
- ));
- $result = phpbb::$db->sql_query_limit($sql, 5);
-
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $global_topic = ($row['forum_id']) ? false : true;
- if ($global_topic)
- {
- $row['forum_id'] = $global_id;
- }
-
- phpbb::$template->assign_block_vars('report', array(
- 'U_POST_DETAILS' => append_sid('mcp', 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id'] . "&amp;i=reports&amp;mode=report_details"),
- 'U_MCP_FORUM' => (!$global_topic) ? append_sid('mcp', 'f=' . $row['forum_id'] . "&amp;i=$id&amp;mode=forum_view") : '',
- 'U_MCP_TOPIC' => append_sid('mcp', 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id'] . "&amp;i=$id&amp;mode=topic_view"),
- 'U_FORUM' => (!$global_topic) ? append_sid('viewforum', 'f=' . $row['forum_id']) : '',
- 'U_TOPIC' => append_sid('viewtopic', 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
-
- 'REPORTER_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
- 'REPORTER' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
- 'REPORTER_COLOUR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
- 'U_REPORTER' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
-
- 'AUTHOR_FULL' => get_username_string('full', $row['author_id'], $row['author_name'], $row['author_colour']),
- 'AUTHOR' => get_username_string('username', $row['author_id'], $row['author_name'], $row['author_colour']),
- 'AUTHOR_COLOUR' => get_username_string('colour', $row['author_id'], $row['author_name'], $row['author_colour']),
- 'U_AUTHOR' => get_username_string('profile', $row['author_id'], $row['author_name'], $row['author_colour']),
-
- 'FORUM_NAME' => (!$global_topic) ? $row['forum_name'] : phpbb::$user->lang['GLOBAL_ANNOUNCEMENT'],
- 'TOPIC_TITLE' => $row['topic_title'],
- 'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : phpbb::$user->lang['NO_SUBJECT'],
- 'REPORT_TIME' => phpbb::$user->format_date($row['report_time']),
- 'POST_TIME' => phpbb::$user->format_date($row['post_time']),
- ));
- }
- }
-
- if ($total == 0)
- {
- phpbb::$template->assign_vars(array(
- 'L_REPORTS_TOTAL' => phpbb::$user->lang['REPORTS_ZERO_TOTAL'],
- 'S_HAS_REPORTS' => false,
- ));
- }
- else
- {
- phpbb::$template->assign_vars(array(
- 'L_REPORTS_TOTAL' => ($total == 1) ? phpbb::$user->lang['REPORT_TOTAL'] : sprintf(phpbb::$user->lang['REPORTS_TOTAL'], $total),
- 'S_HAS_REPORTS' => true,
- ));
- }
- }
- }
-
- // Latest 5 logs
- if ($module->loaded('logs'))
- {
- $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_')));
-
- if (!empty($forum_list))
- {
- // Add forum_id 0 for global announcements
- $forum_list[] = 0;
-
- $log_count = 0;
- $log = array();
- view_log('mod', $log, $log_count, 5, 0, $forum_list);
-
- foreach ($log as $row)
- {
- phpbb::$template->assign_block_vars('log', array(
- 'USERNAME' => $row['username_full'],
- 'IP' => $row['ip'],
- 'TIME' => phpbb::$user->format_date($row['time']),
- 'ACTION' => $row['action'],
- 'U_VIEW_TOPIC' => (!empty($row['viewtopic'])) ? $row['viewtopic'] : '',
- 'U_VIEWLOGS' => (!empty($row['viewlogs'])) ? $row['viewlogs'] : '',
- ));
- }
- }
-
- phpbb::$template->assign_vars(array(
- 'S_SHOW_LOGS' => (!empty($forum_list)) ? true : false,
- 'S_HAS_LOGS' => (!empty($log)) ? true : false,
- ));
- }
-
- phpbb::$template->assign_var('S_MCP_ACTION', append_sid('mcp'));
- make_jumpbox(append_sid('mcp', 'i=main&amp;mode=forum_view'), 0, false, 'm_', true);
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/mcp_logs.php b/phpBB/modules/mcp/mcp_logs.php
deleted file mode 100644
index 9bfbef5c7b..0000000000
--- a/phpBB/modules/mcp/mcp_logs.php
+++ /dev/null
@@ -1,209 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* mcp_logs
-* Handling warning the users
-* @package mcp
-*/
-class mcp_logs
-{
- var $u_action;
- var $p_master;
-
- function __construct(&$p_master)
- {
- $this->p_master = &$p_master;
- }
-
- function main($id, $mode)
- {
- phpbb::$user->add_lang('acp/common');
-
- $action = request_var('action', array('' => ''));
-
- if (is_array($action))
- {
- list($action, ) = each($action);
- }
- else
- {
- $action = request_var('action', '');
- }
-
- // Set up general vars
- $start = request_var('start', 0);
- $deletemark = ($action == 'del_marked') ? true : false;
- $deleteall = ($action == 'del_all') ? true : false;
- $marked = request_var('mark', array(0));
-
- // Sort keys
- $sort_days = request_var('st', 0);
- $sort_key = request_var('sk', 't');
- $sort_dir = request_var('sd', 'd');
-
- $this->tpl_name = 'mcp_logs';
- $this->page_title = 'MCP_LOGS';
-
- $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_')));
- $forum_list[] = 0;
-
- $forum_id = $topic_id = 0;
-
- switch ($mode)
- {
- case 'front':
- break;
-
- case 'forum_logs':
- $forum_id = request_var('f', 0);
-
- if (!in_array($forum_id, $forum_list))
- {
- trigger_error('NOT_AUTHORISED');
- }
-
- $forum_list = array($forum_id);
- break;
-
- case 'topic_logs':
- $topic_id = request_var('t', 0);
-
- $sql = 'SELECT forum_id
- FROM ' . TOPICS_TABLE . '
- WHERE topic_id = ' . $topic_id;
- $result = phpbb::$db->sql_query($sql);
- $forum_id = (int) phpbb::$db->sql_fetchfield('forum_id');
- phpbb::$db->sql_freeresult($result);
-
- if (!in_array($forum_id, $forum_list))
- {
- trigger_error('NOT_AUTHORISED');
- }
-
- $forum_list = array($forum_id);
- break;
- }
-
- // Delete entries if requested and able
- if (($deletemark || $deleteall) && phpbb::$acl->acl_get('a_clearlogs'))
- {
- if (confirm_box(true))
- {
- if ($deletemark && sizeof($marked))
- {
- $sql = 'DELETE FROM ' . LOG_TABLE . '
- WHERE log_type = ' . LOG_MOD . '
- AND ' . phpbb::$db->sql_in_set('forum_id', $forum_list) . '
- AND ' . phpbb::$db->sql_in_set('log_id', $marked);
- phpbb::$db->sql_query($sql);
-
- add_log('admin', 'LOG_CLEAR_MOD');
- }
- else if ($deleteall)
- {
- $sql = 'DELETE FROM ' . LOG_TABLE . '
- WHERE log_type = ' . LOG_MOD . '
- AND ' . phpbb::$db->sql_in_set('forum_id', $forum_list);
-
- if ($mode == 'topic_logs')
- {
- $sql .= ' AND topic_id = ' . $topic_id;
- }
- phpbb::$db->sql_query($sql);
-
- add_log('admin', 'LOG_CLEAR_MOD');
- }
- }
- else
- {
- confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
- 'f' => $forum_id,
- 't' => $topic_id,
- 'start' => $start,
- 'delmarked' => $deletemark,
- 'delall' => $deleteall,
- 'mark' => $marked,
- 'st' => $sort_days,
- 'sk' => $sort_key,
- 'sd' => $sort_dir,
- 'i' => $id,
- 'mode' => $mode,
- 'action' => request_var('action', array('' => ''))))
- );
- }
- }
-
- // Sorting
- $limit_days = array(0 => phpbb::$user->lang['ALL_ENTRIES'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']);
- $sort_by_text = array('u' => phpbb::$user->lang['SORT_USERNAME'], 't' => phpbb::$user->lang['SORT_DATE'], 'i' => phpbb::$user->lang['SORT_IP'], 'o' => phpbb::$user->lang['SORT_ACTION']);
- $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
-
- $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
- gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
-
- // Define where and sort sql for use in displaying logs
- $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;
- $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
-
- // Grab log data
- $log_data = array();
- $log_count = 0;
- view_log('mod', $log_data, $log_count, phpbb::$config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort);
-
- phpbb::$template->assign_vars(array(
- 'PAGE_NUMBER' => on_page($log_count, phpbb::$config['topics_per_page'], $start),
- 'TOTAL' => ($log_count == 1) ? phpbb::$user->lang['TOTAL_LOG'] : sprintf(phpbb::$user->lang['TOTAL_LOGS'], $log_count),
- 'PAGINATION' => generate_pagination($this->u_action . "&amp;$u_sort_param", $log_count, phpbb::$config['topics_per_page'], $start),
-
- 'L_TITLE' => phpbb::$user->lang['MCP_LOGS'],
-
- 'U_POST_ACTION' => $this->u_action,
- 'S_CLEAR_ALLOWED' => (phpbb::$acl->acl_get('a_clearlogs')) ? true : false,
- 'S_SELECT_SORT_DIR' => $s_sort_dir,
- 'S_SELECT_SORT_KEY' => $s_sort_key,
- 'S_SELECT_SORT_DAYS' => $s_limit_days,
- 'S_LOGS' => ($log_count > 0),
- ));
-
- foreach ($log_data as $row)
- {
- $data = array();
-
- $checks = array('viewtopic', 'viewforum');
- foreach ($checks as $check)
- {
- if (isset($row[$check]) && $row[$check])
- {
- $data[] = '<a href="' . $row[$check] . '">' . phpbb::$user->lang['LOGVIEW_' . strtoupper($check)] . '</a>';
- }
- }
-
- phpbb::$template->assign_block_vars('log', array(
- 'USERNAME' => $row['username_full'],
- 'IP' => $row['ip'],
- 'DATE' => phpbb::$user->format_date($row['time']),
- 'ACTION' => $row['action'],
- 'DATA' => (sizeof($data)) ? implode(' | ', $data) : '',
- 'ID' => $row['id'],
- ));
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/mcp_main.php b/phpBB/modules/mcp/mcp_main.php
deleted file mode 100644
index b2b71722e2..0000000000
--- a/phpBB/modules/mcp/mcp_main.php
+++ /dev/null
@@ -1,1211 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* mcp_main
-* Handling mcp actions
-* @package mcp
-*/
-class mcp_main
-{
- var $p_master;
- var $u_action;
-
- function __construct(&$p_master)
- {
- $this->p_master = &$p_master;
- }
-
- function main($id, $mode)
- {
- global $action;
-
- $quickmod = ($mode == 'quickmod') ? true : false;
-
- switch ($action)
- {
- case 'lock':
- case 'unlock':
- $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
-
- if (!sizeof($topic_ids))
- {
- trigger_error('NO_TOPIC_SELECTED');
- }
-
- lock_unlock($action, $topic_ids);
- break;
-
- case 'lock_post':
- case 'unlock_post':
-
- $post_ids = (!$quickmod) ? request_var('post_id_list', array(0)) : array(request_var('p', 0));
-
- if (!sizeof($post_ids))
- {
- trigger_error('NO_POST_SELECTED');
- }
-
- lock_unlock($action, $post_ids);
- break;
-
- case 'make_announce':
- case 'make_sticky':
- case 'make_global':
- case 'make_normal':
-
- $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
-
- if (!sizeof($topic_ids))
- {
- trigger_error('NO_TOPIC_SELECTED');
- }
-
- change_topic_type($action, $topic_ids);
- break;
-
- case 'move':
- phpbb::$user->add_lang('viewtopic');
-
- $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
-
- if (!sizeof($topic_ids))
- {
- trigger_error('NO_TOPIC_SELECTED');
- }
-
- mcp_move_topic($topic_ids);
- break;
-
- case 'fork':
- phpbb::$user->add_lang('viewtopic');
-
- $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
-
- if (!sizeof($topic_ids))
- {
- trigger_error('NO_TOPIC_SELECTED');
- }
-
- mcp_fork_topic($topic_ids);
- break;
-
- case 'delete_topic':
- phpbb::$user->add_lang('viewtopic');
-
- $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
-
- if (!sizeof($topic_ids))
- {
- trigger_error('NO_TOPIC_SELECTED');
- }
-
- mcp_delete_topic($topic_ids);
- break;
-
- case 'delete_post':
- phpbb::$user->add_lang('posting');
-
- $post_ids = (!$quickmod) ? request_var('post_id_list', array(0)) : array(request_var('p', 0));
-
- if (!sizeof($post_ids))
- {
- trigger_error('NO_POST_SELECTED');
- }
-
- mcp_delete_post($post_ids);
- break;
- }
-
- switch ($mode)
- {
- case 'front':
- include(PHPBB_ROOT_PATH . 'includes/mcp/mcp_front.' . PHP_EXT);
-
- phpbb::$user->add_lang('acp/common');
-
- mcp_front_view($id, $mode, $action);
-
- $this->tpl_name = 'mcp_front';
- $this->page_title = 'MCP_MAIN';
- break;
-
- case 'forum_view':
- include(PHPBB_ROOT_PATH . 'includes/mcp/mcp_forum.' . PHP_EXT);
-
- phpbb::$user->add_lang('viewforum');
-
- $forum_id = request_var('f', 0);
-
- $forum_info = get_forum_data($forum_id, 'm_', true);
-
- if (!sizeof($forum_info))
- {
- $this->main('main', 'front');
- return;
- }
-
- $forum_info = $forum_info[$forum_id];
-
- mcp_forum_view($id, $mode, $action, $forum_info);
-
- $this->tpl_name = 'mcp_forum';
- $this->page_title = 'MCP_MAIN_FORUM_VIEW';
- break;
-
- case 'topic_view':
- include(PHPBB_ROOT_PATH . 'includes/mcp/mcp_topic.' . PHP_EXT);
-
- mcp_topic_view($id, $mode, $action);
-
- $this->tpl_name = 'mcp_topic';
- $this->page_title = 'MCP_MAIN_TOPIC_VIEW';
- break;
-
- case 'post_details':
- include(PHPBB_ROOT_PATH . 'includes/mcp/mcp_post.' . PHP_EXT);
-
- mcp_post_details($id, $mode, $action);
-
- $this->tpl_name = ($action == 'whois') ? 'mcp_whois' : 'mcp_post';
- $this->page_title = 'MCP_MAIN_POST_DETAILS';
- break;
-
- default:
- trigger_error('NO_MODE', E_USER_ERROR);
- break;
- }
- }
-}
-
-/**
-* Lock/Unlock Topic/Post
-*/
-function lock_unlock($action, $ids)
-{
- if ($action == 'lock' || $action == 'unlock')
- {
- $table = TOPICS_TABLE;
- $sql_id = 'topic_id';
- $set_id = 'topic_status';
- $l_prefix = 'TOPIC';
- }
- else
- {
- $table = POSTS_TABLE;
- $sql_id = 'post_id';
- $set_id = 'post_edit_locked';
- $l_prefix = 'POST';
- }
-
- $orig_ids = $ids;
-
- if (!check_ids($ids, $table, $sql_id, array('m_lock')))
- {
- // Make sure that for f_user_lock only the lock action is triggered.
- if ($action != 'lock')
- {
- return;
- }
-
- $ids = $orig_ids;
-
- if (!check_ids($ids, $table, $sql_id, array('f_user_lock')))
- {
- return;
- }
- }
- unset($orig_ids);
-
- $redirect = request_var('redirect', build_url(array('action', 'quickmod')));
-
- $s_hidden_fields = build_hidden_fields(array(
- $sql_id . '_list' => $ids,
- 'action' => $action,
- 'redirect' => $redirect)
- );
- $success_msg = '';
-
- if (confirm_box(true))
- {
- $sql = "UPDATE $table
- SET $set_id = " . (($action == 'lock' || $action == 'lock_post') ? ITEM_LOCKED : ITEM_UNLOCKED) . '
- WHERE ' . phpbb::$db->sql_in_set($sql_id, $ids);
- phpbb::$db->sql_query($sql);
-
- $data = ($action == 'lock' || $action == 'unlock') ? get_topic_data($ids) : get_post_data($ids);
-
- foreach ($data as $id => $row)
- {
- add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_' . strtoupper($action), $row['topic_title']);
- }
-
- $success_msg = $l_prefix . ((sizeof($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS';
- }
- else
- {
- confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((sizeof($ids) == 1) ? '' : 'S'), $s_hidden_fields);
- }
-
- $redirect = request_var('redirect', 'index.' . PHP_EXT);
- $redirect = reapply_sid($redirect);
-
- if (!$success_msg)
- {
- redirect($redirect);
- }
- else
- {
- meta_refresh(2, $redirect);
- trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
- }
-}
-
-/**
-* Change Topic Type
-*/
-function change_topic_type($action, $topic_ids)
-{
- // For changing topic types, we only allow operations in one forum.
- $forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('f_announce', 'f_sticky', 'm_'), true);
-
- if ($forum_id === false)
- {
- return;
- }
-
- switch ($action)
- {
- case 'make_announce':
- $new_topic_type = POST_ANNOUNCE;
- $check_acl = 'f_announce';
- $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_ANNOUNCEMENT' : 'MCP_MAKE_ANNOUNCEMENTS';
- break;
-
- case 'make_global':
- $new_topic_type = POST_GLOBAL;
- $check_acl = 'f_announce';
- $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_GLOBAL' : 'MCP_MAKE_GLOBALS';
- break;
-
- case 'make_sticky':
- $new_topic_type = POST_STICKY;
- $check_acl = 'f_sticky';
- $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_STICKY' : 'MCP_MAKE_STICKIES';
- break;
-
- default:
- $new_topic_type = POST_NORMAL;
- $check_acl = '';
- $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_NORMAL' : 'MCP_MAKE_NORMALS';
- break;
- }
-
- $redirect = request_var('redirect', build_url(array('action', 'quickmod')));
-
- $s_hidden_fields = array(
- 'topic_id_list' => $topic_ids,
- 'f' => $forum_id,
- 'action' => $action,
- 'redirect' => $redirect,
- );
- $success_msg = '';
-
- if (confirm_box(true))
- {
- if ($new_topic_type != POST_GLOBAL)
- {
- $sql = 'UPDATE ' . TOPICS_TABLE . "
- SET topic_type = $new_topic_type
- WHERE " . phpbb::$db->sql_in_set('topic_id', $topic_ids) . '
- AND forum_id <> 0';
- phpbb::$db->sql_query($sql);
-
- // Reset forum id if a global topic is within the array
- $to_forum_id = request_var('to_forum_id', 0);
-
- if ($to_forum_id)
- {
- $sql = 'UPDATE ' . TOPICS_TABLE . "
- SET topic_type = $new_topic_type, forum_id = $to_forum_id
- WHERE " . phpbb::$db->sql_in_set('topic_id', $topic_ids) . '
- AND forum_id = 0';
- phpbb::$db->sql_query($sql);
-
- // Update forum_ids for all posts
- $sql = 'UPDATE ' . POSTS_TABLE . "
- SET forum_id = $to_forum_id
- WHERE " . phpbb::$db->sql_in_set('topic_id', $topic_ids) . '
- AND forum_id = 0';
- phpbb::$db->sql_query($sql);
-
- // Do a little forum sync stuff
- $sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts, COUNT(t.topic_approved) as topics_authed
- FROM ' . TOPICS_TABLE . ' t
- WHERE ' . phpbb::$db->sql_in_set('t.topic_id', $topic_ids);
- $result = phpbb::$db->sql_query($sql);
- $row_data = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- $sync_sql = array();
-
- if ($row_data['topic_posts'])
- {
- $sync_sql[$to_forum_id][] = 'forum_posts = forum_posts + ' . (int) $row_data['topic_posts'];
- }
-
- if ($row_data['topics_authed'])
- {
- $sync_sql[$to_forum_id][] = 'forum_topics = forum_topics + ' . (int) $row_data['topics_authed'];
- }
-
- $sync_sql[$to_forum_id][] = 'forum_topics_real = forum_topics_real + ' . (int) sizeof($topic_ids);
-
- foreach ($sync_sql as $forum_id_key => $array)
- {
- $sql = 'UPDATE ' . FORUMS_TABLE . '
- SET ' . implode(', ', $array) . '
- WHERE forum_id = ' . $forum_id_key;
- phpbb::$db->sql_query($sql);
- }
-
- sync('forum', 'forum_id', $to_forum_id);
- }
- }
- else
- {
- // Get away with those topics already being a global announcement by re-calculating $topic_ids
- $sql = 'SELECT topic_id
- FROM ' . TOPICS_TABLE . '
- WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids) . '
- AND forum_id <> 0';
- $result = phpbb::$db->sql_query($sql);
-
- $topic_ids = array();
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $topic_ids[] = $row['topic_id'];
- }
- phpbb::$db->sql_freeresult($result);
-
- if (sizeof($topic_ids))
- {
- // Delete topic shadows for global announcements
- $sql = 'DELETE FROM ' . TOPICS_TABLE . '
- WHERE ' . phpbb::$db->sql_in_set('topic_moved_id', $topic_ids);
- phpbb::$db->sql_query($sql);
-
- $sql = 'UPDATE ' . TOPICS_TABLE . "
- SET topic_type = $new_topic_type, forum_id = 0
- WHERE " . phpbb::$db->sql_in_set('topic_id', $topic_ids);
- phpbb::$db->sql_query($sql);
-
- // Update forum_ids for all posts
- $sql = 'UPDATE ' . POSTS_TABLE . '
- SET forum_id = 0
- WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids);
- phpbb::$db->sql_query($sql);
-
- // Do a little forum sync stuff
- $sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts, COUNT(t.topic_approved) as topics_authed
- FROM ' . TOPICS_TABLE . ' t
- WHERE ' . phpbb::$db->sql_in_set('t.topic_id', $topic_ids);
- $result = phpbb::$db->sql_query($sql);
- $row_data = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- $sync_sql = array();
-
- if ($row_data['topic_posts'])
- {
- $sync_sql[$forum_id][] = 'forum_posts = forum_posts - ' . (int) $row_data['topic_posts'];
- }
-
- if ($row_data['topics_authed'])
- {
- $sync_sql[$forum_id][] = 'forum_topics = forum_topics - ' . (int) $row_data['topics_authed'];
- }
-
- $sync_sql[$forum_id][] = 'forum_topics_real = forum_topics_real - ' . (int) sizeof($topic_ids);
-
- foreach ($sync_sql as $forum_id_key => $array)
- {
- $sql = 'UPDATE ' . FORUMS_TABLE . '
- SET ' . implode(', ', $array) . '
- WHERE forum_id = ' . $forum_id_key;
- phpbb::$db->sql_query($sql);
- }
-
- sync('forum', 'forum_id', $forum_id);
- }
- }
-
- $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED';
-
- if (sizeof($topic_ids))
- {
- $data = get_topic_data($topic_ids);
-
- foreach ($data as $topic_id => $row)
- {
- add_log('mod', $forum_id, $topic_id, 'LOG_TOPIC_TYPE_CHANGED', $row['topic_title']);
- }
- }
- }
- else
- {
- // Global topic involved?
- $global_involved = false;
-
- if ($new_topic_type != POST_GLOBAL)
- {
- $sql = 'SELECT forum_id
- FROM ' . TOPICS_TABLE . '
- WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids) . '
- AND forum_id = 0';
- $result = phpbb::$db->sql_query($sql);
- $row = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- if ($row)
- {
- $global_involved = true;
- }
- }
-
- if ($global_involved)
- {
- phpbb::$template->assign_vars(array(
- 'S_FORUM_SELECT' => make_forum_select(request_var('f', $forum_id), false, false, true, true),
- 'S_CAN_LEAVE_SHADOW' => false,
- 'ADDITIONAL_MSG' => (sizeof($topic_ids) == 1) ? phpbb::$user->lang['SELECT_FORUM_GLOBAL_ANNOUNCEMENT'] : phpbb::$user->lang['SELECT_FORUM_GLOBAL_ANNOUNCEMENTS'],
- ));
-
- confirm_box(false, $l_new_type, build_hidden_fields($s_hidden_fields), 'mcp_move.html');
- }
- else
- {
- confirm_box(false, $l_new_type, build_hidden_fields($s_hidden_fields));
- }
- }
-
- $redirect = request_var('redirect', 'index.' . PHP_EXT);
- $redirect = reapply_sid($redirect);
-
- if (!$success_msg)
- {
- redirect($redirect);
- }
- else
- {
- meta_refresh(2, $redirect);
- trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
- }
-}
-
-/**
-* Move Topic
-*/
-function mcp_move_topic($topic_ids)
-{
- // Here we limit the operation to one forum only
- $forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_move'), true);
-
- if ($forum_id === false)
- {
- return;
- }
-
- $to_forum_id = request_var('to_forum_id', 0);
- $redirect = request_var('redirect', build_url(array('action', 'quickmod')));
- $additional_msg = $success_msg = '';
-
- $s_hidden_fields = build_hidden_fields(array(
- 'topic_id_list' => $topic_ids,
- 'f' => $forum_id,
- 'action' => 'move',
- 'redirect' => $redirect)
- );
-
- if ($to_forum_id)
- {
- $forum_data = get_forum_data($to_forum_id, 'f_post');
-
- if (!sizeof($forum_data))
- {
- $additional_msg = phpbb::$user->lang['FORUM_NOT_EXIST'];
- }
- else
- {
- $forum_data = $forum_data[$to_forum_id];
-
- if ($forum_data['forum_type'] != FORUM_POST)
- {
- $additional_msg = phpbb::$user->lang['FORUM_NOT_POSTABLE'];
- }
- else if (!phpbb::$acl->acl_get('f_post', $to_forum_id))
- {
- $additional_msg = phpbb::$user->lang['USER_CANNOT_POST'];
- }
- else if ($forum_id == $to_forum_id)
- {
- $additional_msg = phpbb::$user->lang['CANNOT_MOVE_SAME_FORUM'];
- }
- }
- }
- else if (phpbb_request::is_set_post('confirm'))
- {
- $additional_msg = phpbb::$user->lang['FORUM_NOT_EXIST'];
- }
-
- if ($to_forum_id && !$additional_msg && confirm_box(true))
- {
- $topic_data = get_topic_data($topic_ids);
- $leave_shadow = phpbb_request::is_set_post('move_leave_shadow');
-
- $topics_moved = sizeof($topic_ids);
- $topics_authed_moved = 0;
- $forum_sync_data = array();
-
- $forum_sync_data[$forum_id] = current($topic_data);
- $forum_sync_data[$to_forum_id] = $forum_data;
-
- foreach ($topic_data as $topic_id => $topic_info)
- {
- if ($topic_info['topic_approved'] == '1')
- {
- $topics_authed_moved++;
- }
- }
-
- phpbb::$db->sql_transaction('begin');
-
- $sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts
- FROM ' . TOPICS_TABLE . ' t
- WHERE ' . phpbb::$db->sql_in_set('t.topic_id', $topic_ids);
- $result = phpbb::$db->sql_query($sql);
- $row_data = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- $sync_sql = array();
-
- if ($row_data['topic_posts'])
- {
- $sync_sql[$forum_id][] = 'forum_posts = forum_posts - ' . (int) $row_data['topic_posts'];
- $sync_sql[$to_forum_id][] = 'forum_posts = forum_posts + ' . (int) $row_data['topic_posts'];
- }
-
- if ($topics_authed_moved)
- {
- $sync_sql[$to_forum_id][] = 'forum_topics = forum_topics + ' . (int) $topics_authed_moved;
- }
-
- $sync_sql[$to_forum_id][] = 'forum_topics_real = forum_topics_real + ' . (int) $topics_moved;
-
- // Move topics, but do not resync yet
- move_topics($topic_ids, $to_forum_id, false);
-
- $forum_ids = array($to_forum_id);
- foreach ($topic_data as $topic_id => $row)
- {
- // Get the list of forums to resync, add a log entry
- $forum_ids[] = $row['forum_id'];
- add_log('mod', $to_forum_id, $topic_id, 'LOG_MOVE', $row['forum_name'], $forum_data['forum_name']);
-
- // If we have moved a global announcement, we need to correct the topic type
- if ($row['topic_type'] == POST_GLOBAL)
- {
- $sql = 'UPDATE ' . TOPICS_TABLE . '
- SET topic_type = ' . POST_ANNOUNCE . '
- WHERE topic_id = ' . (int) $row['topic_id'];
- phpbb::$db->sql_query($sql);
- }
-
- // Leave a redirection if required and only if the topic is visible to users
- if ($leave_shadow && $row['topic_approved'] && $row['topic_type'] != POST_GLOBAL)
- {
- $shadow = array(
- 'forum_id' => (int) $row['forum_id'],
- 'icon_id' => (int) $row['icon_id'],
- 'topic_attachment' => (int) $row['topic_attachment'],
- 'topic_approved' => 1, // a shadow topic is always approved
- 'topic_reported' => 0, // a shadow topic is never reported
- 'topic_title' => (string) $row['topic_title'],
- 'topic_poster' => (int) $row['topic_poster'],
- 'topic_time' => (int) $row['topic_time'],
- 'topic_time_limit' => (int) $row['topic_time_limit'],
- 'topic_views' => (int) $row['topic_views'],
- 'topic_replies' => (int) $row['topic_replies'],
- 'topic_replies_real' => (int) $row['topic_replies_real'],
- 'topic_status' => ITEM_MOVED,
- 'topic_type' => POST_NORMAL,
- 'topic_first_post_id' => (int) $row['topic_first_post_id'],
- 'topic_first_poster_colour'=>(string) $row['topic_first_poster_colour'],
- 'topic_first_poster_name'=> (string) $row['topic_first_poster_name'],
- 'topic_last_post_id' => (int) $row['topic_last_post_id'],
- 'topic_last_poster_id' => (int) $row['topic_last_poster_id'],
- 'topic_last_poster_colour'=>(string) $row['topic_last_poster_colour'],
- 'topic_last_poster_name'=> (string) $row['topic_last_poster_name'],
- 'topic_last_post_subject'=> (string) $row['topic_last_post_subject'],
- 'topic_last_post_time' => (int) $row['topic_last_post_time'],
- 'topic_last_view_time' => (int) $row['topic_last_view_time'],
- 'topic_moved_id' => (int) $row['topic_id'],
- 'topic_bumped' => (int) $row['topic_bumped'],
- 'topic_bumper' => (int) $row['topic_bumper'],
- 'poll_title' => (string) $row['poll_title'],
- 'poll_start' => (int) $row['poll_start'],
- 'poll_length' => (int) $row['poll_length'],
- 'poll_max_options' => (int) $row['poll_max_options'],
- 'poll_last_vote' => (int) $row['poll_last_vote']
- );
-
- phpbb::$db->sql_query('INSERT INTO ' . TOPICS_TABLE . phpbb::$db->sql_build_array('INSERT', $shadow));
-
- $topics_authed_moved--;
- $topics_moved--;
- }
- }
- unset($topic_data);
-
- $sync_sql[$forum_id][] = 'forum_topics_real = forum_topics_real - ' . (int) $topics_moved;
-
- if ($topics_authed_moved)
- {
- $sync_sql[$forum_id][] = 'forum_topics = forum_topics - ' . (int) $topics_authed_moved;
- }
-
- $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_MOVED_SUCCESS' : 'TOPICS_MOVED_SUCCESS';
-
- foreach ($sync_sql as $forum_id_key => $array)
- {
- $sql = 'UPDATE ' . FORUMS_TABLE . '
- SET ' . implode(', ', $array) . '
- WHERE forum_id = ' . $forum_id_key;
- phpbb::$db->sql_query($sql);
- }
-
- phpbb::$db->sql_transaction('commit');
-
- sync('forum', 'forum_id', array($forum_id, $to_forum_id));
- }
- else
- {
- phpbb::$template->assign_vars(array(
- 'S_FORUM_SELECT' => make_forum_select($to_forum_id, $forum_id, false, true, true, true),
- 'S_CAN_LEAVE_SHADOW' => true,
- 'ADDITIONAL_MSG' => $additional_msg,
- ));
-
- confirm_box(false, 'MOVE_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');
- }
-
- $redirect = request_var('redirect', 'index.' . PHP_EXT);
- $redirect = reapply_sid($redirect);
-
- if (!$success_msg)
- {
- redirect($redirect);
- }
- else
- {
- meta_refresh(3, $redirect);
-
- $message = phpbb::$user->lang[$success_msg];
- $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>');
- $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', "f=$forum_id") . '">', '</a>');
- $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_NEW_FORUM'], '<a href="' . append_sid('viewforum', "f=$to_forum_id") . '">', '</a>');
-
- trigger_error($message);
- }
-}
-
-/**
-* Delete Topics
-*/
-function mcp_delete_topic($topic_ids)
-{
- if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_delete')))
- {
- return;
- }
-
- $redirect = request_var('redirect', build_url(array('action', 'quickmod')));
- $forum_id = request_var('f', 0);
-
- $s_hidden_fields = build_hidden_fields(array(
- 'topic_id_list' => $topic_ids,
- 'f' => $forum_id,
- 'action' => 'delete_topic',
- 'redirect' => $redirect)
- );
- $success_msg = '';
-
- if (confirm_box(true))
- {
- $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_DELETED_SUCCESS' : 'TOPICS_DELETED_SUCCESS';
-
- $data = get_topic_data($topic_ids);
-
- foreach ($data as $topic_id => $row)
- {
- add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_' . ($row['topic_moved_id'] ? 'SHADOW_' : '') . 'TOPIC', $row['topic_title']);
- }
-
- $return = delete_topics('topic_id', $topic_ids);
- }
- else
- {
- confirm_box(false, (sizeof($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS', $s_hidden_fields);
- }
-
- if (!phpbb_request::is_set('quickmod'))
- {
- $redirect = request_var('redirect', 'index.' . PHP_EXT);
- $redirect = reapply_sid($redirect);
- $redirect_message = 'PAGE';
- }
- else
- {
- $redirect = append_sid('viewforum', 'f=' . $forum_id);
- $redirect_message = 'FORUM';
- }
-
- if (!$success_msg)
- {
- redirect($redirect);
- }
- else
- {
- meta_refresh(3, $redirect);
- trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_' . $redirect_message], '<a href="' . $redirect . '">', '</a>'));
- }
-}
-
-/**
-* Delete Posts
-*/
-function mcp_delete_post($post_ids)
-{
- if (!check_ids($post_ids, POSTS_TABLE, 'post_id', array('m_delete')))
- {
- return;
- }
-
- $redirect = request_var('redirect', build_url(array('action', 'quickmod')));
- $forum_id = request_var('f', 0);
-
- $s_hidden_fields = build_hidden_fields(array(
- 'post_id_list' => $post_ids,
- 'f' => $forum_id,
- 'action' => 'delete_post',
- 'redirect' => $redirect)
- );
- $success_msg = '';
-
- if (confirm_box(true))
- {
- if (!function_exists('delete_posts'))
- {
- include(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT);
- }
-
- // Count the number of topics that are affected
- // I did not use COUNT(DISTINCT ...) because I remember having problems
- // with it on older versions of MySQL -- Ashe
-
- $sql = 'SELECT DISTINCT topic_id
- FROM ' . POSTS_TABLE . '
- WHERE ' . phpbb::$db->sql_in_set('post_id', $post_ids);
- $result = phpbb::$db->sql_query($sql);
-
- $topic_id_list = array();
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $topic_id_list[] = $row['topic_id'];
- }
- $affected_topics = sizeof($topic_id_list);
- phpbb::$db->sql_freeresult($result);
-
- $post_data = get_post_data($post_ids);
-
- foreach ($post_data as $id => $row)
- {
- add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_DELETE_POST', $row['post_subject']);
- }
-
- // Now delete the posts, topics and forums are automatically resync'ed
- delete_posts('post_id', $post_ids);
-
- $sql = 'SELECT COUNT(topic_id) AS topics_left
- FROM ' . TOPICS_TABLE . '
- WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_id_list);
- $result = phpbb::$db->sql_query_limit($sql, 1);
-
- $deleted_topics = ($row = phpbb::$db->sql_fetchrow($result)) ? ($affected_topics - $row['topics_left']) : $affected_topics;
- phpbb::$db->sql_freeresult($result);
-
- $topic_id = request_var('t', 0);
-
- // Return links
- $return_link = array();
- if ($affected_topics == 1 && !$deleted_topics && $topic_id)
- {
- $return_link[] = sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', "f=$forum_id&amp;t=$topic_id") . '">', '</a>');
- }
- $return_link[] = sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $forum_id) . '">', '</a>');
-
- if (sizeof($post_ids) == 1)
- {
- if ($deleted_topics)
- {
- // We deleted the only post of a topic, which in turn has
- // been removed from the database
- $success_msg = phpbb::$user->lang['TOPIC_DELETED_SUCCESS'];
- }
- else
- {
- $success_msg = phpbb::$user->lang['POST_DELETED_SUCCESS'];
- }
- }
- else
- {
- if ($deleted_topics)
- {
- // Some of topics disappeared
- $success_msg = phpbb::$user->lang['POSTS_DELETED_SUCCESS'] . '<br /><br />' . phpbb::$user->lang['EMPTY_TOPICS_REMOVED_WARNING'];
- }
- else
- {
- $success_msg = phpbb::$user->lang['POSTS_DELETED_SUCCESS'];
- }
- }
- }
- else
- {
- confirm_box(false, (sizeof($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS', $s_hidden_fields);
- }
-
- $redirect = request_var('redirect', 'index.' . PHP_EXT);
- $redirect = reapply_sid($redirect);
-
- if (!$success_msg)
- {
- redirect($redirect);
- }
- else
- {
- if ($affected_topics != 1 || $deleted_topics || !$topic_id)
- {
- $redirect = append_sid('mcp', "f=$forum_id&i=main&mode=forum_view", false);
- }
-
- meta_refresh(3, $redirect);
- trigger_error($success_msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>') . '<br /><br />' . implode('<br /><br />', $return_link));
- }
-}
-
-/**
-* Fork Topic
-*/
-function mcp_fork_topic($topic_ids)
-{
- if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_')))
- {
- return;
- }
-
- $to_forum_id = request_var('to_forum_id', 0);
- $forum_id = request_var('f', 0);
- $redirect = request_var('redirect', build_url(array('action', 'quickmod')));
- $additional_msg = $success_msg = '';
-
- $s_hidden_fields = build_hidden_fields(array(
- 'topic_id_list' => $topic_ids,
- 'f' => $forum_id,
- 'action' => 'fork',
- 'redirect' => $redirect)
- );
-
- if ($to_forum_id)
- {
- $forum_data = get_forum_data($to_forum_id, 'f_post');
-
- if (!sizeof($topic_ids))
- {
- $additional_msg = phpbb::$user->lang['NO_TOPIC_SELECTED'];
- }
- else if (!sizeof($forum_data))
- {
- $additional_msg = phpbb::$user->lang['FORUM_NOT_EXIST'];
- }
- else
- {
- $forum_data = $forum_data[$to_forum_id];
-
- if ($forum_data['forum_type'] != FORUM_POST)
- {
- $additional_msg = phpbb::$user->lang['FORUM_NOT_POSTABLE'];
- }
- else if (!phpbb::$acl->acl_get('f_post', $to_forum_id))
- {
- $additional_msg = phpbb::$user->lang['USER_CANNOT_POST'];
- }
- }
- }
- else if (phpbb_request::is_set_post('confirm'))
- {
- $additional_msg = phpbb::$user->lang['FORUM_NOT_EXIST'];
- }
-
- if (!$additional_msg && confirm_box(true))
- {
- $topic_data = get_topic_data($topic_ids, 'f_post');
-
- $total_posts = 0;
- $new_topic_id_list = array();
-
- foreach ($topic_data as $topic_id => $topic_row)
- {
- $sql_ary = array(
- 'forum_id' => (int) $to_forum_id,
- 'icon_id' => (int) $topic_row['icon_id'],
- 'topic_attachment' => (int) $topic_row['topic_attachment'],
- 'topic_approved' => 1,
- 'topic_reported' => 0,
- 'topic_title' => (string) $topic_row['topic_title'],
- 'topic_poster' => (int) $topic_row['topic_poster'],
- 'topic_time' => (int) $topic_row['topic_time'],
- 'topic_replies' => (int) $topic_row['topic_replies_real'],
- 'topic_replies_real' => (int) $topic_row['topic_replies_real'],
- 'topic_status' => (int) $topic_row['topic_status'],
- 'topic_type' => (int) $topic_row['topic_type'],
- 'topic_first_poster_name' => (string) $topic_row['topic_first_poster_name'],
- 'topic_last_poster_id' => (int) $topic_row['topic_last_poster_id'],
- 'topic_last_poster_name' => (string) $topic_row['topic_last_poster_name'],
- 'topic_last_post_time' => (int) $topic_row['topic_last_post_time'],
- 'topic_last_view_time' => (int) $topic_row['topic_last_view_time'],
- 'topic_bumped' => (int) $topic_row['topic_bumped'],
- 'topic_bumper' => (int) $topic_row['topic_bumper'],
- 'poll_title' => (string) $topic_row['poll_title'],
- 'poll_start' => (int) $topic_row['poll_start'],
- 'poll_length' => (int) $topic_row['poll_length']
- );
-
- phpbb::$db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary));
- $new_topic_id = phpbb::$db->sql_nextid();
- $new_topic_id_list[$topic_id] = $new_topic_id;
-
- if ($topic_row['poll_start'])
- {
- $poll_rows = array();
-
- $sql = 'SELECT *
- FROM ' . POLL_OPTIONS_TABLE . "
- WHERE topic_id = $topic_id";
- $result = phpbb::$db->sql_query($sql);
-
- while ($row = phpbb::$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
- );
-
- phpbb::$db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary));
- }
- }
-
- $sql = 'SELECT *
- FROM ' . POSTS_TABLE . "
- WHERE topic_id = $topic_id
- ORDER BY post_time ASC";
- $result = phpbb::$db->sql_query($sql);
-
- $post_rows = array();
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $post_rows[] = $row;
- }
- phpbb::$db->sql_freeresult($result);
-
- if (!sizeof($post_rows))
- {
- continue;
- }
-
- $total_posts += sizeof($post_rows);
- foreach ($post_rows as $row)
- {
- $sql_ary = array(
- 'topic_id' => (int) $new_topic_id,
- 'forum_id' => (int) $to_forum_id,
- 'poster_id' => (int) $row['poster_id'],
- 'icon_id' => (int) $row['icon_id'],
- 'poster_ip' => (string) $row['poster_ip'],
- 'post_time' => (int) $row['post_time'],
- 'post_approved' => 1,
- 'post_reported' => 0,
- 'enable_bbcode' => (int) $row['enable_bbcode'],
- 'enable_smilies' => (int) $row['enable_smilies'],
- 'enable_magic_url' => (int) $row['enable_magic_url'],
- 'enable_sig' => (int) $row['enable_sig'],
- 'post_username' => (string) $row['post_username'],
- 'post_subject' => (string) $row['post_subject'],
- 'post_text' => (string) $row['post_text'],
- 'post_edit_reason' => (string) $row['post_edit_reason'],
- 'post_edit_user' => (int) $row['post_edit_user'],
- 'post_checksum' => (string) $row['post_checksum'],
- 'post_attachment' => (int) $row['post_attachment'],
- 'bbcode_bitfield' => $row['bbcode_bitfield'],
- 'bbcode_uid' => (string) $row['bbcode_uid'],
- 'post_edit_time' => (int) $row['post_edit_time'],
- 'post_edit_count' => (int) $row['post_edit_count'],
- 'post_edit_locked' => (int) $row['post_edit_locked'],
- 'post_postcount' => 0,
- );
-
- phpbb::$db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary));
- $new_post_id = phpbb::$db->sql_nextid();
-
- // Copy whether the topic is dotted
- markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']);
-
- // Copy Attachments
- if ($row['post_attachment'])
- {
- $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . "
- WHERE post_msg_id = {$row['post_id']}
- AND topic_id = $topic_id
- AND in_message = 0";
- $result = phpbb::$db->sql_query($sql);
-
- $sql_ary = array();
- while ($attach_row = phpbb::$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) basename($attach_row['physical_filename']),
- 'real_filename' => (string) 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']
- );
- }
- phpbb::$db->sql_freeresult($result);
-
- if (sizeof($sql_ary))
- {
- phpbb::$db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary);
- }
- }
- }
-
- $sql = 'SELECT user_id, notify_status
- FROM ' . TOPICS_WATCH_TABLE . '
- WHERE topic_id = ' . $topic_id;
- $result = phpbb::$db->sql_query($sql);
-
- $sql_ary = array();
- while ($row = phpbb::$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'],
- );
- }
- phpbb::$db->sql_freeresult($result);
-
- if (sizeof($sql_ary))
- {
- phpbb::$db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary);
- }
- }
-
- // Sync new topics, parent forums and board stats
- sync('topic', 'topic_id', $new_topic_id_list);
-
- $sync_sql = array();
-
- $sync_sql[$to_forum_id][] = 'forum_posts = forum_posts + ' . $total_posts;
- $sync_sql[$to_forum_id][] = 'forum_topics = forum_topics + ' . sizeof($new_topic_id_list);
- $sync_sql[$to_forum_id][] = 'forum_topics_real = forum_topics_real + ' . sizeof($new_topic_id_list);
-
- foreach ($sync_sql as $forum_id_key => $array)
- {
- $sql = 'UPDATE ' . FORUMS_TABLE . '
- SET ' . implode(', ', $array) . '
- WHERE forum_id = ' . $forum_id_key;
- phpbb::$db->sql_query($sql);
- }
-
- sync('forum', 'forum_id', $to_forum_id);
- set_config_count('num_topics', sizeof($new_topic_id_list), true);
- set_config_count('num_posts', $total_posts, true);
-
- foreach ($new_topic_id_list as $topic_id => $new_topic_id)
- {
- add_log('mod', $to_forum_id, $new_topic_id, 'LOG_FORK', $topic_row['forum_name']);
- }
-
- $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS';
- }
- else
- {
- phpbb::$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_var('redirect', 'index.' . PHP_EXT);
- $redirect = reapply_sid($redirect);
-
- if (!$success_msg)
- {
- redirect($redirect);
- }
- else
- {
- $redirect_url = append_sid('viewforum', 'f=' . $forum_id);
- meta_refresh(3, $redirect_url);
- $return_link = sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>');
-
- if ($forum_id != $to_forum_id)
- {
- $return_link .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_NEW_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $to_forum_id) . '">', '</a>');
- }
-
- trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . $return_link);
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/mcp_notes.php b/phpBB/modules/mcp/mcp_notes.php
deleted file mode 100644
index ed0bf373bf..0000000000
--- a/phpBB/modules/mcp/mcp_notes.php
+++ /dev/null
@@ -1,240 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* mcp_notes
-* Displays notes about a user
-* @package mcp
-*/
-class mcp_notes
-{
- var $p_master;
- var $u_action;
-
- function __construct(&$p_master)
- {
- $this->p_master = &$p_master;
- }
-
- function main($id, $mode)
- {
- $action = request_var('action', array('' => ''));
-
- if (is_array($action))
- {
- list($action, ) = each($action);
- }
-
- $this->page_title = 'MCP_NOTES';
-
- switch ($mode)
- {
- case 'front':
- phpbb::$template->assign_vars(array(
- 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&amp;form=mcp&amp;field=username&amp;select_single=true'),
- 'U_POST_ACTION' => append_sid('mcp', 'i=notes&amp;mode=user_notes'),
-
- 'L_TITLE' => phpbb::$user->lang['MCP_NOTES'],
- ));
-
- $this->tpl_name = 'mcp_notes_front';
- break;
-
- case 'user_notes':
- phpbb::$user->add_lang('acp/common');
-
- $this->mcp_notes_user_view($action);
- $this->tpl_name = 'mcp_notes_user';
- break;
- }
- }
-
- /**
- * Display user notes
- */
- function mcp_notes_user_view($action)
- {
- $user_id = request_var('u', 0);
- $username = request_var('username', '', true);
- $start = request_var('start', 0);
- $st = request_var('st', 0);
- $sk = request_var('sk', 'b');
- $sd = request_var('sd', 'd');
-
- add_form_key('mcp_notes');
-
- $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($username)) . "'";
-
- $sql = 'SELECT *
- FROM ' . USERS_TABLE . "
- WHERE $sql_where";
- $result = phpbb::$db->sql_query($sql);
- $userrow = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- if (!$userrow)
- {
- trigger_error('NO_USER');
- }
-
- $user_id = $userrow['user_id'];
-
- // Populate user id to the currently active module (this module)
- // The following method is another way of adjusting module urls. It is the easy variant if we want
- // to directly adjust the current module url based on data retrieved within the same module.
- if (strpos($this->u_action, "&amp;u=$user_id") === false)
- {
- $this->p_master->adjust_url('&amp;u=' . $user_id);
- $this->u_action .= "&amp;u=$user_id";
- }
-
- $deletemark = ($action == 'del_marked') ? true : false;
- $deleteall = ($action == 'del_all') ? true : false;
- $marked = request_var('marknote', array(0));
- $usernote = utf8_normalize_nfc(request_var('usernote', '', true));
-
- // Handle any actions
- if (($deletemark || $deleteall) && phpbb::$acl->acl_get('a_clearlogs'))
- {
- $where_sql = '';
- if ($deletemark && $marked)
- {
- $sql_in = array();
- foreach ($marked as $mark)
- {
- $sql_in[] = $mark;
- }
- $where_sql = ' AND ' . phpbb::$db->sql_in_set('log_id', $sql_in);
- unset($sql_in);
- }
-
- if ($where_sql || $deleteall)
- {
- if (check_form_key('mcp_notes'))
- {
- $sql = 'DELETE FROM ' . LOG_TABLE . '
- WHERE log_type = ' . LOG_USERS . "
- AND reportee_id = $user_id
- $where_sql";
- phpbb::$db->sql_query($sql);
-
- add_log('admin', 'LOG_CLEAR_USER', $userrow['username']);
-
- $msg = ($deletemark) ? 'MARKED_NOTES_DELETED' : 'ALL_NOTES_DELETED';
- }
- else
- {
- $msg = 'FORM_INVALID';
- }
- $redirect = $this->u_action . '&amp;u=' . $user_id;
- meta_refresh(3, $redirect);
- trigger_error(phpbb::$user->lang[$msg] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
- }
- }
-
- if ($usernote && $action == 'add_feedback')
- {
- if (check_form_key('mcp_notes'))
- {
- add_log('admin', 'LOG_USER_FEEDBACK', $userrow['username']);
- add_log('mod', 0, 0, 'LOG_USER_FEEDBACK', $userrow['username']);
-
- add_log('user', $user_id, 'LOG_USER_GENERAL', $usernote);
- $msg = phpbb::$user->lang['USER_FEEDBACK_ADDED'];
- }
- else
- {
- $msg = phpbb::$user->lang['FORM_INVALID'];
- }
- $redirect = $this->u_action;
- meta_refresh(3, $redirect);
-
- trigger_error($msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
- }
-
- // Generate the appropriate user information for the user we are looking at
- if (!function_exists('get_user_avatar'))
- {
- include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT);
- }
-
- $rank_title = $rank_img = '';
- $avatar_img = get_user_avatar($userrow['user_avatar'], $userrow['user_avatar_type'], $userrow['user_avatar_width'], $userrow['user_avatar_height']);
-
- $limit_days = array(0 => phpbb::$user->lang['ALL_ENTRIES'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']);
- $sort_by_text = array('a' => phpbb::$user->lang['SORT_USERNAME'], 'b' => phpbb::$user->lang['SORT_DATE'], 'c' => phpbb::$user->lang['SORT_IP'], 'd' => phpbb::$user->lang['SORT_ACTION']);
- $sort_by_sql = array('a' => 'u.username_clean', 'b' => 'l.log_time', 'c' => 'l.log_ip', 'd' => 'l.log_operation');
-
- $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
- gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
-
- // Define where and sort sql for use in displaying logs
- $sql_where = ($st) ? (time() - ($st * 86400)) : 0;
- $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC');
-
- $log_data = array();
- $log_count = 0;
- view_log('user', $log_data, $log_count, phpbb::$config['posts_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort);
-
- if ($log_count)
- {
- phpbb::$template->assign_var('S_USER_NOTES', true);
-
- foreach ($log_data as $row)
- {
- phpbb::$template->assign_block_vars('usernotes', array(
- 'REPORT_BY' => $row['username_full'],
- 'REPORT_AT' => phpbb::$user->format_date($row['time']),
- 'ACTION' => $row['action'],
- 'IP' => $row['ip'],
- 'ID' => $row['id'],
- ));
- }
- }
-
- phpbb::$template->assign_vars(array(
- 'U_POST_ACTION' => $this->u_action,
- 'S_CLEAR_ALLOWED' => (phpbb::$acl->acl_get('a_clearlogs')) ? true : false,
- 'S_SELECT_SORT_DIR' => $s_sort_dir,
- 'S_SELECT_SORT_KEY' => $s_sort_key,
- 'S_SELECT_SORT_DAYS' => $s_limit_days,
-
- 'L_TITLE' => phpbb::$user->lang['MCP_NOTES_USER'],
-
- 'PAGE_NUMBER' => on_page($log_count, phpbb::$config['posts_per_page'], $start),
- 'PAGINATION' => generate_pagination($this->u_action . "&amp;st=$st&amp;sk=$sk&amp;sd=$sd", $log_count, phpbb::$config['posts_per_page'], $start),
- 'TOTAL_REPORTS' => ($log_count == 1) ? phpbb::$user->lang['LIST_REPORT'] : sprintf(phpbb::$user->lang['LIST_REPORTS'], $log_count),
-
- 'RANK_TITLE' => $rank_title,
- 'JOINED' => phpbb::$user->format_date($userrow['user_regdate']),
- 'POSTS' => ($userrow['user_posts']) ? $userrow['user_posts'] : 0,
- 'WARNINGS' => ($userrow['user_warnings']) ? $userrow['user_warnings'] : 0,
-
- 'USERNAME_FULL' => get_username_string('full', $userrow['user_id'], $userrow['username'], $userrow['user_colour']),
- 'USERNAME_COLOUR' => get_username_string('colour', $userrow['user_id'], $userrow['username'], $userrow['user_colour']),
- 'USERNAME' => get_username_string('username', $userrow['user_id'], $userrow['username'], $userrow['user_colour']),
- 'U_PROFILE' => get_username_string('profile', $userrow['user_id'], $userrow['username'], $userrow['user_colour']),
-
- 'AVATAR_IMG' => $avatar_img,
- 'RANK_IMG' => $rank_img,
- ));
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/mcp_post.php b/phpBB/modules/mcp/mcp_post.php
deleted file mode 100644
index 2f3320dd07..0000000000
--- a/phpBB/modules/mcp/mcp_post.php
+++ /dev/null
@@ -1,497 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Handling actions in post details screen
-*/
-function mcp_post_details($id, $mode, $action)
-{
- phpbb::$user->add_lang('posting');
-
- $post_id = request_var('p', 0);
- $start = request_var('start', 0);
-
- // Get post data
- $post_info = get_post_data(array($post_id), false, true);
-
- add_form_key('mcp_post_details');
-
- if (!sizeof($post_info))
- {
- trigger_error('POST_NOT_EXIST');
- }
-
- $post_info = $post_info[$post_id];
- $extra_url = extra_url();
- $url = ($extra_url) ? append_sid('mcp', extra_url()) : append_sid('mcp') . '?';
-
- switch ($action)
- {
- case 'whois':
-
- if (phpbb::$acl->acl_get('m_info', $post_info['forum_id']))
- {
- $ip = request_var('ip', '');
- include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
-
- phpbb::$template->assign_vars(array(
- 'RETURN_POST' => sprintf(phpbb::$user->lang['RETURN_POST'], '<a href="' . append_sid('mcp', "i=$id&amp;mode=$mode&amp;p=$post_id") . '">', '</a>'),
- 'U_RETURN_POST' => append_sid('mcp', "i=$id&amp;mode=$mode&amp;p=$post_id"),
- 'L_RETURN_POST' => sprintf(phpbb::$user->lang['RETURN_POST'], '', ''),
- 'WHOIS' => user_ipwhois($ip),
- ));
- }
-
- // We're done with the whois page so return
- return;
-
- break;
-
- case 'chgposter':
- case 'chgposter_ip':
-
- if ($action == 'chgposter')
- {
- $username = request_var('username', '', true);
- $sql_where = "username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($username)) . "'";
- }
- else
- {
- $new_user_id = request_var('u', 0);
- $sql_where = 'user_id = ' . $new_user_id;
- }
-
- $sql = 'SELECT *
- FROM ' . USERS_TABLE . '
- WHERE ' . $sql_where;
- $result = phpbb::$db->sql_query($sql);
- $row = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- if (!$row)
- {
- trigger_error('NO_USER');
- }
-
- if (phpbb::$acl->acl_get('m_chgposter', $post_info['forum_id']))
- {
- if (check_form_key('mcp_post_details'))
- {
- change_poster($post_info, $row);
- }
- else
- {
- trigger_error('FORM_INVALID');
- }
- }
-
- break;
- }
-
- // Set some vars
- $users_ary = $usernames_ary = array();
- $attachments = $extensions = array();
- $post_id = $post_info['post_id'];
- $topic_tracking_info = array();
-
- // Get topic tracking info
- if (phpbb::$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.' . PHP_EXT);
- $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'] && phpbb::$acl->acl_get('u_download') && phpbb::$acl->acl_get('f_download', $post_info['forum_id']))
- {
- $extensions = phpbb_cache::obtain_extensions_forum($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 = phpbb::$db->sql_query($sql);
-
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $attachments[] = $row;
- }
- phpbb::$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))
- {
- phpbb::$template->assign_var('S_HAS_ATTACHMENTS', true);
-
- foreach ($attachments as $attachment)
- {
- phpbb::$template->assign_block_vars('attachment', array(
- 'DISPLAY_ATTACHMENT' => $attachment,
- ));
- }
- }
- }
-
- phpbb::$template->assign_vars(array(
- 'U_MCP_ACTION' => "$url&amp;i=main&amp;quickmod=1", // Use this for mode paramaters
- 'U_POST_ACTION' => "$url&amp;i=$id&amp;mode=post_details", // Use this for action parameters
- 'U_APPROVE_ACTION' => append_sid('mcp', "i=queue&amp;p=$post_id&amp;f={$post_info['forum_id']}"),
-
- 'S_CAN_VIEWIP' => phpbb::$acl->acl_get('m_info', $post_info['forum_id']),
- 'S_CAN_CHGPOSTER' => phpbb::$acl->acl_get('m_chgposter', $post_info['forum_id']),
- 'S_CAN_LOCK_POST' => phpbb::$acl->acl_get('m_lock', $post_info['forum_id']),
- 'S_CAN_DELETE_POST' => phpbb::$acl->acl_get('m_delete', $post_info['forum_id']),
-
- 'S_POST_REPORTED' => ($post_info['post_reported']) ? true : false,
- 'S_POST_UNAPPROVED' => (!$post_info['post_approved']) ? true : false,
- 'S_POST_LOCKED' => ($post_info['post_edit_locked']) ? true : false,
- 'S_USER_NOTES' => true,
- 'S_CLEAR_ALLOWED' => (phpbb::$acl->acl_get('a_clearlogs')) ? true : false,
-
- 'U_EDIT' => (phpbb::$acl->acl_get('m_edit', $post_info['forum_id'])) ? append_sid('posting', "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '',
- 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&amp;form=mcp_chgposter&amp;field=username&amp;select_single=true'),
- 'U_MCP_APPROVE' => append_sid('mcp', 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
- 'U_MCP_REPORT' => append_sid('mcp', 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
- 'U_MCP_USER_NOTES' => append_sid('mcp', 'i=notes&amp;mode=user_notes&amp;u=' . $post_info['user_id']),
- 'U_MCP_WARN_USER' => (phpbb::$acl->acl_get('m_warn')) ? append_sid('mcp', 'i=warn&amp;mode=warn_user&amp;u=' . $post_info['user_id']) : '',
- 'U_VIEW_POST' => append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&amp;p=' . $post_info['post_id'] . '#p' . $post_info['post_id']),
- 'U_VIEW_TOPIC' => append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']),
-
- 'MINI_POST_IMG' => ($post_unread) ? phpbb::$user->img('icon_post_target_unread', 'NEW_POST') : phpbb::$user->img('icon_post_target', 'POST'),
-
- 'RETURN_TOPIC' => sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', "f={$post_info['forum_id']}&amp;p=$post_id") . "#p$post_id\">", '</a>'),
- 'RETURN_FORUM' => sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', "f={$post_info['forum_id']}&amp;start={$start}") . '">', '</a>'),
- 'REPORTED_IMG' => phpbb::$user->img('icon_topic_reported', 'POST_REPORTED'),
- 'UNAPPROVED_IMG' => phpbb::$user->img('icon_topic_unapproved', 'POST_UNAPPROVED'),
- 'EDIT_IMG' => phpbb::$user->img('icon_post_edit', 'EDIT_POST'),
- 'SEARCH_IMG' => phpbb::$user->img('icon_user_search', 'SEARCH'),
-
- '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' => phpbb::$user->format_date($post_info['post_time']),
- 'POST_IP' => $post_info['poster_ip'],
- 'POST_IPADDR' => (phpbb::$acl->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' => (phpbb::$acl->acl_get('m_info', $post_info['forum_id'])) ? "$url&amp;i=$id&amp;mode=$mode&amp;lookup={$post_info['poster_ip']}#ip" : '',
- 'U_WHOIS' => (phpbb::$acl->acl_get('m_info', $post_info['forum_id'])) ? append_sid('mcp', "i=$id&amp;mode=$mode&amp;action=whois&amp;p=$post_id&amp;ip={$post_info['poster_ip']}") : '',
- ));
-
- // Get User Notes
- $log_data = array();
- $log_count = 0;
- view_log('user', $log_data, $log_count, phpbb::$config['posts_per_page'], 0, 0, 0, $post_info['user_id']);
-
- if ($log_count)
- {
- phpbb::$template->assign_var('S_USER_NOTES', true);
-
- foreach ($log_data as $row)
- {
- phpbb::$template->assign_block_vars('usernotes', array(
- 'REPORT_BY' => $row['username_full'],
- 'REPORT_AT' => phpbb::$user->format_date($row['time']),
- 'ACTION' => $row['action'],
- 'ID' => $row['id'],
- ));
- }
- }
-
- // Get Reports
- if (phpbb::$acl->acl_get('m_', $post_info['forum_id']))
- {
- $sql = 'SELECT r.*, re.*, u.user_id, u.username
- FROM ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u, ' . REPORTS_REASONS_TABLE . " re
- WHERE r.post_id = $post_id
- AND r.reason_id = re.reason_id
- AND u.user_id = r.user_id
- ORDER BY r.report_time DESC";
- $result = phpbb::$db->sql_query($sql);
-
- if ($row = phpbb::$db->sql_fetchrow($result))
- {
- phpbb::$template->assign_var('S_SHOW_REPORTS', true);
-
- do
- {
- // If the reason is defined within the language file, we will use the localized version, else just use the database entry...
- if (isset(phpbb::$user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset(phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]))
- {
- $row['reson_description'] = phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])];
- $row['reason_title'] = phpbb::$user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])];
- }
-
- phpbb::$template->assign_block_vars('reports', array(
- 'REPORT_ID' => $row['report_id'],
- 'REASON_TITLE' => $row['reason_title'],
- 'REASON_DESC' => $row['reason_description'],
- 'REPORTER' => ($row['user_id'] != ANONYMOUS) ? $row['username'] : phpbb::$user->lang['GUEST'],
- 'U_REPORTER' => ($row['user_id'] != ANONYMOUS) ? append_sid('memberlist', 'mode=viewprofile&amp;u=' . $row['user_id']) : '',
- 'USER_NOTIFY' => ($row['user_notify']) ? true : false,
- 'REPORT_TIME' => phpbb::$user->format_date($row['report_time']),
- 'REPORT_TEXT' => bbcode_nl2br(trim($row['report_text'])),
- ));
- }
- while ($row = phpbb::$db->sql_fetchrow($result));
- }
- phpbb::$db->sql_freeresult($result);
- }
-
- // Get IP
- if (phpbb::$acl->acl_get('m_info', $post_info['forum_id']))
- {
- $rdns_ip_num = request_var('rdns', '');
-
- if ($rdns_ip_num != 'all')
- {
- phpbb::$template->assign_vars(array(
- 'U_LOOKUP_ALL' => "$url&amp;i=main&amp;mode=post_details&amp;rdns=all",
- ));
- }
-
- // Get other users who've posted under this IP
- $sql = 'SELECT poster_id, COUNT(poster_id) as postings
- FROM ' . POSTS_TABLE . "
- WHERE poster_ip = '" . phpbb::$db->sql_escape($post_info['poster_ip']) . "'
- GROUP BY poster_id
- ORDER BY postings DESC";
- $result = phpbb::$db->sql_query($sql);
-
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- // Fill the user select list with users who have posted under this IP
- if ($row['poster_id'] != $post_info['poster_id'])
- {
- $users_ary[$row['poster_id']] = $row;
- }
- }
- phpbb::$db->sql_freeresult($result);
-
- if (sizeof($users_ary))
- {
- // Get the usernames
- $sql = 'SELECT user_id, username
- FROM ' . USERS_TABLE . '
- WHERE ' . phpbb::$db->sql_in_set('user_id', array_keys($users_ary));
- $result = phpbb::$db->sql_query($sql);
-
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $users_ary[$row['user_id']]['username'] = $row['username'];
- $usernames_ary[utf8_clean_string($row['username'])] = $users_ary[$row['user_id']];
- }
- phpbb::$db->sql_freeresult($result);
-
- foreach ($users_ary as $user_id => $user_row)
- {
- phpbb::$template->assign_block_vars('userrow', array(
- 'USERNAME' => ($user_id == ANONYMOUS) ? phpbb::$user->lang['GUEST'] : $user_row['username'],
- 'NUM_POSTS' => $user_row['postings'],
- 'L_POST_S' => ($user_row['postings'] == 1) ? phpbb::$user->lang['POST'] : phpbb::$user->lang['POSTS'],
-
- 'U_PROFILE' => ($user_id == ANONYMOUS) ? '' : append_sid('memberlist', 'mode=viewprofile&amp;u=' . $user_id),
- 'U_SEARCHPOSTS' => append_sid('search', 'author_id=' . $user_id . '&amp;sr=topics'),
- ));
- }
- }
-
- // Get other IP's this user has posted under
-
- // A compound index on poster_id, poster_ip (posts table) would help speed up this query a lot,
- // but the extra size is only valuable if there are persons having more than a thousands posts.
- // This is better left to the really really big forums.
-
- $sql = 'SELECT poster_ip, COUNT(poster_ip) AS postings
- FROM ' . POSTS_TABLE . '
- WHERE poster_id = ' . $post_info['poster_id'] . "
- GROUP BY poster_ip
- ORDER BY postings DESC";
- $result = phpbb::$db->sql_query($sql);
-
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $hostname = (($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') && $row['poster_ip']) ? @gethostbyaddr($row['poster_ip']) : '';
-
- phpbb::$template->assign_block_vars('iprow', array(
- 'IP' => $row['poster_ip'],
- 'HOSTNAME' => $hostname,
- 'NUM_POSTS' => $row['postings'],
- 'L_POST_S' => ($row['postings'] == 1) ? phpbb::$user->lang['POST'] : phpbb::$user->lang['POSTS'],
-
- 'U_LOOKUP_IP' => ($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') ? '' : "$url&amp;i=$id&amp;mode=post_details&amp;rdns={$row['poster_ip']}#ip",
- 'U_WHOIS' => append_sid('mcp', "i=$id&amp;mode=$mode&amp;action=whois&amp;p=$post_id&amp;ip={$row['poster_ip']}"),
- ));
- }
- phpbb::$db->sql_freeresult($result);
-
- $user_select = '';
-
- if (sizeof($usernames_ary))
- {
- ksort($usernames_ary);
-
- foreach ($usernames_ary as $row)
- {
- $user_select .= '<option value="' . $row['poster_id'] . '">' . $row['username'] . "</option>\n";
- }
- }
-
- phpbb::$template->assign_var('S_USER_SELECT', $user_select);
- }
-
-}
-
-/**
-* Change a post's poster
-*/
-function change_poster(&$post_info, $userdata)
-{
- if (empty($userdata) || $userdata['user_id'] == $post_info['user_id'])
- {
- return;
- }
-
- $post_id = $post_info['post_id'];
-
- $sql = 'UPDATE ' . POSTS_TABLE . "
- SET poster_id = {$userdata['user_id']}
- WHERE post_id = $post_id";
- phpbb::$db->sql_query($sql);
-
- // Resync topic/forum if needed
- if ($post_info['topic_last_post_id'] == $post_id || $post_info['forum_last_post_id'] == $post_id || $post_info['topic_first_post_id'] == $post_id)
- {
- sync('topic', 'topic_id', $post_info['topic_id'], false, false);
- sync('forum', 'forum_id', $post_info['forum_id'], false, false);
- }
-
- // Adjust post counts... only if the post is approved (else, it was not added the users post count anyway)
- if ($post_info['post_postcount'] && $post_info['post_approved'])
- {
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET user_posts = user_posts - 1
- WHERE user_id = ' . $post_info['user_id'] .'
- AND user_posts > 0';
- phpbb::$db->sql_query($sql);
-
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET user_posts = user_posts + 1
- WHERE user_id = ' . $userdata['user_id'];
- phpbb::$db->sql_query($sql);
- }
-
- // Add posted to information for this topic for the new user
- markread('post', $post_info['forum_id'], $post_info['topic_id'], time(), $userdata['user_id']);
-
- // Remove the dotted topic option if the old user has no more posts within this topic
- if (phpbb::$config['load_db_track'] && $post_info['user_id'] != ANONYMOUS)
- {
- $sql = 'SELECT topic_id
- FROM ' . POSTS_TABLE . '
- WHERE topic_id = ' . $post_info['topic_id'] . '
- AND poster_id = ' . $post_info['user_id'];
- $result = phpbb::$db->sql_query_limit($sql, 1);
- $topic_id = (int) phpbb::$db->sql_fetchfield('topic_id');
- phpbb::$db->sql_freeresult($result);
-
- if (!$topic_id)
- {
- $sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . '
- WHERE user_id = ' . $post_info['user_id'] . '
- AND topic_id = ' . $post_info['topic_id'];
- phpbb::$db->sql_query($sql);
- }
- }
-
- // change the poster_id within the attachments table, else the data becomes out of sync and errors displayed because of wrong ownership
- if ($post_info['post_attachment'])
- {
- $sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
- SET poster_id = ' . $userdata['user_id'] . '
- WHERE poster_id = ' . $post_info['user_id'] . '
- AND post_msg_id = ' . $post_info['post_id'] . '
- AND topic_id = ' . $post_info['topic_id'];
- phpbb::$db->sql_query($sql);
- }
-
- // refresh search cache of this post
- $search_type = basename(phpbb::$config['search_type']);
-
- if (file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT))
- {
- require(PHPBB_ROOT_PATH . "includes/search/$search_type." . PHP_EXT);
-
- // We do some additional checks in the module to ensure it can actually be utilised
- $error = false;
- $search = new $search_type($error);
-
- if (!$error && method_exists($search, 'destroy_cache'))
- {
- $search->destroy_cache(array(), array($post_info['user_id'], $userdata['user_id']));
- }
- }
-
- $from_username = $post_info['username'];
- $to_username = $userdata['username'];
-
- // Renew post info
- $post_info = get_post_data(array($post_id), false, true);
-
- if (!sizeof($post_info))
- {
- trigger_error('POST_NOT_EXIST');
- }
-
- $post_info = $post_info[$post_id];
-
- // Now add log entry
- add_log('mod', $post_info['forum_id'], $post_info['topic_id'], 'LOG_MCP_CHANGE_POSTER', $post_info['topic_title'], $from_username, $to_username);
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/mcp_queue.php b/phpBB/modules/mcp/mcp_queue.php
deleted file mode 100644
index ff4698b117..0000000000
--- a/phpBB/modules/mcp/mcp_queue.php
+++ /dev/null
@@ -1,1078 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* mcp_queue
-* Handling the moderation queue
-* @package mcp
-*/
-class mcp_queue
-{
- var $p_master;
- var $u_action;
-
- function __construct(&$p_master)
- {
- $this->p_master = &$p_master;
- }
-
- function main($id, $mode)
- {
- global $action;
-
- include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT);
-
- $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.' . PHP_EXT);
-
- $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';
-
- phpbb::$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))
- {
- phpbb::$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 (phpbb::$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.' . PHP_EXT);
- $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'] && phpbb::$acl->acl_get('u_download') && phpbb::$acl->acl_get('f_download', $post_info['forum_id']))
- {
- $extensions = phpbb_cache::obtain_extensions_forum($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 = phpbb::$db->sql_query($sql);
-
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $attachments[] = $row;
- }
- phpbb::$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))
- {
- phpbb::$template->assign_var('S_HAS_ATTACHMENTS', true);
-
- foreach ($attachments as $attachment)
- {
- phpbb::$template->assign_block_vars('attachment', array(
- 'DISPLAY_ATTACHMENT' => $attachment,
- ));
- }
- }
- }
-
- $post_url = append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&amp;p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
- $topic_url = append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']);
-
- phpbb::$template->assign_vars(array(
- 'S_MCP_QUEUE' => true,
- 'U_APPROVE_ACTION' => append_sid('mcp', "i=queue&amp;p=$post_id&amp;f=$forum_id"),
- 'S_CAN_VIEWIP' => phpbb::$acl->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' => (phpbb::$acl->acl_get('m_edit', $post_info['forum_id'])) ? append_sid('posting', "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '',
- 'U_MCP_APPROVE' => append_sid('mcp', 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
- 'U_MCP_REPORT' => append_sid('mcp', 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
- 'U_MCP_USER_NOTES' => append_sid('mcp', 'i=notes&amp;mode=user_notes&amp;u=' . $post_info['user_id']),
- 'U_MCP_WARN_USER' => (phpbb::$acl->acl_get('m_warn')) ? append_sid('mcp', '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) ? phpbb::$user->img('icon_post_target_unread', 'NEW_POST') : phpbb::$user->img('icon_post_target', 'POST'),
-
- 'RETURN_QUEUE' => sprintf(phpbb::$user->lang['RETURN_QUEUE'], '<a href="' . append_sid('mcp', 'i=queue' . (($topic_id) ? '&amp;mode=unapproved_topics' : '&amp;mode=unapproved_posts')) . "&amp;start=$start\">", '</a>'),
- 'RETURN_POST' => sprintf(phpbb::$user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'),
- 'RETURN_TOPIC_SIMPLE' => sprintf(phpbb::$user->lang['RETURN_TOPIC_SIMPLE'], '<a href="' . $topic_url . '">', '</a>'),
- 'REPORTED_IMG' => phpbb::$user->img('icon_topic_reported', 'POST_REPORTED'),
- 'UNAPPROVED_IMG' => phpbb::$user->img('icon_topic_unapproved', 'POST_UNAPPROVED'),
- 'EDIT_IMG' => phpbb::$user->img('icon_post_edit', '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' => phpbb::$user->format_date($post_info['post_time']),
- 'POST_IP' => $post_info['poster_ip'],
- 'POST_IPADDR' => (phpbb::$acl->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' => (phpbb::$acl->acl_get('m_info', $post_info['forum_id'])) ? append_sid('mcp', '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':
- phpbb::$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 . "
- WHERE forum_id IN (0, $forum_list)";
- $result = phpbb::$db->sql_query($sql);
- $forum_info['forum_topics'] = (int) phpbb::$db->sql_fetchfield('sum_forum_topics');
- phpbb::$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"' : '') . '>' . phpbb::$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' : '') . "
- WHERE p.forum_id IN (0, $forum_list)
- AND p.post_approved = 0
- " . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . '
- ' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . "
- AND t.topic_id = p.topic_id
- AND t.topic_first_post_id <> p.post_id
- $limit_time_sql
- ORDER BY $sort_order_sql";
- $result = phpbb::$db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start);
-
- $i = 0;
- $post_ids = array();
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $post_ids[] = $row['post_id'];
- $row_num[$row['post_id']] = $i++;
- }
- phpbb::$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 ' . phpbb::$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 = phpbb::$db->sql_query($sql);
-
- $post_data = $rowset = array();
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- if ($row['forum_id'])
- {
- $forum_names[] = $row['forum_id'];
- }
- $post_data[$row['post_id']] = $row;
- }
- phpbb::$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
- WHERE forum_id IN (0, $forum_list)
- AND topic_approved = 0
- $limit_time_sql
- ORDER BY $sort_order_sql";
- $result = phpbb::$db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start);
-
- $rowset = array();
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- if ($row['forum_id'])
- {
- $forum_names[] = $row['forum_id'];
- }
- $rowset[] = $row;
- }
- phpbb::$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 ' . phpbb::$db->sql_in_set('forum_id', $forum_names);
- $result = phpbb::$db->sql_query($sql, 3600);
-
- $forum_names = array();
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $forum_names[$row['forum_id']] = $row['forum_name'];
- }
- phpbb::$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'] = phpbb::$user->lang['GUEST'];
- }
-
- phpbb::$template->assign_block_vars('postrow', array(
- 'U_TOPIC' => append_sid('viewtopic', 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
- 'U_VIEWFORUM' => (!$global_topic) ? append_sid('viewforum', 'f=' . $row['forum_id']) : '',
- 'U_VIEWPOST' => append_sid('viewtopic', 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''),
- 'U_VIEW_DETAILS' => append_sid('mcp', "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']] : phpbb::$user->lang['GLOBAL_ANNOUNCEMENT'],
- 'POST_SUBJECT' => $row['post_subject'],
- 'TOPIC_TITLE' => $row['topic_title'],
- 'POST_TIME' => phpbb::$user->format_date($row['post_time']),
- ));
- }
- unset($rowset, $forum_names);
-
- // Now display the page
- phpbb::$template->assign_vars(array(
- 'L_DISPLAY_ITEMS' => ($mode == 'unapproved_posts') ? phpbb::$user->lang['DISPLAY_POSTS'] : phpbb::$user->lang['DISPLAY_TOPICS'],
- 'L_EXPLAIN' => ($mode == 'unapproved_posts') ? phpbb::$user->lang['MCP_QUEUE_UNAPPROVED_POSTS_EXPLAIN'] : phpbb::$user->lang['MCP_QUEUE_UNAPPROVED_TOPICS_EXPLAIN'],
- 'L_TITLE' => ($mode == 'unapproved_posts') ? phpbb::$user->lang['MCP_QUEUE_UNAPPROVED_POSTS'] : phpbb::$user->lang['MCP_QUEUE_UNAPPROVED_TOPICS'],
- 'L_ONLY_TOPIC' => ($topic_id) ? sprintf(phpbb::$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, phpbb::$config['topics_per_page'], $start),
- 'PAGE_NUMBER' => on_page($total, phpbb::$config['topics_per_page'], $start),
- 'TOPIC_ID' => $topic_id,
- 'TOTAL' => ($total == 1) ? (($mode == 'unapproved_posts') ? phpbb::$user->lang['VIEW_TOPIC_POST'] : phpbb::$user->lang['VIEW_FORUM_TOPIC']) : sprintf((($mode == 'unapproved_posts') ? phpbb::$user->lang['VIEW_TOPIC_POSTS'] : phpbb::$user->lang['VIEW_FORUM_TOPICS']), $total),
- ));
-
- $this->tpl_name = 'mcp_queue';
- break;
- }
- }
-}
-
-/**
-* Approve Post/Topic
-*/
-function approve_post($post_id_list, $id, $mode)
-{
- if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
- {
- trigger_error('NOT_AUTHORISED');
- }
-
- $redirect = request_var('redirect', build_url(array('quickmod')));
- $success_msg = '';
-
- $s_hidden_fields = build_hidden_fields(array(
- 'i' => $id,
- 'mode' => $mode,
- 'post_id_list' => $post_id_list,
- 'action' => 'approve',
- 'redirect' => $redirect)
- );
-
- $post_info = get_post_data($post_id_list, 'm_approve');
-
- if (confirm_box(true))
- {
- $notify_poster = phpbb_request::is_set('notify_poster');
-
- // If Topic -> total_topics = total_topics+1, total_posts = total_posts+1, forum_topics = forum_topics+1, forum_posts = forum_posts+1
- // If Post -> total_posts = total_posts+1, forum_posts = forum_posts+1, topic_replies = topic_replies+1
-
- $total_topics = $total_posts = 0;
- $forum_topics_posts = $topic_approve_sql = $topic_replies_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array();
- $user_posts_sql = $post_approved_list = array();
-
- $update_forum_information = false;
-
- foreach ($post_info as $post_id => $post_data)
- {
- if ($post_data['post_approved'])
- {
- $post_approved_list[] = $post_id;
- continue;
- }
-
- $topic_id_list[$post_data['topic_id']] = 1;
-
- if ($post_data['forum_id'])
- {
- $forum_id_list[$post_data['forum_id']] = 1;
- }
-
- // User post update (we do not care about topic or post, since user posts are strictly connected to posts)
- // But we care about forums where post counts get not increased. ;)
- if ($post_data['post_postcount'])
- {
- $user_posts_sql[$post_data['poster_id']] = (empty($user_posts_sql[$post_data['poster_id']])) ? 1 : $user_posts_sql[$post_data['poster_id']] + 1;
- }
-
- // Topic or Post. ;)
- if ($post_data['topic_first_post_id'] == $post_id)
- {
- if ($post_data['forum_id'])
- {
- if (!isset($forum_topics_posts[$post_data['forum_id']]))
- {
- $forum_topics_posts[$post_data['forum_id']] = array(
- 'forum_posts' => 0,
- 'forum_topics' => 0
- );
- }
-
- $total_topics++;
- $forum_topics_posts[$post_data['forum_id']]['forum_topics']++;
- }
- $topic_approve_sql[] = $post_data['topic_id'];
-
- $approve_log[] = array(
- 'type' => 'topic',
- 'post_subject' => $post_data['post_subject'],
- 'forum_id' => $post_data['forum_id'],
- 'topic_id' => $post_data['topic_id'],
- );
- }
- else
- {
- if (!isset($topic_replies_sql[$post_data['topic_id']]))
- {
- $topic_replies_sql[$post_data['topic_id']] = 0;
- }
- $topic_replies_sql[$post_data['topic_id']]++;
-
- $approve_log[] = array(
- 'type' => 'post',
- 'post_subject' => $post_data['post_subject'],
- 'forum_id' => $post_data['forum_id'],
- 'topic_id' => $post_data['topic_id'],
- );
- }
-
- if ($post_data['forum_id'])
- {
- if (!isset($forum_topics_posts[$post_data['forum_id']]))
- {
- $forum_topics_posts[$post_data['forum_id']] = array(
- 'forum_posts' => 0,
- 'forum_topics' => 0
- );
- }
-
- $total_posts++;
- $forum_topics_posts[$post_data['forum_id']]['forum_posts']++;
-
- // Increment by topic_replies if we approve a topic...
- // This works because we do not adjust the topic_replies when re-approving a topic after an edit.
- if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_replies'])
- {
- $total_posts += $post_data['topic_replies'];
- $forum_topics_posts[$post_data['forum_id']]['forum_posts'] += $post_data['topic_replies'];
- }
- }
-
- $post_approve_sql[] = $post_id;
-
- // If the post is newer than the last post information stored we need to update the forum information
- if ($post_data['post_time'] >= $post_data['forum_last_post_time'])
- {
- $update_forum_information = true;
- }
- }
- $post_id_list = array_values(array_diff($post_id_list, $post_approved_list));
- for ($i = 0, $size = sizeof($post_approved_list); $i < $size; $i++)
- {
- unset($post_info[$post_approved_list[$i]]);
- }
-
- if (sizeof($topic_approve_sql))
- {
- $sql = 'UPDATE ' . TOPICS_TABLE . '
- SET topic_approved = 1
- WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_approve_sql);
- phpbb::$db->sql_query($sql);
- }
-
- if (sizeof($post_approve_sql))
- {
- $sql = 'UPDATE ' . POSTS_TABLE . '
- SET post_approved = 1
- WHERE ' . phpbb::$db->sql_in_set('post_id', $post_approve_sql);
- phpbb::$db->sql_query($sql);
- }
-
- foreach ($approve_log as $log_data)
- {
- 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']);
- }
-
- if (sizeof($topic_replies_sql))
- {
- foreach ($topic_replies_sql as $topic_id => $num_replies)
- {
- $sql = 'UPDATE ' . TOPICS_TABLE . "
- SET topic_replies = topic_replies + $num_replies
- WHERE topic_id = $topic_id";
- phpbb::$db->sql_query($sql);
- }
- }
-
- if (sizeof($forum_topics_posts))
- {
- foreach ($forum_topics_posts as $forum_id => $row)
- {
- $sql = 'UPDATE ' . FORUMS_TABLE . '
- SET ';
- $sql .= ($row['forum_topics']) ? "forum_topics = forum_topics + {$row['forum_topics']}" : '';
- $sql .= ($row['forum_topics'] && $row['forum_posts']) ? ', ' : '';
- $sql .= ($row['forum_posts']) ? "forum_posts = forum_posts + {$row['forum_posts']}" : '';
- $sql .= " WHERE forum_id = $forum_id";
-
- phpbb::$db->sql_query($sql);
- }
- }
-
- if (sizeof($user_posts_sql))
- {
- // Try to minimize the query count by merging users with the same post count additions
- $user_posts_update = array();
-
- foreach ($user_posts_sql as $user_id => $user_posts)
- {
- $user_posts_update[$user_posts][] = $user_id;
- }
-
- foreach ($user_posts_update as $user_posts => $user_id_ary)
- {
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET user_posts = user_posts + ' . $user_posts . '
- WHERE ' . phpbb::$db->sql_in_set('user_id', $user_id_ary);
- phpbb::$db->sql_query($sql);
- }
- }
-
- if ($total_topics)
- {
- set_config_count('num_topics', $total_topics, true);
- }
-
- if ($total_posts)
- {
- set_config_count('num_posts', $total_posts, true);
- }
- unset($topic_approve_sql, $topic_replies_sql, $post_approve_sql);
-
- update_post_information('topic', array_keys($topic_id_list));
-
- if ($update_forum_information)
- {
- update_post_information('forum', array_keys($forum_id_list));
- }
- unset($topic_id_list, $forum_id_list);
-
- $messenger = new messenger();
-
- // Notify Poster?
- if ($notify_poster)
- {
- foreach ($post_info as $post_id => $post_data)
- {
- if ($post_data['poster_id'] == ANONYMOUS)
- {
- continue;
- }
-
- $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';
-
- $messenger->template($email_template, $post_data['user_lang']);
-
- $messenger->to($post_data['user_email'], $post_data['username']);
- $messenger->im($post_data['user_jabber'], $post_data['username']);
-
- $messenger->assign_vars(array(
- 'USERNAME' => htmlspecialchars_decode($post_data['username']),
- 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_data['post_subject'])),
- 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_data['topic_title'])),
-
- 'U_VIEW_TOPIC' => generate_board_url() . '/viewtopic.' . PHP_EXT . "?f={$post_data['forum_id']}&t={$post_data['topic_id']}&e=0",
- 'U_VIEW_POST' => generate_board_url() . '/viewtopic.' . PHP_EXT . "?f={$post_data['forum_id']}&t={$post_data['topic_id']}&p=$post_id&e=$post_id")
- );
-
- $messenger->send($post_data['user_notify_type']);
- }
- }
-
- $messenger->save_queue();
-
- // Send out normal user notifications
- $email_sig = str_replace('<br />', "\n", "-- \n" . phpbb::$config['board_email_sig']);
-
- foreach ($post_info as $post_id => $post_data)
- {
- if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id'])
- {
- // Forum Notifications
- 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);
- }
- else
- {
- // Topic Notifications
- 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);
- }
- }
-
- if (sizeof($post_id_list) == 1)
- {
- $post_data = $post_info[$post_id_list[0]];
- $post_url = append_sid('viewtopic', "f={$post_data['forum_id']}&amp;t={$post_data['topic_id']}&amp;p={$post_data['post_id']}") . '#p' . $post_data['post_id'];
- }
- unset($post_info);
-
- if ($total_topics)
- {
- $success_msg = ($total_topics == 1) ? 'TOPIC_APPROVED_SUCCESS' : 'TOPICS_APPROVED_SUCCESS';
- }
- else
- {
- $success_msg = (sizeof($post_id_list) + sizeof($post_approved_list) == 1) ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS';
- }
- }
- else
- {
- $show_notify = false;
-
- foreach ($post_info as $post_data)
- {
- if ($post_data['poster_id'] == ANONYMOUS)
- {
- continue;
- }
- else
- {
- $show_notify = true;
- break;
- }
- }
-
- phpbb::$template->assign_vars(array(
- 'S_NOTIFY_POSTER' => $show_notify,
- 'S_APPROVE' => true,
- ));
-
- confirm_box(false, 'APPROVE_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
- }
-
- $redirect = request_var('redirect', 'index.' . PHP_EXT);
- $redirect = reapply_sid($redirect);
-
- if (!$success_msg)
- {
- redirect($redirect);
- }
- else
- {
- meta_refresh(3, $redirect);
-
- // If approving one post, also give links back to post...
- $add_message = '';
- if (sizeof($post_id_list) == 1 && !empty($post_url))
- {
- $add_message = '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>');
- }
-
- trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>') . $add_message);
- }
-}
-
-/**
-* Disapprove Post/Topic
-*/
-function disapprove_post($post_id_list, $id, $mode)
-{
- if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
- {
- trigger_error('NOT_AUTHORISED');
- }
-
- $redirect = request_var('redirect', build_url(array('t', 'mode', 'quickmod')) . "&amp;mode=$mode");
- $reason = utf8_normalize_nfc(request_var('reason', '', true));
- $reason_id = request_var('reason_id', 0);
- $success_msg = $additional_msg = '';
-
- $s_hidden_fields = build_hidden_fields(array(
- 'i' => $id,
- 'mode' => $mode,
- 'post_id_list' => $post_id_list,
- 'action' => 'disapprove',
- 'redirect' => $redirect)
- );
-
- $notify_poster = phpbb_request::is_set('notify_poster');
- $disapprove_reason = '';
-
- if ($reason_id)
- {
- $sql = 'SELECT reason_title, reason_description
- FROM ' . REPORTS_REASONS_TABLE . "
- WHERE reason_id = $reason_id";
- $result = phpbb::$db->sql_query($sql);
- $row = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- if (!$row || (!$reason && strtolower($row['reason_title']) == 'other'))
- {
- $additional_msg = phpbb::$user->lang['NO_REASON_DISAPPROVAL'];
- }
- else
- {
- // If the reason is defined within the language file, we will use the localized version, else just use the database entry...
- $disapprove_reason = (strtolower($row['reason_title']) != 'other') ? ((isset(phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) ? phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])] : $row['reason_description']) : '';
- $disapprove_reason .= ($reason) ? "\n\n" . $reason : '';
-
- if (isset(phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]))
- {
- $disapprove_reason_lang = strtoupper($row['reason_title']);
- }
-
- $email_disapprove_reason = $disapprove_reason;
- }
- }
-
- $post_info = get_post_data($post_id_list, 'm_approve');
-
- if (!$additional_message && confirm_box(true))
- {
-
- // If Topic -> forum_topics_real -= 1
- // If Post -> topic_replies_real -= 1
-
- $num_disapproved = 0;
- $forum_topics_real = $topic_id_list = $forum_id_list = $topic_replies_real_sql = $post_disapprove_sql = $disapprove_log = array();
-
- foreach ($post_info as $post_id => $post_data)
- {
- $topic_id_list[$post_data['topic_id']] = 1;
-
- if ($post_data['forum_id'])
- {
- $forum_id_list[$post_data['forum_id']] = 1;
- }
-
- // Topic or Post. ;)
- /**
- * @todo this probably is a different method than the one used by delete_posts, does this cause counter inconsistency?
- */
- if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_last_post_id'] == $post_id)
- {
- if ($post_data['forum_id'])
- {
- if (!isset($forum_topics_real[$post_data['forum_id']]))
- {
- $forum_topics_real[$post_data['forum_id']] = 0;
- }
- $forum_topics_real[$post_data['forum_id']]++;
- $num_disapproved++;
- }
-
- $disapprove_log[] = array(
- 'type' => 'topic',
- 'post_subject' => $post_data['post_subject'],
- 'forum_id' => $post_data['forum_id'],
- 'topic_id' => 0, // useless to log a topic id, as it will be deleted
- );
- }
- else
- {
- if (!isset($topic_replies_real_sql[$post_data['topic_id']]))
- {
- $topic_replies_real_sql[$post_data['topic_id']] = 0;
- }
- $topic_replies_real_sql[$post_data['topic_id']]++;
-
- $disapprove_log[] = array(
- 'type' => 'post',
- 'post_subject' => $post_data['post_subject'],
- 'forum_id' => $post_data['forum_id'],
- 'topic_id' => $post_data['topic_id'],
- );
- }
-
- $post_disapprove_sql[] = $post_id;
- }
-
- unset($post_data);
-
- if (sizeof($forum_topics_real))
- {
- foreach ($forum_topics_real as $forum_id => $topics_real)
- {
- $sql = 'UPDATE ' . FORUMS_TABLE . "
- SET forum_topics_real = forum_topics_real - $topics_real
- WHERE forum_id = $forum_id";
- phpbb::$db->sql_query($sql);
- }
- }
-
- if (sizeof($topic_replies_real_sql))
- {
- foreach ($topic_replies_real_sql as $topic_id => $num_replies)
- {
- $sql = 'UPDATE ' . TOPICS_TABLE . "
- SET topic_replies_real = topic_replies_real - $num_replies
- WHERE topic_id = $topic_id";
- phpbb::$db->sql_query($sql);
- }
- }
-
- if (sizeof($post_disapprove_sql))
- {
- if (!function_exists('delete_posts'))
- {
- include_once(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT);
- }
-
- // We do not check for permissions here, because the moderator allowed approval/disapproval should be allowed to delete the disapproved posts
- delete_posts('post_id', $post_disapprove_sql);
-
- foreach ($disapprove_log as $log_data)
- {
- 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);
- }
- }
- unset($post_disapprove_sql, $topic_replies_real_sql);
-
- update_post_information('topic', array_keys($topic_id_list));
-
- if (sizeof($forum_id_list))
- {
- update_post_information('forum', array_keys($forum_id_list));
- }
- unset($topic_id_list, $forum_id_list);
-
- $messenger = new messenger();
-
- // Notify Poster?
- if ($notify_poster)
- {
- $lang_reasons = array();
-
- foreach ($post_info as $post_id => $post_data)
- {
- if ($post_data['poster_id'] == ANONYMOUS)
- {
- continue;
- }
-
- if (isset($disapprove_reason_lang))
- {
- // Okay we need to get the reason from the posters language
- if (!isset($lang_reasons[$post_data['user_lang']]))
- {
- // Assign the current users translation as the default, this is not ideal but getting the board default adds another layer of complexity.
- $lang_reasons[$post_data['user_lang']] = phpbb::$user->lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang];
-
- // Only load up the language pack if the language is different to the current one
- if ($post_data['user_lang'] != phpbb::$user->lang_name && file_exists(PHPBB_ROOT_PATH . '/language/' . $post_data['user_lang'] . '/mcp.' . PHP_EXT))
- {
- // Load up the language pack
- $lang = array();
- @include(PHPBB_ROOT_PATH . '/language/' . $post_data['user_lang'] . '/mcp.' . PHP_EXT);
-
- // If we find the reason in this language pack use it
- if (isset($lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang]))
- {
- $lang_reasons[$post_data['user_lang']] = $lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang];
- }
-
- unset($lang); // Free memory
- }
- }
-
- $email_disapprove_reason = $lang_reasons[$post_data['user_lang']];
- $email_disapprove_reason .= ($reason) ? "\n\n" . $reason : '';
- }
-
- $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';
-
- $messenger->template($email_template, $post_data['user_lang']);
-
- $messenger->to($post_data['user_email'], $post_data['username']);
- $messenger->im($post_data['user_jabber'], $post_data['username']);
-
- $messenger->assign_vars(array(
- 'USERNAME' => htmlspecialchars_decode($post_data['username']),
- 'REASON' => htmlspecialchars_decode($email_disapprove_reason),
- 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_data['post_subject'])),
- 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_data['topic_title'])))
- );
-
- $messenger->send($post_data['user_notify_type']);
- }
-
- unset($lang_reasons);
- }
- unset($post_info, $disapprove_reason, $email_disapprove_reason, $disapprove_reason_lang);
-
- $messenger->save_queue();
-
- if (sizeof($forum_topics_real))
- {
- $success_msg = ($num_disapproved == 1) ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS';
- }
- else
- {
- $success_msg = (sizeof($post_id_list) == 1) ? 'POST_DISAPPROVED_SUCCESS' : 'POSTS_DISAPPROVED_SUCCESS';
- }
- }
- else
- {
- include_once(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT);
-
- display_reasons($reason_id);
-
- $show_notify = false;
-
- foreach ($post_info as $post_data)
- {
- if ($post_data['poster_id'] == ANONYMOUS)
- {
- continue;
- }
- else
- {
- $show_notify = true;
- break;
- }
- }
-
- phpbb::$template->assign_vars(array(
- 'S_NOTIFY_POSTER' => $show_notify,
- 'S_APPROVE' => false,
- 'REASON' => $reason,
- 'ADDITIONAL_MSG' => $additional_msg,
- ));
-
- confirm_box(false, 'DISAPPROVE_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
- }
-
- $redirect = request_var('redirect', 'index.' . PHP_EXT);
- $redirect = reapply_sid($redirect);
-
- if (!$success_msg)
- {
- redirect($redirect);
- }
- else
- {
- meta_refresh(3, $redirect);
- trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>'));
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/mcp_reports.php b/phpBB/modules/mcp/mcp_reports.php
deleted file mode 100644
index 01f8a8fac6..0000000000
--- a/phpBB/modules/mcp/mcp_reports.php
+++ /dev/null
@@ -1,652 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* mcp_reports
-* Handling the reports queue
-* @package mcp
-*/
-class mcp_reports
-{
- var $p_master;
- var $u_action;
-
- function __construct(&$p_master)
- {
- $this->p_master = &$p_master;
- }
-
- function main($id, $mode)
- {
- global $action;
-
- include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT);
-
- $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.' . PHP_EXT);
-
- $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':
-
- phpbb::$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, 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 = phpbb::$db->sql_query_limit($sql, 1);
- $report = phpbb::$db->sql_fetchrow($result);
- phpbb::$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(phpbb::$user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])]) && isset(phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])]))
- {
- $reason['description'] = phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])];
- $reason['title'] = phpbb::$user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])];
- }
-
- if (topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false))
- {
- phpbb::$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 (phpbb::$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.' . PHP_EXT);
- $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'] && phpbb::$acl->acl_get('u_download') && phpbb::$acl->acl_get('f_download', $post_info['forum_id']))
- {
- $extensions = phpbb_cache::obtain_extensions_forum($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 = phpbb::$db->sql_query($sql);
-
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $attachments[] = $row;
- }
- phpbb::$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))
- {
- phpbb::$template->assign_var('S_HAS_ATTACHMENTS', true);
-
- foreach ($attachments as $attachment)
- {
- phpbb::$template->assign_block_vars('attachment', array(
- 'DISPLAY_ATTACHMENT' => $attachment,
- ));
- }
- }
- }
-
- phpbb::$template->assign_vars(array(
- 'S_MCP_REPORT' => true,
- 'S_CLOSE_ACTION' => append_sid('mcp', 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
- 'S_CAN_VIEWIP' => phpbb::$acl->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' => (phpbb::$acl->acl_get('m_edit', $post_info['forum_id'])) ? append_sid('posting', "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '',
- 'U_MCP_APPROVE' => append_sid('mcp', 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
- 'U_MCP_REPORT' => append_sid('mcp', 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
- 'U_MCP_REPORTER_NOTES' => append_sid('mcp', 'i=notes&amp;mode=user_notes&amp;u=' . $report['user_id']),
- 'U_MCP_USER_NOTES' => append_sid('mcp', 'i=notes&amp;mode=user_notes&amp;u=' . $post_info['user_id']),
- 'U_MCP_WARN_REPORTER' => (phpbb::$acl->acl_get('m_warn')) ? append_sid('mcp', 'i=warn&amp;mode=warn_user&amp;u=' . $report['user_id']) : '',
- 'U_MCP_WARN_USER' => (phpbb::$acl->acl_get('m_warn')) ? append_sid('mcp', 'i=warn&amp;mode=warn_user&amp;u=' . $post_info['user_id']) : '',
- 'U_VIEW_FORUM' => append_sid('viewforum', 'f=' . $post_info['forum_id']),
- 'U_VIEW_POST' => append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&amp;p=' . $post_info['post_id'] . '#p' . $post_info['post_id']),
- 'U_VIEW_TOPIC' => append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']),
-
- 'EDIT_IMG' => phpbb::$user->img('icon_post_edit', 'EDIT_POST'),
- 'MINI_POST_IMG' => ($post_unread) ? phpbb::$user->img('icon_post_target_unread', 'NEW_POST') : phpbb::$user->img('icon_post_target', 'POST'),
- 'UNAPPROVED_IMG' => phpbb::$user->img('icon_topic_unapproved', 'POST_UNAPPROVED'),
-
- 'RETURN_REPORTS' => sprintf(phpbb::$user->lang['RETURN_REPORTS'], '<a href="' . append_sid('mcp', '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' => phpbb::$user->img('icon_topic_reported', 'POST_REPORTED'),
- 'REPORT_DATE' => phpbb::$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'] : phpbb::$user->lang['NO_SUBJECT'],
- 'POST_DATE' => phpbb::$user->format_date($post_info['post_time']),
- 'POST_IP' => $post_info['poster_ip'],
- 'POST_IPADDR' => (phpbb::$acl->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' => (phpbb::$acl->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 && $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 ' . phpbb::$db->sql_in_set('forum_id', $forum_list);
- $result = phpbb::$db->sql_query($sql);
- $forum_info['forum_topics'] = (int) phpbb::$db->sql_fetchfield('sum_forum_topics');
- phpbb::$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"' : '') . '>' . phpbb::$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 ' . phpbb::$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 = phpbb::$db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start);
-
- $i = 0;
- $report_ids = array();
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $report_ids[] = $row['report_id'];
- $row_num[$row['report_id']] = $i++;
- }
- phpbb::$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 ' . phpbb::$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 = phpbb::$db->sql_query($sql);
-
- $report_data = $rowset = array();
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $global_topic = ($row['forum_id']) ? false : true;
- if ($global_topic)
- {
- $row['forum_id'] = $global_id;
- }
-
- phpbb::$template->assign_block_vars('postrow', array(
- 'U_VIEWFORUM' => (!$global_topic) ? append_sid('viewforum', 'f=' . $row['forum_id']) : '',
- 'U_VIEWPOST' => append_sid('viewtopic', 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']) . '#p' . $row['post_id'],
- 'U_VIEW_DETAILS' => append_sid('mcp', "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'] : phpbb::$user->lang['GLOBAL_ANNOUNCEMENT'],
- 'POST_ID' => $row['post_id'],
- 'POST_SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : phpbb::$user->lang['NO_SUBJECT'],
- 'POST_TIME' => phpbb::$user->format_date($row['post_time']),
- 'REPORT_ID' => $row['report_id'],
- 'REPORT_TIME' => phpbb::$user->format_date($row['report_time']),
- 'TOPIC_TITLE' => $row['topic_title'],
- ));
- }
- phpbb::$db->sql_freeresult($result);
- unset($report_ids, $row);
- }
-
- // Now display the page
- phpbb::$template->assign_vars(array(
- 'L_EXPLAIN' => ($mode == 'reports') ? phpbb::$user->lang['MCP_REPORTS_OPEN_EXPLAIN'] : phpbb::$user->lang['MCP_REPORTS_CLOSED_EXPLAIN'],
- 'L_TITLE' => ($mode == 'reports') ? phpbb::$user->lang['MCP_REPORTS_OPEN'] : phpbb::$user->lang['MCP_REPORTS_CLOSED'],
- 'L_ONLY_TOPIC' => ($topic_id) ? sprintf(phpbb::$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, phpbb::$config['topics_per_page'], $start),
- 'PAGE_NUMBER' => on_page($total, phpbb::$config['topics_per_page'], $start),
- 'TOPIC_ID' => $topic_id,
- 'TOTAL' => $total,
- 'TOTAL_REPORTS' => ($total == 1) ? phpbb::$user->lang['LIST_REPORT'] : sprintf(phpbb::$user->lang['LIST_REPORTS'], $total),
- ));
-
- $this->tpl_name = 'mcp_reports';
- break;
- }
- }
-}
-
-/**
-* Closes a report
-*/
-function close_report($report_id_list, $mode, $action)
-{
- $sql = 'SELECT r.post_id
- FROM ' . REPORTS_TABLE . ' r
- WHERE ' . phpbb::$db->sql_in_set('r.report_id', $report_id_list);
- $result = phpbb::$db->sql_query($sql);
-
- $post_id_list = array();
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $post_id_list[] = $row['post_id'];
- }
- $post_id_list = array_unique($post_id_list);
-
- if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_report')))
- {
- trigger_error('NOT_AUTHORISED');
- }
-
- if ($action == 'delete' && strpos(phpbb::$user->data['session_page'], 'mode=report_details') !== false)
- {
- $redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&amp;mode=reports');
- }
- else if ($action == 'close' && !request_var('r', 0))
- {
- $redirect = request_var('redirect', build_url(array('mode', 'p', 'quickmod')) . '&amp;mode=reports');
- }
- else
- {
- $redirect = request_var('redirect', build_url(array('quickmod')));
- }
- $success_msg = '';
- $forum_ids = array();
- $topic_ids = array();
-
- $s_hidden_fields = build_hidden_fields(array(
- 'i' => 'reports',
- 'mode' => $mode,
- 'report_id_list' => $report_id_list,
- 'action' => $action,
- 'redirect' => $redirect)
- );
-
- if (confirm_box(true))
- {
- $post_info = get_post_data($post_id_list, 'm_report');
-
- $sql = 'SELECT r.report_id, r.post_id, r.report_closed, r.user_id, r.user_notify, u.username, u.username_clean, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type
- FROM ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u
- WHERE ' . phpbb::$db->sql_in_set('r.report_id', $report_id_list) . '
- ' . (($action == 'close') ? 'AND r.report_closed = 0' : '') . '
- AND r.user_id = u.user_id';
- $result = phpbb::$db->sql_query($sql);
-
- $reports = $close_report_posts = $close_report_topics = $notify_reporters = $report_id_list = array();
- while ($report = phpbb::$db->sql_fetchrow($result))
- {
- $reports[$report['report_id']] = $report;
- $report_id_list[] = $report['report_id'];
-
- if (!$report['report_closed'])
- {
- $close_report_posts[] = $report['post_id'];
- $close_report_topics[] = $post_info[$report['post_id']]['topic_id'];
- }
-
- if ($report['user_notify'] && !$report['report_closed'])
- {
- $notify_reporters[$report['report_id']] = &$reports[$report['report_id']];
- }
- }
- phpbb::$db->sql_freeresult($result);
-
- if (sizeof($reports))
- {
- $close_report_posts = array_unique($close_report_posts);
- $close_report_topics = array_unique($close_report_topics);
-
- if (sizeof($close_report_posts))
- {
- // Get a list of topics that still contain reported posts
- $sql = 'SELECT DISTINCT topic_id
- FROM ' . POSTS_TABLE . '
- WHERE ' . phpbb::$db->sql_in_set('topic_id', $close_report_topics) . '
- AND post_reported = 1
- AND ' . phpbb::$db->sql_in_set('post_id', $close_report_posts, true);
- $result = phpbb::$db->sql_query($sql);
-
- $keep_report_topics = array();
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $keep_report_topics[] = $row['topic_id'];
- }
- phpbb::$db->sql_freeresult($result);
-
- $close_report_topics = array_diff($close_report_topics, $keep_report_topics);
- unset($keep_report_topics);
- }
-
- phpbb::$db->sql_transaction('begin');
-
- if ($action == 'close')
- {
- $sql = 'UPDATE ' . REPORTS_TABLE . '
- SET report_closed = 1
- WHERE ' . phpbb::$db->sql_in_set('report_id', $report_id_list);
- }
- else
- {
- $sql = 'DELETE FROM ' . REPORTS_TABLE . '
- WHERE ' . phpbb::$db->sql_in_set('report_id', $report_id_list);
- }
- phpbb::$db->sql_query($sql);
-
-
- if (sizeof($close_report_posts))
- {
- $sql = 'UPDATE ' . POSTS_TABLE . '
- SET post_reported = 0
- WHERE ' . phpbb::$db->sql_in_set('post_id', $close_report_posts);
- phpbb::$db->sql_query($sql);
-
- if (sizeof($close_report_topics))
- {
- $sql = 'UPDATE ' . TOPICS_TABLE . '
- SET topic_reported = 0
- WHERE ' . phpbb::$db->sql_in_set('topic_id', $close_report_topics) . '
- OR ' . phpbb::$db->sql_in_set('topic_moved_id', $close_report_topics);
- phpbb::$db->sql_query($sql);
- }
- }
-
- phpbb::$db->sql_transaction('commit');
- }
- unset($close_report_posts, $close_report_topics);
-
- foreach ($reports as $report)
- {
- add_log('mod', $post_info[$report['post_id']]['forum_id'], $post_info[$report['post_id']]['topic_id'], 'LOG_REPORT_' . strtoupper($action) . 'D', $post_info[$report['post_id']]['post_subject']);
- }
-
- $messenger = new messenger();
-
- // Notify reporters
- if (sizeof($notify_reporters))
- {
- foreach ($notify_reporters as $report_id => $reporter)
- {
- if ($reporter['user_id'] == ANONYMOUS)
- {
- continue;
- }
-
- $post_id = $reporter['post_id'];
-
- $messenger->template('report_' . $action . 'd', $reporter['user_lang']);
-
- $messenger->to($reporter['user_email'], $reporter['username']);
- $messenger->im($reporter['user_jabber'], $reporter['username']);
-
- $messenger->assign_vars(array(
- 'USERNAME' => htmlspecialchars_decode($reporter['username']),
- 'CLOSER_NAME' => htmlspecialchars_decode(phpbb::$user->data['username']),
- 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_info[$post_id]['post_subject'])),
- 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_info[$post_id]['topic_title'])))
- );
-
- $messenger->send($reporter['user_notify_type']);
- }
- }
-
- foreach ($post_info as $post)
- {
- $forum_ids[$post['forum_id']] = $post['forum_id'];
- $topic_ids[$post['topic_id']] = $post['topic_id'];
- }
-
- unset($notify_reporters, $post_info, $reports);
-
- $messenger->save_queue();
-
- $success_msg = (sizeof($report_id_list) == 1) ? 'REPORT_' . strtoupper($action) . 'D_SUCCESS' : 'REPORTS_' . strtoupper($action) . 'D_SUCCESS';
- }
- else
- {
- confirm_box(false, phpbb::$user->lang[strtoupper($action) . '_REPORT' . ((sizeof($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields);
- }
-
- $redirect = request_var('redirect', 'index.' . PHP_EXT);
- $redirect = reapply_sid($redirect);
-
- if (!$success_msg)
- {
- redirect($redirect);
- }
- else
- {
- meta_refresh(3, $redirect);
- $return_forum = '';
- if (sizeof($forum_ids == 1))
- {
- $return_forum = sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
- }
- $return_topic = '';
- if (sizeof($topic_ids == 1))
- {
- $return_topic = sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 't=' . current($topic_ids) . '&amp;f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
- }
-
- trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . $return_forum . $return_topic . sprintf(phpbb::$user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>'));
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/mcp_topic.php b/phpBB/modules/mcp/mcp_topic.php
deleted file mode 100644
index 91579b1059..0000000000
--- a/phpBB/modules/mcp/mcp_topic.php
+++ /dev/null
@@ -1,627 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* View topic in MCP
-*/
-function mcp_topic_view($id, $mode, $action)
-{
- $url = append_sid(PHPBB_ROOT_PATH. 'mcp.' . PHP_EXT . '?' . extra_url());
-
- phpbb::$user->add_lang('viewtopic');
-
- $topic_id = request_var('t', 0);
- $topic_info = get_topic_data(array($topic_id), false, true);
-
- if (!sizeof($topic_info))
- {
- trigger_error('TOPIC_NOT_EXIST');
- }
-
- $topic_info = $topic_info[$topic_id];
-
- // Set up some vars
- $icon_id = request_var('icon', 0);
- $subject = utf8_normalize_nfc(request_var('subject', '', true));
- $start = request_var('start', 0);
- $sort_days_old = request_var('st_old', 0);
- $forum_id = request_var('f', 0);
- $to_topic_id = request_var('to_topic_id', 0);
- $to_forum_id = request_var('to_forum_id', 0);
- $sort = phpbb_request::is_set_post('sort');
- $submitted_id_list = request_var('post_ids', array(0));
- $checked_ids = $post_id_list = request_var('post_id_list', array(0));
-
- // Split Topic?
- if ($action == 'split_all' || $action == 'split_beyond')
- {
- if (!$sort)
- {
- split_topic($action, $topic_id, $to_forum_id, $subject);
- }
- $action = 'split';
- }
-
- // Merge Posts?
- if ($action == 'merge_posts')
- {
- if (!$sort)
- {
- merge_posts($topic_id, $to_topic_id);
- }
- $action = 'merge';
- }
-
- if ($action == 'split' && !$subject)
- {
- $subject = $topic_info['topic_title'];
- }
-
- // Approve posts?
- if ($action == 'approve' && phpbb::$acl->acl_get('m_approve', $topic_info['forum_id']))
- {
- include(PHPBB_ROOT_PATH . 'includes/mcp/mcp_queue.' . PHP_EXT);
- include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT);
- include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT);
-
- if (!sizeof($post_id_list))
- {
- trigger_error('NO_POST_SELECTED');
- }
-
- if (!$sort)
- {
- approve_post($post_id_list, $id, $mode);
- }
- }
-
- // Jumpbox, sort selects and that kind of things
- make_jumpbox($url . "&amp;i=$id&amp;mode=forum_view", $topic_info['forum_id'], false, 'm_', true);
- $where_sql = ($action == 'reports') ? 'WHERE post_reported = 1 AND ' : 'WHERE';
-
- $sort_days = $total = 0;
- $sort_key = $sort_dir = '';
- $sort_by_sql = $sort_order_sql = array();
- mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id, $where_sql);
-
- $limit_time_sql = ($sort_days) ? 'AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
-
- if ($total == -1)
- {
- $total = $topic_info['topic_replies'] + 1;
- }
-
- $posts_per_page = max(0, request_var('posts_per_page', intval(phpbb::$config['posts_per_page'])));
- if ($posts_per_page == 0)
- {
- $posts_per_page = $total;
- }
-
- if ((!empty($sort_days_old) && $sort_days_old != $sort_days) || $total <= $posts_per_page)
- {
- $start = 0;
- }
-
- // Make sure $start is set to the last page if it exceeds the amount
- if ($start < 0 || $start >= $total)
- {
- $start = ($start < 0) ? 0 : floor(($total - 1) / $posts_per_page) * $posts_per_page;
- }
-
- $sql = 'SELECT u.username, u.username_clean, u.user_colour, p.*
- FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
- WHERE ' . (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . '
- p.topic_id = ' . $topic_id . ' ' .
- ((!phpbb::$acl->acl_get('m_approve', $topic_info['forum_id'])) ? ' AND p.post_approved = 1 ' : '') . '
- AND p.poster_id = u.user_id ' .
- $limit_time_sql . '
- ORDER BY ' . $sort_order_sql;
- $result = phpbb::$db->sql_query_limit($sql, $posts_per_page, $start);
-
- $rowset = $post_id_list = array();
- $bbcode_bitfield = '';
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $rowset[] = $row;
- $post_id_list[] = $row['post_id'];
- $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);
- }
- phpbb::$db->sql_freeresult($result);
-
- if ($bbcode_bitfield !== '')
- {
- include_once(PHPBB_ROOT_PATH . 'includes/bbcode.' . PHP_EXT);
- $bbcode = new bbcode(base64_encode($bbcode_bitfield));
- }
-
- $topic_tracking_info = array();
-
- // Get topic tracking info
- if (phpbb::$config['load_db_lastread'])
- {
- $tmp_topic_data = array($topic_id => $topic_info);
- $topic_tracking_info = get_topic_tracking($topic_info['forum_id'], $topic_id, $tmp_topic_data, array($topic_info['forum_id'] => $topic_info['forum_mark_time']));
- unset($tmp_topic_data);
- }
- else
- {
- $topic_tracking_info = get_complete_topic_tracking($topic_info['forum_id'], $topic_id);
- }
-
- $has_unapproved_posts = false;
-
- // Grab extensions
- $extensions = $attachments = array();
- if ($topic_info['topic_attachment'] && sizeof($post_id_list))
- {
- $extensions = phpbb_cache::obtain_extensions_forum($topic_info['forum_id']);
-
- // Get attachments...
- if (phpbb::$acl->acl_get('u_download') && phpbb::$acl->acl_get('f_download', $topic_info['forum_id']))
- {
- $sql = 'SELECT *
- FROM ' . ATTACHMENTS_TABLE . '
- WHERE ' . phpbb::$db->sql_in_set('post_msg_id', $post_id_list) . '
- AND in_message = 0
- ORDER BY filetime DESC, post_msg_id ASC';
- $result = phpbb::$db->sql_query($sql);
-
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $attachments[$row['post_msg_id']][] = $row;
- }
- phpbb::$db->sql_freeresult($result);
- }
- }
-
- foreach ($rowset as $i => $row)
- {
- $message = $row['post_text'];
- $post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title'];
-
- if ($row['bbcode_bitfield'])
- {
- $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
- }
-
- $message = bbcode_nl2br($message);
- $message = smiley_text($message);
-
- if (!empty($attachments[$row['post_id']]))
- {
- $update_count = array();
- parse_attachments($topic_info['forum_id'], $message, $attachments[$row['post_id']], $update_count);
- }
-
- if (!$row['post_approved'])
- {
- $has_unapproved_posts = true;
- }
-
- $post_unread = (isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
-
- phpbb::$template->assign_block_vars('postrow', array(
- '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_DATE' => phpbb::$user->format_date($row['post_time']),
- 'POST_SUBJECT' => $post_subject,
- 'MESSAGE' => $message,
- 'POST_ID' => $row['post_id'],
- 'RETURN_TOPIC' => sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 't=' . $topic_id) . '">', '</a>'),
-
- 'MINI_POST_IMG' => ($post_unread) ? phpbb::$user->img('icon_post_target_unread', 'NEW_POST') : phpbb::$user->img('icon_post_target', 'POST'),
-
- 'S_POST_REPORTED' => ($row['post_reported']) ? true : false,
- 'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true,
- 'S_CHECKED' => (($submitted_id_list && !in_array(intval($row['post_id']), $submitted_id_list)) || in_array(intval($row['post_id']), $checked_ids)) ? true : false,
- 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,
-
- 'U_POST_DETAILS' => "$url&amp;i=$id&amp;p={$row['post_id']}&amp;mode=post_details" . (($forum_id) ? "&amp;f=$forum_id" : ''),
- 'U_MCP_APPROVE' => (phpbb::$acl->acl_get('m_approve', $topic_info['forum_id'])) ? append_sid('mcp', 'i=queue&amp;mode=approve_details&amp;f=' . $topic_info['forum_id'] . '&amp;p=' . $row['post_id']) : '',
- 'U_MCP_REPORT' => (phpbb::$acl->acl_get('m_report', $topic_info['forum_id'])) ? append_sid('mcp', 'i=reports&amp;mode=report_details&amp;f=' . $topic_info['forum_id'] . '&amp;p=' . $row['post_id']) : '',
- ));
-
- // Display not already displayed Attachments for this post, we already parsed them. ;)
- if (!empty($attachments[$row['post_id']]))
- {
- foreach ($attachments[$row['post_id']] as $attachment)
- {
- phpbb::$template->assign_block_vars('postrow.attachment', array(
- 'DISPLAY_ATTACHMENT' => $attachment,
- ));
- }
- }
-
- unset($rowset[$i]);
- }
-
- // Display topic icons for split topic
- $s_topic_icons = false;
-
- if (phpbb::$acl->acl_get('m_split', $topic_info['forum_id']))
- {
- include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT);
- $s_topic_icons = posting_gen_topic_icons('', $icon_id);
-
- // Has the user selected a topic for merge?
- if ($to_topic_id)
- {
- $to_topic_info = get_topic_data(array($to_topic_id), 'm_merge');
-
- if (!sizeof($to_topic_info))
- {
- $to_topic_id = 0;
- }
- else
- {
- $to_topic_info = $to_topic_info[$to_topic_id];
-
- if (!$to_topic_info['enable_icons'] || phpbb::$acl->acl_get('!f_icons', $topic_info['forum_id']))
- {
- $s_topic_icons = false;
- }
- }
- }
- }
-
- $s_hidden_fields = build_hidden_fields(array(
- 'st_old' => $sort_days,
- 'post_ids' => $post_id_list,
- ));
-
- phpbb::$template->assign_vars(array(
- 'TOPIC_TITLE' => $topic_info['topic_title'],
- 'U_VIEW_TOPIC' => append_sid('viewtopic', 'f=' . $topic_info['forum_id'] . '&amp;t=' . $topic_info['topic_id']),
-
- 'TO_TOPIC_ID' => $to_topic_id,
- 'TO_TOPIC_INFO' => ($to_topic_id) ? sprintf(phpbb::$user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '<a href="' . append_sid('viewtopic', 'f=' . $to_topic_info['forum_id'] . '&amp;t=' . $to_topic_id) . '">' . $to_topic_info['topic_title'] . '</a>') : '',
-
- 'SPLIT_SUBJECT' => $subject,
- 'POSTS_PER_PAGE' => $posts_per_page,
- 'ACTION' => $action,
-
- 'REPORTED_IMG' => phpbb::$user->img('icon_topic_reported', 'POST_REPORTED'),
- 'UNAPPROVED_IMG' => phpbb::$user->img('icon_topic_unapproved', 'POST_UNAPPROVED'),
-
- 'S_MCP_ACTION' => "$url&amp;i=$id&amp;mode=$mode&amp;action=$action&amp;start=$start",
- 'S_FORUM_SELECT' => ($to_forum_id) ? make_forum_select($to_forum_id, false, false, true, true, true) : make_forum_select($topic_info['forum_id'], false, false, true, true, true),
- 'S_CAN_SPLIT' => (phpbb::$acl->acl_get('m_split', $topic_info['forum_id'])) ? true : false,
- 'S_CAN_MERGE' => (phpbb::$acl->acl_get('m_merge', $topic_info['forum_id'])) ? true : false,
- 'S_CAN_DELETE' => (phpbb::$acl->acl_get('m_delete', $topic_info['forum_id'])) ? true : false,
- 'S_CAN_APPROVE' => ($has_unapproved_posts && phpbb::$acl->acl_get('m_approve', $topic_info['forum_id'])) ? true : false,
- 'S_CAN_LOCK' => (phpbb::$acl->acl_get('m_lock', $topic_info['forum_id'])) ? true : false,
- 'S_CAN_REPORT' => (phpbb::$acl->acl_get('m_report', $topic_info['forum_id'])) ? true : false,
- 'S_REPORT_VIEW' => ($action == 'reports') ? true : false,
- 'S_MERGE_VIEW' => ($action == 'merge') ? true : false,
- 'S_SPLIT_VIEW' => ($action == 'split') ? true : false,
-
- 'S_HIDDEN_FIELDS' => $s_hidden_fields,
-
- 'S_SHOW_TOPIC_ICONS' => $s_topic_icons,
- 'S_TOPIC_ICON' => $icon_id,
-
- 'U_SELECT_TOPIC' => "$url&amp;i=$id&amp;mode=forum_view&amp;action=merge_select" . (($forum_id) ? "&amp;f=$forum_id" : ''),
-
- 'RETURN_TOPIC' => sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', "f={$topic_info['forum_id']}&amp;t={$topic_info['topic_id']}&amp;start=$start") . '">', '</a>'),
- 'RETURN_FORUM' => sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', "f={$topic_info['forum_id']}&amp;start=$start") . '">', '</a>'),
-
- 'PAGE_NUMBER' => on_page($total, $posts_per_page, $start),
- 'PAGINATION' => (!$posts_per_page) ? '' : generate_pagination(append_sid('mcp', "i=$id&amp;t={$topic_info['topic_id']}&amp;mode=$mode&amp;action=$action&amp;to_topic_id=$to_topic_id&amp;posts_per_page=$posts_per_page&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir"), $total, $posts_per_page, $start),
- 'TOTAL_POSTS' => ($total == 1) ? phpbb::$user->lang['VIEW_TOPIC_POST'] : sprintf(phpbb::$user->lang['VIEW_TOPIC_POSTS'], $total),
- ));
-}
-
-/**
-* Split topic
-*/
-function split_topic($action, $topic_id, $to_forum_id, $subject)
-{
- $post_id_list = request_var('post_id_list', array(0));
- $forum_id = request_var('forum_id', 0);
- $start = request_var('start', 0);
-
- if (!sizeof($post_id_list))
- {
- phpbb::$template->assign_var('MESSAGE', phpbb::$user->lang['NO_POST_SELECTED']);
- return;
- }
-
- if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_split')))
- {
- return;
- }
-
- $post_id = $post_id_list[0];
- $post_info = get_post_data(array($post_id));
-
- if (!sizeof($post_info))
- {
- phpbb::$template->assign_var('MESSAGE', phpbb::$user->lang['NO_POST_SELECTED']);
- return;
- }
-
- $post_info = $post_info[$post_id];
- $subject = trim($subject);
-
- // Make some tests
- if (!$subject)
- {
- phpbb::$template->assign_var('MESSAGE', phpbb::$user->lang['EMPTY_SUBJECT']);
- return;
- }
-
- if ($to_forum_id <= 0)
- {
- phpbb::$template->assign_var('MESSAGE', phpbb::$user->lang['NO_DESTINATION_FORUM']);
- return;
- }
-
- $forum_info = get_forum_data(array($to_forum_id), 'f_post');
-
- if (!sizeof($forum_info))
- {
- phpbb::$template->assign_var('MESSAGE', phpbb::$user->lang['USER_CANNOT_POST']);
- return;
- }
-
- $forum_info = $forum_info[$to_forum_id];
-
- if ($forum_info['forum_type'] != FORUM_POST)
- {
- phpbb::$template->assign_var('MESSAGE', phpbb::$user->lang['FORUM_NOT_POSTABLE']);
- return;
- }
-
- $redirect = request_var('redirect', build_url(array('quickmod')));
-
- $s_hidden_fields = build_hidden_fields(array(
- 'i' => 'main',
- 'post_id_list' => $post_id_list,
- 'f' => $forum_id,
- 'mode' => 'topic_view',
- 'start' => $start,
- 'action' => $action,
- 't' => $topic_id,
- 'redirect' => $redirect,
- 'subject' => $subject,
- 'to_forum_id' => $to_forum_id,
- 'icon' => request_var('icon', 0))
- );
- $success_msg = $return_link = '';
-
- if (confirm_box(true))
- {
- if ($action == 'split_beyond')
- {
- $sort_days = $total = 0;
- $sort_key = $sort_dir = '';
- $sort_by_sql = $sort_order_sql = array();
- mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
-
- $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';
-
- if ($sort_order_sql[0] == 'u')
- {
- $sql = 'SELECT p.post_id, p.forum_id, p.post_approved
- FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
- WHERE p.topic_id = $topic_id
- AND p.poster_id = u.user_id
- $limit_time_sql
- ORDER BY $sort_order_sql";
- }
- else
- {
- $sql = 'SELECT p.post_id, p.forum_id, p.post_approved
- FROM ' . POSTS_TABLE . " p
- WHERE p.topic_id = $topic_id
- $limit_time_sql
- ORDER BY $sort_order_sql";
- }
- $result = phpbb::$db->sql_query_limit($sql, 0, $start);
-
- $store = false;
- $post_id_list = array();
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- // If split from selected post (split_beyond), we split the unapproved items too.
- if (!$row['post_approved'] && !phpbb::$acl->acl_get('m_approve', $row['forum_id']))
- {
-// continue;
- }
-
- // Start to store post_ids as soon as we see the first post that was selected
- if ($row['post_id'] == $post_id)
- {
- $store = true;
- }
-
- if ($store)
- {
- $post_id_list[] = $row['post_id'];
- }
- }
- phpbb::$db->sql_freeresult($result);
- }
-
- if (!sizeof($post_id_list))
- {
- trigger_error('NO_POST_SELECTED');
- }
-
- $icon_id = request_var('icon', 0);
-
- $sql_ary = array(
- 'forum_id' => $to_forum_id,
- 'topic_title' => $subject,
- 'icon_id' => $icon_id,
- 'topic_approved'=> 1
- );
-
- $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary);
- phpbb::$db->sql_query($sql);
-
- $to_topic_id = phpbb::$db->sql_nextid();
- move_posts($post_id_list, $to_topic_id);
-
- $topic_info = get_topic_data(array($topic_id));
- $topic_info = $topic_info[$topic_id];
-
- add_log('mod', $to_forum_id, $to_topic_id, 'LOG_SPLIT_DESTINATION', $subject);
- add_log('mod', $forum_id, $topic_id, 'LOG_SPLIT_SOURCE', $topic_info['topic_title']);
-
- // Change topic title of first post
- $sql = 'UPDATE ' . POSTS_TABLE . "
- SET post_subject = '" . phpbb::$db->sql_escape($subject) . "'
- WHERE post_id = {$post_id_list[0]}";
- phpbb::$db->sql_query($sql);
-
- $success_msg = 'TOPIC_SPLIT_SUCCESS';
-
- // Update forum statistics
- set_config_count('num_topics', 1, true);
-
- // Link back to both topics
- $return_link = sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
- }
- else
- {
- confirm_box(false, ($action == 'split_all') ? 'SPLIT_TOPIC_ALL' : 'SPLIT_TOPIC_BEYOND', $s_hidden_fields);
- }
-
- $redirect = request_var('redirect', 'index.' . PHP_EXT);
- $redirect = reapply_sid($redirect);
-
- if (!$success_msg)
- {
- return;
- }
- else
- {
- meta_refresh(3, append_sid('viewtopic', "f=$to_forum_id&amp;t=$to_topic_id"));
- trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . $return_link);
- }
-}
-
-/**
-* Merge selected posts into selected topic
-*/
-function merge_posts($topic_id, $to_topic_id)
-{
- if (!$to_topic_id)
- {
- phpbb::$template->assign_var('MESSAGE', phpbb::$user->lang['NO_FINAL_TOPIC_SELECTED']);
- return;
- }
-
- $topic_data = get_topic_data(array($to_topic_id), 'm_merge');
-
- if (!sizeof($topic_data))
- {
- phpbb::$template->assign_var('MESSAGE', phpbb::$user->lang['NO_FINAL_TOPIC_SELECTED']);
- return;
- }
-
- $topic_data = $topic_data[$to_topic_id];
-
- $post_id_list = request_var('post_id_list', array(0));
- $start = request_var('start', 0);
-
- if (!sizeof($post_id_list))
- {
- phpbb::$template->assign_var('MESSAGE', phpbb::$user->lang['NO_POST_SELECTED']);
- return;
- }
-
- if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_merge')))
- {
- return;
- }
-
- $redirect = request_var('redirect', build_url(array('quickmod')));
-
- $s_hidden_fields = build_hidden_fields(array(
- 'i' => 'main',
- 'post_id_list' => $post_id_list,
- 'to_topic_id' => $to_topic_id,
- 'mode' => 'topic_view',
- 'action' => 'merge_posts',
- 'start' => $start,
- 'redirect' => $redirect,
- 't' => $topic_id)
- );
- $success_msg = $return_link = '';
-
- if (confirm_box(true))
- {
- $to_forum_id = $topic_data['forum_id'];
-
- move_posts($post_id_list, $to_topic_id);
- add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']);
-
- // Message and return links
- $success_msg = 'POSTS_MERGED_SUCCESS';
-
- // Does the original topic still exist? If yes, link back to it
- $sql = 'SELECT forum_id
- FROM ' . TOPICS_TABLE . '
- WHERE topic_id = ' . $topic_id;
- $result = phpbb::$db->sql_query_limit($sql, 1);
- $row = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- if ($row)
- {
- $return_link .= sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $row['forum_id'] . '&amp;t=' . $topic_id) . '">', '</a>');
- }
- else
- {
- // If the topic no longer exist, we will update the topic watch table.
- // To not let it error out on users watching both topics, we just return on an error...
- phpbb::$db->sql_return_on_error(true);
- phpbb::$db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE topic_id = ' . (int) $topic_id);
- phpbb::$db->sql_return_on_error(false);
-
- phpbb::$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . (int) $topic_id);
- }
-
- // Link to the new topic
- $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf(phpbb::$user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
- }
- else
- {
- confirm_box(false, 'MERGE_POSTS', $s_hidden_fields);
- }
-
- $redirect = request_var('redirect', 'index.' . PHP_EXT);
- $redirect = reapply_sid($redirect);
-
- if (!$success_msg)
- {
- return;
- }
- else
- {
- meta_refresh(3, append_sid('viewtopic', "f=$to_forum_id&amp;t=$to_topic_id"));
- trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . $return_link);
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/modules/mcp/mcp_warn.php b/phpBB/modules/mcp/mcp_warn.php
deleted file mode 100644
index 734a61b8f2..0000000000
--- a/phpBB/modules/mcp/mcp_warn.php
+++ /dev/null
@@ -1,495 +0,0 @@
-<?php
-/**
-*
-* @package mcp
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* mcp_warn
-* Handling warning the users
-* @package mcp
-*/
-class mcp_warn
-{
- var $p_master;
- var $u_action;
-
- function __construct(&$p_master)
- {
- $this->p_master = &$p_master;
- }
-
- function main($id, $mode)
- {
- $action = request_var('action', array('' => ''));
-
- if (is_array($action))
- {
- list($action, ) = each($action);
- }
-
- $this->page_title = 'MCP_WARN';
-
- add_form_key('mcp_warn');
-
- switch ($mode)
- {
- case 'front':
- $this->mcp_warn_front_view();
- $this->tpl_name = 'mcp_warn_front';
- break;
-
- case 'list':
- $this->mcp_warn_list_view($action);
- $this->tpl_name = 'mcp_warn_list';
- break;
-
- case 'warn_post':
- $this->mcp_warn_post_view($action);
- $this->tpl_name = 'mcp_warn_post';
- break;
-
- case 'warn_user':
- $this->mcp_warn_user_view($action);
- $this->tpl_name = 'mcp_warn_user';
- break;
- }
- }
-
- /**
- * Generates the summary on the main page of the warning module
- */
- function mcp_warn_front_view()
- {
- phpbb::$template->assign_vars(array(
- 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&amp;form=mcp&amp;field=username&amp;select_single=true'),
- 'U_POST_ACTION' => append_sid('mcp', 'i=warn&amp;mode=warn_user'),
- ));
-
- // Obtain a list of the 5 naughtiest users....
- // These are the 5 users with the highest warning count
- $highest = array();
- $count = 0;
-
- view_warned_users($highest, $count, 5);
-
- foreach ($highest as $row)
- {
- phpbb::$template->assign_block_vars('highest', array(
- 'U_NOTES' => append_sid('mcp', 'i=notes&amp;mode=user_notes&amp;u=' . $row['user_id']),
-
- 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
- 'USERNAME' => $row['username'],
- 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '',
- 'U_USER' => append_sid('memberlist', 'mode=viewprofile&amp;u=' . $row['user_id']),
-
- 'WARNING_TIME' => phpbb::$user->format_date($row['user_last_warning']),
- 'WARNINGS' => $row['user_warnings'],
- ));
- }
-
- // And now the 5 most recent users to get in trouble
- $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_warnings, w.warning_time
- FROM ' . USERS_TABLE . ' u, ' . WARNINGS_TABLE . ' w
- WHERE u.user_id = w.user_id
- ORDER BY w.warning_time DESC';
- $result = phpbb::$db->sql_query_limit($sql, 5);
-
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- phpbb::$template->assign_block_vars('latest', array(
- 'U_NOTES' => append_sid('mcp', 'i=notes&amp;mode=user_notes&amp;u=' . $row['user_id']),
-
- 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
- 'USERNAME' => $row['username'],
- 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '',
- 'U_USER' => append_sid('memberlist', 'mode=viewprofile&amp;u=' . $row['user_id']),
-
- 'WARNING_TIME' => phpbb::$user->format_date($row['warning_time']),
- 'WARNINGS' => $row['user_warnings'],
- ));
- }
- phpbb::$db->sql_freeresult($result);
- }
-
- /**
- * Lists all users with warnings
- */
- function mcp_warn_list_view($action)
- {
- phpbb::$user->add_lang('memberlist');
-
- $start = request_var('start', 0);
- $st = request_var('st', 0);
- $sk = request_var('sk', 'b');
- $sd = request_var('sd', 'd');
-
- $limit_days = array(0 => phpbb::$user->lang['ALL_ENTRIES'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']);
- $sort_by_text = array('a' => phpbb::$user->lang['SORT_USERNAME'], 'b' => phpbb::$user->lang['SORT_DATE'], 'c' => phpbb::$user->lang['SORT_WARNINGS']);
- $sort_by_sql = array('a' => 'username_clean', 'b' => 'user_last_warning', 'c' => 'user_warnings');
-
- $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
- gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
-
- // Define where and sort sql for use in displaying logs
- $sql_where = ($st) ? (time() - ($st * 86400)) : 0;
- $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC');
-
- $users = array();
- $user_count = 0;
-
- view_warned_users($users, $user_count, phpbb::$config['topics_per_page'], $start, $sql_where, $sql_sort);
-
- foreach ($users as $row)
- {
- phpbb::$template->assign_block_vars('user', array(
- 'U_NOTES' => append_sid('mcp', 'i=notes&amp;mode=user_notes&amp;u=' . $row['user_id']),
-
- 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
- 'USERNAME' => $row['username'],
- 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '',
- 'U_USER' => append_sid('memberlist', 'mode=viewprofile&amp;u=' . $row['user_id']),
-
- 'WARNING_TIME' => phpbb::$user->format_date($row['user_last_warning']),
- 'WARNINGS' => $row['user_warnings'],
- ));
- }
-
- phpbb::$template->assign_vars(array(
- 'U_POST_ACTION' => $this->u_action,
- 'S_CLEAR_ALLOWED' => (phpbb::$acl->acl_get('a_clearlogs')) ? true : false,
- 'S_SELECT_SORT_DIR' => $s_sort_dir,
- 'S_SELECT_SORT_KEY' => $s_sort_key,
- 'S_SELECT_SORT_DAYS' => $s_limit_days,
-
- 'PAGE_NUMBER' => on_page($user_count, phpbb::$config['topics_per_page'], $start),
- 'PAGINATION' => generate_pagination(append_sid('mcp', "i=warn&amp;mode=list&amp;st=$st&amp;sk=$sk&amp;sd=$sd"), $user_count, phpbb::$config['topics_per_page'], $start),
- 'TOTAL_USERS' => ($user_count == 1) ? phpbb::$user->lang['LIST_USER'] : sprintf(phpbb::$user->lang['LIST_USERS'], $user_count),
- ));
- }
-
- /**
- * Handles warning the user when the warning is for a specific post
- */
- function mcp_warn_post_view($action)
- {
- $post_id = request_var('p', 0);
- $forum_id = request_var('f', 0);
- $notify = phpbb_request::is_set('notify_user');
- $warning = utf8_normalize_nfc(request_var('warning', '', true));
-
- $sql = 'SELECT u.*, p.*
- FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
- WHERE post_id = $post_id
- AND u.user_id = p.poster_id";
- $result = phpbb::$db->sql_query($sql);
- $user_row = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- if (!$user_row)
- {
- trigger_error('NO_POST');
- }
-
- // There is no point issuing a warning to ignored users (ie anonymous and bots)
- if ($user_row['user_type'] == phpbb::USER_IGNORE)
- {
- trigger_error('CANNOT_WARN_ANONYMOUS');
- }
-
- // Prevent someone from warning themselves
- if ($user_row['user_id'] == phpbb::$user->data['user_id'])
- {
- trigger_error('CANNOT_WARN_SELF');
- }
-
- // Check if there is already a warning for this post to prevent multiple
- // warnings for the same offence
- $sql = 'SELECT post_id
- FROM ' . WARNINGS_TABLE . "
- WHERE post_id = $post_id";
- $result = phpbb::$db->sql_query($sql);
- $row = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- if ($row)
- {
- trigger_error('ALREADY_WARNED');
- }
-
- $user_id = $user_row['user_id'];
-
- if (strpos($this->u_action, "&amp;f=$forum_id&amp;p=$post_id") === false)
- {
- $this->p_master->adjust_url("&amp;f=$forum_id&amp;p=$post_id");
- $this->u_action .= "&amp;f=$forum_id&amp;p=$post_id";
- }
-
- // Check if can send a notification
- if (phpbb::$config['allow_privmsg'])
- {
- $auth2 = new auth();
- $auth2->acl($user_row);
- $s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false;
- unset($auth2);
- }
- else
- {
- $s_can_notify = false;
- }
-
- // Prevent against clever people
- if ($notify && !$s_can_notify)
- {
- $notify = false;
- }
-
- if ($warning && $action == 'add_warning')
- {
- if (check_form_key('mcp_warn'))
- {
- add_warning($user_row, $warning, $notify, $post_id);
- $msg = phpbb::$user->lang['USER_WARNING_ADDED'];
- }
- else
- {
- $msg = phpbb::$user->lang['FORM_INVALID'];
- }
- $redirect = append_sid('mcp', "i=notes&amp;mode=user_notes&amp;u=$user_id");
- meta_refresh(2, $redirect);
- trigger_error($msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
- }
-
- // OK, they didn't submit a warning so lets build the page for them to do so
-
- // We want to make the message available here as a reminder
- // Parse the message and subject
- $message = censor_text($user_row['post_text']);
-
- // Second parse bbcode here
- if ($user_row['bbcode_bitfield'])
- {
- include_once(PHPBB_ROOT_PATH . 'includes/bbcode.' . PHP_EXT);
-
- $bbcode = new bbcode($user_row['bbcode_bitfield']);
- $bbcode->bbcode_second_pass($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield']);
- }
-
- $message = bbcode_nl2br($message);
- $message = smiley_text($message);
-
- // Generate the appropriate user information for the user we are looking at
- if (!function_exists('get_user_avatar'))
- {
- include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT);
- }
-
- $rank_title = $rank_img = '';
- $avatar_img = get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']);
-
- phpbb::$template->assign_vars(array(
- 'U_POST_ACTION' => $this->u_action,
-
- 'POST' => $message,
- 'USERNAME' => $user_row['username'],
- 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '',
- 'RANK_TITLE' => $rank_title,
- 'JOINED' => phpbb::$user->format_date($user_row['user_regdate']),
- 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0,
- 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0,
-
- 'AVATAR_IMG' => $avatar_img,
- 'RANK_IMG' => $rank_img,
-
- 'L_WARNING_POST_DEFAULT' => sprintf(phpbb::$user->lang['WARNING_POST_DEFAULT'], generate_board_url() . '/viewtopic.' . PHP_EXT . "?f=$forum_id&amp;p=$post_id#p$post_id"),
-
- 'S_CAN_NOTIFY' => $s_can_notify,
- ));
- }
-
- /**
- * Handles warning the user
- */
- function mcp_warn_user_view($action)
- {
- global $module;
-
- $user_id = request_var('u', 0);
- $username = request_var('username', '', true);
- $notify = phpbb_request::is_set('notify_user');
- $warning = utf8_normalize_nfc(request_var('warning', '', true));
-
- $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($username)) . "'";
-
- $sql = 'SELECT *
- FROM ' . USERS_TABLE . '
- WHERE ' . $sql_where;
- $result = phpbb::$db->sql_query($sql);
- $user_row = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- if (!$user_row)
- {
- trigger_error('NO_USER');
- }
-
- // Prevent someone from warning themselves
- if ($user_row['user_id'] == phpbb::$user->data['user_id'])
- {
- trigger_error('CANNOT_WARN_SELF');
- }
-
- $user_id = $user_row['user_id'];
-
- if (strpos($this->u_action, "&amp;u=$user_id") === false)
- {
- $this->p_master->adjust_url('&amp;u=' . $user_id);
- $this->u_action .= "&amp;u=$user_id";
- }
-
- // Check if can send a notification
- if (phpbb::$config['allow_privmsg'])
- {
- $auth2 = new auth();
- $auth2->acl($user_row);
- $s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false;
- unset($auth2);
- }
- else
- {
- $s_can_notify = false;
- }
-
- // Prevent against clever people
- if ($notify && !$s_can_notify)
- {
- $notify = false;
- }
-
- if ($warning && $action == 'add_warning')
- {
- if (check_form_key('mcp_warn'))
- {
- add_warning($user_row, $warning, $notify);
- $msg = phpbb::$user->lang['USER_WARNING_ADDED'];
- }
- else
- {
- $msg = phpbb::$user->lang['FORM_INVALID'];
- }
- $redirect = append_sid('mcp', "i=notes&amp;mode=user_notes&amp;u=$user_id");
- meta_refresh(2, $redirect);
- trigger_error($msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
- }
-
- // Generate the appropriate user information for the user we are looking at
- if (!function_exists('get_user_avatar'))
- {
- include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT);
- }
-
- $rank_title = $rank_img = '';
- $avatar_img = get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']);
-
- // OK, they didn't submit a warning so lets build the page for them to do so
- phpbb::$template->assign_vars(array(
- 'U_POST_ACTION' => $this->u_action,
-
- 'RANK_TITLE' => $rank_title,
- 'JOINED' => phpbb::$user->format_date($user_row['user_regdate']),
- 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0,
- 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0,
-
- 'USERNAME_FULL' => get_username_string('full', $user_row['user_id'], $user_row['username'], $user_row['user_colour']),
- 'USERNAME_COLOUR' => get_username_string('colour', $user_row['user_id'], $user_row['username'], $user_row['user_colour']),
- 'USERNAME' => get_username_string('username', $user_row['user_id'], $user_row['username'], $user_row['user_colour']),
- 'U_PROFILE' => get_username_string('profile', $user_row['user_id'], $user_row['username'], $user_row['user_colour']),
-
- 'AVATAR_IMG' => $avatar_img,
- 'RANK_IMG' => $rank_img,
-
- 'S_CAN_NOTIFY' => $s_can_notify,
- ));
-
- return $user_id;
- }
-}
-
-/**
-* Insert the warning into the database
-*/
-function add_warning($user_row, $warning, $send_pm = true, $post_id = 0)
-{
- if ($send_pm)
- {
- include_once(PHPBB_ROOT_PATH . 'includes/functions_privmsgs.' . PHP_EXT);
- include_once(PHPBB_ROOT_PATH . 'includes/message_parser.' . PHP_EXT);
-
- $user_row['user_lang'] = (file_exists(PHPBB_ROOT_PATH . 'language/' . $user_row['user_lang'] . '/mcp.' . PHP_EXT)) ? $user_row['user_lang'] : phpbb::$config['default_lang'];
- include(PHPBB_ROOT_PATH . 'language/' . basename($user_row['user_lang']) . '/mcp.' . PHP_EXT);
-
- $message_parser = new parse_message();
-
- $message_parser->message = sprintf($lang['WARNING_PM_BODY'], $warning);
- $message_parser->parse(true, true, true, false, false, true, true);
-
- $pm_data = array(
- 'from_user_id' => phpbb::$user->data['user_id'],
- 'from_user_ip' => phpbb::$user->ip,
- 'from_username' => phpbb::$user->data['username'],
- 'enable_sig' => false,
- 'enable_bbcode' => true,
- 'enable_smilies' => true,
- 'enable_urls' => false,
- 'icon_id' => 0,
- 'bbcode_bitfield' => $message_parser->bbcode_bitfield,
- 'bbcode_uid' => $message_parser->bbcode_uid,
- 'message' => $message_parser->message,
- 'address_list' => array('u' => array($user_row['user_id'] => 'to')),
- );
-
- submit_pm('post', $lang['WARNING_PM_SUBJECT'], $pm_data, false);
- }
-
- add_log('admin', 'LOG_USER_WARNING', $user_row['username']);
- $log_id = add_log('user', $user_row['user_id'], 'LOG_USER_WARNING_BODY', $warning);
-
- $sql_ary = array(
- 'user_id' => $user_row['user_id'],
- 'post_id' => $post_id,
- 'log_id' => $log_id,
- 'warning_time' => time(),
- );
-
- phpbb::$db->sql_query('INSERT INTO ' . WARNINGS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary));
-
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET user_warnings = user_warnings + 1,
- user_last_warning = ' . time() . '
- WHERE user_id = ' . $user_row['user_id'];
- phpbb::$db->sql_query($sql);
-
- // We add this to the mod log too for moderators to see that a specific user got warned.
- $sql = 'SELECT forum_id, topic_id
- FROM ' . POSTS_TABLE . '
- WHERE post_id = ' . $post_id;
- $result = phpbb::$db->sql_query($sql);
- $row = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_USER_WARNING', $user_row['username']);
-}
-
-?> \ No newline at end of file