<commit_before><?php

/**
 * @name      <NAME>
 * @copyright Elkarte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * This software is a derived product, based on:
 *
 * Simple Machines Forum (SMF)
 * copyright:	2011 Simple Machines (http://www.simplemachines.org)
 * license:  	BSD, See included LICENSE.TXT for terms and conditions.
 *
 * @version 1.0 Alpha
 */

function template_moderation_center()
{
	global $settings, $options, $context, $txt, $scripturl;

	// Show a welcome message to the user.
	echo '
					<div id="modcenter">
						<div id="mod_main_section" >';

	$alternate = true;
	// Show all the blocks they want to see.
	foreach ($context['mod_blocks'] as $block)
	{
		$block_function = 'template_' . $block;

		echo '
							<div class="modblock_', $alternate ? 'left' : 'right', '">', function_exists($block_function) ? $block_function() : '', '</div>';

		if (!$alternate)
			echo '
							<br class="clear" />';

		$alternate = !$alternate;
	}

	echo '
						</div>
					</div>';
}

function template_latest_news()
{
	global $settings, $options, $context, $txt, $scripturl;

	echo '
								<div class="cat_bar">
									<h3 class="catbg">
										<a href="', $scripturl, '?action=quickhelp;help=live_news" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics_hd.png" alt="', $txt['help'], '" class="icon" /></a> ', $txt['mc_latest_news'], '
									</h3>
								</div>
								<div class="windowbg">
									<div class="content">
										<div id="ourAnnouncements" class="smalltext">', $txt['mc_cannot_connect_sm'], '</div>
									</div>
								</div>';

	// This requires a lot of javascript...
	echo '
								<script type="text/javascript" src="', $scripturl, '?action=viewadminfile;filename=current-version.js"></script>
								<script type="text/javascript" src="', $scripturl, '?action=viewadminfile;filename=latest-news.js"></script>
								<script type="text/javascript"><!-- // --><![CDATA[
									var oAdminIndex = new smf_AdminIndex({
										sSelf: \'oAdminCenter\',
										bLoadAnnouncements: true,
										sAnnouncementTemplate: ', JavaScriptEscape('
											<dl>
												%content%
											</dl>
										'), ',
										sAnnouncementMessageTemplate: ', JavaScriptEscape('
											<dt><a href="%href%">%subject%</a> ' . $txt['on'] . ' %time%</dt>
											<dd>
												%message%
											</dd>
										'), ',
										sAnnouncementContainerId: \'ourAnnouncements\'
									});
								// ]]></script>';

}

// Show all the group requests the user can see.
function template_group_requests_block()
{
	global $settings, $options, $context, $txt, $scripturl;

	echo '
								<div class="cat_bar">
									<h3 class="catbg">
										<a href="', $scripturl, '?action=groups;sa=requests">', $txt['mc_group_requests'], '</a>
									</h3>
								</div>
								<div class="windowbg">
									<div class="content modbox">
										<ul class="reset">';

		foreach ($context['group_requests'] as $request)
			echo '
											<li class="smalltext">
												<a href="', $request['request_href'], '">', $request['group']['name'], '</a> ', $txt['mc_groupr_by'], ' ', $request['member']['link'], '
											</li>';

		// Don't have any watched users right now?
		if (empty($context['group_requests']))
			echo '
											<li>
												<strong class="smalltext">', $txt['mc_group_requests_none'], '</strong>
											</li>';

		echo '
										</ul>
									</div>
								</div>';
}

// A block to show the current top reported posts.
function template_reported_posts_block()
{
	global $settings, $options, $context, $txt, $scripturl;

	echo '
								<div class="cat_bar">
									<h3 class="catbg">
										<a href="', $scripturl, '?action=moderate;area=reports">', $txt['mc_recent_reports'], '</a>
									</h3>
								</div>
								<div class="windowbg">
									<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>';
}

