Passed
Pull Request — release-2.1 (#4892)
by Mathias
05:08
created

template_registration_policy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 0
dl 0
loc 21
rs 9.9332
c 0
b 0
f 0
1
<?php
2
/**
3
 * Simple Machines Forum (SMF)
4
 *
5
 * @package SMF
6
 * @author Simple Machines http://www.simplemachines.org
7
 * @copyright 2018 Simple Machines and individual contributors
8
 * @license http://www.simplemachines.org/about/smf/license.php BSD
9
 *
10
 * @version 2.1 Beta 4
11
 */
12
13
/**
14
 * Before showing users a registration form, show them the registration agreement.
15
 */
16
function template_registration_agreement()
17
{
18
	global $context, $scripturl, $txt;
19
20
	echo '
21
		<form action="', $scripturl, '?action=signup" method="post" accept-charset="', $context['character_set'], '" id="registration">
22
			<div class="cat_bar">
23
				<h3 class="catbg">', $txt['registration_agreement'], '</h3>
24
			</div>
25
			<div class="roundframe">
26
				<p>', $context['agreement'], '</p>
27
			</div>
28
			<div id="confirm_buttons">';
29
30
	// Age restriction in effect?
31
	if ($context['show_coppa'])
32
		echo '
33
				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br>
34
				<br>
35
				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">';
36
	else
37
		echo '
38
				<input type="submit" name="accept_agreement" value="', $txt['policy_agree'], '" class="button">';
39
40
	echo '
41
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
42
				<input type="hidden" name="', $context['register_token_var'], '" value="', $context['register_token'], '">
43
			</div><!-- .confirm_buttons -->
44
			<input type="hidden" name="step" value="1">
45
		</form>';
46
47
}
48
49
/**
50
 * Before showing users a registration form, show them the registration policy.
51
 */
52
function template_registration_policy()
53
{
54
	global $context, $scripturl, $txt;
55
56
	echo '
57
		<form action="', $scripturl, '?action=signup" method="post" accept-charset="', $context['character_set'], '" id="registration">
58
			<div class="cat_bar">
59
				<h3 class="catbg">', $txt['registration_policy'], '</h3>
60
			</div>
61
			<div class="roundframe">
62
				<p>', $context['policy'], '</p>
63
			</div>
64
			<div id="confirm_buttons">';
65
66
67
	echo '
68
				<input type="submit" name="accept_policy" value="', $txt['policy_agree'], '" class="button">';
69
70
	echo '
71
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
72
				<input type="hidden" name="', $context['register_token_var'], '" value="', $context['register_token'], '">
73
			</div><!-- .confirm_buttons -->
74
			<input type="hidden" name="step" value="2">
75
		</form>';
76
77
}
78
79
/**
80
 * Before registering - get their information.
81
 */
82
function template_registration_form()
83
{
84
	global $context, $scripturl, $txt, $modSettings;
85
86
	echo '
87
		<script>
88
			function verifyAgree()
89
			{
90
				if (currentAuthMethod == \'passwd\' && document.forms.registration.smf_autov_pwmain.value != document.forms.registration.smf_autov_pwverify.value)
91
				{
92
					alert("', $txt['register_passwords_differ_js'], '");
93
					return false;
94
				}
95
96
				return true;
97
			}
98
99
			var currentAuthMethod = \'passwd\';
100
		</script>';
101
102
	// Any errors?
103
	if (!empty($context['registration_errors']))
104
	{
105
		echo '
106
		<div class="errorbox">
107
			<span>', $txt['registration_errors_occurred'], '</span>
108
			<ul>';
109
110
		// Cycle through each error and display an error message.
111
		foreach ($context['registration_errors'] as $error)
112
			echo '
113
				<li>', $error, '</li>';
114
115
		echo '
116
			</ul>
117
		</div>';
118
	}
119
120
	echo '
121
		<form action="', !empty($modSettings['force_ssl']) ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=signup2" method="post" accept-charset="', $context['character_set'], '" name="registration" id="registration" onsubmit="return verifyAgree();">
122
			<div class="cat_bar">
123
				<h3 class="catbg">', $txt['registration_form'], '</h3>
124
			</div>
125
			<div class="title_bar">
126
				<h3 class="titlebg">', $txt['required_info'], '</h3>
127
			</div>
128
			<div class="roundframe noup">
129
				<fieldset>
130
					<dl class="register_form">
131
						<dt>
132
							<strong><label for="smf_autov_username">', $txt['username'], ':</label></strong>
133
						</dt>
134
						<dd>
135
							<input type="text" name="user" id="smf_autov_username" size="50" tabindex="', $context['tabindex']++, '" maxlength="25" value="', isset($context['username']) ? $context['username'] : '', '">
136
							<span id="smf_autov_username_div" style="display: none;">
137
								<a id="smf_autov_username_link" href="#">
138
									<span id="smf_autov_username_img" class="generic_icons check"></span>
139
								</a>
140
							</span>
141
						</dd>
142
						<dt><strong><label for="smf_autov_reserve1">', $txt['user_email_address'], ':</label></strong></dt>
143
						<dd>
144
							<input type="text" name="email" id="smf_autov_reserve1" size="50" tabindex="', $context['tabindex']++, '" value="', isset($context['email']) ? $context['email'] : '', '">
145
						</dd>
146
					</dl>
147
					<dl class="register_form" id="password1_group">
148
						<dt><strong><label for="smf_autov_pwmain">', ucwords($txt['choose_pass']), ':</label></strong></dt>
149
						<dd>
150
							<input type="password" name="passwrd1" id="smf_autov_pwmain" size="50" tabindex="', $context['tabindex']++, '">
151
							<span id="smf_autov_pwmain_div" style="display: none;">
152
								<span id="smf_autov_pwmain_img" class="generic_icons invalid"></span>
153
							</span>
154
						</dd>
155
					</dl>
156
					<dl class="register_form" id="password2_group">
157
						<dt>
158
							<strong><label for="smf_autov_pwverify">', ucwords($txt['verify_pass']), ':</label></strong>
159
						</dt>
160
						<dd>
161
							<input type="password" name="passwrd2" id="smf_autov_pwverify" size="50" tabindex="', $context['tabindex']++, '">
162
							<span id="smf_autov_pwverify_div" style="display: none;">
163
								<span id="smf_autov_pwverify_img" class="generic_icons valid"></span>
164
							</span>
165
						</dd>
166
					</dl>
167
					<dl class="register_form" id="notify_announcements">
168
						<dt>
169
							<strong><label for="notify_announcements">', $txt['notify_announcements'], ':</label></strong>
170
						</dt>
171
						<dd>
172
							<input type="checkbox" name="notify_announcements" id="notify_announcements" tabindex="', $context['tabindex']++, '"', $context['notify_announcements'] ? ' checked="checked"' : '', '>
173
						</dd>
174
					</dl>';
175
176
	// If there is any field marked as required, show it here!
177
	if (!empty($context['custom_fields_required']) && !empty($context['custom_fields']))
178
	{
179
		echo '
180
					<dl class="register_form">';
181
182
		foreach ($context['custom_fields'] as $field)
183
			if ($field['show_reg'] > 1)
184
				echo '
185
						<dt>
186
							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong>
187
							<span class="smalltext">', $field['desc'], '</span>
188
						</dt>
189
						<dd>', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '</dd>';
190
191
		echo '
192
					</dl>';
193
	}
194
195
	echo '
196
				</fieldset>
197
			</div><!-- .roundframe -->';
198
199
	// If we have either of these, show the extra group.
200
	if (!empty($context['profile_fields']) || !empty($context['custom_fields']))
201
		echo '
202
			<div class="title_bar">
203
				<h3 class="titlebg">', $txt['additional_information'], '</h3>
204
			</div>
205
			<div class="roundframe noup">
206
				<fieldset>
207
					<dl class="register_form" id="custom_group">';
208
209
	if (!empty($context['profile_fields']))
210
	{
211
		// Any fields we particularly want?
212
		foreach ($context['profile_fields'] as $key => $field)
213
		{
214
			if ($field['type'] == 'callback')
215
			{
216
				if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func']))
217
				{
218
					$callback_func = 'template_profile_' . $field['callback_func'];
219
					$callback_func();
220
				}
221
			}
222
			else
223
			{
224
				echo '
225
						<dt>
226
							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['label'], ':</strong>';
227
228
				// Does it have any subtext to show?
229
				if (!empty($field['subtext']))
230
					echo '
231
							<span class="smalltext">', $field['subtext'], '</span>';
232
233
				echo '
234
						</dt>
235
						<dd>';
236
237
				// Want to put something infront of the box?
238
				if (!empty($field['preinput']))
239
					echo '
240
							', $field['preinput'];
241
242
				// What type of data are we showing?
243
				if ($field['type'] == 'label')
244
					echo '
245
							', $field['value'];
246
247
				// Maybe it's a text box - very likely!
248
				elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'url')))
249
					echo '
250
							<input type="', $field['type'] == 'password' ? 'password' : 'text', '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], '>';
251
252
				// You "checking" me out? ;)
253
				elseif ($field['type'] == 'check')
254
					echo '
255
							<input type="hidden" name="', $key, '" value="0"><input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], '>';
256
257
				// Always fun - select boxes!
258
				elseif ($field['type'] == 'select')
259
				{
260
					echo '
261
							<select name="', $key, '" id="', $key, '" tabindex="', $context['tabindex']++, '">';
262
263
					if (isset($field['options']))
264
					{
265
						// Is this some code to generate the options?
266
						if (!is_array($field['options']))
267
							$field['options'] = eval($field['options']);
0 ignored issues
show
introduced by
The use of eval() is discouraged.
Loading history...
268
269
						// Assuming we now have some!
270
						if (is_array($field['options']))
271
							foreach ($field['options'] as $value => $name)
272
								echo '
273
								<option', (!empty($field['disabled_options']) && is_array($field['disabled_options']) && in_array($value, $field['disabled_options'], true) ? ' disabled' : ''), ' value="' . $value . '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>';
274
					}
275
276
					echo '
277
							</select>';
278
				}
279
280
				// Something to end with?
281
				if (!empty($field['postinput']))
282
					echo '
283
							', $field['postinput'];
284
285
				echo '
286
						</dd>';
287
			}
288
		}
