Browse Source

Merge branch 'release-2.1' of git://github.com/SimpleMachines/SMF2.1.git into cust_fields

Conflicts:
	other/upgrade_2-1_mysql.sql
	other/upgrade_2-1_postgresql.sql
	other/upgrade_2-1_sqlite.sql

Signed-off-by: Suki <[email protected]>
Suki 10 years ago
parent
commit
8e3797de83

+ 1 - 0
Sources/Admin.php

@@ -322,6 +322,7 @@ function AdminMain()
 					'function' => 'ModifyWarningSettings',
 					'icon' => 'warning.png',
 					'inactive' => $modSettings['warning_settings'][0] == 0,
+					'permission' => array('admin_forum'),
 				),
 				'ban' => array(
 					'label' => $txt['ban_title'],

+ 5 - 1
Sources/Display.php

@@ -1080,6 +1080,7 @@ function Display()
 		'can_remove_poll' => 'poll_remove',
 		'can_reply' => 'post_reply',
 		'can_reply_unapproved' => 'post_unapproved_replies',
+		'can_view_warning' => 'profile_warning',
 	);
 	foreach ($anyown_permissions as $contextual => $perm)
 		$context[$contextual] = allowedTo($perm . '_any') || ($context['user']['started'] && allowedTo($perm . '_own'));
@@ -1302,9 +1303,12 @@ function prepareDisplayContext($reset = false)
 	}
 	else
 	{
+		// Define this here to make things a bit more readable
+		$can_view_warning = $context['user']['can_mod'] || allowedTo('view_warning_any') || ($message['id_member'] == $user_info['id'] && allowedTo('view_warning_own'));
+		
 		$memberContext[$message['id_member']]['can_view_profile'] = allowedTo('profile_view') || ($message['id_member'] == $user_info['id'] && !$user_info['is_guest']);
 		$memberContext[$message['id_member']]['is_topic_starter'] = $message['id_member'] == $context['topic_starter_id'];
-		$memberContext[$message['id_member']]['can_see_warning'] = !isset($context['disabled_fields']['warning_status']) && $memberContext[$message['id_member']]['warning_status'] && ($context['user']['can_mod'] || (!$user_info['is_guest'] && !empty($modSettings['warning_show']) && ($modSettings['warning_show'] > 1 || $message['id_member'] == $user_info['id'])));
+		$memberContext[$message['id_member']]['can_see_warning'] = !isset($context['disabled_fields']['warning_status']) && $memberContext[$message['id_member']]['warning_status'] && $can_view_warning;
 	}
 
 	$memberContext[$message['id_member']]['ip'] = $message['poster_ip'];

+ 1 - 1
Sources/Logging.php

@@ -486,7 +486,7 @@ function logActions($logs)
 			{
 				require_once($sourcedir . '/ModerationCenter.php');
 				updateSettings(array('last_mod_report_action' => time()));
-				recountOpenReports();
+				recountOpenReports('posts');
 			}
 			$smcFunc['db_free_result']($request);
 		}

+ 33 - 3
Sources/ManagePermissions.php

@@ -698,6 +698,7 @@ function ModifyMembergroup()
 
 	loadAllPermissions();
 	loadPermissionProfiles();
+	$context['hidden_perms'] = array();
 
 	if ($context['group']['id'] > 0)
 	{
@@ -800,11 +801,35 @@ function ModifyMembergroup()
 
 					if ($perm['has_own_any'])
 					{
-						$curPerm['any']['select'] = in_array($perm['id'] . '_any', $permissions[$permissionType]['allowed']) ? 'on' : (in_array($perm['id'] . '_any', $permissions[$permissionType]['denied']) ? 'denied' : 'off');
-						$curPerm['own']['select'] = in_array($perm['id'] . '_own', $permissions[$permissionType]['allowed']) ? 'on' : (in_array($perm['id'] . '_own', $permissions[$permissionType]['denied']) ? 'denied' : 'off');
+						$curPerm['any']['select'] = in_array($perm['id'] . '_any', $permissions[$permissionType]['allowed']) ? 'on' : (in_array($perm['id'] . '_any', $permissions[$permissionType]['denied']) ? 'deny' : 'off');
+						$curPerm['own']['select'] = in_array($perm['id'] . '_own', $permissions[$permissionType]['allowed']) ? 'on' : (in_array($perm['id'] . '_own', $permissions[$permissionType]['denied']) ? 'deny' : 'off');
 					}
 					else
-						$curPerm['select'] = in_array($perm['id'], $permissions[$permissionType]['denied']) ? 'denied' : (in_array($perm['id'], $permissions[$permissionType]['allowed']) ? 'on' : 'off');
+						$curPerm['select'] = in_array($perm['id'], $permissions[$permissionType]['denied']) ? 'deny' : (in_array($perm['id'], $permissions[$permissionType]['allowed']) ? 'on' : 'off');
+
+						// Keep the last value if it's hidden.
+						if ($perm['hidden'] || $permissionArray['hidden'])
+						{
+							if ($perm['has_own_any'])
+							{
+								$context['hidden_perms'][] = array(
+									$permissionType,
+									$perm['own']['id'],
+									$curPerm['own']['select'] == 'deny' && !empty($modSettings['permission_enable_deny']) ? 'deny' : $curPerm['own']['select'],
+								);
+								$context['hidden_perms'][] = array(
+									$permissionType,
+									$perm['any']['id'],
+									$curPerm['any']['select'] == 'deny' && !empty($modSettings['permission_enable_deny']) ? 'deny' : $curPerm['any']['select'],
+								);
+							}
+							else
+								$context['hidden_perms'][] = array(
+									$permissionType,
+									$perm['id'],
+									$curPerm['select'] == 'deny' && !empty($modSettings['permission_enable_deny']) ? 'deny' : $curPerm['select'],
+								);
+						}
 				}
 			}
 		}
@@ -1457,6 +1482,7 @@ function loadAllPermissions()
 			'profile_displayed_name' => array(true, 'profile_account'),
 			'profile_password' => array(true, 'profile_account'),
 			'profile_remove' => array(true, 'profile_account'),
+			'view_warning' => array(true, 'profile_account'),
 		),
 		'board' => array(
 			'moderate_board' => array(false, 'general_board'),
@@ -1516,7 +1542,10 @@ function loadAllPermissions()
 		$hiddenPermissions[] = 'calendar_edit';
 	}
 	if ($modSettings['warning_settings'][0] == 0)
+	{
 		$hiddenPermissions[] = 'issue_warning';
+		$hiddenPermissions[] = 'view_warning';
+	}
 	if (empty($modSettings['karmaMode']))
 		$hiddenPermissions[] = 'karma_edit';
 
@@ -2204,6 +2233,7 @@ function loadIllegalGuestPermissions()
 		'profile_signature',
 		'profile_title',
 		'profile_upload_avatar',
+		'profile_warning',
 		'remove',
 		'report_any',
 		'report_user',

+ 1 - 1
Sources/ManageSettings.php

@@ -352,7 +352,7 @@ function ModifyWarningSettings($return_config = false)
 				array('int', 'warning_mute', 'subtext' => $txt['setting_warning_mute_note']),
 				'rem1' => array('int', 'user_limit', 'subtext' => $txt['setting_user_limit_note']),
 				'rem2' => array('int', 'warning_decrement', 'subtext' => $txt['setting_warning_decrement_note']),
-				array('select', 'warning_show', 'subtext' => $txt['setting_warning_show_note'], array($txt['setting_warning_show_mods'], $txt['setting_warning_show_user'], $txt['setting_warning_show_all'])),
+				array('permissions', 'view_warning'),
 		);
 
 	call_integration_hook('integrate_warning_settings', array(&$config_vars));

+ 12 - 314
Sources/ModerationCenter.php

@@ -122,11 +122,11 @@ function ModerationMain($dont_call = false)
 					'icon' => 'post_moderation_attach.png',
 					'custom_url' => $scripturl . '?action=moderate;area=attachmod;sa=attachments',
 				),
