Pārlūkot izejas kodu

Moving queries to th Subs file

Signed-off-by: Suki <[email protected]>
Suki 11 gadi atpakaļ
vecāks
revīzija
9248e0aa14
2 mainītis faili ar 25 papildinājumiem un 18 dzēšanām
  1. 0 17
      Sources/ModerationCenter.php
  2. 25 1
      Sources/Subs-ReportedPosts.php

+ 0 - 17
Sources/ModerationCenter.php

@@ -681,23 +681,6 @@ function ReportedPosts()
 		$context['report_post_action'] = 'close_all';
 	}
 
-	// How many entries are we viewing?
-	$request = $smcFunc['db_query']('', '
-		SELECT COUNT(*)
-		FROM {db_prefix}log_reported AS lr
-		WHERE lr.closed = {int:view_closed}
-			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']),
-		array(
-			'view_closed' => $context['view_closed'],
-		)
-	);
-	list ($context['total_reports']) = $smcFunc['db_fetch_row']($request);
-	$smcFunc['db_free_result']($request);
-
-	// So, that means we can page index, yes?
-	$context['page_index'] = constructPageIndex($scripturl . '?action=moderate;area=reports' . ($context['view_closed'] ? ';sa=closed' : ''), $_GET['start'], $context['total_reports'], 10);
-	$context['start'] = $_GET['start'];
-
 	// By George, that means we in a position to get the reports, golly good.
 	$request = $smcFunc['db_query']('', '
 		SELECT lr.id_report, lr.id_msg, lr.id_topic, lr.id_board, lr.id_member, lr.subject, lr.body,

+ 25 - 1
Sources/Subs-ReportedPosts.php

@@ -23,7 +23,7 @@ if (!defined('SMF'))
  * @param integer $value The new value to update.
  * @params integer $report_id The affected report.
  */
-function UpdateReport($action, $value, $report_id)
+function updateReport($action, $value, $report_id)
 {
 	global $smcFunc, $user_info, $context;
 
@@ -73,4 +73,28 @@ function UpdateReport($action, $value, $report_id)
 	updateSettings(array('last_mod_report_action' => time()));
 	recountOpenReports();
 }
+
+function countReports($closed = 0)
+{
+	global $smcFunc, $context, $user_info;
+
+	$context['start'] = $_GET['start'];
+
+	// How many entries are we viewing?
+	$request = $smcFunc['db_query']('', '
+		SELECT COUNT(*)
+		FROM {db_prefix}log_reported AS lr
+		WHERE lr.closed = {int:view_closed}
+			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']),
+		array(
+			'view_closed' => $closed,
+		)
+	);
+	list ($context['total_reports']) = $smcFunc['db_fetch_row']($request);
+	$smcFunc['db_free_result']($request);
+
+	// So, that means we can page index, yes?
+	$context['page_index'] = constructPageIndex($scripturl . '?action=moderate;area=reports' . ($closed ? ';sa=closed' : ''), $context['start'], $context['total_reports'], 10);
+}
+
 ?>