Browse Source

! part of [bug 4873] If agreement.txt is missing, show an error. emanuele has the rest of the fix

Signed-off-by: Spuds <[email protected]>
Spuds 12 years ago
parent
commit
193560918d

+ 8 - 0
Sources/Register.php

@@ -105,6 +105,14 @@ function Register($reg_errors = array())
 			$context['agreement'] = parse_bbc(file_get_contents($boarddir . '/agreement.txt'), true, 'agreement');
 		else
 			$context['agreement'] = '';
+		
+		// Nothing to show, lets disable registration and inform the admin of this error
+		if (empty($context['agreement']))
+		{
+			// No file found or a blank file, log the error so the admin knows there is a problem!
+			log_error($txt['registration_agreement_missing'], 'critical');
+			fatal_lang_error('registration_disabled', false);
+		}
 	}
 
 	if (!empty($modSettings['userLanguage']))

+ 1 - 0
Themes/default/Register.template.php

@@ -327,6 +327,7 @@ function template_registration_form()
 			<input type="hidden" name="', $context['register_token_var'], '" value="', $context['register_token'], '" />
 			<input type="hidden" name="step" value="2" />
 		</form>
+		<br class="clear" />
 		<script type="text/javascript"><!-- // --><![CDATA[
 			var regTextStrings = {
 				"username_valid": "', $txt['registration_username_available'], '",

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

@@ -137,6 +137,7 @@ $txt['cannot_who_view'] = 'Sorry - you don\'t have the proper permissions to vie
 $txt['no_theme'] = 'That theme does not exist.';
 $txt['theme_dir_wrong'] = 'The default theme\'s directory is wrong, please correct it by clicking this text.';
 $txt['registration_disabled'] = 'Sorry, registration is currently disabled.';
+$txt['registration_agreement_missing'] = 'The registration agreement file, agreement.txt, is either missing or empty.  Registrations have been disable until this is fixed';
 $txt['registration_no_secret_question'] = 'Sorry, there is no secret question set for this member.';
 $txt['poll_range_error'] = 'Sorry, the poll must run for more than 0 days.';
 $txt['delFirstPost'] = 'You are not allowed to delete the first post in a topic.<p>If you want to delete this topic, click on the Remove Topic link, or ask a moderator/administrator to do it for you.</p>';