Browse Source

Changes to show a single reported posts, its comments and the moderator's comments

Signed-off-by: Suki <[email protected]>
Suki 11 years ago
parent
commit
7196c569c6
2 changed files with 31 additions and 7 deletions
  1. 7 1
      Sources/ReportedPosts.php
  2. 24 6
      Sources/Subs-ReportedPosts.php

+ 7 - 1
Sources/ReportedPosts.php

@@ -111,6 +111,7 @@ function ReportDetails()
 	global $smcFunc;
 
 	$report = array();
+	$reportComments = array();
 
 	// Have to at least give us something to work with.
 	if (empty($_REQUEST['report']))
@@ -151,6 +152,11 @@ function ReportDetails()
 		'ignore' => $report['ignore_all']
 	);
 
+	$reportComments = getReportComments($report_id);
+
+	if (!empty($reportComments))
+		$context['report'] = array_merge($context['report'], $reportComments);
+
 	// What have the other moderators done to this message?
 	require_once($sourcedir . '/Modlog.php');
 	require_once($sourcedir . '/Subs-List.php');
@@ -162,7 +168,7 @@ function ReportDetails()
 		'title' => $txt['mc_modreport_modactions'],
 		'items_per_page' => 15,
 		'no_items_label' => $txt['modlog_no_entries_found'],
-		'base_href' => $scripturl . '?action=moderate;area=reports;report=' . $context['report']['id'],
+		'base_href' => $scripturl . '?action=moderate;area=reports;sa=details;report=' . $context['report']['id'],
 		'default_sort_col' => 'time',
 		'get_items' => array(
 			'function' => 'list_getModLogEntries',

+ 24 - 6
Sources/Subs-ReportedPosts.php

@@ -134,7 +134,7 @@ function getReports($closed = 0)
 				'id_board' => $row['id_board'],
 				'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'],
 			),
-			'report_href' => $scripturl . '?action=moderate;sa=details;report=' . $row['id_report'],
+			'report_href' => $scripturl . '?action=moderate;area=reports;sa=details;report=' . $row['id_report'],
 			'author' => array(
 				'id' => $row['id_author'],
 				'name' => $row['author_name'],
@@ -248,6 +248,9 @@ function getReportDetails($report_id)
 {
 	global $smcFunc, $user_info;
 
+	if (empty($report_id))
+		return false;
+
 	// Get the report details, need this so we can limit access to a particular board.
 	$request = $smcFunc['db_query']('', '
 		SELECT lr.id_report, lr.id_msg, lr.id_topic, lr.id_board, lr.id_member, lr.subject, lr.body,
@@ -259,7 +262,7 @@ function getReportDetails($report_id)
 			AND ' . ($user_info['mod_cache']['bq'] == '1=1' || $user_info['mod_cache']['bq'] == '0=1' ? $user_info['mod_cache']['bq'] : 'lr.' . $user_info['mod_cache']['bq']) . '
 		LIMIT 1',
 		array(
-			'id_report' => $_REQUEST['report'],
+			'id_report' => $report_id,
 		)
 	);
 
@@ -276,6 +279,16 @@ function getReportDetails($report_id)
 
 function getReportComments($report_id)
 {
+	global $smcFunc, $scripturl;
+
+	if (empty($report_id))
+		return false;
+
+	$report = array(
+		'comments' => array(),
+		'mod_comments' => array()
+	);
+
 	// So what bad things do the reporters have to say about it?
 	$request = $smcFunc['db_query']('', '
 		SELECT lrc.id_comment, lrc.id_report, lrc.time_sent, lrc.comment, lrc.member_ip,
@@ -284,12 +297,13 @@ function getReportComments($report_id)
 			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = lrc.id_member)
 		WHERE lrc.id_report = {int:id_report}',
 		array(
-			'id_report' => $context['report']['id'],
+			'id_report' => $report_id,
 		)
 	);
+
 	while ($row = $smcFunc['db_fetch_assoc']($request))
 	{
-		$context['report']['comments'][] = array(
+		$report['comments'][] = array(
 			'id' => $row['id_comment'],
 			'message' => strtr($row['comment'], array("\n" => '<br>')),
 			'time' => timeformat($row['time_sent']),
@@ -313,12 +327,13 @@ function getReportComments($report_id)
 		WHERE lc.id_notice = {int:id_report}
 			AND lc.comment_type = {literal:reportc}',
 		array(
-			'id_report' => $context['report']['id'],
+			'id_report' => $report_id,
 		)
 	);
+
 	while ($row = $smcFunc['db_fetch_assoc']($request))
 	{
-		$context['report']['mod_comments'][] = array(
+		$report['mod_comments'][] = array(
 			'id' => $row['id_comment'],
 			'message' => parse_bbc($row['body']),
 			'time' => timeformat($row['log_time']),
@@ -331,6 +346,9 @@ function getReportComments($report_id)
 			),
 		);
 	}
+
 	$smcFunc['db_free_result']($request);
+
+	return $report;
 }
 ?>