diff options
author | Nils Adermann <naderman@naderman.de> | 2009-07-21 20:59:11 +0000 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2009-07-21 20:59:11 +0000 |
commit | 6e4a7c03d14d6fcc03955fbe26c3d5f725eb929d (patch) | |
tree | 055fde9f035382ec59b83962cc4120022fbf7ced /phpBB/includes/mcp/mcp_front.php | |
parent | 0ee8d7ab15caae94cdd381e9f449713c8838b611 (diff) | |
download | forums-6e4a7c03d14d6fcc03955fbe26c3d5f725eb929d.tar forums-6e4a7c03d14d6fcc03955fbe26c3d5f725eb929d.tar.gz forums-6e4a7c03d14d6fcc03955fbe26c3d5f725eb929d.tar.bz2 forums-6e4a7c03d14d6fcc03955fbe26c3d5f725eb929d.tar.xz forums-6e4a7c03d14d6fcc03955fbe26c3d5f725eb929d.zip |
Users can report PMs to moderators which are then visible in a new MCP module
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9814 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/mcp/mcp_front.php')
-rw-r--r-- | phpBB/includes/mcp/mcp_front.php | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 05c1b796ac..ee75c1daff 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -152,6 +152,7 @@ function mcp_front_view($id, $mode, $action) $sql = 'SELECT COUNT(r.report_id) AS total FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p WHERE r.post_id = p.post_id + AND r.pm_id = 0 AND r.report_closed = 0 AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')'; $result = $db->sql_query($sql); @@ -181,6 +182,7 @@ function mcp_front_view($id, $mode, $action) ), 'WHERE' => 'r.post_id = p.post_id + AND r.pm_id = 0 AND r.report_closed = 0 AND r.reason_id = rr.reason_id AND p.topic_id = t.topic_id @@ -243,6 +245,96 @@ function mcp_front_view($id, $mode, $action) } } + // Latest 5 reported PMs + if ($module->loaded('pm_reports') && $auth->acl_getf_global('m_report')) + { + $template->assign_var('S_SHOW_PM_REPORTS', true); + + $sql = 'SELECT COUNT(r.report_id) AS total + FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . ' p + WHERE r.post_id = 0 + AND r.pm_id = p.msg_id + AND r.report_closed = 0'; + $result = $db->sql_query($sql); + $total = (int) $db->sql_fetchfield('total'); + $db->sql_freeresult($result); + + if ($total) + { + include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + $user->add_lang(array('ucp')); + + $sql = $db->sql_build_query('SELECT', array( + 'SELECT' => 'r.report_id, r.report_time, p.msg_id, p.message_subject, p.message_time, p.to_address, p.bcc_address, 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', + + 'FROM' => array( + REPORTS_TABLE => 'r', + REPORTS_REASONS_TABLE => 'rr', + USERS_TABLE => array('u', 'u2'), + PRIVMSGS_TABLE => 'p' + ), + + 'WHERE' => 'r.pm_id = p.msg_id + AND r.post_id = 0 + AND r.report_closed = 0 + AND r.reason_id = rr.reason_id + AND r.user_id = u.user_id + AND p.author_id = u2.user_id', + + 'ORDER_BY' => 'p.message_time DESC' + )); + $result = $db->sql_query_limit($sql, 5); + + $pm_by_id = $pm_list = array(); + while ($row = $db->sql_fetchrow($result)) + { + $pm_by_id[(int) $row['msg_id']] = $row; + $pm_list[] = (int) $row['msg_id']; + } + + $address_list = get_recipient_strings($pm_by_id); + + foreach ($pm_list as $message_id) + { + $row = $pm_by_id[$message_id]; + + $template->assign_block_vars('pm_report', array( + 'U_PM_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'r=' . $row['report_id'] . "&i=pm_reports&mode=pm_report_details"), + + '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']), + + 'PM_AUTHOR_FULL' => get_username_string('full', $row['author_id'], $row['author_name'], $row['author_colour']), + 'PM_AUTHOR' => get_username_string('username', $row['author_id'], $row['author_name'], $row['author_colour']), + 'PM_AUTHOR_COLOUR' => get_username_string('colour', $row['author_id'], $row['author_name'], $row['author_colour']), + 'U_PM_AUTHOR' => get_username_string('profile', $row['author_id'], $row['author_name'], $row['author_colour']), + + 'PM_SUBJECT' => $row['message_subject'], + 'REPORT_TIME' => $user->format_date($row['report_time']), + 'PM_TIME' => $user->format_date($row['message_time']), + 'RECIPIENTS' => implode(', ', $address_list[$row['msg_id']]), + )); + } + } + + if ($total == 0) + { + $template->assign_vars(array( + 'L_REPORTS_TOTAL' => $user->lang['REPORTS_ZERO_TOTAL'], + 'S_HAS_PM_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 if ($module->loaded('logs')) { |