289
	}
290
291
	// Are there any custom fields?
292
	if (!empty($context['custom_fields']))
293
	{
294
		foreach ($context['custom_fields'] as $field)
295
			if ($field['show_reg'] < 2)
296
				echo '
297
						<dt>
298
							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong>
299
							<span class="smalltext">', $field['desc'], '</span>
300
						</dt>
301
						<dd>', $field['input_html'], '</dd>';
302
	}
303
304
	// If we have either of these, close the list like a proper gent.
305
	if (!empty($context['profile_fields']) || !empty($context['custom_fields']))
306
		echo '
307
					</dl>
308
				</fieldset>
309
			</div><!-- .roundframe -->';
310
311
	if ($context['visual_verification'])
312
		echo '
313
			<div class="title_bar">
314
				<h3 class="titlebg">', $txt['verification'], '</h3>
315
			</div>
316
			<div class="roundframe noup">
317
				<fieldset class="centertext">
318
					', template_control_verification($context['visual_verification_id'], 'all'), '
319
				</fieldset>
320
			</div>';
321
322
	echo '
323
			<div id="confirm_buttons" class="flow_auto">';
324
325
	// Age restriction in effect?
326
	if (!$context['require_agreement'] && $context['show_coppa'])
327
		echo '
328
				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br>
