Explorar el Código

Merge pull request #704 from Arantor/release-2.1

A bug fix and an improvement.
Arantor hace 11 años
padre
commit
535e51e085

+ 23 - 0
Sources/ModerationCenter.php

@@ -697,6 +697,29 @@ function ReportedPosts()
 	}
 	$smcFunc['db_free_result']($request);
 
+	// Get the names of boards those topics are in. Slightly faster this way.
+	if (!empty($report_boards_ids))
+	{
+		$report_boards_ids = array_unique($report_boards_ids);
+		$board_names = array();
+		$request = $smcFunc['db_query']('', '
+			SELECT id_board, name
+			FROM {db_prefix}boards
+			WHERE id_board IN ({array_int:boards})',
+			array(
+				'boards' => $report_boards_ids,
+			)
+		);
+
+		while ($row = $smcFunc['db_fetch_assoc']($request))
+			$board_names[$row['id_board']] = $row['name'];
+		$smcFunc['db_free_result']($request);
+
+		foreach ($context['reports'] as $id_report => $report)
+			if (!empty($board_names[$report['topic']['id_board']]))
+				$context['reports'][$id_report]['topic']['board_name'] = $board_names[$report['topic']['id_board']];
+	}
+
 	// Now get all the people who reported it.
 	if (!empty($report_ids))
 	{

+ 1 - 1
Sources/SendTopic.php

@@ -545,7 +545,7 @@ function ReportToModerator2()
 	$real_mods = array();
 	while ($row = $smcFunc['db_fetch_assoc']($request))
 		$real_mods[] = $row['id_member'];
-	$smcFunc['db_free_result']($request2);
+	$smcFunc['db_free_result']($request);
 
 	// Get any additional members who are in groups assigned to moderate this board
 	$request = $smcFunc['db_query']('', '

+ 1 - 1
Themes/default/ModerationCenter.template.php

@@ -224,7 +224,7 @@ function template_reported_posts()
 		<div class="generic_list_wrapper ', $report['alternate'] ? 'windowbg' : 'windowbg2', '">
 			<div class="content">
 				<h5>
-					<strong><a href="', $report['topic']['href'], '">', $report['subject'], '</a></strong> ', $txt['mc_reportedp_by'], ' <strong>', $report['author']['link'], '</strong>
+					<strong>', !empty($report['topic']['board_name']) ? '<a href="' . $scripturl . '?board=' . $report['topic']['id_board'] . '.0">' . $report['topic']['board_name'] . '</a>' : '??', ' / <a href="', $report['topic']['href'], '">', $report['subject'], '</a></strong> ', $txt['mc_reportedp_by'], ' <strong>', $report['author']['link'], '</strong>
 				</h5>
 				<div class="smalltext">
 					', $txt['mc_reportedp_last_reported'], ': ', $report['last_updated'], '&nbsp;-&nbsp;';