-				'reports' => array(
+				'reportedposts' => array(
 					'label' => $txt['mc_reported_posts'],
 					'enabled' => $context['can_moderate_boards'],
-					'file' => 'ReportedPosts.php',
-					'function' => 'ReportedPosts',
+					'file' => 'ReportedContent.php',
+					'function' => 'ReportedContent',
 					'icon' => 'reports.png',
 					'subsections' => array(
 						'show' => array($txt['mc_reportedp_active']),
@@ -168,10 +168,11 @@ function ModerationMain($dont_call = false)
 						'post' => array($txt['mc_watched_users_post']),
 					),
 				),
-				'memberreports' => array(
+				'reportedmembers' => array(
 					'label' => $txt['mc_reported_members_title'],
 					'enabled' => $context['can_moderate_users'],
-					'function' => 'ReportedMembers',
+					'file' => 'ReportedContent.php',
+					'function' => 'ReportedContent',
 					'icon' => 'members_watched.png',
 					'subsections' => array(
 						'open' => array($txt['mc_reportedp_active']),
@@ -525,7 +526,7 @@ function ModBlockReportedPosts()
 			'id' => $row['id_report'],
 			'alternate' => $i % 2,
 			'topic_href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'],
-			'report_href' => $scripturl . '?action=moderate;area=reports;report=' . $row['id_report'],
+			'report_href' => $scripturl . '?action=moderate;area=reportedposts;report=' . $row['id_report'],
 			'author' => array(
 				'id' => $row['id_author'],
 				'name' => $row['author_name'],
@@ -639,7 +640,7 @@ function ModBlockReportedMembers()
 		$context['reported_users'][] = array(
 			'id' => $row['id_report'],
 			'alternate' => $i % 2,
-			'report_href' => $scripturl . '?action=moderate;area=memberreports;report=' . $row['id_report'],
+			'report_href' => $scripturl . '?action=moderate;area=reportedmembers;report=' . $row['id_report'],
 			'user' => array(
 				'id' => $row['id_user'],
 				'name' => $row['user_name'],
@@ -730,7 +731,7 @@ function ReportedMembers()
 
 		// Time to update.
 		updateSettings(array('last_mod_report_action' => time()));
-		recountOpenMemberReports();
+		recountOpenReports('members');
 	}
 	elseif (isset($_POST['close']) && isset($_POST['close_selected']))
 	{
@@ -779,7 +780,7 @@ function ReportedMembers()
 
 			// Time to update.
 			updateSettings(array('last_mod_report_action' => time()));
-			recountOpenMemberReports();
+			recountOpenReports('members');
 		}
 
 		// Go on and tell the result.
@@ -801,7 +802,7 @@ function ReportedMembers()
 	$smcFunc['db_free_result']($request);
 
 	// So, that means we can page index, yes?
-	$context['page_index'] = constructPageIndex($scripturl . '?action=moderate;area=memberreports' . ($context['view_closed'] ? ';sa=closed' : ''), $_GET['start'], $context['total_reports'], 10);
+	$context['page_index'] = constructPageIndex($scripturl . '?action=moderate;area=reportedmembers' . ($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.
@@ -827,7 +828,7 @@ function ReportedMembers()
 		$context['reports'][$row['id_report']] = array(
 			'id' => $row['id_report'],
 			'alternate' => $i % 2,
-			'report_href' => $scripturl . '?action=moderate;area=memberreports;report=' . $row['id_report'],
+			'report_href' => $scripturl . '?action=moderate;area=reportedmembers;report=' . $row['id_report'],
 			'user' => array(
 				'id' => $row['id_user'],
 				'name' => $row['user_name'],
@@ -906,309 +907,6 @@ function ModerateGroups()
 	$subactions[$context['sub_action']]();
 }
 
-/**
- * How many open reports do we have?
- */
-function recountOpenMemberReports()
-{
-	global $user_info, $context, $smcFunc;
-
-	$request = $smcFunc['db_query']('', '
-		SELECT COUNT(*)
-		FROM {db_prefix}log_reported
-		WHERE closed = {int:not_closed}
-			AND ignore_all = {int:not_ignored}
-			AND id_board = {int:not_a_reported_post}',
-		array(
-			'not_closed' => 0,
-			'not_ignored' => 0,
-			'not_a_reported_post' => 0,
-		)
-	);
-	list ($open_reports) = $smcFunc['db_fetch_row']($request);
-	$smcFunc['db_free_result']($request);
-
-	$_SESSION['rmc'] = array(
-		'id' => $user_info['id'],
-		'time' => time(),
-		'reports' => $open_reports,
-	);
-
-	$context['open_member_reports'] = $open_reports;
-}
-
-function MemberReport()
-{
-	global $user_info, $context, $sourcedir, $scripturl, $txt, $smcFunc;
-
-	// Have to at least give us something
-	if (empty($_REQUEST['report']))
-		fatal_lang_error('mc_no_modreport_specified');
-
-	// Integers only please
-	$_REQUEST['report'] = (int) $_REQUEST['report'];
-
-	// Get the report details, need this so we can limit access to a particular board
-	$request = $smcFunc['db_query']('', '
-		SELECT lr.id_report, lr.id_member,
-			lr.time_started, lr.time_updated, lr.num_reports, lr.closed, lr.ignore_all,
-			IFNULL(mem.real_name, lr.membername) AS user_name, IFNULL(mem.id_member, 0) AS id_user
-		FROM {db_prefix}log_reported AS lr
-			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = lr.id_member)
-		WHERE lr.id_report = {int:id_report}
-			AND lr.id_board = {int:not_a_reported_post}
-		LIMIT 1',
-		array(
-			'id_report' => $_REQUEST['report'],
-			'not_a_reported_post' => 0,
-		)
-	);
-
-	// So did we find anything?
-	if (!$smcFunc['db_num_rows']($request))
-		fatal_lang_error('mc_no_modreport_found');
-
-	// Woohoo we found a report and they can see it!  Bad news is we have more work to do
-	$row = $smcFunc['db_fetch_assoc']($request);
-	$smcFunc['db_free_result']($request);
-
-	// If they are adding a comment then... add a comment.
-	if (isset($_POST['add_comment']) && !empty($_POST['mod_comment']))
-	{
-		checkSession();
-
-		$newComment = trim($smcFunc['htmlspecialchars']($_POST['mod_comment']));
-
-		// In it goes.
-		if (!empty($newComment))
-		{
-			$smcFunc['db_insert']('',
-				'{db_prefix}log_comments',
-				array(
-					'id_member' => 'int', 'member_name' => 'string', 'comment_type' => 'string', 'recipient_name' => 'string',
-					'id_notice' => 'int', 'body' => 'string', 'log_time' => 'int',
-				),
-				array(
-					$user_info['id'], $user_info['name'], 'reportc', '',
-					$_REQUEST['report'], $newComment, time(),
-				),
-				array('id_comment')
-			);
-			$last_comment = $smcFunc['db_insert_id']('{db_prefix}log_comments', 'id_comment');
-
-			// And get ready to notify people.
-			$smcFunc['db_insert']('insert',
-				'{db_prefix}background_tasks',
-				array('task_file' => 'string', 'task_class' => 'string', 'task_data' => 'string', 'claimed_time' => 'int'),
-				array('$sourcedir/tasks/MemberReportReply-Notify.php', 'MemberReportReply_Notify_Background', serialize(array(
-					'report_id' => $_REQUEST['report'],
-					'comment_id' => $last_comment,
-					'sender_name' => $user_info['name'],
-					'time' => time(),
-				)), 0),
-				array('id_task')
-			);
-
-			// Redirect to prevent double submittion.
-			redirectexit($scripturl . '?action=moderate;area=memberreports;report=' . $_REQUEST['report']);
-		}
-	}
-
-	$context['report'] = array(
-		'id' => $row['id_report'],
-		'report_href' => $scripturl . '?action=moderate;area=memberreports;report=' . $row['id_report'],
-		'user' => array(
-			'id' => $row['id_user'],
-			'name' => $row['user_name'],
-			'link' => $row['id_user'] ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_user'] . '">' . $row['user_name'] . '</a>' : $row['user_name'],
-			'href' => $scripturl . '?action=profile;u=' . $row['id_user'],
-		),
-		'comments' => array(),
-		'mod_comments' => array(),
-		'time_started' => timeformat($row['time_started']),
-		'last_updated' => timeformat($row['time_updated']),
-		'num_reports' => $row['num_reports'],
-		'closed' => $row['closed'],
-		'ignore' => $row['ignore_all']
-	);
-
-	// So what bad things do the reporters have to say about it?
-	$request = $smcFunc['db_query']('', '
-		SELECT lrc.id_comment, lrc.id_report, lrc.time_sent, lrc.comment, lrc.member_ip,
-			IFNULL(mem.id_member, 0) AS id_member, IFNULL(mem.real_name, lrc.membername) AS reporter
-		FROM {db_prefix}log_reported_comments AS lrc
-			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = lrc.id_member)
-		WHERE lrc.id_report = {int:id_report}',
-		array(
-			'id_report' => $context['report']['id'],
-		)
-	);
-	while ($row = $smcFunc['db_fetch_assoc']($request))
-	{
-		$context['report']['comments'][] = array(
-			'id' => $row['id_comment'],
-			'message' => strtr($row['comment'], array("\n" => '<br>')),
-			'time' => timeformat($row['time_sent']),
-			'member' => array(
-				'id' => $row['id_member'],
-				'name' => empty($row['reporter']) ? $txt['guest'] : $row['reporter'],
-				'link' => $row['id_member'] ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['reporter'] . '</a>' : (empty($row['reporter']) ? $txt['guest'] : $row['reporter']),
-				'href' => $row['id_member'] ? $scripturl . '?action=profile;u=' . $row['id_member'] : '',
-				'ip' => !empty($row['member_ip']) && allowedTo('moderate_forum') ? '<a href="' . $scripturl . '?action=trackip;searchip=' . $row['member_ip'] . '">' . $row['member_ip'] . '</a>' : '',
-			),
-		);
-	}
-	$smcFunc['db_free_result']($request);
-
-	// Hang about old chap, any comments from moderators on this one?
-	$request = $smcFunc['db_query']('', '
-		SELECT lc.id_comment, lc.id_notice, lc.log_time, lc.body,
-			IFNULL(mem.id_member, 0) AS id_member, IFNULL(mem.real_name, lc.member_name) AS moderator
-		FROM {db_prefix}log_comments AS lc
-			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = lc.id_member)
-		WHERE lc.id_notice = {int:id_report}
-			AND lc.comment_type = {literal:reportc}',
-		array(
-			'id_report' => $context['report']['id'],
-		)
-	);
-	while ($row = $smcFunc['db_fetch_assoc']($request))
-	{
-		$context['report']['mod_comments'][] = array(
-			'id' => $row['id_comment'],
-			'message' => parse_bbc($row['body']),
-			'time' => timeformat($row['log_time']),
-			'member' => array(
-				'id' => $row['id_member'],
-				'name' => $row['moderator'],
-				'link' => $row['id_member'] ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['moderator'] . '</a>' : $row['moderator'],
-				'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
-			),
-		);
-	}
-	$smcFunc['db_free_result']($request);
-
-	// What have the other moderators done to this message?
-	require_once($sourcedir . '/Modlog.php');
-	require_once($sourcedir . '/Subs-List.php');
-	loadLanguage('Modlog');
-
-	// 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' => '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=memberreports;report=' . $context['report']['id'],
-		'default_sort_col' => 'time',
-		'get_items' => array(
-			'function' => 'list_getModLogEntries',
-			'params' => array(
-				'lm.extra LIKE {raw:member}
-					AND lm.action LIKE {raw:report}',
-				array('member' => '\'%' . $member . '\'', 'report' => '\'%_user_report\''),
-				1,
-				true,
-			),
-		),
-		'get_count' => array(
-			'function' => 'list_getModLogEntryCount',
-			'params' => array(
-				'lm.extra LIKE {string:member}
-				AND lm.action LIKE {string:report}',
-				array('member' => '%' . $member . '%', 'report' => '%_user_report'),
-				1,
-				true,
-			),
-		),
-		// This assumes we are viewing by user.
-		'columns' => array(
-			'action' => array(
-				'header' => array(
-					'value' => $txt['modlog_action'],
-				),
-				'data' => array(
-					'db' => 'action_text',
-					'class' => 'smalltext',
-				),
-				'sort' => array(
-					'default' => 'lm.action',
-					'reverse' => 'lm.action DESC',
-				),
-			),
-			'time' => array(
-				'header' => array(
-					'value' => $txt['modlog_date'],
-				),
-				'data' => array(
-					'db' => 'time',
-					'class' => 'smalltext',
-				),
-				'sort' => array(
-					'default' => 'lm.log_time',
-					'reverse' => 'lm.log_time DESC',
-				),
-			),
-			'moderator' => array(
-				'header' => array(
-					'value' => $txt['modlog_member'],
-				),
-				'data' => array(
-					'db' => 'moderator_link',
-					'class' => 'smalltext',
-				),
-				'sort' => array(
-					'default' => 'mem.real_name',
-					'reverse' => 'mem.real_name DESC',
-				),
-			),
-			'position' => array(
-				'header' => array(
-					'value' => $txt['modlog_position'],
-				),
-				'data' => array(
-					'db' => 'position',
-					'class' => 'smalltext',
-				),
-				'sort' => array(
-					'default' => 'mg.group_name',
-					'reverse' => 'mg.group_name DESC',
-				),
-			),
-			'ip' => array(
-				'header' => array(
-					'value' => $txt['modlog_ip'],
-				),
-				'data' => array(
-					'db' => 'ip',
-					'class' => 'smalltext',
-				),
-				'sort' => array(
-					'default' => 'lm.ip',
-					'reverse' => 'lm.ip DESC',
-				),
-			),
-		),
-	);
-
-	// Create the watched user list.
-	createList($listOptions);
-
-	// Make sure to get the correct tab selected.
-	if ($context['report']['closed'])
-		$context[$context['moderation_menu_name']]['current_subsection'] = 'closed';
-
-	// Finally we are done :P
-	loadTemplate('ModerationCenter');
-	$context['page_title'] = sprintf($txt['mc_viewmemberreport'], $context['report']['user']['name']);
-	$context['sub_template'] = 'viewmemberreport';
-}
-
 /**
  * Show a notice sent to a user.
  */

+ 2 - 2
Sources/Modlog.php

@@ -622,9 +622,9 @@ function list_getModLogEntries($start, $items_per_page, $sort, $query_string = '
 		{
 			// 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>';
+				$entries[$k]['extra']['report'] = '<a href="' . $scripturl . '?action=moderate;area=reportedmembers;sa=details;rid=' . $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>';
+				$entries[$k]['extra']['report'] = '<a href="' . $scripturl . '?action=moderate;area=reportedposts;sa=details;rid=' . $entry['extra']['report'] . '">' . $txt['modlog_report'] . '</a>';
 		}
 
 		if (empty($entries[$k]['action_text']))

+ 2 - 2
Sources/Profile-View.php

@@ -33,9 +33,9 @@ function summary($memID)
 		'can_send_email' => allowedTo('send_email_to_members'),
 		'can_have_buddy' => allowedTo('profile_identity_own') && !empty($modSettings['enable_buddylist']),
 		'can_issue_warning' => allowedTo('issue_warning') && $modSettings['warning_settings'][0] == 1,
+		'can_view_warning' => (allowedTo('moderate_forum') || allowedTo('issue_warning') || allowedTo('view_warning_any') || ($context['user']['is_owner'] && allowedTo('view_warning_own')) && $modSettings['warning_settings'][0] === 1)
 	);
 	$context['member'] = &$memberContext[$memID];
-	$context['can_view_warning'] = (allowedTo('issue_warning') && !$context['user']['is_owner']) || (!empty($modSettings['warning_show']) && ($modSettings['warning_show'] > 1 || $context['user']['is_owner']));
 
 	// Set a canonical URL for this page.
 	$context['canonical_url'] = $scripturl . '?action=profile;u=' . $memID;
@@ -2729,7 +2729,7 @@ function viewWarning($memID)
 	global $modSettings, $context, $sourcedir, $txt, $scripturl;
 
 	// Firstly, can we actually even be here?
-	if (!allowedTo('issue_warning') && (empty($modSettings['warning_show']) || ($modSettings['warning_show'] == 1 && !$context['user']['is_owner'])))
+	if (!($context['user']['is_owner'] && allowedTo('view_warning_own')) && !allowedTo('view_warning_any') && !allowedTo('issue_warning') && !allowedTo('moderate_forum'))
 		fatal_lang_error('no_access', false);
 
 	// Make sure things which are disabled stay disabled.

+ 3 - 3
Sources/Profile.php

@@ -185,13 +185,13 @@ function ModifyProfile($post_errors = array())
 				),
 				'viewwarning' => array(
 					'label' => $txt['profile_view_warnings'],
-					'enabled' => $modSettings['warning_settings'][0] == 1 && $cur_profile['warning'] && (!empty($modSettings['warning_show']) && ($context['user']['is_owner'] || $modSettings['warning_show'] == 2)),
+					'enabled' => $modSettings['warning_settings'][0] == 1 && $cur_profile['warning'],
 					'file' => 'Profile-View.php',
 					'function' => 'viewWarning',
 					'icon' => 'warning.png',
 					'permission' => array(
-						'own' => 'is_not_guest', // @todo this needs to be a view-own warning
-						'any' => 'issue_warning',
+						'own' => array('profile_warning_own', 'profile_warning_any', 'issue_warning', 'moderate_forum'),
+						'any' => array('profile_warning_any', 'issue_warning', 'moderate_forum'),
 					),
 				),
 			),

+ 3 - 3
Sources/RemoveTopic.php

@@ -144,7 +144,7 @@ function DeleteMessage()
 
 	// We want to redirect back to recent action.
 	if (isset($_REQUEST['modcenter']))
-		redirectexit('action=moderate;area=reports;done');
+		redirectexit('action=moderate;area=reportedposts;done');
 	elseif (isset($_REQUEST['recent']))
 		redirectexit('action=recent');
 	elseif (isset($_REQUEST['profile'], $_REQUEST['start'], $_REQUEST['u']))
@@ -332,7 +332,7 @@ function removeTopics($topics, $decreasePostCount = true, $ignoreRecycling = fal
 			);
 
 			updateSettings(array('last_mod_report_action' => time()));
-			recountOpenReports();
+			recountOpenReports('posts');
 
 			// Topics that were recycled don't need to be deleted, so subtract them.
 			$topics = array_diff($topics, $recycleTopics);
@@ -990,7 +990,7 @@ function removeMessage($message, $decreasePostCount = true)
 	{
 		require_once($sourcedir . '/ModerationCenter.php');
 		updateSettings(array('last_mod_report_action' => time()));
-		recountOpenReports();
+		recountOpenReports('posts');
 	}
 
 	return false;

+ 95 - 46
Sources/ReportedPosts.php → Sources/ReportedContent.php

@@ -1,7 +1,7 @@
 <?php
 
 /**
- * Handles reported posts and moderation comments.
+ * Handles reported members and posts, as well as moderation comments.
  *
  * Simple Machines Forum (SMF)
  *
@@ -24,33 +24,37 @@ if (!defined('SMF'))
  * @uses ModerationCenter language file.
  *
  */
-function ReportedPosts()
+function ReportedContent()
 {
 	global $txt, $context, $scripturl, $user_info, $smcFunc;
 	global $sourcedir;
 
+	// First order of business - what are these reports about?
+	// area=reported{type}
+	$context['report_type'] = substr($_GET['area'], 8);
+
 	loadLanguage('ModerationCenter');
-	loadTemplate('ReportedPosts');
+	loadTemplate('ReportedContent');
 
 	// We need this little rough gem.
-	require_once($sourcedir . '/Subs-ReportedPosts.php');
+	require_once($sourcedir . '/Subs-ReportedContent.php');
 
 	// Do we need to show a confirmation message?
 	$context['report_post_action'] = !empty($_SESSION['rc_confirmation']) ? $_SESSION['rc_confirmation'] : array();
 	unset($_SESSION['rc_confirmation']);
 
 	// Set up the comforting bits...
-	$context['page_title'] = $txt['mc_reported_posts'];
+	$context['page_title'] = $txt['mc_reported_' . $context['report_type']];
 
 	// Put the open and closed options into tabs, because we can...
 	$context[$context['moderation_menu_name']]['tab_data'] = array(
-		'title' => $txt['mc_reported_posts'],
+		'title' => $txt['mc_reported_' . $context['report_type']],
 		'help' => '',
-		'description' => $txt['mc_reported_posts_desc'],
+		'description' => $txt['mc_reported_' . $context['report_type'] . '_desc'],
 	);
 
 	// This comes under the umbrella of moderating posts.
-	if ($user_info['mod_cache']['bq'] == '0=1')
+	if ($context['report_type'] == 'members' || $user_info['mod_cache']['bq'] == '0=1')
 		isAllowedTo('moderate_forum');
 
 	$sub_actions = array(
@@ -63,7 +67,7 @@ function ReportedPosts()
 	);
 
 	// Go ahead and add your own sub-actions.
-	call_integration_hook('integrate_reported_posts', array(&$sub_actions));
+	call_integration_hook('integrate_reported_' . $context['report_type'], array(&$sub_actions));
 
 	// By default we call the open sub-action.
 	if (isset($_REQUEST['sa']) && isset($sub_actions[$_REQUEST['sa']]))
@@ -89,7 +93,7 @@ function ShowReports()
 	$context['view_closed'] = 0;
 
 	// Call the right template.
-	$context['sub_template'] = 'reported_posts';
+	$context['sub_template'] = 'reported_' . $context['report_type'];
 	$context['start'] = (int) isset($_GET['start']) ? $_GET['start'] : 0;
 
 	// Before anything, we need to know just how many reports do we have.
@@ -99,7 +103,7 @@ function ShowReports()
 	$context['reports_how_many'] = 10;
 
 	// So, that means we can have pagination, yes?
-	$context['page_index'] = constructPageIndex($scripturl . '?action=moderate;area=reports;sa=show', $context['start'], $context['total_reports'], $context['reports_how_many']);
+	$context['page_index'] = constructPageIndex($scripturl . '?action=moderate;area=reported' . $context['report_type'] . ';sa=show', $context['start'], $context['total_reports'], $context['reports_how_many']);
 
 	// Get the reports at once!
 	$context['reports'] = getReports($context['view_closed']);
@@ -122,7 +126,7 @@ function ShowReports()
 		$_SESSION['rc_confirmation'] = 'close_all';
 
 		// Force a page refresh.
-		redirectexit($scripturl . '?action=moderate;area=reports');
+		redirectexit($scripturl . '?action=moderate;area=reported' . $context['report_type']);
 	}
 
 	// Show a confirmation if the user wants to disregard a report.
@@ -155,7 +159,7 @@ function ShowClosedReports()
 	$context['view_closed'] = 1;
 
 	// Call the right template.
-	$context['sub_template'] = 'reported_posts';
+	$context['sub_template'] = 'reported_' . $context['report_type'];
 	$context['start'] = (int) isset($_GET['start']) ? $_GET['start'] : 0;
 
 	// Before anything, we need to know just how many reports do we have.
@@ -165,7 +169,7 @@ function ShowClosedReports()
 	$context['reports_how_many'] = 10;
 
 	// So, that means we can have pagination, yes?
-	$context['page_index'] = constructPageIndex($scripturl . '?action=moderate;area=reports;sa=closed', $context['start'], $context['total_reports'], $context['reports_how_many']);
+	$context['page_index'] = constructPageIndex($scripturl . '?action=moderate;area=reported' . $context['report_type'] . ';sa=closed', $context['start'], $context['total_reports'], $context['reports_how_many']);
 
 	// Get the reports at once!
 	$context['reports'] = getReports($context['view_closed']);
@@ -212,32 +216,52 @@ function ReportDetails()
 	if(!$report)
 		fatal_lang_error('mc_no_modreport_found');
 
-	// Build the report data.
+	// Build the report data - basic details first, then extra stuff based on the type
 	$context['report'] = array(
 		'id' => $report['id_report'],
-		'topic_id' => $report['id_topic'],
-		'board_id' => $report['id_board'],
-		'message_id' => $report['id_msg'],
-		'message_href' => $scripturl . '?msg=' . $report['id_msg'],
-		'message_link' => '<a href="' . $scripturl . '?msg=' . $report['id_msg'] . '">' . $report['subject'] . '</a>',
-		'report_href' => $scripturl . '?action=moderate;area=reports;rid=' . $report['id_report'],
-		'author' => array(
-			'id' => $report['id_author'],
-			'name' => $report['author_name'],
-			'link' => $report['id_author'] ? '<a href="' . $scripturl . '?action=profile;u=' . $report['id_author'] . '">' . $report['author_name'] . '</a>' : $report['author_name'],
-			'href' => $scripturl . '?action=profile;u=' . $report['id_author'],
-		),
+		'report_href' => $scripturl . '?action=moderate;area=reported' . $context['report_type'] . ';rid=' . $report['id_report'],
 		'comments' => array(),
 		'mod_comments' => array(),
 		'time_started' => timeformat($report['time_started']),
 		'last_updated' => timeformat($report['time_updated']),
-		'subject' => $report['subject'],
-		'body' => parse_bbc($report['body']),
 		'num_reports' => $report['num_reports'],
 		'closed' => $report['closed'],
 		'ignore' => $report['ignore_all']
 	);
 
+	// Different reports have different "extra" data attached to them
+	if ($context['report_type'] == 'members')
+	{
+		$extraDetails = array(
+			'user' => array(
+				'id' => $report['id_user'],
+				'name' => $report['user_name'],
+				'link' => $report['id_user'] ? '<a href="' . $scripturl . '?action=profile;u=' . $report['id_user'] . '">' . $report['user_name'] . '</a>' : $report['user_name'],
+				'href' => $scripturl . '?action=profile;u=' . $report['id_user'],
+			),
+		);
+	}
+	else
+	{
+		$extraDetails = array(
+			'topic_id' => $report['id_topic'],
+			'board_id' => $report['id_board'],
+			'message_id' => $report['id_msg'],
+			'message_href' => $scripturl . '?msg=' . $report['id_msg'],
+			'message_link' => '<a href="' . $scripturl . '?msg=' . $report['id_msg'] . '">' . $report['subject'] . '</a>',
+			'author' => array(
+				'id' => $report['id_author'],
+				'name' => $report['author_name'],
+				'link' => $report['id_author'] ? '<a href="' . $scripturl . '?action=profile;u=' . $report['id_author'] . '">' . $report['author_name'] . '</a>' : $report['author_name'],
+				'href' => $scripturl . '?action=profile;u=' . $report['id_author'],
+			),
+			'subject' => $report['subject'],
+			'body' => parse_bbc($report['body']),
+		);
+	}
+
+	$context['report'] = array_merge($context['report'], $extraDetails);
+
 	$reportComments = getReportComments($report_id);
 
 	if (!empty($reportComments))
@@ -248,29 +272,46 @@ function ReportDetails()
 	require_once($sourcedir . '/Subs-List.php');
 	loadLanguage('Modlog');
 
+	// Parameters are slightly different depending on what we're doing here...
+	if ($context['report_type'] == 'members')
+	{
+		// 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'] . '";}';
+
+		$params = array(
+			'lm.extra LIKE {raw:member}
+				AND lm.action LIKE {raw:report}',
+			array('member' => '\'%' . $member . '\'', 'report' => '\'%_user_report\''),
+			1,
+			true,
+		);
+	}
+	else
+	{
+		$params = array(
+			'lm.id_topic = {int:id_topic} 
+				AND lm.id_board != {int:not_a_reported_post}',
+			array('id_topic' => $context['report']['topic_id'], 'not_a_reported_post' => 0),
+			1,
+		);
+	}
+
 	// This is all the information from the moderation log.
 	$listOptions = array(
 		'id' => 'moderation_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;sa=details;rid=' . $context['report']['id'],
+		'base_href' => $scripturl . '?action=moderate;area=reported' . $context['report_type'] . ';sa=details;rid=' . $context['report']['id'],
 		'default_sort_col' => 'time',
 		'get_items' => array(
 			'function' => 'list_getModLogEntries',
-			'params' => array(
-				'lm.id_topic = {int:id_topic}',
-				array('id_topic' => $context['report']['topic_id']),
-				1,
-			),
+			'params' => $params,
 		),
 		'get_count' => array(
 			'function' => 'list_getModLogEntryCount',
-			'params' => array(
-				'lm.id_topic = {int:id_topic}',
-				array('id_topic' => $context['report']['topic_id']),
-				1,
-			),
+			'params' => $params,
 		),
 		// This assumes we are viewing by user.
 		'columns' => array(
@@ -355,8 +396,16 @@ function ReportDetails()
 });', true);
 
 	// Finally we are done :P
-	$context['page_title'] = sprintf($txt['mc_viewmodreport'], $context['report']['subject'], $context['report']['author']['name']);
-	$context['sub_template'] = 'viewmodreport';
+	if ($context['report_type'] == 'members')
+	{
+		$context['page_title'] = sprintf($txt['mc_viewmemberreport'], $context['report']['user']['name']);
+		$context['sub_template'] = 'viewmemberreport';
+	}
+	else
+	{
+		$context['page_title'] = sprintf($txt['mc_viewmodreport'], $context['report']['subject'], $context['report']['author']['name']);
+		$context['sub_template'] = 'viewmodreport';
+	}
 
 	// We can ignore a report from this page too so show the confirmation on here as well.
 	addInlineJavascript('
@@ -439,7 +488,7 @@ function HandleComment()
 	}
 
 	//Redirect to prevent double submission.
-	redirectexit($scripturl . '?action=moderate;area=reports;sa=details;rid=' . $report_id);
+	redirectexit($scripturl . '?action=moderate;area=reported' . $context['report_type'] . ';sa=details;rid=' . $report_id);
 }
 
 /**
@@ -497,7 +546,7 @@ function EditComment()
 
 		$_SESSION['rc_confirmation'] = 'message_edited';
 
-		redirectexit($scripturl . '?action=moderate;area=reports;sa=details;rid=' . $context['report_id']);
+		redirectexit($scripturl . '?action=moderate;area=reported' . $context['report_type'] . ';sa=details;rid=' . $context['report_id']);
 	}
 
 	createToken('mod-reportC-edit');
@@ -509,7 +558,7 @@ function EditComment()
  */
 function HandleReport()
 {
-	global $scripturl;
+	global $scripturl, $context;
 
 	checkSession('get');
 
@@ -538,6 +587,6 @@ function HandleReport()
 	$_SESSION['rc_confirmation'] = $message;
 
 	// Done!
-	redirectexit($scripturl . '?action=moderate;area=reports');
+	redirectexit($scripturl . '?action=moderate;area=reported' . $context['report_type']);
 }
 ?>

+ 4 - 4
Sources/Security.php

@@ -494,8 +494,8 @@ function banPermissions()
 		$context['open_mod_reports'] = $_SESSION['rc']['reports'];
 	elseif ($_SESSION['mc']['bq'] != '0=1')
 	{
-		require_once($sourcedir . '/Subs-ReportedPosts.php');
-		recountOpenReports();
+		require_once($sourcedir . '/Subs-ReportedContent.php');
+		recountOpenReports('posts');
 	}
 	else
 		$context['open_mod_reports'] = 0;
@@ -504,8 +504,8 @@ function banPermissions()
 		$contexct['open_member_reports'] = $_SESSION['rmc']['reports'];
 	elseif (allowedTo('moderate_forum'))
 	{
-		require_once($sourcedir . '/ModerationCenter.php');
-		recountOpenMemberReports();
+		require_once($sourcedir . '/Subs-ReportedContent.php');
+		recountOpenReports('members');
 	}
 	else
 		$context['open_member_reports'] = 0;

+ 226 - 83
Sources/Subs-ReportedPosts.php → Sources/Subs-ReportedContent.php

@@ -35,12 +35,22 @@ function updateReport($action, $value, $report_id)
 	if ($action == 'ignore')
 		$action = 'ignore_all';
 
+	// We don't need the board query for reported members
+	if ($context['report_type'] == 'members')
+	{
+		$board_query = '';
+	}
+	else
+	{
+		$board_query = ' AND ' . $user_info['mod_cache']['bq'];
+	}
+
 	// Update the report...
 	$smcFunc['db_query']('', '
 		UPDATE {db_prefix}log_reported
 		SET  {raw:action} = {string:value}
 		'. (is_array($report_id) ? 'WHERE id_report IN ({array_int:id_report})' : 'WHERE id_report = {int:id_report}') .'
-			AND ' . $user_info['mod_cache']['bq'],
+			' . $board_query,
 		array(
 			'action' => $action,
 			'value' => $value,
@@ -50,29 +60,51 @@ function updateReport($action, $value, $report_id)
 
 	// From now on, lets work with arrays, makes life easier.
 	$report_id = (array) $report_id;
-
-	// Get the board, topic and message for this report
-	$request = $smcFunc['db_query']('', '
-		SELECT id_board, id_topic, id_msg, id_report
-		FROM {db_prefix}log_reported
-		WHERE id_report IN ({array_int:id_report})',
-		array(
-			'id_report' => $report_id,
-		)
-	);
-
+	
 	// Set up the data for the log...
 	$extra = array();
 
-	while ($row = $smcFunc['db_fetch_assoc']($request))
-		$extra[$row['id_report']] = array(
-			'report' => $row['id_report'],
-			'board' => $row['id_board'],
-			'message' => $row['id_msg'],
-			'topic' => $row['id_topic'],
+	if ($context['report_type'] == 'posts')
+	{
+		// Get the board, topic and message for this report
+		$request = $smcFunc['db_query']('', '
+			SELECT id_board, id_topic, id_msg, id_report
+			FROM {db_prefix}log_reported
+			WHERE id_report IN ({array_int:id_report})',
+			array(
+				'id_report' => $report_id,
+			)
+		);
+	
+		while ($row = $smcFunc['db_fetch_assoc']($request))
+			$extra[$row['id_report']] = array(
+				'report' => $row['id_report'],
+				'board' => $row['id_board'],
+				'message' => $row['id_msg'],
+				'topic' => $row['id_topic'],
+			);
+	
+		$smcFunc['db_free_result']($request);
+	}
+	else
+	{
+		$request = $smcFunc['db_query']('', '
+			SELECT id_report, id_member, membername
+			FROM {db_prefix}log_reported
+			WHERE id_report IN ({array_int:id_report})',
+			array(
+				'id_report' => $report_id,
+			)
 		);
 
-	$smcFunc['db_free_result']($request);
+		while($row = $smcFunc['db_fetch_assoc']($request))
+			$extra[$row['id_report']] = array(
+				'report' => $row['id_report'],
+				'member' => $row['id_member'],
+			);
+
+		$smcFunc['db_free_result']($request);
+	}
 
 	// Back to "ignore".
 	if ($action == 'ignore_all')
@@ -80,6 +112,9 @@ function updateReport($action, $value, $report_id)
 
 	$log_report = $action == 'ignore' ? (!empty($value) ? 'ignore' : 'unignore') : (!empty($value) ? 'close' : 'open');
 
+	if ($context['report_type'] == 'members')
+		$log_report .= '_user';
+
 	// Log this action.
 	if (!empty($extra))
 		foreach ($extra as $report)
@@ -87,7 +122,7 @@ function updateReport($action, $value, $report_id)
 
 	// Time to update.
 	updateSettings(array('last_mod_report_action' => time()));
-	recountOpenReports();
+	recountOpenReports($context['report_type']);
 }
 
 /**
@@ -99,16 +134,35 @@ function updateReport($action, $value, $report_id)
  */
 function countReports($closed = 0)
 {
-	global $smcFunc, $user_info;
+	global $smcFunc, $user_info, $context;
 
 	$total_reports = 0;
 
+	// Skip entries with id_board = 0 if we're viewing member reports
+	if ($context['report_type'] == 'members')
+	{
+		$and = 'lr.id_board = 0';
+	}
+	else
+	{
+		if ($user_info['mod_cache']['bq'] == '1=1' || $user_info['mod_cache']['bq'] == '0=1')
+		{
+			$bq = $user_info['mod_cache']['bq'];
+		}
+		else
+		{
+			$bq = 'lr.' . $user_info['mod_cache']['bq'];
+		}
+
+		$and = $bq . ' AND lr.id_board != 0';
+	}
+
 	// 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']),
+			AND ' . $and,
 		array(
 			'view_closed' => (int) $closed,
 		)
@@ -133,52 +187,94 @@ function getReports($closed = 0)
 	$reports = array();
 
 	// 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,
-			lr.time_started, lr.time_updated, lr.num_reports, lr.closed, lr.ignore_all,
-			IFNULL(mem.real_name, lr.membername) AS author_name, IFNULL(mem.id_member, 0) AS id_author
-		FROM {db_prefix}log_reported AS lr
-			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = lr.id_member)
-		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']) . '
-		ORDER BY lr.time_updated DESC
-		LIMIT ' . $context['start'] . ', 10',
-		array(
-			'view_closed' => (int) $closed,
-		)
-	);
+	if ($context['report_type'] == 'members')
+	{
+		$request = $smcFunc['db_query']('', '
+			SELECT lr.id_report, lr.id_member,
+				lr.time_started, lr.time_updated, lr.num_reports, lr.closed, lr.ignore_all,
+				IFNULL(mem.real_name, lr.membername) AS user_name, IFNULL(mem.id_member, 0) AS id_user
+			FROM {db_prefix}log_reported AS lr
+				LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = lr.id_member)
+			WHERE lr.closed = {int:view_closed}
+				AND lr.id_board = 0
+			ORDER BY lr.time_updated DESC
+			LIMIT ' . $context['start'] . ', 10',
+			array(
+				'view_closed' => (int) $closed,
+			)
+		);
+	}
+	else
+	{
+		$request = $smcFunc['db_query']('', '
+			SELECT lr.id_report, lr.id_msg, lr.id_topic, lr.id_board, lr.id_member, lr.subject, lr.body,
+				lr.time_started, lr.time_updated, lr.num_reports, lr.closed, lr.ignore_all,
+				IFNULL(mem.real_name, lr.membername) AS author_name, IFNULL(mem.id_member, 0) AS id_author
+			FROM {db_prefix}log_reported AS lr
+				LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = lr.id_member)
+			WHERE lr.closed = {int:view_closed}
+				AND lr.id_board != 0
+				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']) . '
+			ORDER BY lr.time_updated DESC
+			LIMIT ' . $context['start'] . ', 10',
+			array(
+				'view_closed' => (int) $closed,
+			)
+		);	
+	}
 
 	$report_ids = array();
 	$report_boards_ids = array();
