mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-09 02:06:32 +02:00
- a handful of mcp fixed, the most important one is the change for check_ids() - it is now supporting ids from more than one forum too, making it possible to use some mcp features as designed initially. We really need to get our moderator team testing the mcp extensively.
- fixed some other tiny glitches - if a forum category with subforums get changed to a link type forum give options of what to do with the subforums (#5334) - other bugfixes git-svn-id: file:///svn/phpbb/trunk@6601 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -79,7 +79,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
||||
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
|
||||
'U_VIEW_FORUM_LOGS' => ($auth->acl_gets('a_', 'm_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=logs&mode=forum_logs&f=' . $forum_id) : '',
|
||||
|
||||
'S_MCP_ACTION' => $url . "&i=$id&action=$action&mode=$mode&start=$start" . (($action == 'merge_select') ? $selected_ids : ''),
|
||||
'S_MCP_ACTION' => $url . "&i=$id&mode=$mode&start=$start" . (($action == 'merge_select') ? $selected_ids : ''),
|
||||
|
||||
'PAGINATION' => generate_pagination($url . "&i=$id&action=$action&mode=$mode" . (($action == 'merge_select') ? $selected_ids : ''), $forum_topics, $topics_per_page, $start),
|
||||
'PAGE_NUMBER' => on_page($forum_topics, $topics_per_page, $start),
|
||||
@@ -159,14 +159,13 @@ function mcp_resync_topics($topic_ids)
|
||||
{
|
||||
global $auth, $db, $template, $phpEx, $user, $phpbb_root_path;
|
||||
|
||||
if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sizeof($topic_ids))
|
||||
{
|
||||
trigger_error($user->lang['NO_TOPIC_SELECTED']);
|
||||
}
|
||||
|
||||
if (check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -222,7 +222,7 @@ function mcp_front_view($id, $mode, $action)
|
||||
'IP' => $row['ip'],
|
||||
'TIME' => $user->format_date($row['time']),
|
||||
'ACTION' => $row['action'],
|
||||
'U_VIEWTOPIC' => (!empty($row['viewtopic'])) ? $row['viewtopic'] : '',
|
||||
'U_VIEW_TOPIC' => (!empty($row['viewtopic'])) ? $row['viewtopic'] : '',
|
||||
'U_VIEWLOGS' => (!empty($row['viewlogs'])) ? $row['viewlogs'] : '')
|
||||
);
|
||||
}
|
||||
|
@@ -207,7 +207,9 @@ function lock_unlock($action, $ids)
|
||||
$l_prefix = 'POST';
|
||||
}
|
||||
|
||||
if (!($forum_id = check_ids($ids, $table, $sql_id, array('m_lock'))))
|
||||
$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')
|
||||
@@ -215,13 +217,16 @@ function lock_unlock($action, $ids)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!($forum_id = check_ids($ids, $table, $sql_id, array('f_user_lock'))))
|
||||
$ids = $orig_ids;
|
||||
|
||||
if (!check_ids($ids, $table, $sql_id, array('f_user_lock')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
unset($orig_ids);
|
||||
|
||||
$redirect = request_var('redirect', $user->data['session_page']);
|
||||
$redirect = request_var('redirect', build_url(array('_f_', 'action')));
|
||||
|
||||
$s_hidden_fields = build_hidden_fields(array(
|
||||
$sql_id . '_list' => $ids,
|
||||
@@ -241,7 +246,7 @@ function lock_unlock($action, $ids)
|
||||
|
||||
foreach ($data as $id => $row)
|
||||
{
|
||||
add_log('mod', $forum_id, $row['topic_id'], 'LOG_' . strtoupper($action), $row['topic_title']);
|
||||
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';
|
||||
@@ -272,7 +277,10 @@ function change_topic_type($action, $topic_ids)
|
||||
{
|
||||
global $auth, $user, $db, $phpEx, $phpbb_root_path;
|
||||
|
||||
if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('f_announce', 'f_sticky', 'm_'))))
|
||||
// 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;
|
||||
}
|
||||
@@ -420,7 +428,10 @@ function mcp_move_topic($topic_ids)
|
||||
global $auth, $user, $db, $template;
|
||||
global $phpEx, $phpbb_root_path;
|
||||
|
||||
if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_move')))
|
||||
// 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;
|
||||
}
|
||||
@@ -575,12 +586,13 @@ function mcp_delete_topic($topic_ids)
|
||||
{
|
||||
global $auth, $user, $db, $phpEx, $phpbb_root_path;
|
||||
|
||||
if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_delete')))
|
||||
if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_delete')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$redirect = request_var('redirect', $user->data['session_page']);
|
||||
$redirect = request_var('redirect', build_url(array('_f_', 'action')));
|
||||
$forum_id = request_var('f', 0);
|
||||
|
||||
$s_hidden_fields = build_hidden_fields(array(
|
||||
'topic_id_list' => $topic_ids,
|
||||
@@ -598,7 +610,7 @@ function mcp_delete_topic($topic_ids)
|
||||
|
||||
foreach ($data as $topic_id => $row)
|
||||
{
|
||||
add_log('mod', $forum_id, 0, 'LOG_TOPIC_DELETED', $row['topic_title']);
|
||||
add_log('mod', $row['forum_id'], 0, 'LOG_TOPIC_DELETED', $row['topic_title']);
|
||||
}
|
||||
|
||||
$return = delete_topics('topic_id', $topic_ids);
|
||||
@@ -630,12 +642,13 @@ function mcp_delete_post($post_ids)
|
||||
{
|
||||
global $auth, $user, $db, $phpEx, $phpbb_root_path;
|
||||
|
||||
if (!($forum_id = check_ids($post_ids, POSTS_TABLE, 'post_id', 'm_delete')))
|
||||
if (!check_ids($post_ids, POSTS_TABLE, 'post_id', array('m_delete')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$redirect = request_var('redirect', $user->data['session_page']);
|
||||
$redirect = request_var('redirect', build_url(array('_f_', 'action')));
|
||||
$forum_id = request_var('f', 0);
|
||||
|
||||
$s_hidden_fields = build_hidden_fields(array(
|
||||
'post_id_list' => $post_ids,
|
||||
@@ -649,7 +662,7 @@ function mcp_delete_post($post_ids)
|
||||
{
|
||||
if (!function_exists('delete_posts'))
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
|
||||
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||
}
|
||||
|
||||
// Count the number of topics that are affected
|
||||
@@ -750,13 +763,14 @@ function mcp_fork_topic($topic_ids)
|
||||
global $auth, $user, $db, $template, $config;
|
||||
global $phpEx, $phpbb_root_path;
|
||||
|
||||
if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_')))
|
||||
if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$to_forum_id = request_var('to_forum_id', 0);
|
||||
$redirect = request_var('redirect', $user->data['session_page']);
|
||||
$forum_id = request_var('forum_id', 0);
|
||||
$redirect = request_var('redirect', build_url(array('_f_', 'action')));
|
||||
$additional_msg = $success_msg = '';
|
||||
|
||||
$s_hidden_fields = build_hidden_fields(array(
|
||||
@@ -835,11 +849,6 @@ function mcp_fork_topic($topic_ids)
|
||||
$new_topic_id = $db->sql_nextid();
|
||||
$new_topic_id_list[$topic_id] = $new_topic_id;
|
||||
|
||||
/**
|
||||
* @todo enable? (is this still needed?)
|
||||
* markread('topic', $to_forum_id, $new_topic_id);
|
||||
*/
|
||||
|
||||
if ($topic_row['poll_start'])
|
||||
{
|
||||
$poll_rows = array();
|
||||
|
@@ -248,7 +248,7 @@ class mcp_queue
|
||||
|
||||
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
|
||||
$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.user_colour
|
||||
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
|
||||
WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . '
|
||||
AND t.topic_id = p.topic_id
|
||||
@@ -279,7 +279,7 @@ class mcp_queue
|
||||
}
|
||||
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
|
||||
$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
|
||||
@@ -323,6 +323,11 @@ class mcp_queue
|
||||
$row['forum_id'] = $global_id;
|
||||
}
|
||||
|
||||
if (empty($row['post_username']))
|
||||
{
|
||||
$row['post_username'] = $user->lang['GUEST'];
|
||||
}
|
||||
|
||||
$template->assign_block_vars('postrow', array(
|
||||
'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
|
||||
'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''),
|
||||
@@ -372,19 +377,18 @@ function approve_post($post_id_list, $mode)
|
||||
global $db, $template, $user, $config;
|
||||
global $phpEx, $phpbb_root_path;
|
||||
|
||||
if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_approve')))
|
||||
if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
|
||||
{
|
||||
trigger_error('NOT_AUTHORIZED');
|
||||
}
|
||||
|
||||
$redirect = request_var('redirect', $user->data['session_page']);
|
||||
$redirect = request_var('redirect', build_url(array('_f_')));
|
||||
$success_msg = '';
|
||||
|
||||
$s_hidden_fields = build_hidden_fields(array(
|
||||
'i' => 'queue',
|
||||
'mode' => $mode,
|
||||
'post_id_list' => $post_id_list,
|
||||
'f' => $forum_id,
|
||||
'action' => 'approve',
|
||||
'redirect' => $redirect)
|
||||
);
|
||||
@@ -398,8 +402,8 @@ function approve_post($post_id_list, $mode)
|
||||
// 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 = $forum_topics = $forum_posts = 0;
|
||||
$topic_approve_sql = $topic_replies_sql = $post_approve_sql = $topic_id_list = array();
|
||||
$total_topics = $total_posts = 0;
|
||||
$forum_topics_posts = $topic_approve_sql = $topic_replies_sql = $post_approve_sql = $topic_id_list = $forum_id_list = array();
|
||||
|
||||
$update_forum_information = false;
|
||||
|
||||
@@ -407,13 +411,26 @@ function approve_post($post_id_list, $mode)
|
||||
{
|
||||
$topic_id_list[$post_data['topic_id']] = 1;
|
||||
|
||||
if ($post_data['forum_id'])
|
||||
{
|
||||
$forum_id_list[$post_data['forum_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++;
|
||||
$forum_topics_posts[$post_data['forum_id']]['forum_topics']++;
|
||||
}
|
||||
|
||||
$topic_approve_sql[] = $post_data['topic_id'];
|
||||
@@ -422,18 +439,23 @@ function approve_post($post_id_list, $mode)
|
||||
{
|
||||
if (!isset($topic_replies_sql[$post_data['topic_id']]))
|
||||
{
|
||||
$topic_replies_sql[$post_data['topic_id']] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$topic_replies_sql[$post_data['topic_id']]++;
|
||||
$topic_replies_sql[$post_data['topic_id']] = 0;
|
||||
}
|
||||
$topic_replies_sql[$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_posts++;
|
||||
$forum_topics_posts[$post_data['forum_id']]['forum_posts']++;
|
||||
}
|
||||
|
||||
$post_approve_sql[] = $post_id;
|
||||
@@ -472,16 +494,19 @@ function approve_post($post_id_list, $mode)
|
||||
}
|
||||
}
|
||||
|
||||
if ($forum_topics || $forum_posts)
|
||||
if (sizeof($forum_topics_posts))
|
||||
{
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . '
|
||||
SET ';
|
||||
$sql .= ($forum_topics) ? "forum_topics = forum_topics + $forum_topics" : '';
|
||||
$sql .= ($forum_topics && $forum_posts) ? ', ' : '';
|
||||
$sql .= ($forum_posts) ? "forum_posts = forum_posts + $forum_posts" : '';
|
||||
$sql .= " WHERE forum_id = $forum_id";
|
||||
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";
|
||||
|
||||
$db->sql_query($sql);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
if ($total_topics)
|
||||
@@ -499,9 +524,9 @@ function approve_post($post_id_list, $mode)
|
||||
|
||||
if ($update_forum_information)
|
||||
{
|
||||
update_post_information('forum', $forum_id);
|
||||
update_post_information('forum', array_keys($forum_id_list));
|
||||
}
|
||||
unset($topic_id_list);
|
||||
unset($topic_id_list, $forum_id_list);
|
||||
|
||||
$messenger = new messenger();
|
||||
|
||||
@@ -528,8 +553,8 @@ function approve_post($post_id_list, $mode)
|
||||
'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.$phpEx?f=$forum_id&t={$post_data['topic_id']}&e=0",
|
||||
'U_VIEW_POST' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t={$post_data['topic_id']}&p=$post_id&e=$post_id")
|
||||
'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f={$post_data['forum_id']}&t={$post_data['topic_id']}&e=0",
|
||||
'U_VIEW_POST' => generate_board_url() . "/viewtopic.$phpEx?f={$post_data['forum_id']}&t={$post_data['topic_id']}&p=$post_id&e=$post_id")
|
||||
);
|
||||
|
||||
$messenger->send($post_data['user_notify_type']);
|
||||
@@ -547,19 +572,19 @@ function approve_post($post_id_list, $mode)
|
||||
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'], $forum_id, $post_data['topic_id'], $post_id);
|
||||
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'], $forum_id, $post_data['topic_id'], $post_id);
|
||||
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);
|
||||
}
|
||||
}
|
||||
unset($post_info);
|
||||
|
||||
if ($forum_topics)
|
||||
if ($total_topics)
|
||||
{
|
||||
$success_msg = ($forum_topics == 1) ? 'TOPIC_APPROVED_SUCCESS' : 'TOPICS_APPROVED_SUCCESS';
|
||||
$success_msg = ($total_topics == 1) ? 'TOPIC_APPROVED_SUCCESS' : 'TOPICS_APPROVED_SUCCESS';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -598,12 +623,12 @@ function disapprove_post($post_id_list, $mode)
|
||||
global $db, $template, $user, $config;
|
||||
global $phpEx, $phpbb_root_path;
|
||||
|
||||
if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_approve')))
|
||||
if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
|
||||
{
|
||||
trigger_error('NOT_AUTHORIZED');
|
||||
}
|
||||
|
||||
$redirect = request_var('redirect', build_url(array('t', 'mode')) . '&mode=unapproved_topics');
|
||||
$redirect = request_var('redirect', build_url(array('t', 'mode', '_f_')) . '&mode=unapproved_topics');
|
||||
$reason = request_var('reason', '', true);
|
||||
$reason_id = request_var('reason_id', 0);
|
||||
$success_msg = $additional_msg = '';
|
||||
@@ -612,7 +637,6 @@ function disapprove_post($post_id_list, $mode)
|
||||
'i' => 'queue',
|
||||
'mode' => $mode,
|
||||
'post_id_list' => $post_id_list,
|
||||
'f' => $forum_id,
|
||||
'action' => 'disapprove',
|
||||
'redirect' => $redirect)
|
||||
);
|
||||
@@ -649,42 +673,52 @@ function disapprove_post($post_id_list, $mode)
|
||||
// If Topic -> forum_topics_real -= 1
|
||||
// If Post -> topic_replies_real -= 1
|
||||
|
||||
$forum_topics_real = 0;
|
||||
$topic_replies_real_sql = $post_disapprove_sql = $topic_id_list = array();
|
||||
$num_disapproved = 0;
|
||||
$forum_topics_real = $topic_id_list = $forum_id_list = $topic_replies_real_sql = $post_disapprove_sql = 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. ;)
|
||||
if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_last_post_id'] == $post_id)
|
||||
{
|
||||
if ($post_data['forum_id'])
|
||||
{
|
||||
$forum_topics_real++;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isset($topic_replies_real_sql[$post_data['topic_id']]))
|
||||
{
|
||||
$topic_replies_real_sql[$post_data['topic_id']] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$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']]++;
|
||||
}
|
||||
|
||||
$post_disapprove_sql[] = $post_id;
|
||||
}
|
||||
|
||||
if ($forum_topics_real)
|
||||
if (sizeof($forum_topics_real))
|
||||
{
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . "
|
||||
SET forum_topics_real = forum_topics_real - $forum_topics_real
|
||||
WHERE forum_id = $forum_id";
|
||||
$db->sql_query($sql);
|
||||
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";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($topic_replies_real_sql))
|
||||
@@ -711,8 +745,12 @@ function disapprove_post($post_id_list, $mode)
|
||||
unset($post_disapprove_sql, $topic_replies_real_sql);
|
||||
|
||||
update_post_information('topic', array_keys($topic_id_list));
|
||||
update_post_information('forum', $forum_id);
|
||||
unset($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();
|
||||
|
||||
@@ -749,9 +787,9 @@ function disapprove_post($post_id_list, $mode)
|
||||
}
|
||||
unset($post_info, $disapprove_reason);
|
||||
|
||||
if ($forum_topics_real)
|
||||
if (sizeof($forum_topics_real))
|
||||
{
|
||||
$success_msg = ($forum_topics_real == 1) ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS';
|
||||
$success_msg = ($num_disapproved == 1) ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -107,14 +107,6 @@ class mcp_reports
|
||||
);
|
||||
}
|
||||
|
||||
// Set some vars
|
||||
if ($post_info['user_id'] == ANONYMOUS)
|
||||
{
|
||||
$poster = ($post_info['post_username']) ? $post_info['post_username'] : $user->lang['GUEST'];
|
||||
}
|
||||
|
||||
$poster = ($post_info['user_colour']) ? '<span style="color:#' . $post_info['user_colour'] . '">' . $post_info['username'] . '</span>' : $post_info['username'];
|
||||
|
||||
// Process message, leave it uncensored
|
||||
$message = $post_info['post_text'];
|
||||
$message = str_replace("\n", '<br />', $message);
|
||||
@@ -129,7 +121,7 @@ class mcp_reports
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_MCP_REPORT' => true,
|
||||
'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=reports&p=$post_id&f=$forum_id"),
|
||||
'S_CLOSE_ACTION' => $this->u_action . '&p=' . $post_id . 'f=' . $forum_id,
|
||||
'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']),
|
||||
'S_POST_REPORTED' => $post_info['post_reported'],
|
||||
'S_POST_UNAPPROVED' => !$post_info['post_approved'],
|
||||
@@ -150,7 +142,7 @@ class mcp_reports
|
||||
'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']),
|
||||
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']),
|
||||
|
||||
'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports' . (($post_info['post_reported']) ? '&mode=reports' : '&mode=reports_closed') . '&start=' . $start) . '">', '</a>'),
|
||||
'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports' . (($post_info['post_reported']) ? '&mode=reports' : '&mode=reports_closed') . '&start=' . $start . '&f=' . $post_info['forum_id']) . '">', '</a>'),
|
||||
'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']),
|
||||
'REPORT_REASON_TITLE' => $reason['title'],
|
||||
'REPORT_REASON_DESCRIPTION' => $reason['description'],
|
||||
@@ -284,7 +276,7 @@ class mcp_reports
|
||||
|
||||
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, r.user_id as reporter_id, ru.username as reporter_name, r.report_time, r.report_id
|
||||
$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.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id
|
||||
FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru
|
||||
WHERE ' . $db->sql_in_set('r.report_id', $report_ids) . '
|
||||
AND t.topic_id = p.topic_id
|
||||
@@ -306,18 +298,21 @@ class mcp_reports
|
||||
'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
|
||||
'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . '#p' . $row['post_id'],
|
||||
'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=reports&start=$start&mode=report_details&f={$row['forum_id']}&r={$row['report_id']}"),
|
||||
'U_VIEW_REPORTER_PROFILE' => ($row['reporter_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['reporter_id']) : '',
|
||||
|
||||
'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
||||
'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
||||
'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
||||
'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
||||
|
||||
'REPORTER_FULL' => get_username_string('full', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
|
||||
'REPORTER_COLOUR' => get_username_string('colour', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
|
||||
'REPORTER' => get_username_string('username', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
|
||||
'U_REPORTER' => get_username_string('profile', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
|
||||
|
||||
'FORUM_NAME' => (!$global_topic) ? $forum_data[$row['forum_id']]['forum_name'] : $user->lang['GLOBAL_ANNOUNCEMENT'],
|
||||
'POST_ID' => $row['post_id'],
|
||||
'POST_SUBJECT' => $row['post_subject'],
|
||||
'POST_TIME' => $user->format_date($row['post_time']),
|
||||
'REPORTER' => ($row['reporter_id'] == ANONYMOUS) ? $user->lang['GUEST'] : $row['reporter_name'],
|
||||
'REPORT_TIME' => $user->format_date($row['report_time']),
|
||||
'TOPIC_TITLE' => $row['topic_title'])
|
||||
);
|
||||
@@ -332,7 +327,7 @@ class mcp_reports
|
||||
'L_TITLE' => ($mode == 'reports') ? $user->lang['MCP_REPORTS_OPEN'] : $user->lang['MCP_REPORTS_CLOSED'],
|
||||
'L_ONLY_TOPIC' => ($topic_id) ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '',
|
||||
|
||||
'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')),
|
||||
'S_MCP_ACTION' => $this->u_action,
|
||||
'S_FORUM_OPTIONS' => $forum_options,
|
||||
'S_CLOSED' => ($mode == 'reports_closed') ? true : false,
|
||||
|
||||
@@ -356,18 +351,18 @@ function close_report($post_id_list, $mode, $action)
|
||||
global $db, $template, $user, $config;
|
||||
global $phpEx, $phpbb_root_path;
|
||||
|
||||
if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_report')))
|
||||
if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_report')))
|
||||
{
|
||||
trigger_error('NOT_AUTHORIZED');
|
||||
}
|
||||
|
||||
if ($action == 'delete' && strpos($user->data['session_page'], 'mode=report_details') !== false)
|
||||
{
|
||||
$redirect = request_var('redirect', build_url(array('mode')) . '&mode=reports');
|
||||
$redirect = request_var('redirect', build_url(array('mode', '_f_', 'r')) . '&mode=reports');
|
||||
}
|
||||
else
|
||||
{
|
||||
$redirect = request_var('redirect', $user->data['session_page']);
|
||||
$redirect = request_var('redirect', build_url(array('_f_')));
|
||||
}
|
||||
$success_msg = '';
|
||||
|
||||
@@ -375,7 +370,6 @@ function close_report($post_id_list, $mode, $action)
|
||||
'i' => 'reports',
|
||||
'mode' => $mode,
|
||||
'post_id_list' => $post_id_list,
|
||||
'f' => $forum_id,
|
||||
'action' => $action,
|
||||
'redirect' => $redirect)
|
||||
);
|
||||
|
@@ -179,7 +179,7 @@ function mcp_topic_view($id, $mode, $action)
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TOPIC_TITLE' => $topic_info['topic_title'],
|
||||
'U_VIEWTOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id']),
|
||||
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id']),
|
||||
|
||||
'TO_TOPIC_ID' => $to_topic_id,
|
||||
'TO_TOPIC_INFO' => ($to_topic_id) ? sprintf($user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_topic_info['forum_id'] . '&t=' . $to_topic_id) . '">' . $to_topic_info['topic_title'] . '</a>') : '',
|
||||
@@ -223,6 +223,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
|
||||
global $db, $template, $user, $phpEx, $phpbb_root_path, $auth;
|
||||
|
||||
$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))
|
||||
@@ -231,7 +232,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_split')))
|
||||
if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_split')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -430,7 +431,7 @@ function merge_posts($topic_id, $to_topic_id)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_merge')))
|
||||
if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_merge')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -445,7 +446,6 @@ function merge_posts($topic_id, $to_topic_id)
|
||||
'action' => 'merge_posts',
|
||||
'start' => $start,
|
||||
'redirect' => $redirect,
|
||||
'f' => $forum_id,
|
||||
't' => $topic_id)
|
||||
);
|
||||
$success_msg = $return_link = '';
|
||||
@@ -465,7 +465,7 @@ function merge_posts($topic_id, $to_topic_id)
|
||||
|
||||
if (sizeof($topic_data))
|
||||
{
|
||||
$return_link .= sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $forum_id . '&t=' . $topic_id) . '">', '</a>');
|
||||
$return_link .= sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_data['forum_id'] . '&t=' . $topic_id) . '">', '</a>');
|
||||
}
|
||||
|
||||
// Link to the new topic
|
||||
|
Reference in New Issue
Block a user