329
				<br>
330
				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">';
331
	else
332
		echo '
333
				<input type="submit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="button">';
334
335
	echo '
336
			</div>
337
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
338
			<input type="hidden" name="', $context['register_token_var'], '" value="', $context['register_token'], '">
339
			<input type="hidden" name="step" value="3">
340
		</form>
341
		<script>
342
			var regTextStrings = {
343
				"username_valid": "', $txt['registration_username_available'], '",
344
				"username_invalid": "', $txt['registration_username_unavailable'], '",
345
				"username_check": "', $txt['registration_username_check'], '",
346
				"password_short": "', $txt['registration_password_short'], '",
347
				"password_reserved": "', $txt['registration_password_reserved'], '",
348
				"password_numbercase": "', $txt['registration_password_numbercase'], '",
349
				"password_no_match": "', $txt['registration_password_no_match'], '",
350
				"password_valid": "', $txt['registration_password_valid'], '"
351
			};
352
			var verificationHandle = new smfRegister("registration", ', empty($modSettings['password_strength']) ? 0 : $modSettings['password_strength'], ', regTextStrings);
353
		</script>';
354
}
355
356
/**
357
 * After registration... all done ;).
358
 */
359
function template_after()
360
{
361
	global $context;
362
363
	// Not much to see here, just a quick... "you're now registered!" or what have you.
364
	echo '
365
		<div id="registration_success">
366
			<div class="cat_bar">
367
				<h3 class="catbg">', $context['title'], '</h3>
368
			</div>
369
			<div class="windowbg">
370
				<p>', $context['description'], '</p>
371
			</div>
372
		</div>';
373
}
374
375
/**
376
 * Template for giving instructions about COPPA activation.
377
 */
