Browse Source

! Disabling showing spiders could cause sql errors in Whos online (Who.php) [Bug 4840]
! It was impossible to register with coppa enabled and agreement disabled (Register.php, Register template, Login language) [Bug 4817]

Spuds 13 years ago
parent
commit
cf04d19893

+ 0 - 3
Sources/ManageLanguages.php

@@ -623,9 +623,6 @@ function ModifyLanguages()
  */
 function list_getNumLanguages()
 {
-	global $settings;
-
-	// Return how many we have.
 	return count(getLanguages(true, false));
 }
 

+ 1 - 1
Sources/Poll.php

@@ -98,7 +98,7 @@ function Vote()
 	if (!$user_info['is_guest'] && $row['selected'] != -1 && empty($row['change_vote']))
 		fatal_lang_error('poll_error', false);
 	// Otherwise if they can change their vote yet they haven't sent any options... remove their vote and redirect.
-	elseif (!empty($row['change_vote']) && !$user_info['is_guest'])
+	elseif (!empty($row['change_vote']) && !$user_info['is_guest'] && empty($_POST['options']))
 	{
 		checkSession('request');
 		$pollOptions = array();

+ 5 - 2
Sources/Register.php

@@ -55,8 +55,8 @@ function Register($reg_errors = array())
 	if ($context['show_coppa'])
 	{
 		$context['skip_coppa'] = false;
-		$context['coppa_agree_above'] = sprintf($txt['agreement_agree_coppa_above'], $modSettings['coppaAge']);
-		$context['coppa_agree_below'] = sprintf($txt['agreement_agree_coppa_below'], $modSettings['coppaAge']);
+		$context['coppa_agree_above'] = sprintf($txt[($context['require_agreement'] ? 'agreement_' : '') . 'agree_coppa_above'], $modSettings['coppaAge']);
+		$context['coppa_agree_below'] = sprintf($txt[($context['require_agreement'] ? 'agreement_' : '') . 'agree_coppa_below'], $modSettings['coppaAge']);
 	}
 
 	// What step are we at?
@@ -233,6 +233,9 @@ function Register2($verifiedOpenID = false)
 		if (!isset($_SESSION['old_url']))
 			redirectexit('action=register');
 
+		// If we don't require an agreement, we need a extra check for coppa.
+		if (empty($modSettings['requireAgreement']) && !empty($modSettings['coppaAge']))
+			$_SESSION['skip_coppa'] = !empty($_POST['accept_agreement']);
 		// Are they under age, and under age users are banned?
 		if (!empty($modSettings['coppaAge']) && empty($modSettings['coppaType']) && empty($_SESSION['skip_coppa']))
 		{

+ 2 - 0
Sources/Who.php

@@ -72,6 +72,8 @@ function Who()
 		$show_methods['guests'] = '(lo.id_member = 0 AND lo.id_spider = 0)';
 		$context['show_methods']['spiders'] = $txt['who_show_spiders_only'];
 	}
+	elseif (empty($modSettings['show_spider_online']) && isset($_SESSION['who_online_sort_by']) && $_SESSION['who_online_sort_by'] == 'spiders')
+		unset($_SESSION['who_online_sort_by']);
 
 	// Does the user prefer a different sort direction?
 	if (isset($_REQUEST['sort']) && isset($sort_methods[$_REQUEST['sort']]))

+ 14 - 54
Themes/default/Register.template.php

@@ -10,7 +10,9 @@
  * @version 2.1 Alpha 1
  */
 
-// Before showing users a registration form, show them the registration agreement.
+/**
+ * Before showing users a registration form, show them the registration agreement.
+ */
 function template_registration_agreement()
 {
 	global $context, $settings, $options, $scripturl, $txt, $modSettings;
@@ -65,45 +67,6 @@ function template_registration_form()
 			}
 
 			var currentAuthMethod = \'passwd\';
-			function updateAuthMethod()
-			{
-				// What authentication method is being used?
-				if (!document.getElementById(\'auth_openid\') || !document.getElementById(\'auth_openid\').checked)
-					currentAuthMethod = \'passwd\';
-				else
-					currentAuthMethod = \'openid\';
-
-				// No openID?
-				if (!document.getElementById(\'auth_openid\'))
-					return true;
-
-				document.forms.registration.openid_url.disabled = currentAuthMethod == \'openid\' ? false : true;
-				document.forms.registration.smf_autov_pwmain.disabled = currentAuthMethod == \'passwd\' ? false : true;
-				document.forms.registration.smf_autov_pwverify.disabled = currentAuthMethod == \'passwd\' ? false : true;
-				document.getElementById(\'smf_autov_pwmain_div\').style.display = currentAuthMethod == \'passwd\' ? \'\' : \'none\';
-				document.getElementById(\'smf_autov_pwverify_div\').style.display = currentAuthMethod == \'passwd\' ? \'\' : \'none\';
-
-				if (currentAuthMethod == \'passwd\')
-				{
-					verificationHandle.refreshMainPassword();
-					verificationHandle.refreshVerifyPassword();
-					document.forms.registration.openid_url.style.backgroundColor = \'\';
-					document.getElementById(\'password1_group\').style.display = \'\';
-					document.getElementById(\'password2_group\').style.display = \'\';
-					document.getElementById(\'openid_group\').style.display = \'none\';
-				}
-				else
-				{
-					document.forms.registration.smf_autov_pwmain.style.backgroundColor = \'\';
-					document.forms.registration.smf_autov_pwverify.style.backgroundColor = \'\';
-					document.forms.registration.openid_url.style.backgroundColor = \'#FFF0F0\';
-					document.getElementById(\'password1_group\').style.display = \'none\';
-					document.getElementById(\'password2_group\').style.display = \'none\';
-					document.getElementById(\'openid_group\').style.display = \'\';
-				}
-
-				return true;
-			}
 		// ]]></script>';
 
 	// Any errors?
@@ -348,8 +311,17 @@ function template_registration_form()
 	}
 
 	echo '
-			<div id="confirm_buttons">
-				<input type="submit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="button_submit" />
+			<div id="confirm_buttons">';
+
+	// Age restriction in effect?
+	if (!$context['require_agreement'] && $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="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="button_submit" />';
+	echo '
 			</div>
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
 			<input type="hidden" name="', $context['register_token_var'], '" value="', $context['register_token'], '" />
@@ -525,18 +497,6 @@ function template_admin_register()
 		</div>
 		<form class="windowbg2" action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '" name="postForm" id="postForm">
 			<span class="topslice"><span></span></span>
-			<script type="text/javascript"><!-- // --><![CDATA[
-				function onCheckChange()
-				{
-					if (document.forms.postForm.emailActivate.checked || document.forms.postForm.password.value == \'\')
-					{
-						document.forms.postForm.emailPassword.disabled = true;
-						document.forms.postForm.emailPassword.checked = true;
-					}
-					else
-						document.forms.postForm.emailPassword.disabled = false;
-				}
-			// ]]></script>
 			<div class="content" id="register_screen">';
 
 	if (!empty($context['registration_done']))

+ 2 - 0
Themes/default/languages/Login.english.php

@@ -8,6 +8,8 @@ $txt['registration_agreement'] = 'Registration Agreement';
 $txt['agreement_agree'] = 'I accept the terms of the agreement.';
 $txt['agreement_agree_coppa_above'] = 'I accept the terms of the agreement and I am at least %1$d years old.';
 $txt['agreement_agree_coppa_below'] = 'I accept the terms of the agreement and I am younger than %1$d years old.';
+$txt['agree_coppa_above'] = 'I am at least %1$d years old.';
+$txt['agree_coppa_below'] = 'I am younger than %1$d years old.';
 
 // Registration form.
 $txt['registration_form'] = 'Registration Form';