Jelajahi Sumber

Even more tweaks and bugfixes

Signed-off-by: Michael Eshom <[email protected]>
Michael Eshom 10 tahun lalu
induk
melakukan
0db40c82eb

+ 12 - 10
Sources/ModerationCenter.php

@@ -271,7 +271,7 @@ function ModerationHome()
 		if (!$context['can_moderate_boards'])
 			$valid_blocks['w'] = 'WatchedUsers';
 
-		$valid_blocks['ru'] = 'ReportedUsers';
+		$valid_blocks['rm'] = 'ReportedMembers';
 	}
 
 	call_integration_hook('integrate_mod_centre_blocks', array(&$valid_blocks));
@@ -580,12 +580,12 @@ function ModBlockReportedMembers()
 	global $context, $user_info, $scripturl, $smcFunc;
 
 	// Got the info already?
-	$cache_key = md5(serialize((int) allowedTo('moderate_forum')));
+	$cachekey = md5(serialize((int) allowedTo('moderate_forum')));
 	$context['reported_users'] = array();
 	if (!allowedTo('moderate_forum'))
 		return 'reported_users_block';
 
-	if (($reported_posts = cache_get_data('reported_users_' . $cache_key, 90)) === null)
+	if (($reported_posts = cache_get_data('reported_users_' . $cachekey, 90)) === null)
 	{
 		// By George, that means we in a position to get the reports, jolly good.
 		$request = $smcFunc['db_query']('', '
@@ -1654,23 +1654,25 @@ function MemberReport()
 	require_once($sourcedir . '/Subs-List.php');
 	loadLanguage('Modlog');
 
-	// Serilaize the member id so we can find the member later
-	$member = serialize(array('member' => (string)$context['report']['user']['id']));
+	// Find their ID in the serialized action string...
+	$user_id_length = strlen((string)$context['report']['user']['id']);
+	$member = 's:6:"member";s:' . $user_id_length . ':"' . $context['report']['user']['id'] . '";}';
 
 	// This is all the information from the moderation log.
+	// Note that we use "raw" here to prevent SMF from escaping things we don't want escaped
 	$listOptions = array(
-		'id' => 'user_moderation_actions_list',
+		'id' => 'memreport_actions_list',
 		'title' => $txt['mc_modreport_modactions'],
 		'items_per_page' => 15,
 		'no_items_label' => $txt['modlog_no_entries_found'],
-		'base_href' => $scripturl . '?action=moderate;area=reports;report=' . $context['report']['id'],
+		'base_href' => $scripturl . '?action=moderate;area=memberreports;report=' . $context['report']['id'],
 		'default_sort_col' => 'time',
 		'get_items' => array(
 			'function' => 'list_getModLogEntries',
 			'params' => array(
-				'lm.extra LIKE {string:member}
-					AND lm.action LIKE {string:report}',
-				array('member' => '%' . $member . '%', 'report' => '%_user_report'),
+				'lm.extra LIKE {raw:member}
+					AND lm.action LIKE {raw:report}',
+				array('member' => '\'%' . $member . '\'', 'report' => '\'%_user_report\''),
 				1,
 				true,
 			),

+ 7 - 1
Sources/Modlog.php

@@ -619,7 +619,13 @@ function list_getModLogEntries($start, $items_per_page, $sort, $query_string = '
 				$entries[$k]['extra'][$type] = sprintf($txt['modlog_id'], $entry['extra'][$type]);
 
 		if (isset($entry['extra']['report']))
-			$entries[$k]['extra']['report'] = '<a href="' . $scripturl . '?action=moderate;area=reports;report=' . $entry['extra']['report'] . '">' . $txt['modlog_report'] . '</a>';
+		{
+			// Member profile reports go in a different area
+			if (stristr($entry['action'], 'user_report'))
+				$entries[$k]['extra']['report'] = '<a href="' . $scripturl . '?action=moderate;area=memberreports;report=' . $entry['extra']['report'] . '">' . $txt['modlog_report'] . '</a>';
+			else
+				$entries[$k]['extra']['report'] = '<a href="' . $scripturl . '?action=moderate;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'];

+ 1 - 1
Sources/Subs.php

@@ -3978,7 +3978,7 @@ function setupMenuContext()
 	if (allowedTo('moderate_forum') && !empty($context['open_member_reports']))
 	{
 		$total_mod_reports += $context['open_member_reports'];
-		$context['menu_buttons']['moderate']['sub_buttons']['members']['title'] .= ' <span class="amt">' . $context['open_member_reports'] . '</span>';
+		$context['menu_buttons']['moderate']['sub_buttons']['reported_members']['title'] .= ' <span class="amt">' . $context['open_member_reports'] . '</span>';
 	}
 
 	if (!empty($context['unapproved_members']))

+ 2 - 2
Sources/tasks/MemberReport-Notify.php

@@ -40,7 +40,7 @@ class MemberReport_Notify_Background extends SMF_BackgroundTask
 		foreach ($prefs as $member => $pref_option)
 		{
 			foreach ($alert_bits as $type => $bitvalue)
-				if ($pref_option['msg_report'] & $bitvalue)
+				if ($pref_option['member_report'] & $bitvalue)
 					$notifies[$type][] = $member;
 		}
 
@@ -62,7 +62,7 @@ class MemberReport_Notify_Background extends SMF_BackgroundTask
 					'is_read' => 0,
 					'extra' => serialize(
 						array(
-							'report_link' => '?action=moderate;area=userreports;report=' . $this->_details['report_id'], // We don't put $scripturl in these!
+							'report_link' => '?action=moderate;area=memberreports;report=' . $this->_details['report_id'], // We don't put $scripturl in these!
 							'user_name' => $this->_details['membername'],
 						)
 					),

+ 2 - 2
Sources/tasks/MemberReportReply-Notify.php

@@ -66,7 +66,7 @@ class MemberReportReply_Notify_Background extends SMF_BackgroundTask
 		{
 			foreach ($alert_bits as $type => $bitvalue)
 			{
-				if ($pref_option['msg_report_reply'] & $bitvalue)
+				if ($pref_option['member_report_reply'] & $bitvalue)
 					$notifies[$type][] = $member;
 			}
 		}
@@ -89,7 +89,7 @@ class MemberReportReply_Notify_Background extends SMF_BackgroundTask
 					'is_read' => 0,
 					'extra' => serialize(
 						array(
-							'report_link' => '?action=moderate;area=userreports;report=' . $this->_details['report_id'], // We don't put $scripturl in these!
+							'report_link' => '?action=moderate;area=memberreports;report=' . $this->_details['report_id'], // We don't put $scripturl in these!
 							'user_name' => $this->_details['user_name'],
 						)
 					),

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

@@ -636,7 +636,7 @@ function template_viewmemberreport()
 
 	$alt = false;
 
-	template_show_list('moderation_actions_list');
+	template_show_list('memreport_actions_list');
 
 	echo '
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -1014,6 +1014,13 @@ function template_reported_members()
 				', !$context['view_closed'] ? '<input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button_submit">' : '', '
 			</div>
 		</div>
+		<br>';
+		
+	$alt = false;
+
+	template_show_list('memreport_actions_list');
+
+	echo '
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
 	</form>';
 }

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

@@ -101,6 +101,12 @@ $txt['modlog_ac_ignore_report'] = 'Disregarded {report} on &quot;{message}&quot;
 $txt['modlog_ac_open_report'] = 'Reopened {report} on &quot;{message}&quot;';
 $txt['modlog_ac_unignore_report'] = 'Undone disregard of {report} on &quot;{message}&quot;';
 
+// Handling reports on users
+$txt['modlog_ac_close_user_report'] = 'Closed {report} on profile of {member}';
+$txt['modlog_ac_ignore_user_report'] = 'Disregarded {report} on profile of {member}';
+$txt['modlog_ac_open_user_report'] = 'Reopened {report} on profile of {member}';
+$txt['modlog_ac_unignore_user_report'] = 'Undone disregard of {report} on profile of {member}';
+
 // Poll stuff
 $txt['modlog_add_poll'] = 'Added a poll to &quot;{topic}&quot;';
 $txt['modlog_edit_poll'] = 'Edited the poll in &quot;{topic}&quot;';