378
function template_coppa()
379
{
380
	global $context, $txt, $scripturl;
381
382
	// Formulate a nice complicated message!
383
	echo '
384
			<div class="title_bar">
385
				<h3 class="titlebg">', $context['page_title'], '</h3>
386
			</div>
387
			<div id="coppa" class="roundframe noup">
388
				<p>', $context['coppa']['body'], '</p>
389
				<p>
390
					<span><a href="', $scripturl, '?action=coppa;form;member=', $context['coppa']['id'], '" target="_blank" rel="noopener">', $txt['coppa_form_link_popup'], '</a> | <a href="', $scripturl, '?action=coppa;form;dl;member=', $context['coppa']['id'], '">', $txt['coppa_form_link_download'], '</a></span>
391
				</p>
392
				<p>', $context['coppa']['many_options'] ? $txt['coppa_send_to_two_options'] : $txt['coppa_send_to_one_option'], '</p>';
393
394
	// Can they send by post?
395
	if (!empty($context['coppa']['post']))
396
		echo '
397
				<h4>1) ', $txt['coppa_send_by_post'], '</h4>
398
				<div class="coppa_contact">
399
					', $context['coppa']['post'], '
400
				</div>';
401
402
	// Can they send by fax??
403
	if (!empty($context['coppa']['fax']))
404
		echo '
405
				<h4>', !empty($context['coppa']['post']) ? '2' : '1', ') ', $txt['coppa_send_by_fax'], '</h4>
406
				<div class="coppa_contact">
407
					', $context['coppa']['fax'], '
408
				</div>';
409
410
	// Offer an alternative Phone Number?
411
	if ($context['coppa']['phone'])
412
		echo '
413
				<p>', $context['coppa']['phone'], '</p>';
414
415
	echo '
416
			</div><!-- #coppa -->';
417
}
418
419
/**
420
 * An easily printable form for giving permission to access the forum for a minor.
421
 */
422
function template_coppa_form()
423
{
424
	global $context, $txt;
425
426
	// Show the form (As best we can)
427
	echo '
428
		<table style="width: 100%; padding: 3px; border: 0" class="tborder">
429
			<tr>
430
				<td>', $context['forum_contacts'], '</td>
431
			</tr>
432
			<tr>
433
				<td class="righttext">
434
					<em>', $txt['coppa_form_address'], '</em>: ', $context['ul'], '<br>
435
					', $context['ul'], '<br>
436
					', $context['ul'], '<br>
437
					', $context['ul'], '
438
				</td>
439
			</tr>
440
			<tr>
441
				<td class="righttext">
442
					<em>', $txt['coppa_form_date'], '</em>: ', $context['ul'], '
443
					<br><br>
444
				</td>
445
			</tr>
446
			<tr>
447
				<td>
448
					', $context['coppa_body'], '
449
				</td>
450
			</tr>
451
		</table>
452
		<br>';
453
}
454
455
/**
456
 * Show a window containing the spoken verification code.
457
 */