-	for ($i = 0; $row = $smcFunc['db_fetch_assoc']($request); $i++)
+	$i = 0;
+	while ($row = $smcFunc['db_fetch_assoc']($request))
 	{
 		$report_ids[] = $row['id_report'];
-		$report_boards_ids[] = $row['id_board'];
 		$reports[$row['id_report']] = array(
 			'id' => $row['id_report'],
 			'alternate' => $i % 2,
-			'topic' => array(
-				'id' => $row['id_topic'],
-				'id_msg' => $row['id_msg'],
-				'id_board' => $row['id_board'],
-				'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'],
-			),
-			'report_href' => $scripturl . '?action=moderate;area=reports;sa=details;rid=' . $row['id_report'],
-			'author' => array(
-				'id' => $row['id_author'],
-				'name' => $row['author_name'],
-				'link' => $row['id_author'] ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_author'] . '">' . $row['author_name'] . '</a>' : $row['author_name'],
-				'href' => $scripturl . '?action=profile;u=' . $row['id_author'],
-			),
+			'report_href' => $scripturl . '?action=moderate;area=reported' . $context['report_type'] . ';sa=details;rid=' . $row['id_report'],
 			'comments' => array(),
 			'time_started' => timeformat($row['time_started']),
 			'last_updated' => timeformat($row['time_updated']),
-			'subject' => $row['subject'],
-			'body' => parse_bbc($row['body']),
 			'num_reports' => $row['num_reports'],
 			'closed' => $row['closed'],
 			'ignore' => $row['ignore_all']
 		);
