Parcourir la source

Keep moving stuff

Signed-off-by: Suki <[email protected]>
Suki il y a 10 ans
Parent
commit
af5b399f96
3 fichiers modifiés avec 41 ajouts et 36 suppressions
  1. 0 30
      Sources/ModerationCenter.php
  2. 9 4
      Sources/ReportedPosts.php
  3. 32 2
      Sources/Subs-ReportedPosts.php

+ 0 - 30
Sources/ModerationCenter.php

@@ -716,36 +716,6 @@ function ModerateGroups()
 	$subactions[$context['sub_action']]();
 }
 
-/**
- * How many open reports do we have?
- */
-function recountOpenReports()
-{
-	global $user_info, $context, $smcFunc;
-
-	$request = $smcFunc['db_query']('', '
-		SELECT COUNT(*)
-		FROM {db_prefix}log_reported
-		WHERE ' . $user_info['mod_cache']['bq'] . '
-			AND closed = {int:not_closed}
-			AND ignore_all = {int:not_ignored}',
-		array(
-			'not_closed' => 0,
-			'not_ignored' => 0,
-		)
-	);
-	list ($open_reports) = $smcFunc['db_fetch_row']($request);
-	$smcFunc['db_free_result']($request);
-
-	$_SESSION['rc'] = array(
-		'id' => $user_info['id'],
-		'time' => time(),
-		'reports' => $open_reports,
-	);
-
-	$context['open_mod_reports'] = $open_reports;
-}
-
 /**
  * Show a notice sent to a user.
  */

+ 9 - 4
Sources/ReportedPosts.php

@@ -34,6 +34,9 @@ function 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'],
@@ -50,8 +53,7 @@ function ReportedPosts()
 		isAllowedTo('moderate_forum');
 
 	$sub_actions = array(
-		'open' => 'OpenReports',
-		'closed' => 'ClosedReports',
+		'show' => 'ShowReports',
 		'handle' => 'HandleReport', // Deals with closing/opening reports.
 		'disregard' => 'DisregardReport',
 		'details' => 'ReportDetails', // Shows a single report and its comments.
@@ -75,16 +77,19 @@ function ReportedPosts()
 }
 
 /**
- * Shows all open reported posts.
+ * Shows all open or closed reported posts.
  * It requires the moderate_forum permission.
  *
  * @uses ModerationCenter template.
  * @uses ModerationCenter language file.
  *
  */
-function OpenReports
+function ShowReports
 {
+	// Showing closed ones?
+	if (isset($_GET['closed']))
 
+	getReports();
 }
 
 function ReportDetails

+ 32 - 2
Sources/Subs-ReportedPosts.php

@@ -99,7 +99,7 @@ function countReports($closed = 0)
 
 function getReports($closed = 0)
 {
-	global $smcFunc, $context, $scripturl;
+	global $smcFunc, $context, $user_info, $scripturl;
 
 	// Lonely, standalone var.
 	$reports = array();
@@ -116,7 +116,7 @@ function getReports($closed = 0)
 		ORDER BY lr.time_updated DESC
 		LIMIT ' . $context['start'] . ', 10',
 		array(
-			'view_closed' => $context['view_closed'],
+			'view_closed' => $closed,
 		)
 	);
 
@@ -212,4 +212,34 @@ function getReports($closed = 0)
 	$context['report_manage_bans'] = allowedTo('manage_bans');
 
 }
+
+/**
+ * How many open reports do we have?
+ */
+function recountOpenReports()
+{
+	global $user_info, $context, $smcFunc;
+
+	$request = $smcFunc['db_query']('', '
+		SELECT COUNT(*)
+		FROM {db_prefix}log_reported
+		WHERE ' . $user_info['mod_cache']['bq'] . '
+			AND closed = {int:not_closed}
+			AND ignore_all = {int:not_ignored}',
+		array(
+			'not_closed' => 0,
+			'not_ignored' => 0,
+		)
+	);
+	list ($open_reports) = $smcFunc['db_fetch_row']($request);
+	$smcFunc['db_free_result']($request);
+
+	$_SESSION['rc'] = array(
+		'id' => $user_info['id'],
+		'time' => time(),
+		'reports' => $open_reports,
+	);
+
+	$context['open_mod_reports'] = $open_reports;
+}
 ?>