function template_watched_users()
{
	global $settings, $options, $context, $txt, $scripturl;

	echo '
						<div class="cat_bar">
							<h3 class="catbg">
								<a href="', $scripturl, '?action=moderate;area=userwatch">', $txt['mc_watched_users'], '</a>
							</h3>
						</div>
						<div class="windowbg">
							<div class="content modbox">
								<ul class="reset">';

		foreach ($context['watched_users'] as $user)
			echo '
									<li>
										<span class="smalltext">', sprintf(!empty($user['last_login']) ? $txt['mc_seen'] : $txt['mc_seen_never'], $user['link'], $user['last_login']), '</span>
									</li>';

		// Don't have any watched users right now?
		if (empty($context['watched_users']))
			echo '
									<li>
										<strong class="smalltext">', $txt['mc_watched_users_none'], '</strong>
									</li>';

		echo '
								</ul>
							</div>
						</div>';
}

// Little section for making... notes.
function template_notes()
{
	global $settings, $options, $context, $txt, $scripturl;

	echo '
						<form action="', $scripturl, '?action=moderate;area=index" method="post">
							<div class="cat_bar">
								<h3 class="catbg">', $txt['mc_notes'], '</h3>
							</div>
							<div class="windowbg">
								<div class="content modbox">';

		if (!empty($context['notes']))
		{
			echo '
									<ul class="reset moderation_notes">';

			// Cycle through the notes.
			foreach ($context['notes'] as $note)
				echo '
										<li class="smalltext"><a href="', $note['delete_href'], '"><img src="', $settings['images_url'], '/pm_recipient_delete.png" alt="" /></a> <strong>', $note['author']['link'], ':</strong> ', $note['text'], '</li>';

			echo '
									</ul>
									<div class="pagesection notes">
										<span class="smalltext">', $context['page_index'], '</span>
									</div>';
		}

		echo '
									<div class="floatleft post_note">
										<input type="text" name="new_note" value="', $txt['mc_click_add_note'], '" style="width: 95%;" onclick="if (this.value == \'', $txt['mc_click_add_note'], '\') this.value = \'\';" class="input_text" />
									</div>
									<input type="submit" name="makenote" value="', $txt['mc_add_note'], '" class="button_submit" />
								</div>
							</div>
							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
						</form>';
}