+
+		if ($context['report_type'] == 'members')
+		{
+			$extraDetails = array(
+				'user' => array(
+					'id' => $row['id_user'],
+					'name' => $row['user_name'],
+					'link' => $row['id_user'] ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_user'] . '">' . $row['user_name'] . '</a>' : $row['user_name'],
+					'href' => $scripturl . '?action=profile;u=' . $row['id_user'],
+				),
+			);
+		}
+		else
+		{
+			$report_boards_ids[] = $row['id_board'];
+			$extraDetails = array(
+				'topic' => array(
+					'id' => $row['id_topic'],
+					'id_msg' => $row['id_msg'],
+					'id_board' => $row['id_board'],
+					'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'],
+				),
+				'author' => array(
+					'id' => $row['id_author'],
+					'name' => $row['author_name'],
+					'link' => $row['id_author'] ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_author'] . '">' . $row['author_name'] . '</a>' : $row['author_name'],
+					'href' => $scripturl . '?action=profile;u=' . $row['id_author'],
+				),
+				'subject' => $row['subject'],
+				'body' => parse_bbc($row['body']),
+			);
+		}
+
+		$reports[$row['id_report']] = array_merge($reports[$row['id_report']], $extraDetails);
+		$i++;
 	}
 	$smcFunc['db_free_result']($request);
 
@@ -246,21 +342,29 @@ function getReports($closed = 0)
 /**
  * Recount all open reports. Sets a SESSION var with the updated info.
  *
+ * @param string the type of reports to count
  * @return int the update open report count.
  */
-function recountOpenReports()
+function recountOpenReports($type)
 {
-	global $user_info, $smcFunc;
+	global $user_info, $smcFunc, $context;
+
+	if ($type == 'members')
+		$bq = '';
+	else
+		$bq = '	AND ' . $user_info['mod_cache']['bq'];					
 
 	$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}',
+		WHERE closed = {int:not_closed}
+			AND ignore_all = {int:not_ignored}
+			AND id_board' . ($type == 'members' ? '' : '!') . '= {int:not_a_reported_post}'
+		 	. $bq,
 		array(
 			'not_closed' => 0,
 			'not_ignored' => 0,
+			'not_a_reported_post' => 0,
 		)
 	);
 	list ($open_reports) = $smcFunc['db_fetch_row']($request);
@@ -283,25 +387,45 @@ function recountOpenReports()
  */
 function getReportDetails($report_id)
 {
-	global $smcFunc, $user_info;
+	global $smcFunc, $user_info, $context;
 
 	if (empty($report_id))
 		return false;
 
-	// Get the report details, need this so we can limit access to a particular board.
-	$request = $smcFunc['db_query']('', '
-		SELECT lr.id_report, lr.id_msg, lr.id_topic, lr.id_board, lr.id_member, lr.subject, lr.body,
-			lr.time_started, lr.time_updated, lr.num_reports, lr.closed, lr.ignore_all,
-			IFNULL(mem.real_name, lr.membername) AS author_name, IFNULL(mem.id_member, 0) AS id_author
-		FROM {db_prefix}log_reported AS lr
-			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = lr.id_member)
-		WHERE lr.id_report = {int:id_report}
-			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']) . '
-		LIMIT 1',
-		array(
-			'id_report' => $report_id,
-		)
-	);
+	// We don't need all this info if we're only getting user info
+	if ($context['report_type'] == 'members')
+	{
+		$request = $smcFunc['db_query']('', '
+			SELECT lr.id_report, lr.id_member,
+					lr.time_started, lr.time_updated, lr.num_reports, lr.closed, lr.ignore_all,
+					IFNULL(mem.real_name, lr.membername) AS user_name, IFNULL(mem.id_member, 0) AS id_user
+			FROM {db_prefix}log_reported AS lr
+				LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = lr.id_member)
+			WHERE lr.id_report = {int:id_report}
+				AND lr.id_board = 0
+			LIMIT 1',
+			array(
+				'id_report' => $report_id,
+			)
+		);		
+	}
+	else
+	{
+		// Get the report details, need this so we can limit access to a particular board.
+		$request = $smcFunc['db_query']('', '
+			SELECT lr.id_report, lr.id_msg, lr.id_topic, lr.id_board, lr.id_member, lr.subject, lr.body,
+				lr.time_started, lr.time_updated, lr.num_reports, lr.closed, lr.ignore_all,
+				IFNULL(mem.real_name, lr.membername) AS author_name, IFNULL(mem.id_member, 0) AS id_author
+			FROM {db_prefix}log_reported AS lr
+				LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = lr.id_member)
+			WHERE lr.id_report = {int:id_report}
+				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']) . '
+			LIMIT 1',
+			array(
+				'id_report' => $report_id,
+			)
+		);
+	}
 
 	// So did we find anything?
 	if (!$smcFunc['db_num_rows']($request))
@@ -461,21 +585,40 @@ function saveModComment($report_id, $data)
 
 	$report = getReportDetails($report_id);
 
+	if ($context['report_type'] == 'members')
+	{
+		$prefix = 'Member';
+		$data = array(
+		 	'report_id' => $id_report,
+			'user_id' => $user['id_member'],
+			'user_name' => $user_name,
+			'sender_id' => $context['user']['id'],
+			'sender_name' => $context['user']['name'],
+			'comment' => $reason,
+			'time' => time(),
+		);
+	}
+	else
+	{
+		$prefix = 'Msg';
+		$data = array(
+			'report_id' => $report_id,
+			'comment_id' => $last_comment,
+			'msg_id' => $report['id_msg'],
+			'topic_id' => $report['id_topic'],
+			'board_id' => $report['id_board'],
+			'sender_id' => $user_info['id'],
+			'sender_name' => $user_info['name'],
+			'time' => time(),
+		);
+	}
+
 	// And get ready to notify people.
 	if (!empty($report))
 		$smcFunc['db_insert']('insert',
 			'{db_prefix}background_tasks',
 			array('task_file' => 'string', 'task_class' => 'string', 'task_data' => 'string', 'claimed_time' => 'int'),
-			array('$sourcedir/tasks/MsgReportReply-Notify.php', 'MsgReportReply_Notify_Background', serialize(array(
-				'report_id' => $report_id,
-				'comment_id' => $last_comment,
-				'msg_id' => $report['id_msg'],
-				'topic_id' => $report['id_topic'],
-				'board_id' => $report['id_board'],
-				'sender_id' => $user_info['id'],
-				'sender_name' => $user_info['name'],
-				'time' => time(),
-			)), 0),
+			array('$sourcedir/tasks/' . $prefix . 'ReportReply-Notify.php', $prefix . 'ReportReply_Notify_Background', serialize($data), 0),
 			array('id_task')
 		);
 }

+ 2 - 2
Sources/Subs.php

@@ -3810,12 +3810,12 @@ function setupMenuContext()
 					),
 					'reports' => array(
 						'title' => $txt['mc_reported_posts'],
-						'href' => $scripturl . '?action=moderate;area=reports',
+						'href' => $scripturl . '?action=moderate;area=reportedposts',
 						'show' => !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
 					),
 					'reported_members' => array(
 						'title' => $txt['mc_reported_members'],
-						'href' => $scripturl . '?action=moderate;area=memberreports',
+						'href' => $scripturl . '?action=moderate;area=reportedmembers',
 						'show' => allowedTo('moderate_forum'),
 						'is_last' => true,
 					)

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

@@ -62,8 +62,8 @@ class MemberReport_Notify_Background extends SMF_BackgroundTask
 					'is_read' => 0,
 					'extra' => serialize(
 						array(
-							'report_link' => '?action=moderate;area=memberreports;report=' . $this->_details['report_id'], // We don't put $scripturl in these!
-							'user_name' => $this->_details['membername'],
+							'report_link' => '?action=moderate;area=reportedmembers;report=' . $this->_details['report_id'], // We don't put $scripturl in these!
+							'user_name' => $this->_details['user_name'],
 						)
 					),
 				);