458
function template_verification_sound()
459
{
460
	global $context, $settings, $txt, $modSettings;
461
462
	echo '<!DOCTYPE html>
463
<html', $context['right_to_left'] ? ' dir="rtl"' : '', '>
464
	<head>
465
		<meta charset="', $context['character_set'], '">
466
		<title>', $txt['visual_verification_sound'], '</title>
467
		<meta name="robots" content="noindex">
468
		<link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'], '">
469
		<style>';
470
471
	// Just show the help text and a "close window" link.
472
	echo '
473
		</style>
474
	</head>
475
	<body style="margin: 1ex;">
476
		<div class="windowbg description" style="text-align: center;">';
477
478
	if (isBrowser('is_ie') || isBrowser('is_ie11'))
479
		echo '
480
			<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="audio/x-wav">
481
				<param name="AutoStart" value="1">
482
				<param name="FileName" value="', $context['verification_sound_href'], '">
483
			</object>';
484
	else
485
		echo '
486
			<audio src="', $context['verification_sound_href'], '" controls>
487
				<object type="audio/x-wav" data="', $context['verification_sound_href'], '">
488
					<a href="', $context['verification_sound_href'], '" rel="nofollow">', $context['verification_sound_href'], '</a>
489
				</object>
490
			</audio>';
491
492
	echo '
493
			<br>
494
			<a href="', $context['verification_sound_href'], ';sound" rel="nofollow">', $txt['visual_verification_sound_again'], '</a><br>
495
			<a href="', $context['verification_sound_href'], '" rel="nofollow">', $txt['visual_verification_sound_direct'], '</a><br><br>
496
			<a href="javascript:self.close();">', $txt['visual_verification_sound_close'], '</a><br>
497
		</div><!-- .description -->
498
	</body>
499
</html>';
500
}
501
502
/**
503
 * The template for the form allowing an admin to register a user from the admin center.
504
 */
