<commit_before><?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
 */

/**
 * Before showing users a registration form, show them the registration agreement.
 */
function template_registration_agreement()
{
	global $context, $scripturl, $txt, $modSettings;

	echo '
		<form action="', $scripturl, '?action=register" method="post" accept-charset="', $context['character_set'], '" id="registration">
			<div class="cat_bar">
				<h3 class="catbg">', $txt['registration_agreement'], '</h3>
			</div>
			<div class="roundframe">
				<p>', $context['agreement'], '</p>
			</div>
			<div id="confirm_buttons">';

	// Age restriction in effect?
	if ($context['show_coppa'])
		echo '
				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button_submit"><br><br>
				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button_submit">';
	else
		echo '
				<input type="submit" name="accept_agreement" value="', $txt['agreement_agree'], '" class="button_submit">';

	echo '
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
			<input type="hidden" name="', $context['register_token_var'], '" value="', $context['register_token'], '">
			</div>
			<input type="hidden" name="step" value="1">
		</form>';

}

// Before registering - get their information.
function template_registration_form()
{
	global $context, $settings, $scripturl, $txt, $modSettings;

	echo '
		<script><!-- // --><![CDATA[
			function verifyAgree()
			{
				if (currentAuthMethod == \'passwd\' && document.forms.registration.smf_autov_pwmain.value != document.forms.registration.smf_autov_pwverify.value)
				{
					alert("', $txt['register_passwords_differ_js'], '");
					return false;
				}

				return true;
			}

			var currentAuthMethod = \'passwd\';
		// ]]></script>';

	// Any errors?
	if (!empty($context['registration_errors']))
	{
		echo '
		<div class="errorbox">
			<span>', $txt['registration_errors_occurred'], '</span>
			<ul class="reset">';

		// Cycle through each error and display an error message.
		foreach ($context['registration_errors'] as $error)
				echo '
				<li>', $error, '</li>';

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

	echo '
		<form action="', $scripturl, '?action=register2" method="post" accept-charset="', $context['character_set'], '" name="registration" id="registration" onsubmit="return verifyAgree();">
			<div class="cat_bar">
				<h3 class="catbg">', $txt['registration_form'], '</h3>
			</div>
			<div class="title_bar title_top">
				<h4 class="titlebg">', $txt['required_info'], '</h4>
			</div>
			<div class="windowbg2">
				<fieldset class="content">
					<dl class="register_form">
						<dt><strong><label for="smf_autov_username">', $txt['username'], ':</label></strong></dt>
						<dd>
							<input type="text" name="user" id="smf_autov_username" size="30" tabindex="', $context['tabindex']++, '" maxlength="25" value="', isset($context['username']) ? $context['username'] : '', '" class="input_text">
							<span id="smf_autov_username_div" style="display: none;">
								<a id="smf_autov_username_link" href="#">
									<span id="smf_autov_username_img" class="field_icons check"></span>
								</a>
							</span>
						</dd>
						<dt><strong><label for="smf_autov_reserve1">', $txt['user_email_address'], ':</label></strong></dt>
						<dd>
							<input type="text" name="email" id="smf_autov_reserve1" size="30" tabindex="', $context['tabindex']++, '" value="', isset($context['email']) ? $context['email'] : '', '" class="input_text">
						</dd>
						<dt><strong><label for="allow_email">', $txt['allow_user_email'], ':</label></strong></dt>
						<dd>
							<input type="checkbox" name="allow_email" id="allow_email" tabindex="', $context['tabindex']++, '" class="input_check">
						</dd>
					</dl>';

	// If OpenID is enabled, give the user a choice between password and OpenID.
	if (!empty($modSettings['enableOpenID']) && $modSettings['enableOpenID'] != 2)
	{
		echo '
					<dl class="register_form" id="authentication_group">
						<dt>
							<strong>', $txt['authenticate_label'], ':</strong>
							<a href="', $scripturl, '?action=helpadmin;help=register_openid" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a>
						</dt>
						<dd>
							<label for="auth_pass" id="option_auth_pass">
								<input type="radio" name="authenticate" value="passwd" id="auth_pass" tabindex="', $context['tabindex']++, '"', empty($context['openid']) ? ' checked' : '', ' onclick="updateAuthMethod();" class="input_radio">
								', $txt['authenticate_password'], '
							</label>
							<label for="auth_openid" id="option_auth_openid">
								<input type="radio" name="authenticate" value="openid" id="auth_openid" tabindex="', $context['tabindex']++, '"', !empty($context['openid']) ? ' checked' : '', ' onclick="updateAuthMethod();" class="input_radio">
								', $txt['authenticate_openid'], '
							</label>
						</dd>
					</dl>';
	}

	echo '
					<dl class="register_form" id="password1_group">
						<dt><strong><label for="smf_autov_pwmain">', ucwords($txt['choose_pass']), ':</label></strong></dt>
						<dd>
							<input type="password" name="<PASSWORD>" id="smf_autov_pwmain" size="30" tabindex="', $context['tabindex']++, '" class="input_password">
							<span id="smf_autov_pwmain_div" style="display: none;">
								<span id="smf_autov_pwmain_img" class="field_icons invalid"></span>
							</span>
						</dd>
					</dl>
					<dl class="register_form" id="password2_group">
						<dt><strong><label for="smf_autov_pwverify">', ucwords($txt['verify_pass']), ':</label></strong></dt>
						<dd>
							<input type="password" name="<PASSWORD>" id="smf_autov_pwverify" size="30" tabindex="', $context['tabindex']++, '" class="input_password">
							<span id="smf_autov_pwverify_div" style="display: none;">
								<span id="smf_autov_pwverify_img" class="field_icons valid"></span>
							</span>
						</dd>
					</dl>';

	// If OpenID is enabled, give the user a choice between password and OpenID.
	if (!empty($modSettings['enableOpenID']) && $modSettings['enableOpenID'] != 2)
	{
		echo '

					<dl class="register_form" id="openid_group">
						<dt><strong>', $txt['authenticate_openid_url'], ':</strong></dt>
						<dd>
							<input type="text" name="openid_identifier" id="openid_url" size="30" tabindex="', $context['tabindex']++, '" value="', isset($context['openid']) ? $context['openid'] : '', '" class="input_text openid_login">
						</dd>
					</dl>';
	}

	// If there is any field marked as required, show it here!
	if (!empty($context['custom_fields_required']) && !empty($context['custom_fields']))
	{
		echo '

					<dl class="register_form">';

		foreach ($context['custom_fields'] as $field)
			if ($field['show_reg'] > 1)
				echo '
						<dt>
							<strong', !empty($field['is_error']) ? ' style="color: red;"' : '', '>', $field['name'], ':</strong>
							<span class="smalltext">', $field['desc'], '</span>
						</dt>
						<dd>', preg_replace_callback('~<(input|select|textarea) ~', create_function('$matches', '
							global $context;
							return \'<\' . $matches[1] . \' tabindex="\' . $context[\'tabindex\']++ . \'"\';
						')
					, $field['input_html']), '</dd>';

		echo '
					</dl>';
	}

	echo '
				</fieldset>
			</div>';

	// If we have either of these, show the extra group.
	if (!empty($context['profile_fields']) || !empty($context['custom_fields']))
	{
		echo '
			<div class="title_bar title_top"><commit_msg>Avoid one more headache and use str_replace to add the tabindex<commit_after><?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
 */

/**
 * Before showing users a registration form, show them the registration agreement.
 */
function template_registration_agreement()
{
	global $context, $scripturl, $txt, $modSettings;

	echo '
		<form action="', $scripturl, '?action=register" method="post" accept-charset="', $context['character_set'], '" id="registration">
			<div class="cat_bar">
				<h3 class="catbg">', $txt['registration_agreement'], '</h3>
			</div>
			<div class="roundframe">
				<p>', $context['agreement'], '</p>
			</div>
			<div id="confirm_buttons">';

	// Age restriction in effect?
	if ($context['show_coppa'])
		echo '
				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button_submit"><br><br>
				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button_submit">';
	else
		echo '
				<input type="submit" name="accept_agreement" value="', $txt['agreement_agree'], '" class="button_submit">';

	echo '
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
			<input type="hidden" name="', $context['register_token_var'], '" value="', $context['register_token'], '">
			</div>
			<input type="hidden" name="step" value="1">
		</form>';

}

// Before registering - get their information.
function template_registration_form()
{
	global $context, $settings, $scripturl, $txt, $modSettings;

	echo '
		<script><!-- // --><![CDATA[
			function verifyAgree()
			{
				if (currentAuthMethod == \'passwd\' && document.forms.registration.smf_autov_pwmain.value != document.forms.registration.smf_autov_pwverify.value)
				{
					alert("', $txt['register_passwords_differ_js'], '");
					return false;
				}

				return true;
			}

			var currentAuthMethod = \'passwd\';
		// ]]></script>';

	// Any errors?
	if (!empty($context['registration_errors']))
	{
		echo '
		<div class="errorbox">
			<span>', $txt['registration_errors_occurred'], '</span>
			<ul class="reset">';

		// Cycle through each error and display an error message.
		foreach ($context['registration_errors'] as $error)
				echo '
				<li>', $error, '</li>';

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

	echo '
		<form action="', $scripturl, '?action=register2" method="post" accept-charset="', $context['character_set'], '" name="registration" id="registration" onsubmit="return verifyAgree();">
			<div class="cat_bar">
				<h3 class="catbg">', $txt['registration_form'], '</h3>
			</div>
			<div class="title_bar title_top">
				<h4 class="titlebg">', $txt['required_info'], '</h4>
			</div>
			<div class="windowbg2">
				<fieldset class="content">
					<dl class="register_form">
						<dt><strong><label for="smf_autov_username">', $txt['username'], ':</label></strong></dt>
						<dd>
							<input type="text" name="user" id="smf_autov_username" size="30" tabindex="', $context['tabindex']++, '" maxlength="25" value="', isset($context['username']) ? $context['username'] : '', '" class="input_text">
							<span id="smf_autov_username_div" style="display: none;">
								<a id="smf_autov_username_link" href="#">
									<span id="smf_autov_username_img" class="field_icons check"></span>
								</a>
							</span>
						</dd>
						<dt><strong><label for="smf_autov_reserve1">', $txt['user_email_address'], ':</label></strong></dt>
						<dd>
							<input type="text" name="email" id="smf_autov_reserve1" size="30" tabindex="', $context['tabindex']++, '" value="', isset($context['email']) ? $context['email'] : '', '" class="input_text">
						</dd>
						<dt><strong><label for="allow_email">', $txt['allow_user_email'], ':</label></strong></dt>
						<dd>
							<input type="checkbox" name="allow_email" id="allow_email" tabindex="', $context['tabindex']++, '" class="input_check">
						</dd>
					</dl>';

	// If OpenID is enabled, give the user a choice between password and OpenID.
	if (!empty($modSettings['enableOpenID']) && $modSettings['enableOpenID'] != 2)
	{
		echo '
					<dl class="register_form" id="authentication_group">
						<dt>
							<strong>', $txt['authenticate_label'], ':</strong>
							<a href="', $scripturl, '?action=helpadmin;help=register_openid" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a>
						</dt>
						<dd>
							<label for="auth_pass" id="option_auth_pass">
								<input type="radio" name="authenticate" value="passwd" id="auth_pass" tabindex="', $context['tabindex']++, '"', empty($context['openid']) ? ' checked' : '', ' onclick="updateAuthMethod();" class="input_radio">
								', $txt['authenticate_password'], '
							</label>
							<label for="auth_openid" id="option_auth_openid">
								<input type="radio" name="authenticate" value="openid" id="auth_openid" tabindex="', $context['tabindex']++, '"', !empty($context['openid']) ? ' checked' : '', ' onclick="updateAuthMethod();" class="input_radio">
								', $txt['authenticate_openid'], '
							</label>
						</dd>
					</dl>';
	}

	echo '
					<dl class="register_form" id="password1_group">
						<dt><strong><label for="smf_autov_pwmain">', ucwords($txt['choose_pass']), ':</label></strong></dt>
						<dd>
							<input type="password" name="passwrd1" id="smf_autov_pwmain" size="30" tabindex="', $context['tabindex']++, '" class="input_password">
							<span id="smf_autov_pwmain_div" style="display: none;">
								<span id="smf_autov_pwmain_img" class="field_icons invalid"></span>
							</span>
						</dd>
					</dl>
					<dl class="register_form" id="password2_group">
						<dt><strong><label for="smf_autov_pwverify">', ucwords($txt['verify_pass']), ':</label></strong></dt>
						<dd>
							<input type="password" name="passw<PASSWORD>" id="smf_autov_pwverify" size="30" tabindex="', $context['tabindex']++, '" class="input_password">
							<span id="smf_autov_pwverify_div" style="display: none;">
								<span id="smf_autov_pwverify_img" class="field_icons valid"></span>
							</span>
						</dd>
					</dl>';

	// If OpenID is enabled, give the user a choice between password and OpenID.
	if (!empty($modSettings['enableOpenID']) && $modSettings['enableOpenID'] != 2)
	{
		echo '

					<dl class="register_form" id="openid_group">
						<dt><strong>', $txt['authenticate_openid_url'], ':</strong></dt>
						<dd>
							<input type="text" name="openid_identifier" id="openid_url" size="30" tabindex="', $context['tabindex']++, '" value="', isset($context['openid']) ? $context['openid'] : '', '" class="input_text openid_login">
						</dd>
					</dl>';
	}

	// If there is any field marked as required, show it here!
	if (!empty($context['custom_fields_required']) && !empty($context['custom_fields']))
	{
		echo '

					<dl class="register_form">';

		foreach ($context['custom_fields'] as $field)
			if ($field['show_reg'] > 1)
				echo '
						<dt>
							<strong', !empty($field['is_error']) ? ' style="color: red;"' : '', '>', $field['name'], ':</strong>
							<span class="smalltext">', $field['desc'], '</span>
						</dt>
						<dd>', str_replace('name="', 'tabindex="' . $context['tabindex']++ .'" name="', $field['input_html']), '</dd>';

		echo '
					</dl>';
	}

	echo '
				</fieldset>
			</div>';

	// If we have either of these, show the extra group.
	if (!empty($context['profile_fields']) || !empty($context['custom_fields']))
	{
		echo '
			<div class="title_bar title_top">
{'fraction_non_alphanumeric': 0.21261214742141613, 'fraction_numerical': 0.004647260052927128, 'mean_word_length': 4.351986183074266, 'pattern_counts': {'":': 0, '<': 302, '<?xml version=': 0, '>': 300, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '1867111', 'n_tokens_mistral': 6211, 'n_tokens_neox': 5070, 'n_words': 1015}