mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 12:03:21 +01:00
- added merging of posts to mcp - fixed parsing of acl_getf results - adjusted tracking code for important announcements (seems to work now) git-svn-id: file:///svn/phpbb/trunk@4923 89ea8834-ac86-4346-8a33-228a782c2dd0
191 lines
6.6 KiB
PHP
191 lines
6.6 KiB
PHP
<?php
|
|
// -------------------------------------------------------------
|
|
//
|
|
// $Id$
|
|
//
|
|
// FILENAME : mcp_front.php
|
|
// STARTED : Thu Jul 08, 2004
|
|
// COPYRIGHT : © 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_');
|
|
}
|
|
|
|
?>
|