@@ -112,10 +112,10 @@ class MemberReport_Notify_Background extends SMF_BackgroundTask
 			foreach ($emails as $this_lang => $recipients)
 			{
 				$replacements = array(
-					'MEMBERNAME' => $member_name,
+					'MEMBERNAME' => $this->_details['user_name'],
 					'REPORTERNAME' => $this->_details['sender_name'],
-					'PROFILELINK' => $scripturl . '?action=profile;u=' . $this->_details['user_id'],
-					'REPORTLINK' => $scripturl . '?action=moderate;area=reports;report=' . $this->_details['report_id'],
+					'PROFILELINK' => $scripturl . '?action=profile;u=' . $this->_details['member_id'],
+					'REPORTLINK' => $scripturl . '?action=moderate;area=reportedmembers;sa=details;rid=' . $this->_details['report_id'],
 					'COMMENT' => $this->_details['comment'],
 				);
 

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

@@ -89,7 +89,7 @@ class MemberReportReply_Notify_Background extends SMF_BackgroundTask
 					'is_read' => 0,
 					'extra' => serialize(
 						array(
-							'report_link' => '?action=moderate;area=memberreports;report=' . $this->_details['report_id'], // We don't put $scripturl in these!
+							'report_link' => '?action=moderate;area=reportedmembers;sa=details;rid=' . $this->_details['report_id'], // We don't put $scripturl in these!
 							'user_name' => $this->_details['user_name'],
 						)
 					),

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

@@ -97,7 +97,7 @@ class MsgReport_Notify_Background extends SMF_BackgroundTask
 					'is_read' => 0,
 					'extra' => serialize(
 						array(
-							'report_link' => '?action=moderate;area=reports;report=' . $this->_details['report_id'], // We don't put $scripturl in these!
+							'report_link' => '?action=moderate;area=reportedposts;sa=details;rid=' . $this->_details['report_id'], // We don't put $scripturl in these!
 						)
 					),
 				);
@@ -163,7 +163,7 @@ class MsgReport_Notify_Background extends SMF_BackgroundTask
 					'POSTERNAME' => $poster_name,
 					'REPORTERNAME' => $this->_details['sender_name'],
 					'TOPICLINK' => $scripturl . '?topic=' . $this->_details['topic_id'] . '.msg' . $this->_details['msg_id'] . '#msg' . $this->_details['msg_id'],
-					'REPORTLINK' => $scripturl . '?action=moderate;area=reports;report=' . $this->_details['report_id'],
+					'REPORTLINK' => $scripturl . '?action=moderate;area=reportedposts;report=' . $this->_details['report_id'],
 					'COMMENT' => $comment,
 				);
 

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

@@ -124,7 +124,7 @@ class MsgReportReply_Notify_Background extends SMF_BackgroundTask
 					'is_read' => 0,
 					'extra' => serialize(
 						array(
-							'report_link' => '?action=moderate;area=reports;report=' . $this->_details['report_id'], // We don't put $scripturl in these!
+							'report_link' => '?action=moderate;area=reportedposts;sa=details;rid=' . $this->_details['report_id'], // We don't put $scripturl in these!
 						)
 					),
 				);
@@ -191,7 +191,7 @@ class MsgReportReply_Notify_Background extends SMF_BackgroundTask
 					'POSTERNAME' => $poster_name,
 					'COMMENTERNAME' => $this->_details['sender_name'],
 					'TOPICLINK' => $scripturl . '?topic=' . $this->_details['topic_id'] . '.msg' . $this->_details['msg_id'] . '#msg' . $this->_details['msg_id'],
-					'REPORTLINK' => $scripturl . '?action=moderate;area=reports;report=' . $this->_details['report_id'],
+					'REPORTLINK' => $scripturl . '?action=moderate;area=reportedposts;report=' . $this->_details['report_id'],
 				);
 
 				$emaildata = loadEmailTemplate('reply_to_moderator', $replacements, empty($modSettings['userLanguage']) ? $language : $this_lang);

+ 63 - 84
Themes/default/ManagePermissions.template.php

@@ -540,6 +540,10 @@ function template_modify_group()
 				<input type="submit" value="', $txt['permissions_commit'], '" class="button_submit">
 			</div>';
 
+	foreach ($context['hidden_perms'] as $hidden_perm)
+		echo '
+			<input type="hidden" name="perm[', $hidden_perm[0], '][', $hidden_perm[1], ']" value="', $hidden_perm[2], '">';
+
 	echo '
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
 			<input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '">
@@ -582,129 +586,104 @@ function template_modify_group_display($type)
 				{
 					echo '
 							<tr class="catbg">
-								<th colspan="2" width="100%" align="left"><strong class="smalltext">', $permissionGroup['name'], '</strong></th>';
-					if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
+								<th width="10"></th>
+								<th', $context['group']['id'] == -1 ? ' colspan="2"' : '', ' class="smalltext">', $permissionGroup['name'], '</th>';
+
+					if ($context['group']['id'] != -1)
 						echo '
-								<th colspan="3" width="10"></th>';
-					else
+								<th align="center">', $txt['permissions_option_own'], '</th>
+								<th align="center">', $txt['permissions_option_any'], '</th>';
+
 						echo '
-								<th align="center"><div>', $txt['permissions_option_on'], '</div></th>
-								<th align="center"><div>', $txt['permissions_option_off'], '</div></th>
-								<th align="center"><div>', $txt['permissions_option_deny'], '</div></th>';
-					echo '
 							</tr>';
 				}
 			}
 
-			$alternate = false;
 			foreach ($permissionGroup['permissions'] as $permission)
 			{
-				// If it's hidden keep the last value.
-				if ($permission['hidden'] || $permissionGroup['hidden'])
-				{
-					echo '
-							<tr style="display: none;">
-								<td>';
-
-					if ($permission['has_own_any'])
-					{
-						// Guests can't have own permissions.
-						if ($context['group']['id'] != -1)
-							echo '
-									<input type="hidden" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']" value="', $permission['own']['select'] == 'denied' && !empty($modSettings['permission_enable_deny']) ? 'deny' : $permission['own']['select'], '">';
-
-						echo '
-									<input type="hidden" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']" value="', $permission['any']['select'] == 'denied' && !empty($modSettings['permission_enable_deny']) ? 'deny' : $permission['any']['select'], '">';
-					}
-					else
-						echo '
-									<input type="hidden" name="perm[', $permission_type['id'], '][', $permission['id'], ']" value="', $permission['select'] == 'denied' && !empty($modSettings['permission_enable_deny']) ? 'deny' : $permission['select'], '">';
-					echo '
-								</td>
-							</tr>';
-				}
-				else
+				if (!$permission['hidden'] && !$permissionGroup['hidden'])
 				{
 					echo '
-							<tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
+							<tr>
 								<td width="10">
 									', $permission['show_help'] ? '<a href="' . $scripturl . '?action=helpadmin;help=permissionhelp_' . $permission['id'] . '" onclick="return reqOverlayDiv(this.href);" class="help"><img src="' . $settings['images_url'] . '/helptopics.png" alt="' . $txt['help'] . '"></a>' : '', '
-								</td>';
+								</td>
+								<td class="lefttext full_width">', $permission['name'], '</td><td>';
 
 					if ($permission['has_own_any'])
 					{
-						echo '
-								<td colspan="4" width="100%" align="left">', $permission['name'], '</td>
-							</tr><tr class="', $alternate ? 'windowbg' : 'windowbg2', '">';
-
 						// Guests can't do their own thing.
 						if ($context['group']['id'] != -1)
 						{
-							echo '
-								<td></td>
-								<td width="100%" class="smalltext" align="right">', $permission['own']['name'], ':</td>';
-
 							if (empty($modSettings['permission_enable_deny']))
 								echo '
-								<td colspan="3"><input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'on' ? ' checked' : '', ' value="on" id="', $permission['own']['id'], '_on" class="input_check" ', $disable_field, '/></td>';
+									<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" id="', $permission['own']['id'], '_on" class="input_check" ', $disable_field, '/>';
 							else
+							{
 								echo '
-								<td width="10"><input type="radio" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'on' ? ' checked' : '', ' value="on" id="', $permission['own']['id'], '_on" class="input_radio" ', $disable_field, '/></td>
-								<td width="10"><input type="radio" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'off' ? ' checked' : '', ' value="off" class="input_radio" ', $disable_field, '/></td>
-								<td width="10"><input type="radio" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'denied' ? ' checked' : '', ' value="deny" class="input_radio" ', $disable_field, '/></td>';
+									<select name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']" ', $disable_field, '>';
 
+								foreach (array('on', 'off', 'deny') as $c)
+									echo '
+										<option ', $permission['own']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
 							echo '
-							</tr><tr class="', $alternate ? 'windowbg' : 'windowbg2', '">';
-						}
+									</select>';
+							}
 
 						echo '
-								<td></td>
-								<td width="100%" class="smalltext" align="right">', $permission['any']['name'], ':</td>';
+								</td>
+								<td>';
+						}
 
 						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
 							echo '
-								<td colspan="3"><input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'on' ? ' checked' : '', ' value="on" class="input_check" ', $disable_field, '/></td>';
+									<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" class="input_check" ', $disable_field, '/>';
 						else
+						{
 							echo '
-								<td><input type="radio" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'on' ? ' checked' : '', ' value="on" onclick="document.forms.permissionForm.', $permission['own']['id'], '_on.checked = true;" class="input_radio" ', $disable_field, '/></td>
-								<td><input type="radio" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'off' ? ' checked' : '', ' value="off" class="input_radio" ', $disable_field, '/></td>
-								<td><input type="radio" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select']== 'denied' ? ' checked' : '', ' value="deny" id="', $permission['any']['id'], '_deny" onclick="window.smf_usedDeny = true;" class="input_radio" ', $disable_field, '/></td>';
+									<select name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']" ', $disable_field, '>';
 
-						echo '
-							</tr>';
+							foreach (array('on', 'off', 'deny') as $c)
+								echo '
+										<option ', $permission['any']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
+							echo '
+									</select>';
+						}
 					}
 					else
 					{
-						echo '
-								<td width="100%" align="left">', $permission['name'], '</td>';
+						if ($context['group']['id'] != -1)
+							echo '
+								</td>
+								<td>';
 
 						if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
 							echo '
-								<td><input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked' : '', ' value="on" class="input_check" ', $disable_field, '/></td>';
+									<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' value="on" class="input_check" ', $disable_field, '/>';
 						else
+						{
 							echo '
-								<td><input type="radio" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked' : '', ' value="on" class="input_radio" ', $disable_field, '/></td>
-								<td><input type="radio" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'off' ? ' checked' : '', ' value="off" class="input_radio" ', $disable_field, '/></td>
-								<td><input type="radio" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'denied' ? ' checked' : '', ' value="deny" onclick="window.smf_usedDeny = true;" class="input_radio" ', $disable_field, '/></td>';
+									<select name="perm[', $permission_type['id'], '][', $permission['id'], ']" ', $disable_field, '>';
 
-						echo '
-							</tr>';
+							foreach (array('on', 'off', 'deny') as $c)
+								echo '
+										<option ', $permission['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
+							echo '
+									</select>';
+						}
 					}
+					echo '
+								</td>
+							</tr>';
 				}
-				$alternate = !$alternate;
 			}
-
-			if (!$permissionGroup['hidden'] && $has_display_content)
-				echo '
-							<tr class="windowbg2">
-								<td colspan="5" width="100%"><!--separator--></td>
-							</tr>';
 		}
-	echo '
+		echo '
 						</table>';
 	}
+
 	echo '
-				<br class="clear">
+					<br class="clear">
 				</div>
 			</div>';
 }
@@ -770,9 +749,9 @@ function template_inline_permissions()
 
 	echo '
 											</fieldset>
-				
+
 											<a href="javascript:void(0);" onclick="document.getElementById(\'', $context['current_permission'], '\').style.display = \'block\'; document.getElementById(\'', $context['current_permission'], '_groups_link\').style.display = \'none\'; return false;" id="', $context['current_permission'], '_groups_link" style="display: none;">[ ', $txt['avatar_select_permission'], ' ]</a>
-									
+
 											<script><!-- // --><![CDATA[
 												document.getElementById("', $context['current_permission'], '").style.display = "none";
 												document.getElementById("', $context['current_permission'], '_groups_link").style.display = "";
@@ -811,7 +790,7 @@ function template_postmod_permissions()
 			echo '
 							<div class="information">', $txt['permissions_post_moderation_deny_note'], '</div>';
 
-		echo '		
+		echo '
 							<div class="padding">
 								<p class="smalltext" style="padding-left: 10px; padding-bottom: 10px; float: left;">
 									<strong>', $txt['permissions_post_moderation_legend'], ':</strong><br>
@@ -847,13 +826,13 @@ function template_postmod_permissions()
 										<th class="centercol" colspan="3">
 											', $txt['permissions_post_moderation_replies_any'], '
 										</th>';
-						
+
 		if ($modSettings['attachmentEnable'] == 1)
 			echo '
 										<th class="last_th centercol" colspan="3">
 											', $txt['permissions_post_moderation_attachments'], '
 										</th>';
-		
+
 		echo '
 									</tr>
 									<tr>
@@ -896,7 +875,7 @@ function template_postmod_permissions()
 										<td align="center" class="windowbg2"><input type="radio" name="new_topic[', $group['id'], ']" value="allow"', $group['new_topic'] == 'allow' ? ' checked' : '', ' class="input_radio"></td>
 										<td align="center" class="windowbg2"><input type="radio" name="new_topic[', $group['id'], ']" value="moderate"', $group['new_topic'] == 'moderate' ? ' checked' : '', ' class="input_radio"></td>
 										<td align="center" class="windowbg2"><input type="radio" name="new_topic[', $group['id'], ']" value="disallow"', $group['new_topic'] == 'disallow' ? ' checked' : '', ' class="input_radio"></td>';
-			
+
 				// Guests can't have "own" permissions
 				if ($group['id'] == '-1')
 				{
@@ -910,12 +889,12 @@ function template_postmod_permissions()
 										<td align="center" class="windowbg"><input type="radio" name="replies_own[', $group['id'], ']" value="moderate"', $group['replies_own'] == 'moderate' ? ' checked' : '', ' class="input_radio"></td>
 										<td align="center" class="windowbg"><input type="radio" name="replies_own[', $group['id'], ']" value="disallow"', $group['replies_own'] == 'disallow' ? ' checked' : '', ' class="input_radio"></td>';
 				}
