mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
cleaned up the mcp, basic operations such as deleting/moving/(un)locking are functional, as well as all basic views, the other modes (splitting, merging, forking, approval, reports and warnings) will be added within the next days.
git-svn-id: file:///svn/phpbb/trunk@4922 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
187
phpBB/includes/mcp/mcp_forum.php
Normal file
187
phpBB/includes/mcp/mcp_forum.php
Normal file
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
// -------------------------------------------------------------
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// FILENAME : mcp_forum.php
|
||||
// STARTED : Thu Jul 08, 2004
|
||||
// COPYRIGHT : <20> 2004 phpBB Group
|
||||
// WWW : http://www.phpbb.com/
|
||||
// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
|
||||
//
|
||||
// -------------------------------------------------------------
|
||||
|
||||
//
|
||||
// TODO:
|
||||
//
|
||||
|
||||
function mcp_forum_view($id, $mode, $action, $url, $forum_info)
|
||||
{
|
||||
global $SID, $phpEx, $phpbb_root_path, $config;
|
||||
global $template, $db, $user, $auth;
|
||||
global $_POST, $_REQUEST;
|
||||
|
||||
if ($action == 'merge_select')
|
||||
{
|
||||
// Fixes a "bug" that makes forum_view use the same ordering as topic_view
|
||||
unset($_POST['sk'], $_POST['sd'], $_REQUEST['sk'], $_REQUEST['sd']);
|
||||
}
|
||||
|
||||
$forum_id = $forum_info['forum_id'];
|
||||
$start = request_var('start', 0);
|
||||
$topic_id_list = request_var('topic_id_list', 0);
|
||||
$post_id_list = request_var('post_id_list', 0);
|
||||
$topic_id = request_var('t', 0);
|
||||
|
||||
$selected_ids = '';
|
||||
if ($post_id_list)
|
||||
{
|
||||
foreach ($post_id_list as $num => $post_id)
|
||||
{
|
||||
$selected_ids .= '&post_id_list[' . $num . ']=' . $post_id;
|
||||
}
|
||||
}
|
||||
|
||||
make_jumpbox($url . "&action=$action&mode=$mode", $forum_id . (($action == 'merge_select') ? $selected_ids : ''), false, 'm_');
|
||||
|
||||
$topics_per_page = ($forum_info['forum_topics_per_page']) ? $forum_info['forum_topics_per_page'] : $config['topics_per_page'];
|
||||
|
||||
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)) : '';
|
||||
|
||||
$template->assign_vars(array(
|
||||
'FORUM_NAME' => $forum_info['forum_name'],
|
||||
|
||||
'REPORTED_IMG' => $user->img('icon_reported', 'TOPIC_REPORTED'),
|
||||
'UNAPPROVED_IMG' => $user->img('icon_unapproved', 'TOPIC_UNAPPROVED'),
|
||||
|
||||
'S_CAN_DELETE' => $auth->acl_get('m_delete', $forum_id),
|
||||
'S_CAN_MOVE' => $auth->acl_get('m_move', $forum_id),
|
||||
'S_CAN_FORK' => $auth->acl_get('m_', $forum_id),
|
||||
'S_CAN_LOCK' => $auth->acl_get('m_lock', $forum_id),
|
||||
'S_CAN_SYNC' => $auth->acl_get('m_', $forum_id),
|
||||
'S_CAN_APPROVE' => $auth->acl_get('m_approve', $forum_id),
|
||||
|
||||
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&f=" . $forum_id,
|
||||
'S_MCP_ACTION' => $url . "&action=$action&mode=$mode&start=$start" . (($action == 'merge_select') ? $selected_ids : ''),
|
||||
|
||||
'PAGINATION' => generate_pagination($url . "&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),
|
||||
'TOTAL' => $forum_topics)
|
||||
);
|
||||
|
||||
$topic_rows = array();
|
||||
|
||||
$sql = 'SELECT t.*
|
||||
FROM ' . TOPICS_TABLE . " t
|
||||
WHERE (t.forum_id = $forum_id OR t.forum_id = 0)
|
||||
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
|
||||
AND t.topic_type IN (" . POST_ANNOUNCE . ", " . POST_GLOBAL . ")
|
||||
$limit_time_sql
|
||||
ORDER BY $sort_order_sql";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$topic_rows[] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = 'SELECT t.*
|
||||
FROM ' . TOPICS_TABLE . " t
|
||||
WHERE t.forum_id = $forum_id
|
||||
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . '
|
||||
AND t.topic_type IN (' . POST_NORMAL . ', ' . POST_STICKY . ")
|
||||
$limit_time_sql
|
||||
ORDER BY t.topic_type DESC, $sort_order_sql";
|
||||
$result = $db->sql_query_limit($sql, $topics_per_page, $start);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$topic_rows[] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
foreach ($topic_rows as $row)
|
||||
{
|
||||
$topic_title = '';
|
||||
|
||||
if ($auth->acl_get('m_approve', $row['forum_id']))
|
||||
{
|
||||
$row['topic_replies'] = $row['topic_replies_real'];
|
||||
}
|
||||
|
||||
if ($row['topic_status'] == ITEM_LOCKED)
|
||||
{
|
||||
$folder_img = $user->img('folder_locked', 'VIEW_TOPIC_LOCKED');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL)
|
||||
{
|
||||
$folder_img = $user->img('folder_announce', 'VIEW_TOPIC_ANNOUNCEMENT');
|
||||
}
|
||||
else if ($row['topic_type'] == POST_STICKY)
|
||||
{
|
||||
$folder_img = $user->img('folder_sticky', 'VIEW_TOPIC_STICKY');
|
||||
}
|
||||
else if ($row['topic_status'] == ITEM_MOVED)
|
||||
{
|
||||
$folder_img = $user->img('folder_moved', 'VIEW_TOPIC_MOVED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder_img = $user->img('folder', 'NO_NEW_POSTS');
|
||||
}
|
||||
}
|
||||
|
||||
if ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL)
|
||||
{
|
||||
$topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'] . ' ';
|
||||
}
|
||||
else if ($row['topic_type'] == POST_STICKY)
|
||||
{
|
||||
$topic_type = $user->lang['VIEW_TOPIC_STICKY'] . ' ';
|
||||
}
|
||||
else if ($row['topic_status'] == ITEM_MOVED)
|
||||
{
|
||||
$topic_type = $user->lang['VIEW_TOPIC_MOVED'] . ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$topic_type = '';
|
||||
}
|
||||
|
||||
if (intval($row['poll_start']))
|
||||
{
|
||||
$topic_type .= $user->lang['VIEW_TOPIC_POLL'] . ' ';
|
||||
}
|
||||
|
||||
$topic_title = censor_text($row['topic_title']);
|
||||
|
||||
$template->assign_block_vars('topicrow', array(
|
||||
'U_VIEW_TOPIC' => "mcp.$phpEx$SID&t=" . $row['topic_id'] . '&mode=topic_view',
|
||||
|
||||
'S_SELECT_TOPIC' => ($action == 'merge_select' && $row['topic_id'] != $topic_id) ? true : false,
|
||||
'U_SELECT_TOPIC' => $url . '&mode=topic_view&action=merge&to_topic_id=' . $row['topic_id'] . $selected_ids,
|
||||
'U_MCP_QUEUE' => $url . '&i=queue&mode=approve&t=' . $row['topic_id'],
|
||||
'U_MCP_REPORT' => $url . '&mode=reports&t=' . $row['topic_id'],
|
||||
|
||||
'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_attach', sprintf($user->lang['TOTAL_ATTACHMENTS'], $row['topic_attachment'])) : '',
|
||||
'TOPIC_FOLDER_IMG' => $folder_img,
|
||||
'TOPIC_TYPE' => $topic_type,
|
||||
'TOPIC_TITLE' => $topic_title,
|
||||
'REPLIES' => $row['topic_replies'],
|
||||
'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']),
|
||||
'TOPIC_ID' => $row['topic_id'],
|
||||
'S_TOPIC_CHECKED' => ($topic_id_list && in_array($row['topic_id'], $topic_id_list)) ? 'checked="checked" ' : '',
|
||||
|
||||
'S_TOPIC_REPORTED' => ($row['topic_reported']) ? true : false,
|
||||
'S_TOPIC_UNAPPROVED'=> ($row['topic_approved']) ? false : true)
|
||||
);
|
||||
}
|
||||
unset($topic_rows);
|
||||
}
|
||||
|
||||
?>
|
189
phpBB/includes/mcp/mcp_front.php
Normal file
189
phpBB/includes/mcp/mcp_front.php
Normal file
@@ -0,0 +1,189 @@
|
||||
<?php
|
||||
// -------------------------------------------------------------
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// FILENAME : mcp_front.php
|
||||
// STARTED : Thu Jul 08, 2004
|
||||
// COPYRIGHT : <20> 2004 phpBB Group
|
||||
// WWW : http://www.phpbb.com/
|
||||
// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
|
||||
//
|
||||
// -------------------------------------------------------------
|
||||
|
||||
//
|
||||
// TODO:
|
||||
// - add list of forums user is moderator in (with links to common management facilities)
|
||||
// - add statistics (how many reports handled, how many posts locked/moved... etc.? -
|
||||
// those would be only valid from the time the log is valid (and not purged)
|
||||
//
|
||||
|
||||
function mcp_front_view($id, $mode, $action, $url)
|
||||
{
|
||||
global $SID, $phpEx, $phpbb_root_path, $config;
|
||||
global $template, $db, $user, $auth;
|
||||
|
||||
// Latest 5 unapproved
|
||||
$forum_list = get_forum_list('m_approve');
|
||||
$post_list = array();
|
||||
|
||||
$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 = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$total = $row['total'];
|
||||
|
||||
if ($total)
|
||||
{
|
||||
$sql = 'SELECT post_id
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ')
|
||||
AND post_approved = 0
|
||||
ORDER BY post_id DESC';
|
||||
$result = $db->sql_query_limit($sql, 5);
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$post_list[] = $row['post_id'];
|
||||
}
|
||||
|
||||
$sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.username, t.topic_id, t.topic_title, t.topic_first_post_id, f.forum_id, f.forum_name
|
||||
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f, ' . USERS_TABLE . ' u
|
||||
WHERE p.post_id IN (' . implode(', ', $post_list) . ')
|
||||
AND t.topic_id = p.topic_id
|
||||
AND f.forum_id = p.forum_id
|
||||
AND p.poster_id = u.user_id
|
||||
ORDER BY p.post_id DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['poster_id'] == ANONYMOUS)
|
||||
{
|
||||
$author = ($row['post_username']) ? $row['post_username'] : $user->lang['GUEST'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$author = '<a href="memberlist.' . $phpEx . $SID . '&mode=viewprofile&u=' . $row['poster_id'] . '">' . $row['username'] . '</a>';
|
||||
}
|
||||
|
||||
$template->assign_block_vars('unapproved', array(
|
||||
'U_POST_DETAILS' => $url . '&mode=post_details',
|
||||
'FORUM' => (!empty($row['forum_id'])) ? '<a href="viewforum.' . $phpEx . $SID . '&f=' . $row['forum_id'] . '">' . $row['forum_name'] . '</a>' : $user->lang['POST_GLOBAL'],
|
||||
'TOPIC' => '<a href="viewtopic.' . $phpEx . $SID . '&f=' . $row['forum_id'] . '&t=' . $row['topic_id'] . '">' . $row['topic_title'] . '</a>',
|
||||
'AUTHOR' => $author,
|
||||
'SUBJECT' => '<a href="mcp.' . $phpEx . $SID . '&p=' . $row['post_id'] . '&mode=post_details">' . (($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT']) . '</a>',
|
||||
'POST_TIME' => $user->format_date($row['post_time']))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($total == 0)
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'L_UNAPPROVED_TOTAL' => $user->lang['UNAPPROVED_POSTS_ZERO_TOTAL'],
|
||||
'S_HAS_UNAPPROVED_POSTS' => false)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'L_UNAPPROVED_TOTAL' => ($total == 1) ? $user->lang['UNAPPROVED_POST_TOTAL'] : sprintf($user->lang['UNAPPROVED_POSTS_TOTAL'], $total),
|
||||
'S_HAS_UNAPPROVED_POSTS' => true)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Latest 5 reported
|
||||
$forum_list = get_forum_list('m_');
|
||||
|
||||
$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 p.forum_id IN (0, ' . implode(', ', $forum_list) . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$total = $row['total'];
|
||||
|
||||
if ($total)
|
||||
{
|
||||
$sql = 'SELECT r.*, p.post_id, p.post_subject, u.username, t.topic_id, t.topic_title, f.forum_id, f.forum_name
|
||||
FROM ' . REPORTS_TABLE . ' r, ' . REASONS_TABLE . ' rr,' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
|
||||
LEFT JOIN ' . FORUMS_TABLE . ' f ON f.forum_id = p.forum_id
|
||||
WHERE r.post_id = p.post_id
|
||||
AND r.reason_id = rr.reason_id
|
||||
AND p.topic_id = t.topic_id
|
||||
AND r.user_id = u.user_id
|
||||
AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')
|
||||
ORDER BY p.post_id DESC';
|
||||
$result = $db->sql_query_limit($sql, 5);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$template->assign_block_vars('report', array(
|
||||
'U_POST_DETAILS' => $url . '&mode=post_details',
|
||||
'FORUM' => (!empty($row['forum_id'])) ? '<a href="viewforum.' . $phpEx . $SID . '&f=' . $row['forum_id'] . '">' . $row['forum_name'] . '</a>' : $user->lang['POST_GLOBAL'],
|
||||
'TOPIC' => '<a href="viewtopic.' . $phpEx . $SID . '&f=' . $row['forum_id'] . '&t=' . $row['topic_id'] . '">' . $row['topic_title'] . '</a>',
|
||||
'REPORTER' => ($row['user_id'] == ANONYMOUS) ? $user->lang['GUEST'] : '<a href="memberlist.' . $phpEx . $SID . '&mode=viewprofile&u=' . $row['user_id'] . '">' . $row['username'] . '</a>',
|
||||
'SUBJECT' => '<a href="mcp.' . $phpEx . $SID . '&p=' . $row['post_id'] . '&mode=post_details">' . (($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT']) . '</a>',
|
||||
'REPORT_TIME' => $user->format_date($row['report_time']))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($total == 0)
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'L_REPORTS_TOTAL' => $user->lang['REPORTS_ZERO_TOTAL'],
|
||||
'S_HAS_REPORTS' => false)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'L_REPORTS_TOTAL' => ($total == 1) ? $user->lang['REPORT_TOTAL'] : sprintf($user->lang['REPORTS_TOTAL'], $total),
|
||||
'S_HAS_REPORTS' => true)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Latest 5 logs
|
||||
$forum_list = get_forum_list(array('m_', 'a_general'));
|
||||
|
||||
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)
|
||||
{
|
||||
$template->assign_block_vars('log', array(
|
||||
'USERNAME' => $row['username'],
|
||||
'IP' => $row['ip'],
|
||||
'TIME' => $user->format_date($row['time']),
|
||||
'ACTION' => $row['action'],
|
||||
'U_VIEWTOPIC' => $row['viewtopic'],
|
||||
'U_VIEWLOGS' => $row['viewlogs'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_SHOW_LOGS' => (!empty($forum_list)) ? true : false,
|
||||
'S_HAS_LOGS' => (!empty($log)) ? true : false)
|
||||
);
|
||||
|
||||
$template->assign_var('S_MCP_ACTION', $url);
|
||||
make_jumpbox($url . '&mode=forum_view', 0, false, 'm_');
|
||||
}
|
218
phpBB/includes/mcp/mcp_post.php
Normal file
218
phpBB/includes/mcp/mcp_post.php
Normal file
@@ -0,0 +1,218 @@
|
||||
<?php
|
||||
// -------------------------------------------------------------
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// FILENAME : mcp_post.php
|
||||
// STARTED : Thu Jul 08, 2004
|
||||
// COPYRIGHT : <20> 2004 phpBB Group
|
||||
// WWW : http://www.phpbb.com/
|
||||
// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
|
||||
//
|
||||
// -------------------------------------------------------------
|
||||
|
||||
//
|
||||
// TODO:
|
||||
// - change poster
|
||||
// - delete post
|
||||
//
|
||||
|
||||
function mcp_post_details($id, $mode, $action, $url)
|
||||
{
|
||||
global $SID, $phpEx, $phpbb_root_path, $config;
|
||||
global $template, $db, $user, $auth;
|
||||
|
||||
$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));
|
||||
|
||||
if (!sizeof($post_info))
|
||||
{
|
||||
trigger_error($user->lang['POST_NOT_EXIST']);
|
||||
}
|
||||
|
||||
$post_info = $post_info[$post_id];
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
case 'chgposter_search':
|
||||
|
||||
$username = request_var('username', '');
|
||||
|
||||
if ($username)
|
||||
{
|
||||
$users_ary = array();
|
||||
|
||||
if (strpos($username, '*') === false)
|
||||
{
|
||||
$username = "*$username*";
|
||||
}
|
||||
$username = str_replace('*', '%', str_replace('%', '\%', $username));
|
||||
|
||||
$sql = 'SELECT user_id, username
|
||||
FROM ' . USERS_TABLE . "
|
||||
WHERE username LIKE '" . $db->sql_escape($username) . "'
|
||||
AND user_type NOT IN (" . USER_INACTIVE . ', ' . USER_IGNORE . ')
|
||||
AND user_id <> ' . $post_info['user_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$users_ary[strtolower($row['username'])] = $row;
|
||||
}
|
||||
|
||||
$user_select = '';
|
||||
ksort($users_ary);
|
||||
foreach ($users_ary as $row)
|
||||
{
|
||||
$user_select .= '<option value="' . $row['user_id'] . '">' . $row['username'] . "</option>\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (!$user_select)
|
||||
{
|
||||
$template->assign_var('MESSAGE', $user->lang['NO_MATCHES_FOUND']);
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_USER_SELECT' => $user_select,
|
||||
'SEARCH_USERNAME' => request_var('username', ''))
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
|
||||
// Set some vars
|
||||
$users_ary = array();
|
||||
$poster = ($post_info['user_colour']) ? '<span style="color:#' . $post_info['user_colour'] . '">' . $post_info['username'] . '</span>' : $post_info['username'];
|
||||
|
||||
// Process message, leave it uncensored
|
||||
$message = $post_info['post_text'];
|
||||
if ($post_info['bbcode_bitfield'])
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx);
|
||||
$bbcode = new bbcode($post_info['bbcode_bitfield']);
|
||||
$bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
|
||||
}
|
||||
$message = smilie_text($message);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_MCP_ACTION' => "$url&i=main&quickmod=1",
|
||||
'S_CHGPOSTER_ACTION' => "$url&i=$id&mode=post_details",
|
||||
'S_APPROVE_ACTION' => "{$phpbb_root_path}mcp.$phpEx$SID&i=queue&mode=approve&quickmod=1&p=$post_id",
|
||||
|
||||
'S_CAN_VIEWIP' => $auth->acl_get('m_ip', $post_info['forum_id']),
|
||||
'S_CAN_CHGPOSTER' => $auth->acl_get('m_', $post_info['forum_id']),
|
||||
'S_CAN_LOCK_POST' => $auth->acl_get('m_lock', $post_info['forum_id']),
|
||||
'S_CAN_DELETE_POST' => $auth->acl_get('m_delete', $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' => ($post_info['user_notes']) ? true : false,
|
||||
'S_USER_WARNINGS' => ($post_info['user_warnings']) ? true : false,
|
||||
|
||||
'U_VIEW_PROFILE' => "memberlist.$phpEx$SID&mode=viewprofile&u=" . $post_info['user_id'],
|
||||
'U_MCP_USERNOTES' => "mcp.$phpEx$SID&i=notes&mode=user_notes&u=" . $post_info['user_id'],
|
||||
'U_MCP_WARNINGS' => "mcp.$phpEx$SID&i=warnings&mode=view_user&u=" . $post_info['user_id'],
|
||||
|
||||
'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&p=$post_id#$post_id\">", '</a>'),
|
||||
'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], "<a href=\"viewforum.$phpEx$SID&f={$post_info['forum_id']}&start={$start}\">", '</a>'),
|
||||
'REPORTED_IMG' => $user->img('icon_reported', $user->lang['POST_REPORTED']),
|
||||
'UNAPPROVED_IMG' => $user->img('icon_unapproved', $user->lang['POST_UNAPPROVED']),
|
||||
|
||||
'POSTER_NAME' => $poster,
|
||||
'POST_PREVIEW' => $message,
|
||||
'POST_SUBJECT' => $post_info['post_subject'],
|
||||
'POST_DATE' => $user->format_date($post_info['post_time']),
|
||||
'POST_IP' => $post_info['poster_ip'],
|
||||
'POST_IPADDR' => @gethostbyaddr($post_info['poster_ip']))
|
||||
);
|
||||
|
||||
// Get IP
|
||||
if ($auth->acl_get('m_ip', $post_info['forum_id']))
|
||||
{
|
||||
$rdns_ip_num = request_var('rdns', '');
|
||||
|
||||
if ($rdns_ip_num != 'all')
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'U_LOOKUP_ALL' => "$url&i=main&mode=post_details&rdns=all")
|
||||
);
|
||||
}
|
||||
|
||||
// Get other users who've posted under this IP
|
||||
$sql = 'SELECT u.user_id, u.username, COUNT(*) as postings
|
||||
FROM ' . USERS_TABLE . ' u, ' . POSTS_TABLE . " p
|
||||
WHERE p.poster_id = u.user_id
|
||||
AND p.poster_ip = '{$post_info['poster_ip']}'
|
||||
AND p.poster_id <> {$post_info['user_id']}
|
||||
GROUP BY u.user_id
|
||||
ORDER BY postings DESC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
// Fill the user select list with users who have posted
|
||||
// under this IP
|
||||
if ($row['user_id'] != $post_info['poster_id'])
|
||||
{
|
||||
$users_ary[strtolower($row['username'])] = $row;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('userrow', array(
|
||||
'USERNAME' => ($row['user_id'] == ANONYMOUS) ? $user->lang['GUEST'] : $row['username'],
|
||||
'NUM_POSTS' => $row['postings'],
|
||||
'L_POST_S' => ($row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'],
|
||||
|
||||
'U_PROFILE' => ($row['user_id'] == ANONYMOUS) ? '' : "memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['user_id'],
|
||||
'U_SEARCHPOSTS' => "search.$phpEx$SID&search_author=" . urlencode($row['username']) . "&showresults=topics")
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Get other IP's this user has posted under
|
||||
$sql = 'SELECT poster_ip, COUNT(*) AS postings
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE poster_id = ' . $post_info['poster_id'] . '
|
||||
GROUP BY poster_ip
|
||||
ORDER BY postings DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$hostname = (($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') && $row['poster_ip']) ? @gethostbyaddr($row['poster_ip']) : '';
|
||||
|
||||
$template->assign_block_vars('iprow', array(
|
||||
'IP' => $row['poster_ip'],
|
||||
'HOSTNAME' => $hostname,
|
||||
'NUM_POSTS' => $row['postings'],
|
||||
'L_POST_S' => ($row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'],
|
||||
|
||||
'U_LOOKUP_IP' => ($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') ? '' : "$url&i=$id&mode=post_details&rdns={$row['poster_ip']}#ip",
|
||||
'U_WHOIS' => "mcp.$phpEx$SID&i=$id&mode=whois&ip={$row['poster_ip']}")
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// If we were not searching for a specific username fill
|
||||
// the user_select box with users who have posted under
|
||||
// the same IP
|
||||
if ($action != 'chgposter_search')
|
||||
{
|
||||
$user_select = '';
|
||||
ksort($users_ary);
|
||||
foreach ($users_ary as $row)
|
||||
{
|
||||
$user_select .= '<option value="' . $row['user_id'] . '">' . $row['username'] . "</option>\n";
|
||||
}
|
||||
$template->assign_var('S_USER_SELECT', $user_select);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
195
phpBB/includes/mcp/mcp_topic.php
Normal file
195
phpBB/includes/mcp/mcp_topic.php
Normal file
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
// -------------------------------------------------------------
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// FILENAME : mcp_topic.php
|
||||
// STARTED : Thu Jul 08, 2004
|
||||
// COPYRIGHT : <20> 2004 phpBB Group
|
||||
// WWW : http://www.phpbb.com/
|
||||
// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
|
||||
//
|
||||
// -------------------------------------------------------------
|
||||
|
||||
//
|
||||
// TODO:
|
||||
//
|
||||
|
||||
function mcp_topic_view($id, $mode, $action, $url)
|
||||
{
|
||||
global $SID, $phpEx, $phpbb_root_path, $config;
|
||||
global $template, $db, $user, $auth;
|
||||
|
||||
$user->add_lang('viewtopic');
|
||||
|
||||
$topic_id = request_var('t', 0);
|
||||
|
||||
$topic_info = get_topic_data(array($topic_id));
|
||||
|
||||
if (!sizeof($topic_info))
|
||||
{
|
||||
trigger_error($user->lang['TOPIC_NOT_EXIST']);
|
||||
}
|
||||
|
||||
$topic_info = $topic_info[$topic_id];
|
||||
|
||||
// Set up some vars
|
||||
$icon_id = request_var('icon', 0);
|
||||
$subject = request_var('subject', '');
|
||||
$start = request_var('start', 0);
|
||||
$to_topic_id = request_var('to_topic_id', 0);
|
||||
$to_forum_id = request_var('to_forum_id', 0);
|
||||
|
||||
$post_id_list = get_array('post_id_list', 0);
|
||||
|
||||
$topics_per_page = ($topic_info['forum_topics_per_page']) ? $topic_info['forum_topics_per_page'] : $config['topics_per_page'];
|
||||
|
||||
// Jumpbox, sort selects and that kind of things
|
||||
make_jumpbox($url . '&mode=forum_view', $topic_info['forum_id'], false, 'm_');
|
||||
mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id);
|
||||
|
||||
$forum_topics = ($total == -1) ? $topic_info['forum_topics'] : $total;
|
||||
$limit_time_sql = ($sort_days) ? 'AND t.topic_last_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($config['posts_per_page'])));
|
||||
|
||||
$sql = 'SELECT u.username, u.user_colour, p.*
|
||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
|
||||
WHERE p.topic_id = {$topic_id}
|
||||
AND p.poster_id = u.user_id
|
||||
ORDER BY $sort_order_sql";
|
||||
$result = $db->sql_query_limit($sql, $posts_per_page, $start);
|
||||
|
||||
$rowset = array();
|
||||
$bbcode_bitfield = 0;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$rowset[] = $row;
|
||||
$bbcode_bitfield |= $row['bbcode_bitfield'];
|
||||
}
|
||||
|
||||
if ($bbcode_bitfield)
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
|
||||
$bbcode = new bbcode($bbcode_bitfield);
|
||||
}
|
||||
|
||||
foreach ($rowset as $i => $row)
|
||||
{
|
||||
$has_unapproved_posts = false;
|
||||
$poster = ($row['poster_id'] != ANONYMOUS) ? $row['username'] : ((!$row['post_username']) ? $user->lang['GUEST'] : $row['post_username']);
|
||||
$poster = ($row['user_colour']) ? '<span style="color:#' . $row['user_colour'] . '">' . $poster . '</span>' : $poster;
|
||||
|
||||
$message = $row['post_text'];
|
||||
$post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title'];
|
||||
|
||||
// If the board has HTML off but the post has HTML
|
||||
// on then we process it, else leave it alone
|
||||
if (!$config['allow_html'] && $row['enable_html'])
|
||||
{
|
||||
$message = preg_replace('#(<)([\/]?.*?)(>)#is', '<\\2>', $message);
|
||||
}
|
||||
|
||||
if ($row['bbcode_bitfield'])
|
||||
{
|
||||
$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
|
||||
}
|
||||
|
||||
$message = smilie_text($message);
|
||||
$message = str_replace("\n", '<br />', $message);
|
||||
|
||||
$checked = ($post_id_list && in_array(intval($row['post_id']), $post_id_list)) ? 'checked="checked" ' : '';
|
||||
$s_checkbox = ($row['post_id'] == $topic_info['topic_first_post_id'] && $action == 'split') ? ' ' : '<input type="checkbox" name="post_id_list[]" value="' . $row['post_id'] . '" ' . $checked . '/>';
|
||||
|
||||
if (!$row['post_approved'])
|
||||
{
|
||||
$has_unapproved_posts = true;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('postrow', array(
|
||||
'POSTER_NAME' => $poster,
|
||||
'POST_DATE' => $user->format_date($row['post_time']),
|
||||
'POST_SUBJECT' => $post_subject,
|
||||
'MESSAGE' => $message,
|
||||
'POST_ID' => $row['post_id'],
|
||||
|
||||
'POST_ICON_IMG' => ($row['post_time'] > $user->data['user_lastvisit'] && $user->data['user_id'] != ANONYMOUS) ? $user->img('icon_post_new', $user->lang['NEW_POST']) : $user->img('icon_post', $user->lang['POST']),
|
||||
|
||||
'S_CHECKBOX' => $s_checkbox,
|
||||
'S_POST_REPORTED' => ($row['post_reported']) ? true : false,
|
||||
'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true,
|
||||
|
||||
'U_POST_DETAILS' => "$url&p={$row['post_id']}&mode=post_details",
|
||||
'U_APPROVE' => "$url&i=queue&mode=approve&p=" . $row['post_id'])
|
||||
);
|
||||
|
||||
unset($rowset[$i]);
|
||||
}
|
||||
|
||||
// Display topic icons for split topic
|
||||
$s_topic_icons = false;
|
||||
|
||||
if ($auth->acl_get('m_split', $topic_info['forum_id']))
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
|
||||
$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'])
|
||||
{
|
||||
$s_topic_icons = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TOPIC_TITLE' => $topic_info['topic_title'],
|
||||
'U_VIEWTOPIC' => "viewtopic.$phpEx$SID&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="viewtopic.' . $phpEx . $SID . '&f=' . $to_topic_info['forum_id'] . '&t=' . $to_topic_id . '" target="_new">' . $to_topic_info['topic_title'] . '</a>') : '',
|
||||
|
||||
'SPLIT_SUBJECT' => $subject,
|
||||
'POSTS_PER_PAGE' => $posts_per_page,
|
||||
'MODE' => $mode,
|
||||
|
||||
'REPORTED_IMG' => $user->img('icon_reported', 'POST_REPORTED', false, true),
|
||||
'UNAPPROVED_IMG' => $user->img('icon_unapproved', 'POST_UNAPPROVED', false, true),
|
||||
|
||||
'S_MCP_ACTION' => "$url&mode=$mode&start=$start",
|
||||
'S_FORUM_SELECT' => '<select name="to_forum_id">' . (($to_forum_id) ? make_forum_select($to_forum_id) : make_forum_select($topic_info['forum_id'])) . '</select>',
|
||||
'S_CAN_SPLIT' => ($auth->acl_get('m_split', $topic_info['forum_id'])) ? true : false,
|
||||
'S_CAN_MERGE' => ($auth->acl_get('m_merge', $topic_info['forum_id'])) ? true : false,
|
||||
'S_CAN_DELETE' => ($auth->acl_get('m_delete', $topic_info['forum_id'])) ? true : false,
|
||||
'S_CAN_APPROVE' => ($has_unapproved_posts && $auth->acl_get('m_approve', $topic_info['forum_id'])) ? true : false,
|
||||
'S_CAN_LOCK' => ($auth->acl_get('m_lock', $topic_info['forum_id'])) ? true : false,
|
||||
|
||||
'S_SHOW_TOPIC_ICONS'=> $s_topic_icons,
|
||||
'S_TOPIC_ICON' => $icon_id,
|
||||
|
||||
'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&f={$topic_info['forum_id']}&t={$topic_info['topic_id']}&start=$start\">", '</a>'),
|
||||
'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], "<a href=\"viewforum.$phpEx$SID&f={$topic_info['forum_id']}&start=$start\">", '</a>'),
|
||||
|
||||
'PAGE_NUMBER' => on_page($total, $posts_per_page, $start),
|
||||
'PAGINATION' => (!$posts_per_page) ? '' : generate_pagination("mcp.$phpEx$SID&t=" . $topic_info['topic_id'] . "&mode=$mode&posts_per_page=$posts_per_page&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $posts_per_page, $start),
|
||||
'TOTAL' => $total)
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user