Prechádzať zdrojové kódy

Yeah, the usual fixes for the usual boo-boos

Signed-off-by: Suki <[email protected]>
Suki 10 rokov pred
rodič
commit
bebd3fe638

+ 0 - 142
Sources/ModerationCenter.php

@@ -545,148 +545,6 @@ function ModBlockGroupRequests()
 	return 'group_requests_block';
 }
 
-/**
- * Browse all the reported posts...
- * @todo this needs to be given its own file?
- */
-function ReportedPosts()
-{
-	global $txt, $context, $scripturl, $user_info, $smcFunc;
-
-	loadTemplate('ModerationCenter');
-
-	// Set an empty var for the server response.
-	$context['report_post_action'] = '';
-
-	// Put the open and closed options into tabs, because we can...
-	$context[$context['moderation_menu_name']]['tab_data'] = array(
-		'title' => $txt['mc_reported_posts'],
-		'help' => '',
-		'description' => $txt['mc_reported_posts_desc'],
-	);
-
-	// This comes under the umbrella of moderating posts.
-	if ($user_info['mod_cache']['bq'] == '0=1')
-		isAllowedTo('moderate_forum');
-
-	// Are they wanting to view a particular report?
-	if (!empty($_REQUEST['report']))
-		return ModReport();
-
-	// Set up the comforting bits...
-	$context['page_title'] = $txt['mc_reported_posts'];
-	$context['sub_template'] = 'reported_posts';
-
-	// Are we viewing open or closed reports?
-	$context['view_closed'] = isset($_GET['sa']) && $_GET['sa'] == 'closed' ? 1 : 0;
-
-	// Are we doing any work?
-	if ((isset($_GET['ignore']) || isset($_GET['close'])) && isset($_GET['rid']))
-	{
-		checkSession('get');
-		$_GET['rid'] = (int) $_GET['rid'];
-
-		// Update the report...
-		$smcFunc['db_query']('', '
-			UPDATE {db_prefix}log_reported
-			SET ' . (isset($_GET['ignore']) ? 'ignore_all = {int:ignore_all}' : 'closed = {int:closed}') . '
-			WHERE id_report = {int:id_report}
-				AND ' . $user_info['mod_cache']['bq'],
-			array(
-				'ignore_all' => isset($_GET['ignore']) ? (int) $_GET['ignore'] : 0,
-				'closed' => isset($_GET['close']) ? (int) $_GET['close'] : 0,
-				'id_report' => $_GET['rid'],
-			)
-		);
-
-		// 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();
-	}
-	elseif (isset($_POST['close']) && isset($_POST['close_selected']))
-	{
-		checkSession();
-
-		// All the ones to update...
-		$toClose = array();
-		foreach ($_POST['close'] as $rid)
-			$toClose[] = (int) $rid;
-
-		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}
-				WHERE id_report IN ({array_int:report_list})
-					AND ' . $user_info['mod_cache']['bq'],
-				array(
-					'report_list' => $toClose,
-					'is_closed' => 1,
-				)
-			);
-
-			// Time to update.
-			updateSettings(array('last_mod_report_action' => time()));
-			recountOpenReports();
-		}
-
-		// Go on and tell the result.
-		$context['report_post_action'] = 'close_all';
-	}
-
-
-	// Do we deleted a message?
-	if (isset($_REQUEST['done']))
-		$context['report_post_action'] = 'message_deleted';
-}
-
 /**
  * Act as an entrace for all group related activity.
  * @todo As for most things in this file, this needs to be moved somewhere appropriate?

+ 15 - 14
Sources/ReportedPosts.php

@@ -27,23 +27,14 @@ if (!defined('SMF'))
 function ReportedPosts()
 {
 	global $txt, $context, $scripturl, $user_info, $smcFunc;
+	global $sourcedir;
 
 	loadLanguage('ModerationCenter');
 	loadTemplate('ReportedPosts');
 
-	// Set an empty var for the server response.
-	$context['report_post_action'] = '';
-
 	// We need this little rough gem.
 	require_once($sourcedir . '/Subs-ReportedPosts.php');
 
-	// Put the open and closed options into tabs, because we can...
-	$context[$context['moderation_menu_name']]['tab_data'] = array(
-		'title' => $txt['mc_reported_posts'],
-		'help' => '',
-		'description' => $txt['mc_reported_posts_desc'],
-	);
-
 	// Set up the comforting bits...
 	$context['page_title'] = $txt['mc_reported_posts'];
 	$context['sub_template'] = 'reported_posts';
@@ -84,15 +75,25 @@ function ReportedPosts()
  */
 function ShowReports()
 {
-	// Showing closed ones?
-	if (isset($_GET['closed']))
+	global $context, $txt;
 
-	getReports();
+	// Put the open and closed options into tabs, because we can...
+	$context[$context['moderation_menu_name']]['tab_data'] = array(
+		'title' => $txt['mc_reported_posts'],
+		'help' => '',
+		'description' => $txt['mc_reported_posts_desc'],
+	);
+
+	// Showing closed ones?
+	$context['view_closed'] = isset($_GET['closed']);
+	$context['sub_template'] = 'reported_posts';
+	$context['reports'] = getReports($context['view_closed']);
 }
 
 function ReportDetails()
 {
-	global $user_info, $context, $sourcedir, $scripturl, $txt, $smcFunc;
+	global $user_info, $context, $sourcedir, $scripturl, $txt;
+	global $smcFunc;
 
 	// Have to at least give us something to work with.
 	if (empty($_REQUEST['report']))

+ 1 - 1
Sources/Security.php

@@ -494,7 +494,7 @@ function banPermissions()
 		$context['open_mod_reports'] = $_SESSION['rc']['reports'];
 	elseif ($_SESSION['mc']['bq'] != '0=1')
 	{
-		require_once($sourcedir . '/ModerationCenter.php');
+		require_once($sourcedir . '/Subs-ReportedPosts.php');
 		recountOpenReports();
 	}
 	else

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

@@ -24,7 +24,7 @@ function template_reported_posts()
 	}
 
 	echo '
-	<form id="reported_posts" action="', $scripturl, '?action=moderate;area=reports', $context['view_closed'] ? ';sa=closed' : '', ';start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
+	<form id="reported_posts" action="', $scripturl, '?action=moderate;area=reports;sa=show', $context['view_closed'] ? ';closed' : '', ';start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
 		<div class="cat_bar">
 			<h3 class="catbg">
 				', $context['view_closed'] ? $txt['mc_reportedp_closed'] : $txt['mc_reportedp_active'], '