function template_reported_posts()
{
	global $settings, $options, $context, $txt, $scripturl;

	echo '
					<form id="reported_posts" action="', $scripturl, '?action=moderate;area=reports', $context['view_closed'] ? ';sa=closed' : '', ';start=', $context['start'], '" method="post" accept-charset="UTF-8">
						<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"');

	foreach ($context['reports'] as $report)
	{
		echo '
						<div class="generic_list_wrapper ', $report['alternate'] ? 'windowbg' : 'windowbg2', '">
							<div class="content">
								<h5>
									<strong><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', $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=reports', $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>
									<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>';
}

// Show a list of all the unapproved posts
function template_unapproved_posts()
{
	global $settings, $options, $context, $txt, $scripturl;

	// Just a big table of it all really...
	echo '
					<div id="modcenter">
					<form action="', $scripturl, '?action=moderate;area=postmod;start=', $context['start'], ';sa=', $context['current_view'], '" method="post" accept-charset="UTF-8"><commit_msg>! Update the reported posts template so its formated like the rest (e.g. unapproved etc)<commit_after><?php

/**
 * @name      Elkarte Forum
 * @copyright Elkarte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * This software is a derived product, based on:
 *
 * Simple Machines Forum (SMF)
 * copyright:	2011 Simple Machines (http://www.simplemachines.org)
 * license:  	BSD, See included LICENSE.TXT for terms and conditions.
 *
 * @version 1.0 Alpha
 */

function template_moderation_center()
{
	global $settings, $options, $context, $txt, $scripturl;

	// Show a welcome message to the user.
	echo '
					<div id="modcenter">
						<div id="mod_main_section" >';

	$alternate = true;
	// Show all the blocks they want to see.
	foreach ($context['mod_blocks'] as $block)
	{
		$block_function = 'template_' . $block;

		echo '
							<div class="modblock_', $alternate ? 'left' : 'right', '">', function_exists($block_function) ? $block_function() : '', '</div>';

		if (!$alternate)
			echo '
							<br class="clear" />';

		$alternate = !$alternate;
	}

	echo '
						</div>
					</div>';
}

function template_latest_news()
{
	global $settings, $options, $context, $txt, $scripturl;

	echo '
								<div class="cat_bar">
									<h3 class="catbg">
										<a href="', $scripturl, '?action=quickhelp;help=live_news" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics_hd.png" alt="', $txt['help'], '" class="icon" /></a> ', $txt['mc_latest_news'], '
									</h3>
								</div>
								<div class="windowbg">
									<div class="content">
										<div id="ourAnnouncements" class="smalltext">', $txt['mc_cannot_connect_sm'], '</div>
									</div>
								</div>';

	// This requires a lot of javascript...
	echo '
								<script type="text/javascript" src="', $scripturl, '?action=viewadminfile;filename=current-version.js"></script>
								<script type="text/javascript" src="', $scripturl, '?action=viewadminfile;filename=latest-news.js"></script>
								<script type="text/javascript"><!-- // --><![CDATA[
									var oAdminIndex = new smf_AdminIndex({
										sSelf: \'oAdminCenter\',
										bLoadAnnouncements: true,
										sAnnouncementTemplate: ', JavaScriptEscape('
											<dl>
												%content%
											</dl>
										'), ',
										sAnnouncementMessageTemplate: ', JavaScriptEscape('
											<dt><a href="%href%">%subject%</a> ' . $txt['on'] . ' %time%</dt>
											<dd>
												%message%
											</dd>
										'), ',
										sAnnouncementContainerId: \'ourAnnouncements\'
									});
								// ]]></script>';

}

// Show all the group requests the user can see.
function template_group_requests_block()
{
	global $settings, $options, $context, $txt, $scripturl;

	echo '
								<div class="cat_bar">
									<h3 class="catbg">
										<a href="', $scripturl, '?action=groups;sa=requests">', $txt['mc_group_requests'], '</a>
									</h3>
								</div>
								<div class="windowbg">
									<div class="content modbox">
										<ul class="reset">';

		foreach ($context['group_requests'] as $request)
			echo '
											<li class="smalltext">
												<a href="', $request['request_href'], '">', $request['group']['name'], '</a> ', $txt['mc_groupr_by'], ' ', $request['member']['link'], '
											</li>';

		// Don't have any watched users right now?
		if (empty($context['group_requests']))
			echo '
											<li>
												<strong class="smalltext">', $txt['mc_group_requests_none'], '</strong>
											</li>';

		echo '
										</ul>
									</div>
								</div>';
}

// A block to show the current top reported posts.
function template_reported_posts_block()
{
	global $settings, $options, $context, $txt, $scripturl;

	echo '
								<div class="cat_bar">
									<h3 class="catbg">
										<a href="', $scripturl, '?action=moderate;area=reports">', $txt['mc_recent_reports'], '</a>
									</h3>
								</div>
								<div class="windowbg">
									<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>';
}

function template_watched_users()
{
	global $settings, $options, $context, $txt, $scripturl;

	echo '
						<div class="cat_bar">
							<h3 class="catbg">
								<a href="', $scripturl, '?action=moderate;area=userwatch">', $txt['mc_watched_users'], '</a>
							</h3>
						</div>
						<div class="windowbg">
							<div class="content modbox">
								<ul class="reset">';

		foreach ($context['watched_users'] as $user)
			echo '
									<li>
										<span class="smalltext">', sprintf(!empty($user['last_login']) ? $txt['mc_seen'] : $txt['mc_seen_never'], $user['link'], $user['last_login']), '</span>
									</li>';

		// Don't have any watched users right now?
		if (empty($context['watched_users']))
			echo '
									<li>
										<strong class="smalltext">', $txt['mc_watched_users_none'], '</strong>
									</li>';

		echo '
								</ul>
							</div>
						</div>';
}

// Little section for making... notes.
function template_notes()
{
	global $settings, $options, $context, $txt, $scripturl;

	echo '
						<form action="', $scripturl, '?action=moderate;area=index" method="post">
							<div class="cat_bar">
								<h3 class="catbg">', $txt['mc_notes'], '</h3>
							</div>
							<div class="windowbg">
								<div class="content modbox">';

		if (!empty($context['notes']))
		{
			echo '
									<ul class="reset moderation_notes">';

			// Cycle through the notes.
			foreach ($context['notes'] as $note)
				echo '
										<li class="smalltext"><a href="', $note['delete_href'], '"><img src="', $settings['images_url'], '/pm_recipient_delete.png" alt="" /></a> <strong>', $note['author']['link'], ':</strong> ', $note['text'], '</li>';

			echo '
									</ul>
									<div class="pagesection notes">
										<span class="smalltext">', $context['page_index'], '</span>
									</div>';
		}

		echo '
									<div class="floatleft post_note">
										<input type="text" name="new_note" value="', $txt['mc_click_add_note'], '" style="width: 95%;" onclick="if (this.value == \'', $txt['mc_click_add_note'], '\') this.value = \'\';" class="input_text" />
									</div>
									<input type="submit" name="makenote" value="', $txt['mc_add_note'], '" class="button_submit" />
								</div>
							</div>
							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
						</form>';
}

function template_reported_posts()
{
	global $settings, $options, $context, $txt, $scripturl;

	echo '
					<form id="reported_posts" action="', $scripturl, '?action=moderate;area=reports', $context['view_closed'] ? ';sa=closed' : '', ';start=', $context['start'], '" method="post" accept-charset="UTF-8">
						<div class="cat_bar">
							<h3 class="catbg">
								', $context['view_closed'] ? $txt['mc_reportedp_closed'] : $txt['mc_reportedp_active'], '
							</h3>
						</div>';

	if (!empty($context['reports']))
		echo '
						<div class="pagesection floatleft">
							', $context['page_index'], '
						</div>';

	foreach ($context['reports'] as $report)
	{
		echo '
						<div class="topic clear">
							<div class="', $report['alternate'] ? 'windowbg' : 'windowbg2', ' core_posts">
								<div class="content">
									<h5>
										<strong><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'], '

									<ul class="quickbuttons">
										<li>
											<a href="', $report['report_href'], '" class="details_button">', $txt['mc_reportedp_details'], '</a>
										</li>
										<li>
											<a href="', $scripturl, '?action=moderate;area=reports', $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'] . '\');"' : '', ' class="ignore_button">', $report['ignore'] ? $txt['mc_reportedp_unignore'] : $txt['mc_reportedp_ignore'], '</a>
										</li>
										<li>
											<a href="', $scripturl, '?action=moderate;area=reports', $context['view_closed'] ? ';sa=closed' : '', ';close=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" class="close_button">', $context['view_closed'] ? $txt['mc_reportedp_open'] : $txt['mc_reportedp_close'], '</a>
										</li>
										<li class="inline_mod_check">'
											, !$context['view_closed'] ? '<input type="checkbox" name="close[]" value="' . $report['id'] . '" />' : '', '
										</li>
									</ul>
								</div>
							</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>';
	else
		echo '
						<div class="pagesection">
							<div class="floatleft">
								<div class="pagelinks">', $context['page_index'], '</div>
							</div>
							<div class="floatright">
								', !$context['view_closed'] ? '<input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button_submit" />' : '', '
							</div>
						</div>';

	echo '
						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
					</form>';
}

// Show a list of all the unapproved posts
function template_unapproved_posts()
{
	global $settings, $options, $context, $txt, $scripturl;

	// Just a big table of it all really...
	echo '
					<div id="modcenter">
					<form action="', $scripturl, '?action=moderate;area=postmod;start=', $context['start'], ';sa=', $context['current_view'], '" method="post" accept-charset="UTF-8">
{'fraction_non_alphanumeric': 0.21534833091436864, 'fraction_numerical': 0.0024492017416545718, 'mean_word_length': 3.1128520798358514, 'pattern_counts': {'":': 0, '<': 373, '<?xml version=': 0, '>': 371, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6072263', 'n_tokens_mistral': 9743, 'n_tokens_neox': 7117, 'n_words': 1483}