Browse Source

+ Log closing/(un-)ignoring/reopening post reports (per #1101).

Signed-off-by: Michael Eshom <[email protected]>
Michael Eshom 10 years ago
parent
commit
de4a2aaa04
3 changed files with 54 additions and 1 deletions
  1. 44 0
      Sources/ModerationCenter.php
  2. 3 1
      Sources/Modlog.php
  3. 7 0
      Themes/default/languages/Modlog.english.php

+ 44 - 0
Sources/ModerationCenter.php

@@ -597,9 +597,27 @@ function ReportedPosts()
 			)
 		);
 
+		// Get the board, topic and message for this report
+		$request = $smcFunc['db_query']('', '
+			SELECT id_board, id_topic, id_msg
+			FROM {db_prefix}log_reported
+			WHERE id_report = {int:id_report}',
+			array(
+				'id_report' => $_GET['rid'],
+			)
+		);
+
+		// Set up the data for the log...
+		$extra = array('report' => $_GET['rid']);
+		list ($extra['board'], $extra['topic'], $extra['message']) = $smcFunc['db_fetch_row']($request);
+		$smcFunc['db_free_result']($request);
+
 		// Tell the user about it.
 		$context['report_post_action'] = isset($_GET['ignore']) ? (!empty($_GET['ignore']) ? 'ignore' : 'unignore') : (!empty($_GET['close']) ? 'close' : 'open');
 
+		// Log this action
+		logAction($context['report_post_action'] . '_report', $extra);
+
 		// Time to update.
 		updateSettings(array('last_mod_report_action' => time()));
 		recountOpenReports();
@@ -615,6 +633,32 @@ function ReportedPosts()
 
 		if (!empty($toClose))
 		{
+			// Get the data for each of these reports
+			$request = $smcFunc['db_query']('', '
+				SELECT id_report, id_board, id_topic, id_msg
+				FROM {db_prefix}log_reported
+				WHERE id_report IN ({array_int:report_list})
+					AND ' . $user_inf['mod_cache']['bq'],
+				array(
+					'id_report' => $_GET['rid'],
+				)
+			);
+
+			while ($reports = $smcFunc['db_fetch_assoc']($request))
+			{
+				$report_data = array(
+					'report' => $row['id_report'],
+					'board' => $row['id_board'],
+					'topic' => $row['id_topic'],
+					'message' => $row['id_msg'],
+				);
+
+				// Log that this report was closed
+				logAction('close_report', $report_data);
+			}
+
+			$smcFunc['db_free_result']($request);
+
 			$smcFunc['db_query']('', '
 				UPDATE {db_prefix}log_reported
 				SET closed = {int:is_closed}

+ 3 - 1
Sources/Modlog.php

@@ -616,10 +616,12 @@ function list_getModLogEntries($start, $items_per_page, $sort, $query_string = '
 			if (!empty($entry['extra'][$type]) && is_numeric($entry['extra'][$type]))
 				$entries[$k]['extra'][$type] = sprintf($txt['modlog_id'], $entry['extra'][$type]);
 
+		if (isset($entry['extra']['report']))
+			$entries[$k]['extra']['report'] = '<a href="' . $scripturl . '?action=modlog;area=reports;report=' . $entry['extra']['report'] . '">' . $txt['modlog_report'] . '</a>';
+
 		if (empty($entries[$k]['action_text']))
 			$entries[$k]['action_text'] = isset($txt['modlog_ac_' . $entry['action']]) ? $txt['modlog_ac_' . $entry['action']] : $entry['action'];
 		$entries[$k]['action_text'] = preg_replace_callback('~\{([A-Za-z\d_]+)\}~i', $callback($entries, $k), $entries[$k]['action_text']);
-
 	}
 
 	// Back we go!

+ 7 - 0
Themes/default/languages/Modlog.english.php

@@ -93,4 +93,11 @@ $txt['modlog_parameter_guest'] = '<em>Guest</em>';
 
 $txt['modlog_ac_approve_attach'] = 'Approved &quot;{filename}&quot; in &quot;{message}&quot;';
 $txt['modlog_ac_remove_attach'] = 'Removed unapproved &quot;{filename}&quot; in &quot;{message}&quot;';
+
+// Handling reports on posts
+$txt['modlog_report'] = 'report';
+$txt['modlog_ac_close_report'] = 'Closed {report} on &quot;{message}&quot;';
+$txt['modlog_ac_ignore_report'] = 'Ignored {report} on &quot;{message}&quot;';
+$txt['modlog_ac_open_report'] = 'Reopened {report} on &quot;{message}&quot;';
+$txt['modlog_ac_unignore_report'] = 'Un-ignored {report} on &quot;{message}&quot;';
 ?>