Ver código fonte

! Fix a bunch of bugs found while testing

Signed-off-by: Michael Eshom <[email protected]>
Michael Eshom 10 anos atrás
pai
commit
0ed10792da

+ 15 - 15
Sources/ModerationCenter.php

@@ -169,9 +169,9 @@ function ModerationMain($dont_call = false)
 					),
 				),
 				'memberreports' => array(
-					'label' => $txt['mc_reported_users_title'],
+					'label' => $txt['mc_reported_members_title'],
 					'enabled' => $context['can_moderate_users'],
-					'function' => 'ViewMemberReports',
+					'function' => 'ReportedMembers',
 					'icon' => 'members_watched.png',
 					'subsections' => array(
 						'open' => array($txt['mc_reportedp_active']),
@@ -575,12 +575,12 @@ function ModBlockGroupRequests()
 /**
  * Show a list of the most recent reported posts.
  */
-function ModBlockReportedUsers()
+function ModBlockReportedMembers()
 {
 	global $context, $user_info, $scripturl, $smcFunc;
 
 	// Got the info already?
-	$cachekey = md5(serialize((int) allowedTo('moderate_forum')));
+	$cache_key = md5(serialize((int) allowedTo('moderate_forum')));
 	$context['reported_users'] = array();
 	if (!allowedTo('moderate_forum'))
 		return 'reported_users_block';
@@ -907,20 +907,20 @@ function ReportedPosts()
 /**
  * Browse all the reported users...
  */
-function ReportedUsers()
+function ReportedMembers()
 {
 	global $txt, $context, $scripturl, $user_info, $smcFunc;
 
 	loadTemplate('ModerationCenter');
 
 	// Set an empty var for the server response.
-	$context['report_user_action'] = '';
+	$context['report_member_action'] = '';
 
 	// Put the open and closed options into tabs, because we can...
 	$context[$context['moderation_menu_name']]['tab_data'] = array(
-		'title' => $txt['mc_reported_users'],
+		'title' => $txt['mc_reported_members'],
 		'help' => '',
-		'description' => $txt['mc_reported_users_desc'],
+		'description' => $txt['mc_reported_members_desc'],
 	);
 
 	isAllowedTo('moderate_forum');
@@ -973,14 +973,14 @@ function ReportedUsers()
 		$extra['member'] = (string)$extra['member'];
 
 		// Tell the user about it.
-		$context['report_post_action'] = isset($_GET['ignore']) ? (!empty($_GET['ignore']) ? 'ignore' : 'unignore') : (!empty($_GET['close']) ? 'close' : 'open');
+		$context['report_member_action'] = isset($_GET['ignore']) ? (!empty($_GET['ignore']) ? 'ignore' : 'unignore') : (!empty($_GET['close']) ? 'close' : 'open');
 
 		// Log this action
-		logAction($context['report_user_action'] . '_user_report', $extra);
+		logAction($context['report_member_action'] . '_user_report', $extra);
 
 		// Time to update.
 		updateSettings(array('last_mod_report_action' => time()));
-		recountOpenUserReports();
+		recountOpenMemberReports();
 	}
 	elseif (isset($_POST['close']) && isset($_POST['close_selected']))
 	{
@@ -1029,11 +1029,11 @@ function ReportedUsers()
 
 			// Time to update.
 			updateSettings(array('last_mod_report_action' => time()));
-			recountOpenReports();
+			recountOpenMemberReports();
 		}
 
 		// Go on and tell the result.
-		$context['report_post_action'] = 'close_all';
+		$context['report_member_action'] = 'close_all';
 	}
 
 	// How many entries are we viewing?
@@ -1071,11 +1071,9 @@ function ReportedUsers()
 	);
 	$context['reports'] = array();
 	$report_ids = array();
-	$report_boards_ids = array();
 	for ($i = 0; $row = $smcFunc['db_fetch_assoc']($request); $i++)
 	{
 		$report_ids[] = $row['id_report'];
-		$report_boards_ids[] = $row['id_board'];
 		$context['reports'][$row['id_report']] = array(
 			'id' => $row['id_report'],
 			'alternate' => $i % 2,
@@ -1125,6 +1123,8 @@ function ReportedUsers()
 		}
 		$smcFunc['db_free_result']($request);
 	}
+
+	$context['report_manage_bans'] = allowedTo('manage_bans');
 }
 
 /**

+ 2 - 2
Sources/Profile-Modify.php

@@ -1961,8 +1961,8 @@ function alert_configuration($memID)
 		'moderation' => array(
 			'msg_report' => array('alert' => 'yes', 'email' => 'yes', 'permission' => array('name' => 'moderate_board', 'is_board' => true)),
 			'msg_report_reply' => array('alert' => 'yes', 'email' => 'yes', 'permission' => array('name' => 'moderate_board', 'is_board' => true)),
-			'profile_report' => array('alert' => 'yes', 'email' => 'yes', 'permission' => array('name' => 'moderate_forum', 'is_board' => false)),
-			'profile_report_reply' => array('alert' => 'yes', 'email' => 'yes', 'permission' => array('name' => 'moderate_forum', 'is_board' => false)),
+			'member_report' => array('alert' => 'yes', 'email' => 'yes', 'permission' => array('name' => 'moderate_forum', 'is_board' => false)),
+			'member_report_reply' => array('alert' => 'yes', 'email' => 'yes', 'permission' => array('name' => 'moderate_forum', 'is_board' => false)),
 		),
 		'members' => array(
 			'member_register' => array('alert' => 'yes', 'email' => 'yes', 'permission' => array('name' => 'moderate_forum', 'is_board' => false)),

+ 1 - 1
Sources/Profile.php

@@ -328,7 +328,7 @@ function ModifyProfile($post_errors = array())
 				),
 				'report' => array(
 					'label' => $txt['report_profile'],
-					'custom_url' => $scripturl . '?action=reporttm;u=' . $context['user']['id'] . ';' . $context['session_var'] . '=' . $context['session_id'],
+					'custom_url' => $scripturl . '?action=reporttm;' . $context['session_var'] . '=' . $context['session_id'],
 					'icon' => 'warning.png',
 					'permission' => array(
 						'own' => array(),

+ 1 - 1
Sources/ReportToMod.php

@@ -36,7 +36,7 @@ function ReportToModerator()
 	// If we don't have the ID of something to report, we'll die with a no_access error below
 	if (isset($_REQUEST['msg']))
 		isAllowedTo('report_msg');
-	elseif (isset($_REQEUST['u']))
+	elseif (isset($_REQUEST['u']))
 		isAllowedTo('report_user');
 
 	// If they're posting, it should be processed by ReportToModerator2.

+ 11 - 0
Sources/Security.php

@@ -498,6 +498,17 @@ function banPermissions()
 	}
 	else
 		$context['open_mod_reports'] = 0;
+
+	if (isset($_SESSION['rmc']) && $_SESSION['rmc']['time'] > $modSettings['last_mod_report_action'] && $_SESSION['rmc']['id'] == $user_info['id'])
+		$contexct['open_member_reports'] = $_SESSION['rmc']['reports'];
+	elseif (allowedTo('moderate_forum'))
+	{
+		require_once($sourcedir . '/ModerationCenter.php');
+		recountOpenMemberReports();
+	}
+	else
+		$context['open_member_reports'] = 0;
+
 }
 
 /**

+ 4 - 1
Sources/Subs.php

@@ -3972,7 +3972,10 @@ function setupMenuContext()
 		$context['menu_buttons']['moderate']['sub_buttons']['reports']['title'] .= ' <span class="amt">' . $context['open_mod_reports'] . '</span>';
 	}
 
-	if (allowedTo('moderate_forum') && $context['open_member_reports'] > 0)
+	/**
+	 * @todo For some reason, $context['open_member_reports'] isn't getting set
+	 */
+	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>';

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