-			
+
 				echo '
 										<td align="center" class="windowbg2"><input type="radio" name="replies_any[', $group['id'], ']" value="allow"', $group['replies_any'] == 'allow' ? ' checked' : '', ' class="input_radio"></td>
 										<td align="center" class="windowbg2"><input type="radio" name="replies_any[', $group['id'], ']" value="moderate"', $group['replies_any'] == 'moderate' ? ' checked' : '', ' class="input_radio"></td>
 										<td align="center" class="windowbg2"><input type="radio" name="replies_any[', $group['id'], ']" value="disallow"', $group['replies_any'] == 'disallow' ? ' checked' : '', ' class="input_radio"></td>';
-	
+
 				if ($modSettings['attachmentEnable'] == 1)
 				{
 					echo '
@@ -923,7 +902,7 @@ function template_postmod_permissions()
 										<td align="center" class="windowbg"><input type="radio" name="attachment[', $group['id'], ']" value="moderate"', $group['attachment'] == 'moderate' ? ' checked' : '', ' class="input_radio"></td>
 										<td align="center" class="windowbg"><input type="radio" name="attachment[', $group['id'], ']" value="disallow"', $group['attachment'] == 'disallow' ? ' checked' : '', ' class="input_radio"></td>';
 				}
-		
+
 				echo '
 									</tr>';
 		}

+ 0 - 327
Themes/default/ModerationCenter.template.php

@@ -320,178 +320,6 @@ function template_unapproved_posts()
 	</div>';
 }
 