505
function template_admin_register()
506
{
507
	global $context, $scripturl, $txt, $modSettings;
508
509
	echo '
510
		<div id="admin_form_wrapper">
511
			<form id="postForm" action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '" name="postForm">
512
				<div class="cat_bar">
513
					<h3 class="catbg">', $txt['admin_browse_register_new'], '</h3>
514
				</div>
515
				<div id="register_screen" class="windowbg">';
516
517
	if (!empty($context['registration_done']))
518
		echo '
519
					<div class="infobox">
520
						', $context['registration_done'], '
521
					</div>';
522
523
	echo '
524
					<dl class="register_form" id="admin_register_form">
525
						<dt>
526
							<strong><label for="user_input">', $txt['admin_register_username'], ':</label></strong>
527
							<span class="smalltext">', $txt['admin_register_username_desc'], '</span>
528
						</dt>
529
						<dd>
530
							<input type="text" name="user" id="user_input" tabindex="', $context['tabindex']++, '" size="50" maxlength="25">
531
						</dd>
532
						<dt>
533
							<strong><label for="email_input">', $txt['admin_register_email'], ':</label></strong>
534
							<span class="smalltext">', $txt['admin_register_email_desc'], '</span>
535
						</dt>
536
						<dd>
537
							<input type="text" name="email" id="email_input" tabindex="', $context['tabindex']++, '" size="50">
538
						</dd>
539
						<dt>
540
							<strong><label for="password_input">', $txt['admin_register_password'], ':</label></strong>
541
							<span class="smalltext">', $txt['admin_register_password_desc'], '</span>
542
						</dt>
543
						<dd>
544
							<input type="password" name="password" id="password_input" tabindex="', $context['tabindex']++, '" size="50" onchange="onCheckChange();">
545
						</dd>';
546
547
	if (!empty($context['member_groups']))
548
	{
549
		echo '
550
						<dt>
551
							<strong><label for="group_select">', $txt['admin_register_group'], ':</label></strong>
552
							<span class="smalltext">', $txt['admin_register_group_desc'], '</span>
553
						</dt>
554
						<dd>
555
							<select name="group" id="group_select" tabindex="', $context['tabindex']++, '">';
556
557
		foreach ($context['member_groups'] as $id => $name)
558
			echo '
559
								<option value="', $id, '">', $name, '</option>';
560
561
		echo '
562
							</select>
563
						</dd>';
564
	}
565
566
	// If there is any field marked as required, show it here!
567
	if (!empty($context['custom_fields_required']) && !empty($context['custom_fields']))
568
		foreach ($context['custom_fields'] as $field)
569
			if ($field['show_reg'] > 1)
570
				echo '
571
						<dt>
572
							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong>
573
							<span class="smalltext">', $field['desc'], '</span>
574
						</dt>
575
						<dd>
576
							', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '
577
						</dd>';
578
579
	echo '
580
						<dt>
581
							<strong><label for="emailPassword_check">', $txt['admin_register_email_detail'], ':</label></strong>
582
							<span class="smalltext">', $txt['admin_register_email_detail_desc'], '</span>
583
						</dt>
584
						<dd>
585
							<input type="checkbox" name="emailPassword" id="emailPassword_check" tabindex="', $context['tabindex']++, '" checked disabled>
586
						</dd>
587
						<dt>
588
							<strong><label for="emailActivate_check">', $txt['admin_register_email_activate'], ':</label></strong>
589
						</dt>
590
						<dd>
591
							<input type="checkbox" name="emailActivate" id="emailActivate_check" tabindex="', $context['tabindex']++, '"', !empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1 ? ' checked' : '', ' onclick="onCheckChange();">
592
						</dd>
593
					</dl>
594
					<div class="flow_auto">
595
						<input type="submit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="button">
596
						<input type="hidden" name="sa" value="register">
597
						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
598
						<input type="hidden" name="', $context['admin-regc_token_var'], '" value="', $context['admin-regc_token'], '">
599
					</div>
600
				</div><!-- #register_screen -->
601
			</form>
602
		</div><!-- #admin_form_wrapper -->
603
	<br class="clear">';
604
}
605
606
/**
607
 * Form for editing the agreement shown for people registering to the forum.
608
 */
609
function template_edit_agreement()
610
{
611
	global $context, $scripturl, $txt;
612
613
	if (!empty($context['saved_successful']))
614
		echo '
615
		<div class="infobox">', $txt['settings_saved'], '</div>';
616
617
	elseif (!empty($context['could_not_save']))
618
		echo '
619
		<div class="errorbox">', $txt['admin_agreement_not_saved'], '</div>';
620
621
	// Warning for if the file isn't writable.
622
	if (!empty($context['warning']))
623
		echo '
624
		<div class="errorbox">', $context['warning'], '</div>';
625
626
	// Just a big box to edit the text file ;)
627
	echo '
628
		<div id="admin_form_wrapper">
629
			<div class="cat_bar">
630
				<h3 class="catbg">', $txt['registration_agreement'], '</h3>
631
			</div>
632
			<div class="windowbg" id="registration_agreement">';
633
634
	// Is there more than one language to choose from?
635
	if (count($context['editable_agreements']) > 1)
636
	{
637
		echo '
638
				<div class="cat_bar">
639
					<h3 class="catbg">', $txt['language_configuration'], '</h3>
640
				</div>
641
				<div class="information">
642
					<form action="', $scripturl, '?action=admin;area=regcenter" id="change_reg" method="post" accept-charset="', $context['character_set'], '" style="display: inline;">
643
						<strong>', $txt['admin_agreement_select_language'], ':</strong>
644
						<select name="agree_lang" onchange="document.getElementById(\'change_reg\').submit();" tabindex="', $context['tabindex']++, '">';
645
646
		foreach ($context['editable_agreements'] as $file => $name)
647
			echo '
648
							<option value="', $file, '"', $context['current_agreement'] == $file ? ' selected' : '', '>', $name, '</option>';
649
650
		echo '
651
						</select>
652
						<div class="righttext">
653
							<input type="hidden" name="sa" value="agreement">
654
							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
655
							<input type="hidden" name="', $context['admin-rega_token_var'], '" value="', $context['admin-rega_token'], '">
656
							<input type="submit" name="change" value="', $txt['admin_agreement_select_language_change'], '" tabindex="', $context['tabindex']++, '" class="button">
657
						</div>
658
					</form>
659
				</div><!-- .information -->';
660
	}
661
662
663
664
	// Show the actual agreement in an oversized text box.
665
	echo '
666
				<form action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '">
667
					<textarea cols="70" rows="20" name="agreement" id="agreement">', $context['agreement'], '</textarea>
668
					<p>
669
						<label for="requireAgreement"><input type="checkbox" name="requireAgreement" id="requireAgreement"', $context['require_agreement'] ? ' checked' : '', ' tabindex="', $context['tabindex']++, '" value="1"> ', $txt['admin_agreement'], '.</label>
670
					</p>
671
					<input type="submit" value="', $txt['save'], '" tabindex="', $context['tabindex']++, '" class="button">
672
					<input type="hidden" name="agree_lang" value="', $context['current_agreement'], '">
673
					<input type="hidden" name="sa" value="agreement">
674
					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
675
					<input type="hidden" name="', $context['admin-rega_token_var'], '" value="', $context['admin-rega_token'], '">
676
				</form>
677
			</div><!-- #registration_agreement -->
678
		</div><!-- #admin_form_wrapper -->';
679
}
680
681
/**
682
 * Template for editing reserved words.
683
 */