@@ -28,7 +28,7 @@ class MemberReport_Notify_Background extends SMF_BackgroundTask
 
 		// Having successfully figured this out, now let's get the preferences of everyone.
 		require_once($sourcedir . '/Subs-Notify.php');
-		$prefs = getNotifyPrefs($members, 'msg_report', true);
+		$prefs = getNotifyPrefs($members, 'member_report', true);
 
 		// So now we find out who wants what.
 		$alert_bits = array(

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

@@ -53,7 +53,7 @@ class MemberReportReply_Notify_Background extends SMF_BackgroundTask
 
 		// Having successfully figured this out, now let's get the preferences of everyone.
 		require_once($sourcedir . '/Subs-Notify.php');
-		$prefs = getNotifyPrefs($members, 'user_report_reply', true);
+		$prefs = getNotifyPrefs($members, 'member_report_reply', true);
 
 		// So now we find out who wants what.
 		$alert_bits = array(

+ 92 - 2
Themes/default/ModerationCenter.template.php

@@ -576,7 +576,7 @@ function template_viewmemberreport()
 			<div class="title_bar">
 				<h3 class="titlebg">
 					<span class="floatleft">
-						', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
+						', sprintf($txt['mc_memberreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
 					</span>
 					<span class="floatright">';
 
@@ -593,7 +593,7 @@ function template_viewmemberreport()
 			</div>
 			<br>
 			<div class="cat_bar">
-				<h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
+				<h3 class="catbg">', $txt['mc_memberreport_whoreported_title'], '</h3>
 			</div>';
 
 	foreach ($context['report']['comments'] as $comment)
@@ -930,4 +930,94 @@ function template_reported_members_block()
 	// ]]></script>';
 }
 
+function template_reported_members()
+{
+	global $context, $txt, $scripturl;
+
+	// Let them know the action was a success.
+	if (!empty($context['report_post_action']) && !empty($txt['report_action_'. $context['report_post_action']]))
+	{
+		echo '
+			<div class="infobox">
+				', $txt['report_action_'. $context['report_post_action']], '
+			</div>';
+	}
+
+	echo '
+	<form id="reported_posts" action="', $scripturl, '?action=moderate;area=memberreports', $context['view_closed'] ? ';sa=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'], '
+			</h3>
+		</div>
+		<div class="pagesection">
+			<div class="pagelinks">', $context['page_index'], '</div>
+		</div>';
+
+	// Make the buttons.
+	$close_button = create_button('close.png', $context['view_closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['view_closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', 'class="centericon"');
+	$details_button = create_button('details.png', 'mc_reportedp_details', 'mc_reportedp_details', 'class="centericon"');
+	$ignore_button = create_button('ignore.png', 'mc_reportedp_ignore', 'mc_reportedp_ignore', 'class="centericon"');
+	$unignore_button = create_button('ignore.png', 'mc_reportedp_unignore', 'mc_reportedp_unignore', 'class="centericon"');
+	$ban_button = create_button('close.png', 'mc_reportedp_ban', 'mc_reportedp_ban', 'class="centericon"');
+
+	foreach ($context['reports'] as $report)
+	{
+		echo '
+		<div class="generic_list_wrapper ', $report['alternate'] ? 'windowbg' : 'windowbg2', '">
+			<div class="content">
+				<h5>
+					<strong><a href="', $report['user']['href'], '">', $report['user']['name'], '</a></strong>
+				</h5>
+				<div class="smalltext">
+					', $txt['mc_reportedp_last_reported'], ': ', $report['last_updated'], '&nbsp;-&nbsp;';
+
+		// Prepare the comments...
+		$comments = array();
+		foreach ($report['comments'] as $comment)
+			$comments[$comment['member']['id']] = $comment['member']['link'];
+
+		echo '
+					', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
+				</div>
+				<hr>
+				', $report['body'], '
+				<br>
+				<ul class="quickbuttons">
+					<li><a href="', $report['report_href'], '">', $details_button, '</a></li>
+					<li><a href="', $scripturl, '?action=moderate;area=memberreports', $context['view_closed'] ? ';sa=closed' : '', ';ignore=', (int) !$report['ignore'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" ', !$report['ignore'] ? 'onclick="return confirm(\'' . $txt['mc_reportedp_ignore_confirm'] . '\');"' : '', '>', $report['ignore'] ? $unignore_button : $ignore_button, '</a></li>
+					<li><a href="', $scripturl, '?action=moderate;area=memberreports', $context['view_closed'] ? ';sa=closed' : '', ';close=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '">', $close_button, '</a></li>';
+
+		// Ban this user button.
+		if (!$report['closed'] && !empty($context['report_manage_bans']) && !empty($report['user']['id']))
+			echo '
+					<li><a href="', $scripturl, '?action=admin;area=ban;sa=add;u=', $report['user']['id'] ,';', $context['session_var'], '=', $context['session_id'], '">', $ban_button, '</a></li>';
+
+		echo '
+					<li>', !$context['view_closed'] ? '<input type="checkbox" name="close[]" value="' . $report['id'] . '" class="input_check">' : '', '</li>
+				</ul>
+			</div>
+		</div>';
+	}
+
+	// Were none found?
+	if (empty($context['reports']))
+		echo '
+		<div class="windowbg2">
+			<div class="content">
+				<p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
+			</div>
+		</div>';
+
+	echo '
+		<div class="pagesection">
+			<div class="pagelinks floatleft">', $context['page_index'], '</div>
+			<div class="floatright">
+				', !$context['view_closed'] ? '<input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button_submit">' : '', '
+			</div>
+		</div>
+		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
+	</form>';
+}
+
 ?>

+ 4 - 2
Themes/default/languages/ModerationCenter.english.php

@@ -88,6 +88,8 @@ $txt['mc_modreport_no_mod_comment'] = 'There are not currently any moderator com
 $txt['mc_modreport_add_mod_comment'] = 'Add Comment';
 
 $txt['mc_viewmemberreport'] = 'Report for profile of %1$s';
+$txt['mc_memberreport_summary'] = 'There have been %1$d report(s) concerning this member.  The last report was %2$s.';
+$txt['mc_memberreport_whoreported_title'] = 'Members who have reported this member.';
 
 $txt['show_notice'] = 'Notice Text';
 $txt['show_notice_subject'] = 'Subject';
@@ -152,6 +154,6 @@ $txt['mc_add_note'] = 'Add';
 
 // Do not use numeric entries in the below string.
 $txt['mc_reportedm_ignore_confirm'] = 'Are you sure you wish to ignore further reports about this user\'s profile?\\n\\nThis will turn off further reports for everyone.';
-$txt['mc_reported_members'] = 'Reported Member Profiles';
-
+$txt['mc_reported_members_title'] = 'Reported Members';
+$txt['mc_reported_members_desc'] = 'Allows you to view a list of all users whose profiles have been reported';
 ?>

+ 1 - 1
Themes/default/languages/Profile.english.php

@@ -152,7 +152,7 @@ $txt['alert_group_calendar'] = 'Calendar';
 $txt['alert_event_new'] = 'When a new event goes into the calendar';
 $txt['alert_request_group'] = 'When someone requests to join a group I moderate';
 $txt['alert_member_report'] = 'When another member\'s profile is reported';
-$txt['alert_member_report_reply'] 'When a member report I\'ve replied to gets replied to';
+$txt['alert_member_report_reply'] = 'When a member report I\'ve replied to gets replied to';
 
 
 $txt['notifications_topics'] = 'Current Topic Notifications';

+ 1 - 0
Themes/default/languages/index.english.php

@@ -764,6 +764,7 @@ $txt['edit_permissions'] = 'Permissions';
 $txt['mc_unapproved_attachments'] = 'Unapproved Attachments';
 $txt['mc_unapproved_poststopics'] = 'Unapproved Posts and Topics';
 $txt['mc_reported_posts'] = 'Reported Posts';
+$txt['mc_reported_members'] = 'Reported Members';
 $txt['modlog_view'] = 'Moderation Log';
 $txt['calendar_menu'] = 'View Calendar';
 

+ 1 - 1
index.php

@@ -328,7 +328,7 @@ function smf_main()
 		'reminder' => array('Reminder.php', 'RemindMe'),
 		'removepoll' => array('Poll.php', 'RemovePoll'),
 		'removetopic2' => array('RemoveTopic.php', 'RemoveTopic2'),
-		'reporttm' => array('SendTopic.php', 'ReportToModerator'),
+		'reporttm' => array('ReportToMod.php', 'ReportToModerator'),
 		'requestmembers' => array('Subs-Auth.php', 'RequestMembers'),
 		'restoretopic' => array('RemoveTopic.php', 'RestoreTopic'),
 		'search' => array('Search.php', 'PlushSearch1'),