-
-function template_viewmodreport()
-{
-	global $context, $scripturl, $txt;
-
-	echo '
-	<div id="modcenter">
-		<form action="', $scripturl, '?action=moderate;area=reports;report=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
-			<div class="cat_bar">
-				<h3 class="catbg">
-					', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
-				</h3>
-			</div>
-			<div class="title_bar">
-				<h3 class="titlebg">
-					<span class="floatleft">
-						', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
-					</span>
-					<span class="floatright">';
-
-		// Make the buttons.
-		$close_button = create_button('close.png', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', '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"');
-
-		echo '
-						<a href="', $scripturl, '?action=moderate;area=reports;ignore=', (int) !$context['report']['ignore'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], '" ', !$context['report']['ignore'] ? 'onclick="return confirm(\'' . $txt['mc_reportedp_ignore_confirm'] . '\');"' : '', '>', $context['report']['ignore'] ? $unignore_button : $ignore_button, '</a>
-						<a href="', $scripturl, '?action=moderate;area=reports;close=', (int) !$context['report']['closed'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $close_button, '</a>
-					</span>
-				</h3>
-			</div>
-			<div class="windowbg2">
-				<div class="content">
-					', $context['report']['body'], '
-				</div>
-			</div>
-			<br>
-			<div class="cat_bar">
-				<h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
-			</div>';
-
-	foreach ($context['report']['comments'] as $comment)
-		echo '
-			<div class="windowbg">
-				<div class="content">
-					<p class="smalltext">', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '</p>
-					<p>', $comment['message'], '</p>
-				</div>
-			</div>';
-
-	echo '
-			<br>
-			<div class="cat_bar">
-				<h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
-			</div>';
-			
-		if (empty($context['report']['mod_comments']))
-		echo '
-				<div class="description">
-					<p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
-				</div>';
-	
-		echo '
-			<div class="windowbg2">
-				<div class="content">';
-
-	foreach ($context['report']['mod_comments'] as $comment)
-		echo
-					'<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em></p>';
-
-		echo '
-					<textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
-					<div>
-						<input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit">
-					</div>
-				</div>
-			</div>
-			<br>';
-
-	$alt = false;
-
-	template_show_list('moderation_actions_list');
-
-	echo '
-			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
-		</form>
-	</div>';
-}
-
-function template_viewmemberreport()
-{
-	global $context, $scripturl, $txt;
-
-	echo '
-	<div id="modcenter">
-		<form action="', $scripturl, '?action=moderate;area=memberreports;report=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
-			<div class="cat_bar">
-				<h3 class="catbg">
-					', sprintf($txt['mc_viewmemberreport'], $context['report']['user']['link']), '
-				</h3>
-			</div>
-			<div class="title_bar">
-				<h3 class="titlebg">
-					<span class="floatleft">
-						', sprintf($txt['mc_memberreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
-					</span>
-					<span class="floatright">';
-
-		// Make the buttons.
-		$close_button = create_button('close.png', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', '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"');
-
-		echo '
-						<a href="', $scripturl, '?action=moderate;area=memberreports;ignore=', (int) !$context['report']['ignore'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], '" ', !$context['report']['ignore'] ? 'onclick="return confirm(\'' . $txt['mc_reportedp_ignore_confirm'] . '\');"' : '', '>', $context['report']['ignore'] ? $unignore_button : $ignore_button, '</a>
-						<a href="', $scripturl, '?action=moderate;area=memberreports;close=', (int) !$context['report']['closed'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $close_button, '</a>
-					</span>
-				</h3>
-			</div>
-			<br>
-			<div class="cat_bar">
-				<h3 class="catbg">', $txt['mc_memberreport_whoreported_title'], '</h3>
-			</div>';
-
-	foreach ($context['report']['comments'] as $comment)
-		echo '
-			<div class="windowbg">
-				<div class="content">
-					<p class="smalltext">', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '</p>
-					<p>', $comment['message'], '</p>
-				</div>
-			</div>';
-
-	echo '
-			<br>
-			<div class="cat_bar">
-				<h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
-			</div>';
-			
-		if (empty($context['report']['mod_comments']))
-		echo '
-				<div class="description">
-					<p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
-				</div>';
-	
-		echo '
-			<div class="windowbg2">
-				<div class="content">';
-
-	foreach ($context['report']['mod_comments'] as $comment)
-		echo
-					'<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em></p>';
-
-		echo '
-					<textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
-					<div>
-						<input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit">
-					</div>
-				</div>
-			</div>
-			<br>';
-
-	$alt = false;
-
-	template_show_list('memreport_actions_list');
-
-	echo '
-			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
-		</form>
-	</div>';
-}
-
 // Callback function for showing a watched users post in the table.
 function template_user_watch_post_callback($post)
 {
@@ -711,159 +539,4 @@ function template_warn_template()
 	// ]]></script>';
 }
 
-// A block to show the current top reported member profiles.
-function template_reported_members_block()
-{
-	global $context, $txt, $scripturl;
-
-	echo '
-		<div class="cat_bar">
-			<h3 class="catbg">
-				<span id="reported_members_toggle" class="', !empty($context['admin_prefs']['mcru']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
-				<a href="', $scripturl, '?action=moderate;area=memberreports" id="reported_members_link">', $txt['mc_recent_member_reports'], '</a>
-			</h3>
-		</div>
-		<div class="windowbg" id="reported_users_panel">
-			<div class="content modbox">
-				<ul class="reset">';
-
-		foreach ($context['reported_members'] as $report)
-			echo '
-					<li class="smalltext">
-						<a href="', $report['report_href'], '">', $report['user_name'], '</a>
-					</li>';
-
-		// Don't have any reported members right now?
-		if (empty($context['reported_members']))
-			echo '
-					<li>
-						<strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
-					</li>';
-
-		echo '
-				</ul>
-			</div>
-		</div>
-		
-	<script><!-- // --><![CDATA[
-		var oReportedPostsPanelToggle = new smc_Toggle({
-			bToggleEnabled: true,
-			bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcrm']) ? 'true' : 'false', ',
-			aSwappableContainers: [
-				\'reported_posts_panel\'
-			],
-			aSwapImages: [
-				{
-					sId: \'reported_members_toggle\',
-					altExpanded: ', JavaScriptEscape($txt['hide']), ',
-					altCollapsed: ', JavaScriptEscape($txt['show']), '
-				}
-			],
-			aSwapLinks: [
-				{
-					sId: \'reported_members_link\',
-					msgExpanded: ', JavaScriptEscape($txt['mc_recent_member_reports']), ',
-					msgCollapsed: ', JavaScriptEscape($txt['mc_recent_member_reports']), '
-				}
-			],
-			oThemeOptions: {
-				bUseThemeSettings: true,
-				sOptionName: \'admin_preferences\',
-				sSessionVar: smf_session_var,
-				sSessionId: smf_session_id,
-				sThemeId: \'1\',
-				sAdditionalVars: \';admin_key=mcrm\'
-			}
-		});
-	// ]]></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_members" 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>
-				<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>';
-}
-
 ?>

+ 578 - 0
Themes/default/ReportedContent.template.php

@@ -0,0 +1,578 @@
+<?php
+/**
+ * Simple Machines Forum (SMF)
+ *
+ * @package SMF
+ * @author Simple Machines http://www.simplemachines.org
+ * @copyright 2014 Simple Machines and individual contributors
+ * @license http://www.simplemachines.org/about/smf/license.php BSD
+ *
+ * @version 2.1 Alpha 1
+ */
+
+function template_reported_posts()
+{
+	global $context, $txt, $scripturl;
+
+	// Let them know the action was a success.
+	if (!empty($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=reportedposts;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'], '
+			</h3>
+		</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"');
+	$delete_button = create_button('delete.png', 'mc_reportedp_delete', 'mc_reportedp_delete', 'class="centericon"');
+
+	foreach ($context['reports'] as $report)
+	{
+		echo '
+		<div class="generic_list_wrapper ', $report['alternate'] ? 'windowbg' : 'windowbg2', '">
+			<div class="content">
+				<h5>
+					<strong>', !empty($report['topic']['board_name']) ? '<a href="' . $scripturl . '?board=' . $report['topic']['id_board'] . '.0">' . $report['topic']['board_name'] . '</a>' : '??', ' / <a href="', $report['topic']['href'], '">', $report['subject'], '</a></strong> ', $txt['mc_reportedp_by'], ' <strong>', $report['author']['link'], '</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=reportedposts;sa=handle;ignore=', (int) !$report['ignore'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-ignore_token_var'], '=', $context['mod-report-ignore_token'], '" class="report_ignore" data-ignore="', (int) !$report['ignore'], '">', $report['ignore'] ? $unignore_button : $ignore_button, '</a></li>
+					<li><a href="', $scripturl, '?action=moderate;area=reportedposts;sa=handle;closed=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a></li>';
+
+		// Delete message button.
+		if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards'])))
+			echo '
+					<li><a href="', $scripturl, '?action=deletemsg;topic=', $report['topic']['id'] ,'.0;msg=', $report['topic']['id_msg'] ,';modcenter;', $context['session_var'], '=', $context['session_id'], '" class="delete_message">', $delete_button, '</a></li>';
+
+		// Ban this user button.
+		if (!$report['closed'] && !empty($context['report_manage_bans']))
+			echo '
+					<li><a href="', $scripturl, '?action=admin;area=ban;sa=add', (!empty($report['author']['id']) ? ';u='. $report['author']['id'] : ';msg='. $report['topic']['id_msg']) ,';', $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">
+			', !empty($context['total_reports']) && $context['total_reports'] >= $context['reports_how_many'] ? '<div class="pagelinks floatleft">'. $context['page_index']. '</div>' : '' ,'
+			<div class="floatright">', !$context['view_closed'] ? '
+				<input type="hidden" name="'. $context['mod-report-close-all_token_var'] .'" value="'. $context['mod-report-close-all_token'] .'">
+				<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>';
+}
+
+
+// A block to show the current top reported posts.
+function template_reported_posts_block()
+{
+	global $context, $txt, $scripturl;
+
+	echo '
+		<div class="cat_bar">
+			<h3 class="catbg">
+				<span id="reported_posts_toggle" class="', !empty($context['admin_prefs']['mcrp']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
+				<a href="', $scripturl, '?action=moderate;area=reportedposts" id="reported_posts_link">', $txt['mc_recent_reports'], '</a>
+			</h3>
+		</div>
+		<div class="windowbg" id="reported_posts_panel">
+			<div class="content modbox">
+				<ul class="reset">';
+
+		foreach ($context['reported_posts'] as $report)
+			echo '
+					<li class="smalltext">
+						<a href="', $report['report_href'], '">', $report['subject'], '</a> ', $txt['mc_reportedp_by'], ' ', $report['author']['link'], '
+					</li>';
+
+		// Don't have any watched users right now?
+		if (empty($context['reported_posts']))
+			echo '
+					<li>
+						<strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
+					</li>';
+
+		echo '
+				</ul>
+			</div>
+		</div>
+
+	<script><!-- // --><![CDATA[
+		var oReportedPostsPanelToggle = new smc_Toggle({
+			bToggleEnabled: true,
+			bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcrp']) ? 'true' : 'false', ',
+			aSwappableContainers: [
+				\'reported_posts_panel\'
+			],
+			aSwapImages: [
+				{
+					sId: \'reported_posts_toggle\',
+					altExpanded: ', JavaScriptEscape($txt['hide']), ',
+					altCollapsed: ', JavaScriptEscape($txt['show']), '
+				}
+			],
+			aSwapLinks: [
+				{
+					sId: \'reported_posts_link\',
+					msgExpanded: ', JavaScriptEscape($txt['mc_recent_reports']), ',
+					msgCollapsed: ', JavaScriptEscape($txt['mc_recent_reports']), '
+				}
+			],
+			oThemeOptions: {
+				bUseThemeSettings: true,
+				sOptionName: \'admin_preferences\',
+				sSessionVar: smf_session_var,
+				sSessionId: smf_session_id,
+				sThemeId: \'1\',
+				sAdditionalVars: \';admin_key=mcrp\'
+			}
+		});
+	// ]]></script>';
+}
+
+
+function template_viewmodreport()
+{
+	global $context, $scripturl, $txt;
+
+	// Let them know the action was a success.
+	if (!empty($context['report_post_action']))
+	{
+		echo '
+			<div class="infobox">
+				', $txt['report_action_'. $context['report_post_action']], '
+			</div>';
+	}
+
+	echo '
+	<div id="modcenter">
+		<form action="', $scripturl, '?action=moderate;area=reportedposts;sa=handlecomment;rid=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
+			<div class="cat_bar">
+				<h3 class="catbg">
+					', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
+				</h3>
+			</div>
+			<div class="title_bar">
+				<h3 class="titlebg">
+					<span class="floatleft">
+						', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
+					</span>
+					<span class="floatright">';
+
+		// Make the buttons.
+		$close_button = create_button('close.png', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', '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"');
+
+		echo '
+						<a href="', $scripturl, '?action=moderate;area=reportedposts;sa=handle;ignore=', (int) !$context['report']['ignore'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-ignore_token_var'], '=', $context['mod-report-ignore_token'], '" class="report_ignore" data-ignore="', !$context['report']['ignore'] ,'">', $context['report']['ignore'] ? $unignore_button : $ignore_button, '</a>
+						<a href="', $scripturl, '?action=moderate;area=reportedposts;sa=handle;closed=', (int) !$context['report']['closed'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a>
+					</span>
+				</h3>
+			</div>
+			<div class="windowbg2">
+				<div class="content">
+					', $context['report']['body'], '
+				</div>
+			</div>
+			<br>
+			<div class="cat_bar">
+				<h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
+			</div>';
+
+	foreach ($context['report']['comments'] as $comment)
+		echo '
+			<div class="windowbg">
+				<div class="content">
+					<p class="smalltext">', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '</p>
+					<p>', $comment['message'], '</p>
+				</div>
+			</div>';
+
+	echo '
+			<br>
+			<div class="cat_bar">
+				<h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
+			</div>
+				<div>';
+
+	if (empty($context['report']['mod_comments']))
+		echo '
+				<div class="information">
+					<p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
+				</div>';
+
+	foreach ($context['report']['mod_comments'] as $comment)
+	{
+		echo
+						'<div class="cat_bar">
+						<h4 class="catbg">', $comment['member']['link'], ':  <em class="smalltext">(', $comment['time'], ')</em>', ($comment['can_edit'] ? '<span class="floatright"><a href="' . $scripturl . '?action=moderate;area=reportedposts;sa=editcomment;rid='. $context['report']['id'] .';mid='. $comment['id'] .';'. $context['session_var'] .'='. $context['session_id'] .'">'. $txt['mc_reportedp_comment_edit'] .'</a> | <a href="' . $scripturl . '?action=moderate;area=reportedposts;sa=handlecomment;rid='. $context['report']['id'] .';mid='. $comment['id'] .';delete;'. $context['session_var'] .'='. $context['session_id']. ';'. $context['mod-reportC-delete_token_var'] .'='. $context['mod-reportC-delete_token'] .'" class="deleteModComment">'. $txt['mc_reportedp_comment_delete'] .'</a></span>' : '') ,'
+						</div></h4>';
+
+		echo '
+						<div class="windowbg">
+							<p class="content">', $comment['message'], '</p>
+						</div>';
+	}
+
+	echo '
+					<div class="title_bar">
+						<h3 class="titlebg">
+							<span class="floatleft">
+								', $txt['mc_reportedp_new_comment'], '
+							</span>
+						</h3>
+					</div>
+					<div class="content">
+						<textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
+						<div class="padding">
+							<input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit">
+							<input type="hidden" name="', $context['mod-reportC-add_token_var'], '" value="', $context['mod-reportC-add_token'], '">
+						</div>
+					</div>
+				</div>
+			<br>';
+
+	template_show_list('moderation_actions_list');
+
+	echo '
+			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
+		</form>
+	</div>';
+}
+
+function template_edit_comment()
+{
+	global $context, $scripturl, $txt;
+
+	echo '
+	<div id="modcenter">
+		<form action="', $scripturl, '?action=moderate;area=reported', $context['report_type'], ';sa=editcomment;mid=', $context['comment_id'], ';rid=', $context['report_id'] ,';save" method="post" accept-charset="', $context['character_set'], '">';
+
+	echo '
+			<br>
+			<div class="cat_bar">
+				<h3 class="catbg">', $txt['mc_modreport_edit_mod_comment'] ,'</h3>
+			</div>
+			<div class="windowbg2">
+				<div class="content">';
+
+	echo '
+					<textarea rows="6" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment">', $context['comment']['body'] ,'</textarea>
+					<div>
+						<input type="submit" name="edit_comment" value="', $txt['mc_modreport_edit_mod_comment'], '" class="button_submit">
+					</div>
+				</div>
+			</div>
+			<br>';
+
+	echo '
+			<input type="hidden" name="', $context['mod-reportC-edit_token_var'], '" value="', $context['mod-reportC-edit_token'], '">
+			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
+		</form>
+	</div>';
+}
+
+// A block to show the current top reported member profiles.
+function template_reported_members_block()
+{
+	global $context, $txt, $scripturl;
+
+	echo '
+		<div class="cat_bar">
+			<h3 class="catbg">
+				<span id="reported_members_toggle" class="', !empty($context['admin_prefs']['mcru']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
+				<a href="', $scripturl, '?action=moderate;area=reportedmembers" id="reported_members_link">', $txt['mc_recent_member_reports'], '</a>
+			</h3>
+		</div>
+		<div class="windowbg" id="reported_users_panel">
+			<div class="content modbox">
+				<ul class="reset">';
+
+		foreach ($context['reported_members'] as $report)
+			echo '
+					<li class="smalltext">
+						<a href="', $report['report_href'], '">', $report['user_name'], '</a>
+					</li>';
+
+		// Don't have any reported members right now?
+		if (empty($context['reported_members']))
+			echo '
+					<li>
+						<strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
+					</li>';
+
+		echo '
+				</ul>
+			</div>
+		</div>
+		
+	<script><!-- // --><![CDATA[
+		var oReportedPostsPanelToggle = new smc_Toggle({
+			bToggleEnabled: true,
+			bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcrm']) ? 'true' : 'false', ',
+			aSwappableContainers: [
+				\'reported_members_panel\'
+			],
+			aSwapImages: [
+				{
+					sId: \'reported_members_toggle\',
+					altExpanded: ', JavaScriptEscape($txt['hide']), ',
+					altCollapsed: ', JavaScriptEscape($txt['show']), '
+				}
+			],
+			aSwapLinks: [
+				{
+					sId: \'reported_members_link\',
+					msgExpanded: ', JavaScriptEscape($txt['mc_recent_member_reports']), ',
+					msgCollapsed: ', JavaScriptEscape($txt['mc_recent_member_reports']), '
+				}
+			],
+			oThemeOptions: {
+				bUseThemeSettings: true,
+				sOptionName: \'admin_preferences\',
+				sSessionVar: smf_session_var,
+				sSessionId: smf_session_id,
+				sThemeId: \'1\',
+				sAdditionalVars: \';admin_key=mcrm\'
+			}
+		});
+	// ]]></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_members" action="', $scripturl, '?action=moderate;area=reportedmembers;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'], '
+			</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>
+				<ul class="quickbuttons">
+					<li><a href="', $report['report_href'], '">', $details_button, '</a></li>
+					<li><a href="', $scripturl, '?action=moderate;area=reportedmembers;sa=handle;ignore=', (int) !$report['ignore'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-ignore_token_var'], '=', $context['mod-report-ignore_token'], '" class="report_ignore" data-ignore="', (int) !$report['ignore'], '">', $report['ignore'] ? $unignore_button : $ignore_button, '</a></li>
+					<li><a href="', $scripturl, '?action=moderate;area=reportedmembers;sa=handle;closed=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $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>';
+}
+
+function template_viewmemberreport()
+{
+	global $context, $scripturl, $txt;
+
+	// Let them know the action was a success.
+	if (!empty($context['report_post_action']))
+	{
+		echo '
+			<div class="infobox">
+				', $txt['report_action_'. $context['report_post_action']], '
+			</div>';
+	}
+
+	echo '
+	<div id="modcenter">
+		<form action="', $scripturl, '?action=moderate;area=reportedmembers;sa=handlecomment;rid=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
+			<div class="cat_bar">
+				<h3 class="catbg">
+					', sprintf($txt['mc_viewmemberreport'], $context['report']['user']['link']), '
+				</h3>
+			</div>
+			<div class="title_bar">
+				<h3 class="titlebg">
+					<span class="floatleft">
+						', sprintf($txt['mc_memberreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
+					</span>
+					<span class="floatright">';
+
+		// Make the buttons.
+		$close_button = create_button('close.png', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', '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"');
+
+		echo '
+						<a href="', $scripturl, '?action=moderate;area=reportedmembers;sa=handle;ignore=', (int) !$context['report']['ignore'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-ignore_token_var'], '=', $context['mod-report-ignore_token'], '" class="report_ignore" data-ignore="', !$context['report']['ignore'] ,'">', $context['report']['ignore'] ? $unignore_button : $ignore_button, '</a>
+						<a href="', $scripturl, '?action=moderate;area=reportedmembers;sa=handle;closed=', (int) !$context['report']['closed'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a>
+					</span>
+				</h3>
+			</div>
+			<br>
+			<div class="cat_bar">
+				<h3 class="catbg">', $txt['mc_memberreport_whoreported_title'], '</h3>
+			</div>';
+
+	foreach ($context['report']['comments'] as $comment)
+		echo '
+			<div class="windowbg">
+				<div class="content">
+					<p class="smalltext">', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '</p>
+					<p>', $comment['message'], '</p>
+				</div>
+			</div>';
+
+	echo '
+			<br>
+			<div class="cat_bar">
+				<h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
+			</div>
+				<div>';
+
+	if (empty($context['report']['mod_comments']))
+		echo '
+				<div class="information">
+					<p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
+				</div>';
+
+	foreach ($context['report']['mod_comments'] as $comment)
+	{
+		echo
+						'<div class="cat_bar">
+						<h4 class="catbg">', $comment['member']['link'], ':  <em class="smalltext">(', $comment['time'], ')</em>', ($comment['can_edit'] ? '<span class="floatright"><a href="' . $scripturl . '?action=moderate;area=reportedmembers;sa=editcomment;rid='. $context['report']['id'] .';mid='. $comment['id'] .';'. $context['session_var'] .'='. $context['session_id'] .'">'. $txt['mc_reportedp_comment_edit'] .'</a> | <a href="' . $scripturl . '?action=moderate;area=reportedmembers;sa=handlecomment;rid='. $context['report']['id'] .';mid='. $comment['id'] .';delete;'. $context['session_var'] .'='. $context['session_id']. ';'. $context['mod-reportC-delete_token_var'] .'='. $context['mod-reportC-delete_token'] .'" class="deleteModComment">'. $txt['mc_reportedp_comment_delete'] .'</a></span>' : '') ,'
+						</div></h4>';
+
+		echo '
+						<div class="windowbg">
+							<p class="content">', $comment['message'], '</p>
+						</div>';
+	}
+
+	echo '
+					<div class="title_bar">
+						<h3 class="titlebg">
+							<span class="floatleft">
+								', $txt['mc_reportedp_new_comment'], '
+							</span>
+						</h3>
+					</div>
+					<div class="content">
+						<textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
+						<div class="padding">
+							<input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit">
+							<input type="hidden" name="', $context['mod-reportC-add_token_var'], '" value="', $context['mod-reportC-add_token'], '">
+						</div>
+					</div>
+				</div>
+			<br>';
+
+	template_show_list('moderation_actions_list');
+
+	echo '
+			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
+		</form>
+	</div>';
+}
+
+?>

+ 0 - 317
Themes/default/ReportedPosts.template.php

@@ -1,317 +0,0 @@
-<?php
-/**
- * Simple Machines Forum (SMF)
- *
- * @package SMF
- * @author Simple Machines http://www.simplemachines.org
- * @copyright 2014 Simple Machines and individual contributors
- * @license http://www.simplemachines.org/about/smf/license.php BSD
- *
- * @version 2.1 Alpha 1
- */
-
-function template_reported_posts()
-{
-	global $context, $txt, $scripturl;
-
-	// Let them know the action was a success.
-	if (!empty($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=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'], '
-			</h3>
-		</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"');
-	$delete_button = create_button('delete.png', 'mc_reportedp_delete', 'mc_reportedp_delete', 'class="centericon"');
-
-	foreach ($context['reports'] as $report)
-	{
-		echo '
-		<div class="generic_list_wrapper ', $report['alternate'] ? 'windowbg' : 'windowbg2', '">
-			<div class="content">
-				<h5>
-					<strong>', !empty($report['topic']['board_name']) ? '<a href="' . $scripturl . '?board=' . $report['topic']['id_board'] . '.0">' . $report['topic']['board_name'] . '</a>' : '??', ' / <a href="', $report['topic']['href'], '">', $report['subject'], '</a></strong> ', $txt['mc_reportedp_by'], ' <strong>', $report['author']['link'], '</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=reports;sa=handle;ignore=', (int) !$report['ignore'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-ignore_token_var'], '=', $context['mod-report-ignore_token'], '" class="report_ignore" data-ignore="', (int) !$report['ignore'], '">', $report['ignore'] ? $unignore_button : $ignore_button, '</a></li>
-					<li><a href="', $scripturl, '?action=moderate;area=reports;sa=handle;closed=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a></li>';
-
-		// Delete message button.
-		if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards'])))
-			echo '
-					<li><a href="', $scripturl, '?action=deletemsg;topic=', $report['topic']['id'] ,'.0;msg=', $report['topic']['id_msg'] ,';modcenter;', $context['session_var'], '=', $context['session_id'], '" class="delete_message">', $delete_button, '</a></li>';
-
-		// Ban this user button.
-		if (!$report['closed'] && !empty($context['report_manage_bans']))
-			echo '
-					<li><a href="', $scripturl, '?action=admin;area=ban;sa=add', (!empty($report['author']['id']) ? ';u='. $report['author']['id'] : ';msg='. $report['topic']['id_msg']) ,';', $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">
-			', !empty($context['total_reports']) && $context['total_reports'] >= $context['reports_how_many'] ? '<div class="pagelinks floatleft">'. $context['page_index']. '</div>' : '' ,'
-			<div class="floatright">', !$context['view_closed'] ? '
-				<input type="hidden" name="'. $context['mod-report-close-all_token_var'] .'" value="'. $context['mod-report-close-all_token'] .'">
-				<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>';
-}
-
-
-// A block to show the current top reported posts.
-function template_reported_posts_block()
-{
-	global $context, $txt, $scripturl;
-
-	echo '
-		<div class="cat_bar">
-			<h3 class="catbg">
-				<span id="reported_posts_toggle" class="', !empty($context['admin_prefs']['mcrp']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
-				<a href="', $scripturl, '?action=moderate;area=reports" id="reported_posts_link">', $txt['mc_recent_reports'], '</a>
-			</h3>
-		</div>
-		<div class="windowbg" id="reported_posts_panel">
-			<div class="content modbox">
-				<ul class="reset">';
-
-		foreach ($context['reported_posts'] as $report)
-			echo '
-					<li class="smalltext">
-						<a href="', $report['report_href'], '">', $report['subject'], '</a> ', $txt['mc_reportedp_by'], ' ', $report['author']['link'], '
-					</li>';
-
-		// Don't have any watched users right now?
-		if (empty($context['reported_posts']))
-			echo '
-					<li>
-						<strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
-					</li>';
-
-		echo '
-				</ul>
-			</div>
-		</div>
-
-	<script><!-- // --><![CDATA[
-		var oReportedPostsPanelToggle = new smc_Toggle({
-			bToggleEnabled: true,
-			bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcrp']) ? 'true' : 'false', ',
-			aSwappableContainers: [
-				\'reported_posts_panel\'
-			],
-			aSwapImages: [
-				{
-					sId: \'reported_posts_toggle\',
-					altExpanded: ', JavaScriptEscape($txt['hide']), ',
-					altCollapsed: ', JavaScriptEscape($txt['show']), '
-				}
-			],
-			aSwapLinks: [
-				{
-					sId: \'reported_posts_link\',
-					msgExpanded: ', JavaScriptEscape($txt['mc_recent_reports']), ',
-					msgCollapsed: ', JavaScriptEscape($txt['mc_recent_reports']), '
-				}
-			],
-			oThemeOptions: {
-				bUseThemeSettings: true,
-				sOptionName: \'admin_preferences\',
-				sSessionVar: smf_session_var,
-				sSessionId: smf_session_id,
-				sThemeId: \'1\',
-				sAdditionalVars: \';admin_key=mcrp\'
-			}
-		});
-	// ]]></script>';
-}
-
-
-function template_viewmodreport()
-{
-	global $context, $scripturl, $txt;
-
-	// Let them know the action was a success.
-	if (!empty($context['report_post_action']))
-	{
-		echo '
-			<div class="infobox">
-				', $txt['report_action_'. $context['report_post_action']], '
-			</div>';
-	}
-
-	echo '
-	<div id="modcenter">
-		<form action="', $scripturl, '?action=moderate;area=reports;sa=handlecomment;rid=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
-			<div class="cat_bar">
-				<h3 class="catbg">
-					', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
-				</h3>
-			</div>
-			<div class="title_bar">
-				<h3 class="titlebg">
-					<span class="floatleft">
-						', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
-					</span>
-					<span class="floatright">';
-
-		// Make the buttons.
-		$close_button = create_button('close.png', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', '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"');
-
-		echo '
-						<a href="', $scripturl, '?action=moderate;area=reports;sa=handle;ignore=', (int) !$context['report']['ignore'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-ignore_token_var'], '=', $context['mod-report-ignore_token'], '" class="report_ignore" data-ignore="', !$context['report']['ignore'] ,'">', $context['report']['ignore'] ? $unignore_button : $ignore_button, '</a>
-						<a href="', $scripturl, '?action=moderate;area=reports;sa=handle;closed=', (int) !$context['report']['closed'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a>
-					</span>
-				</h3>
-			</div>
-			<div class="windowbg2">
-				<div class="content">
-					', $context['report']['body'], '
-				</div>
-			</div>
-			<br>
-			<div class="cat_bar">
-				<h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
-			</div>';
-
-	foreach ($context['report']['comments'] as $comment)
-		echo '
-			<div class="windowbg">
-				<div class="content">
-					<p class="smalltext">', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '</p>
-					<p>', $comment['message'], '</p>
-				</div>
-			</div>';
-
-	echo '
-			<br>
-			<div class="cat_bar">
-				<h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
-			</div>
-				<div>';
-
-	if (empty($context['report']['mod_comments']))
-		echo '
-				<div class="information">
-					<p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
-				</div>';
-
-	foreach ($context['report']['mod_comments'] as $comment)
-	{
-		echo
-						'<div class="cat_bar">
-						<h4 class="catbg">', $comment['member']['link'], ':  <em class="smalltext">(', $comment['time'], ')</em>', ($comment['can_edit'] ? '<span class="floatright"><a href="' . $scripturl . '?action=moderate;area=reports;sa=editcomment;rid='. $context['report']['id'] .';mid='. $comment['id'] .';'. $context['session_var'] .'='. $context['session_id'] .'">'. $txt['mc_reportedp_comment_edit'] .'</a> | <a href="' . $scripturl . '?action=moderate;area=reports;sa=handlecomment;rid='. $context['report']['id'] .';mid='. $comment['id'] .';delete;'. $context['session_var'] .'='. $context['session_id']. ';'. $context['mod-reportC-delete_token_var'] .'='. $context['mod-reportC-delete_token'] .'" class="deleteModComment">'. $txt['mc_reportedp_comment_delete'] .'</a></span>' : '') ,'
-						</div></h4>';
-
-		echo '
-						<div class="windowbg">
-							<p class="content">', $comment['message'], '</p>
-						</div>';
-	}
-
-	echo '
-					<div class="title_bar">
-						<h3 class="titlebg">
-							<span class="floatleft">
-								', $txt['mc_reportedp_new_comment'], '
-							</span>
-						</h3>
-					</div>
-					<div class="content">
-						<textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>
-						<div class="padding">
-							<input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit">
-							<input type="hidden" name="', $context['mod-reportC-add_token_var'], '" value="', $context['mod-reportC-add_token'], '">
-						</div>
-					</div>
-				</div>
-			<br>';
-
-	template_show_list('moderation_actions_list');
-
-	echo '
-			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
-		</form>
-	</div>';
-}
-
-function template_edit_comment()
-{
-	global $context, $scripturl, $txt;
-
-	echo '
-	<div id="modcenter">
-		<form action="', $scripturl, '?action=moderate;area=reports;sa=editcomment;mid=', $context['comment_id'], ';rid=', $context['report_id'] ,';save" method="post" accept-charset="', $context['character_set'], '">';
-
-	echo '
-			<br>
-			<div class="cat_bar">
-				<h3 class="catbg">', $txt['mc_modreport_edit_mod_comment'] ,'</h3>
-			</div>
-			<div class="windowbg2">
-				<div class="content">';
-
-	echo '
-					<textarea rows="6" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment">', $context['comment']['body'] ,'</textarea>
-					<div>
-						<input type="submit" name="edit_comment" value="', $txt['mc_modreport_edit_mod_comment'], '" class="button_submit">
-					</div>
-				</div>
-			</div>
-			<br>';
-
-	echo '
-			<input type="hidden" name="', $context['mod-reportC-edit_token_var'], '" value="', $context['mod-reportC-edit_token'], '">
-			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
-		</form>
-	</div>';
-}
-?>

+ 11 - 16
Themes/default/css/admin.css

@@ -435,7 +435,7 @@ div.quick_tasks {
 #support_resources, #credits_sections {
 	margin: 16px 0 -24px 0;
 	border: none;
-	border-top: 1px solid #bbb;	
+	border-top: 1px solid #bbb;
 }
 #credits_logo {
 	position: absolute;
@@ -781,21 +781,6 @@ dl.settings dt.small_caption {
 dl.settings dd.small_caption {
 	width: 79%;
 }
-/* Styles for the manage permissions section.
-------------------------------------------------- */
-#permissionForm .table_grid {
-	width: 100%;
-}
-#permissionForm .table_grid img.icon {
-	vertical-align: top;
-	width: 16px;
-}
-dl.admin_permissions dt {
-	width: 35%;
-}
-dl.admin_permissions dd {
-	width: 64%;
-}
 
 /* Styles for the manage search section.
 ------------------------------------------------- */
@@ -865,6 +850,16 @@ table.table_grid.perm_grid {
 	margin: 0.2em;
 	width: 49%;
 }
+.perm_grid img {
+	vertical-align: middle;
+	width: 16px;
+}
+dl.admin_permissions dt {
+	width: 35%;
+}
+dl.admin_permissions dd {
+	width: 64%;
+}
 .permission_groups {
 	padding: 0;
 	margin: 0;

+ 1 - 1
Themes/default/css/index.css

@@ -2885,7 +2885,7 @@ dl.register_form dd {
 	vertical-align: middle;
 }
 
-tr.windowbg td, tr.windowbg2 td, tr.highlight2 td {
+tr.windowbg td, tr.windowbg2 td, tr.highlight2 td, .table_grid tr td {
 	padding: 4px 8px;
 }
 #credits p {

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

@@ -84,6 +84,8 @@ $txt['permissions_board_desc'] = '<strong>Note</strong>: changing these board pe
 $txt['permissions_commit'] = 'Save changes';
 $txt['permissions_on'] = 'in profile';
 $txt['permissions_local_for'] = 'Permissions for group';
+$txt['permissions_option_own'] = 'Own';
+$txt['permissions_option_any'] = 'Any';
 $txt['permissions_option_on'] = 'A';
 $txt['permissions_option_off'] = 'X';
 $txt['permissions_option_deny'] = 'D';
@@ -182,6 +184,10 @@ $txt['permissionname_profile_remove'] = 'Delete account';
 $txt['permissionhelp_profile_remove'] = 'This permission allows a user to delete his account, when set to \'Own Account\'.';
 $txt['permissionname_profile_remove_own'] = 'Own account';
 $txt['permissionname_profile_remove_any'] = 'Any account';
+$txt['permissionname_view_warning'] = 'View warning status';
+$txt['permissionname_view_warning_own'] = 'Own account';
+$txt['permissionname_view_warning_any'] = 'Any account';
+$txt['permissionhelp_view_warning'] = 'Allows users to view their own warning status and history (\'Own account\') or that of any user (\'Any account\')';
 
 $txt['permissionname_report_user'] = 'Report users\' profiles';
 $txt['permissionhelp_report_user'] = 'This permission will allow members to report other users\' profiles to the admins to alert them of spam or other inappropriate content in the profile.';

+ 29 - 11
other/upgrade_2-1_mysql.sql

@@ -97,10 +97,9 @@ $is_done = false;
 while (!$is_done)
 {
 	nextSubStep($substep);
-	$fileHash = '';
 
 	$request = upgrade_query("
-		SELECT id_attach, id_folder, filename, file_hash, mime_type
+		SELECT id_attach, id_member, id_folder, filename, file_hash, mime_type
 		FROM {$db_prefix}attachments
 		WHERE attachment_type != 1
 		LIMIT $_GET[a], 100");
@@ -114,6 +113,8 @@ while (!$is_done)
 		// The current folder.
 		$currentFolder = !empty($modSettings['currentAttachmentUploadDir']) ? $modSettings['attachmentUploadDir'][$row['id_folder']] : $modSettings['attachmentUploadDir'];
 
+		$fileHash = '';
+
 		// Old School?
 		if (empty($row['file_hash']))
 		{
@@ -134,12 +135,13 @@ while (!$is_done)
 			// Create a nice hash.
 			$fileHash = sha1(md5($row['filename'] . time()) . mt_rand());
 
-			// The old file, we need to know if the filename was encrypted or not.
-			if (file_exists($currentFolder . '/' . $row['id_attach']. '_' . strtr($row['filename'], '.', '_') . md5($row['filename'])))
-				$oldFile = $currentFolder . '/' . $row['id_attach']. '_' . strtr($row['filename'], '.', '_') . md5($row['filename']);
-
-			else if (file_exists($currentFolder . '/' . $row['filename']));
+			// Iterate through the possible attachment names until we find the one that exists
+			$oldFile = $currentFolder . '/' . $row['id_attach']. '_' . strtr($row['filename'], '.', '_') . md5($row['filename']);
+			if (!file_exists($oldFile))
+			{
 				$oldFile = $currentFolder . '/' . $row['filename'];
+				if (!file_exists($oldFile)) $oldFile = false;
+			}
 
 			// Build the new file.
 			$newFile = $currentFolder . '/' . $row['id_attach'] . '_' . $fileHash .'.dat';
@@ -152,17 +154,26 @@ while (!$is_done)
 			$newFile = $currentFolder . '/' . $row['id_attach'] . '_' . $row['file_hash'] .'.dat';
 		}
 
+		if (!$oldFile)
+		{
+			// Existing attachment could not be found. Just skip it...
+			continue;
+		}
+
 		// Check if the av is an attachment
 		if ($row['id_member'] != 0)
+		{
 			if (rename($oldFile, $custom_av_dir . '/' . $row['filename']))
 				upgrade_query("
 					UPDATE {$db_prefix}attachments
 					SET file_hash = '', attachment_type = 1
 					WHERE id_attach = $row[id_attach]");
-
+		}
 		// Just a regular attachment.
 		else
+		{
 			rename($oldFile, $newFile);
+		}
 
 		// Only update this if it was successful and the file was using the old system.
 		if (empty($row['file_hash']) && !empty($fileHash) && file_exists($newFile) && !file_exists($oldFile))
@@ -1082,12 +1093,19 @@ ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
 			{
 				// Keep track of the index of this label - we'll need that in a bit...
 				$label_info[$row['id_member']][$label] = $index;
-				$inserts[] = array($row['id_member'], $label);
 			}
 		}
 
 		$smcFunc['db_free_result']($get_labels);
 
+		foreach ($label_info AS $id_member => $labels)
+		{
+			foreach ($labels as $label => $index)
+			{
+				$inserts[] = array($id_member, $label);
+			}
+		}
+
 		if (!empty($inserts))
 		{
 			$smcFunc['db_insert']('', '{db_prefix}pm_labels', array('id_member' => 'int', 'name' => 'string-30'), $inserts, array());
@@ -1119,8 +1137,8 @@ ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
 		while ($label_row = $smcFunc['db_fetch_assoc']($get_new_label_ids))
 		{
 			// Map the old index values to the new ID values...
-			$old_index = $label_info[$row['id_member']][$row['label_name']];
-			$label_info_2[$row['id_member']][$old_index] = $row['id_label'];
+			$old_index = $label_info[$label_row['id_member']][$label_row['name']];
+			$label_info_2[$label_row['id_member']][$old_index] = $label_row['id_label'];
 		}
 
 		$smcFunc['db_free_result']($get_new_label_ids);