684
function template_edit_reserved_words()
685
{
686
	global $context, $scripturl, $txt;
687
688
	if (!empty($context['saved_successful']))
689
		echo '
690
	<div class="infobox">', $txt['settings_saved'], '</div>';
691
692
	echo '
693
	<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '">
694
		<div class="cat_bar">
695
			<h3 class="catbg">', $txt['admin_reserved_set'], '</h3>
696
		</div>
697
		<div class="windowbg">
698
			<h4>', $txt['admin_reserved_line'], '</h4>
699
			<textarea cols="30" rows="6" name="reserved" id="reserved">', implode("\n", $context['reserved_words']), '</textarea>
700
			<dl class="settings">
701
				<dt>
702
					<label for="matchword">', $txt['admin_match_whole'], '</label>
703
				</dt>
704
				<dd>
705
					<input type="checkbox" name="matchword" id="matchword" tabindex="', $context['tabindex']++, '"', $context['reserved_word_options']['match_word'] ? ' checked' : '', '>
706
				</dd>
707
				<dt>
708
					<label for="matchcase">', $txt['admin_match_case'], '</label>
709
				</dt>
710
				<dd>
711
					<input type="checkbox" name="matchcase" id="matchcase" tabindex="', $context['tabindex']++, '"', $context['reserved_word_options']['match_case'] ? ' checked' : '', '>
712
				</dd>
713
				<dt>
714
					<label for="matchuser">', $txt['admin_check_user'], '</label>
715
				</dt>
716
				<dd>
717
					<input type="checkbox" name="matchuser" id="matchuser" tabindex="', $context['tabindex']++, '"', $context['reserved_word_options']['match_user'] ? ' checked' : '', '>
718
				</dd>
719
				<dt>
720
					<label for="matchname">', $txt['admin_check_display'], '</label>
721
				</dt>
722
				<dd>
723
					<input type="checkbox" name="matchname" id="matchname" tabindex="', $context['tabindex']++, '"', $context['reserved_word_options']['match_name'] ? ' checked' : '', '>
724
				</dd>
725
			</dl>
726
			<div class="flow_auto">
727
				<input type="submit" value="', $txt['save'], '" name="save_reserved_names" tabindex="', $context['tabindex']++, '" class="button">
728
				<input type="hidden" name="sa" value="reservednames">
729
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
730
				<input type="hidden" name="', $context['admin-regr_token_var'], '" value="', $context['admin-regr_token'], '">
731
			</div>
732
		</div><!-- .windowbg -->
733
	</form>';
734
}
735
736
?>