Passed
Push — development ( 2d06b1...8e8389 )
by Spuds
01:13 queued 23s
created

template_verification_sound()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 34
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 13
dl 0
loc 34
rs 9.8333
c 0
b 0
f 0
nc 1
nop 0
1
<?php
2
3
/**
4
 * @package   ElkArte Forum
5
 * @copyright ElkArte Forum contributors
6
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file)
7
 *
8
 * This file contains code covered by:
9
 * copyright: 2011 Simple Machines (http://www.simplemachines.org)
10
 *
11
 * @version 2.0 dev
12
 *
13
 */
14
15
function template_mailcheck_javascript()
16
{
17
	global $txt;
18
19
	theme()->addInlineJavascript('
20
	disableAutoComplete();
21
	document.querySelectorAll("input[type=email]").forEach(function(input) {
22
	
23
	    input.addEventListener("blur", function(event) {
24
	        $(this).mailcheck({
25
	            suggested: function(input, suggestion) {
26
	                document.getElementById("suggestion").innerHTML = "<i class=\"icon i-warn\"></i>' . $txt['register_did_you'] . ' <b><i>" + suggestion.full + "</b></i>";
27
	                input[0].classList.add("check_input");
28
	            },
29
	            empty: function() {
30
	                document.getElementById("suggestion").innerHTML = "";
31
	                input[0].classList.remove("check_input");
32
	            }
33
	        });
34
	    });
35
	});', true);
36
}
37
38
/**
39
 * Before showing users a registration form, show them the registration agreement.
40
 */
41
function template_registration_agreement()
42
{
43
	global $context, $txt;
44
45
	template_mailcheck_javascript();
46
47
	echo '
48
		<form action="', getUrl('action', ['action' => 'register']), '" method="post" accept-charset="UTF-8" id="registration">
49
			<h2 class="category_header">', $txt['registration_agreement'];
50
51
	if (!empty($context['languages']))
52
	{
53
		if (count($context['languages']) === 1)
54
		{
55
			echo '
56
				<input type="hidden" name="lngfile" value="', key($context['languages']), '" />';
57
		}
58
		else
59
		{
60
			echo '
61
				<select onchange="this.form.submit()" name="lngfile">';
62
63
			foreach ($context['languages'] as $lang_key => $lang_val)
64
			{
65
				echo '
66
					<option value="', $lang_key, '"', empty($lang_val['selected']) ? '' : ' selected="selected"', '>', $lang_val['name'], '</option>';
67
			}
68
69
			echo '
70
				</select>';
71
		}
72
	}
73
74
	if (!empty($context['agreement']))
75
	{
76
		echo '
77
			</h2>
78
			<div class="well">
79
				<p>', $context['agreement'], '</p>
80
			</div>';
81
	}
82
83
	if (!empty($context['privacy_policy']))
84
	{
85
		echo '
86
			<h2 class="category_header">', $txt['registration_privacy_policy'], '
87
			</h2>
88
			<div class="well">
89
				<p>', $context['privacy_policy'], '</p>
90
			</div>';
91
	}
92
93
	echo '
94
			<div id="confirm_buttons" class="submitbutton centertext">';
95
96
	// Age restriction in effect?
97
	if ($context['show_coppa'])
98
	{
99
		echo '
100
				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" />
101
				<br /><br />
102
				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" />';
103
	}
104
	else
105
	{
106
		echo '
107
				<input type="submit" id="accept_agreement" name="accept_agreement" value="', $txt['agreement_agree'], '" />';
108
	}
109
110
	echo '
111
				<input type="submit" id="no_accept" name="no_accept" value="', $txt['agreement_no_agree'], '" />';
112
113
	if ($context['show_contact_button'])
114
	{
115
		echo '
116
				<br /><br />
117
				<input type="submit" id="show_contact" name="show_contact" value="', $txt['contact'], '" />';
118
	}
119
120
	if (!empty($context['register_subaction']))
121
	{
122
		echo '
123
				<input type="hidden" name="sa" value="', $context['register_subaction'], '" />';
124
	}
125
126
	echo '
127
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
128
			<input type="hidden" name="', $context['register_token_var'], '" value="', $context['register_token'], '" />
129
			</div>
130
			<input type="hidden" name="step" value="1" />
131
		</form>';
132
}
133
134
/**
135
 * Before registering - get their information.
136
 *
137
 * @uses ParseError
138
 */
139
function template_registration_form()
140
{
141
	global $context, $txt, $modSettings;
142
143
	template_mailcheck_javascript();
144
145
	theme()->addInlineJavascript('
146
		function verifyAgree()
147
		{
148
			if (document.forms.registration.elk_autov_pwmain.value !== document.forms.registration.elk_autov_pwverify.value)
149
			{
150
				alert("' . $txt['register_passwords_differ_js'] . '");
151
				return false;
152
			}
153
154
			return true;
155
		}', true);
156
157
	// Any errors?
158
	if (!empty($context['registration_errors']))
159
	{
160
		echo '
161
		<div class="errorbox">
162
			<span>', $txt['registration_errors_occurred'], '</span>
163
			<ul>';
164
165
		// Cycle through each error and display an error message.
166
		foreach ($context['registration_errors'] as $error)
167
		{
168
			echo '
169
				<li>', $error, '</li>';
170
		}
171
172
		echo '
173
			</ul>
174
		</div>';
175
	}
176
177
	echo '
178
		<form action="', getUrl('atcion', ['action' => 'register', 'sa' => 'register2']), '" method="post" accept-charset="UTF-8" name="registration" id="registration" onsubmit="return verifyAgree();">
179
			<h2 class="category_header">', $txt['registration_form'], '</h2>
180
			<input type="text" name="reason_for_joining_hp" class="hide" autocomplete="off" />
181
			<div class="content">
182
				<div class="form_container">
183
					<div class="form_field w_icon">
184
						<input type="text" name="user" id="elk_autov_username" size="30" tabindex="', $context['tabindex']++, '" maxlength="25" value="', $context['username'] ?? '', '" class="input_text" placeholder="', $txt['username'], '" required="required" autofocus="autofocus" />
185
						<label for="elk_autov_username">', $txt['username'], '</label>
186
						<span id="elk_autov_username_div" class="hide">
187
							<a id="elk_autov_username_link" href="#">
188
								<i id="elk_autov_username_img" class="icon i-check"></i>
189
							</a>
190
						</span>
191
					</div>';
192
193
	if ($context['insert_display_name'] == true)
194
	{
195
		echo '
196
					<div class="form_field w_icon">
197
						<input type="text" name="display" id="elk_autov_displayname" size="30" tabindex="', $context['tabindex']++, '" maxlength="25" value="', $context['display_name'] ?? '', '" class="input_text" placeholder="', $txt['display_name'], '" required="required" />
198
						<label for="elk_autov_displayname">', $txt['display_name'], '</label>
199
						<span id="elk_autov_displayname_div" class="hide">
200
							<a id="elk_autov_displayname_link" href="#">
201
								<i id="elk_autov_displayname_img" class="icon i-check"></i>
202
							</a>
203
						</span>
204
					</div>';
205
	}
206
207
	echo '
208
					<div class="form_field">
209
						<input type="email" name="email" id="elk_autov_reserve1" size="30" tabindex="', $context['tabindex']++, '" value="', $context['email'] ?? '', '" class="input_text" placeholder="', $txt['user_email_address'], '" required="required" />
210
						<label for="elk_autov_reserve1">', $txt['user_email_address'], '</label>
211
						<span id="suggestion" class="smalltext"></span>
212
					</div>
213
					<div class="form_field">
214
						<input type="checkbox" name="notify_announcements" id="notify_announcements" tabindex="', $context['tabindex']++, '"', $context['notify_announcements'] ? ' checked="checked"' : '', ' class="input_check" />
215
						<label for="notify_announcements">', $txt['notify_announcements'], '</label>
216
					</div>
217
					<div class="form_field w_icon" id="password1_group">
218
						<input type="password" name="passwrd1" id="elk_autov_pwmain" size="30" tabindex="', $context['tabindex']++, '" class="input_password" placeholder="', $txt['choose_pass'], '" required="required" autocomplete="new-password" />
219
						<label for="elk_autov_pwmain">', $txt['choose_pass'], '</label>
220
						<span id="elk_autov_pwmain_div" class="hide">
221
							<i id="elk_autov_pwmain_img" class="icon i-warn"></i>
222
						</span>
223
					</div>
224
					<div class="form_field w_icon" id="password2_group">
225
						<input type="password" name="passwrd2" id="elk_autov_pwverify" size="30" tabindex="', $context['tabindex']++, '" class="input_password" placeholder="', $txt['verify_pass'], '" required="required" autocomplete="new-password" />
226
						<label for="elk_autov_pwverify">', $txt['verify_pass'], '</label>
227
						<span id="elk_autov_pwverify_div" class="hide">
228
							<i id="elk_autov_pwverify_img" class="icon i-check" ></i>
229
						</span>
230
					</div>';
231
232
	// If there is any custom/profile field marked as required, show it here!
233
	if (!empty($context['custom_fields_required']) && !empty($context['custom_fields']))
234
	{
235
		foreach ($context['custom_fields'] as $key => $field)
236
		{
237
			if ($field['show_reg'] > 1)
238
			{
239
				echo '
240
					<div class="form_field">', preg_replace_callback('~<(input|select|textarea) ~', static function ($matches) {
241
					global $context;
242
243
					return '<' . $matches[1] . ' tabindex="' . ($context['tabindex']++) . '"';
244
				}, $field['input_html']);
245
246
				// Fieldsets already have a legend
247
				if (strpos($field['input_html'], 'fieldset') === false)
248
				{
249
					echo '	
250
						<label ', empty($field['is_error']) ? '' : ' class="error"', ' for="', $field['colname'], '">', $field['name'], '</label>';
251
				}
252
253
				echo '
254
						<p class="smalltext">', $field['desc'], '</p>
255
					</div>';
256
257
				// Drop this one so we don't show the additonal information header unless needed
258
				unset($context['custom_fields'][$key]);
259
			}
260
		}
261
	}
262
263
	echo '
264
				</div>
265
			</div>';
266
267
	// If we have stand or custom fields to display, show the optional grouping area
268
	if (!empty($context['profile_fields']) || !empty($context['custom_fields']))
269
	{
270
		echo '
271
			<div class="separator"></div>
272
			<h2 class="category_header">', $txt['additional_information'], '</h2>
273
			<fieldset class="content">
274
				<dl class="settings" id="custom_group">';
275
276
		$lastItem = template_profile_options();
277
		template_custom_profile_options($lastItem);
278
279
		echo '
280
				</dl>
281
			</fieldset>';
282
	}
283
284
	// Any verification tests to pass?
285
	if (isset($context['visual_verification']) && $context['visual_verification'] !== false)
286
	{
287
		template_verification_controls($context['visual_verification_id'], '
288
			<h2 class="category_header">' . $txt['verification'] . '</h2>
289
			<fieldset class="content centertext">
290
				', '
291
			</fieldset>');
292
	}
293
294
	if ($context['checkbox_agreement'] && $context['require_agreement'])
295
	{
296
		echo '
297
			<fieldset class="content">
298
				<div id="agreement_box">
299
					', $context['agreement'], '
300
				</div>
301
				<label for="checkbox_agreement">
302
					<input type="checkbox" name="checkbox_agreement" id="checkbox_agreement" value="1"', ($context['registration_passed_agreement'] ? ' checked="checked"' : ''), ' tabindex="', $context['tabindex']++, '" />
303
					', $txt['checkbox_agreement'], '
304
				</label>';
305
306
		if (!empty($context['privacy_policy']))
307
		{
308
			echo '	
309
				<div id="privacypol_box">
310
					', $context['privacy_policy'], '
311
				</div>
312
				<label for="checkbox_privacypol">
313
					<input type="checkbox" name="checkbox_privacypol" id="checkbox_privacypol" value="1"', ($context['registration_passed_privacypol'] ? ' checked="checked"' : ''), ' tabindex="', $context['tabindex']++, '" />
314
					', $txt['checkbox_privacypol'], '
315
				</label>';
316
		}
317
318
		if (!empty($context['languages']))
319
		{
320
			echo '
321
				<br />
322
				<select id="agreement_lang" class="input_select">';
323
324
			foreach ($context['languages'] as $key => $val)
325
			{
326
				echo '
327
					<option value="', $key, '"', empty($val['selected']) ? '' : ' selected="selected"', '>', $val['name'], '</option>';
328
			}
329
330
			echo '
331
				</select>';
332
		}
333
334
		echo '
335
			</fieldset>';
336
	}
337
338
	echo '
339
			<div id="confirm_buttons" class="submitbutton centertext">';
340
341
	// Age restriction in effect?
342
	if ((!$context['require_agreement'] || $context['checkbox_agreement']) && $context['show_coppa'])
343
	{
344
		echo '
345
				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" />
346
				<br /><br />
347
				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" />';
348
	}
349
	else
350
	{
351
		echo '
352
				<input type="submit" id="regSubmit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" />';
353
	}
354
355
	if ($context['show_contact_button'])
356
	{
357
		echo '
358
				<input type="submit" id="show_contact" name="show_contact" value="', $txt['contact'], '" />';
359
	}
360
361
	echo '
362
			</div>
363
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
364
			<input type="hidden" name="', $context['register_token_var'], '" value="', $context['register_token'], '" />
365
			<input type="hidden" name="step" value="2" />
366
		</form>
367
368
		<script>
369
			document.getElementById("agreement_lang").addEventListener("change", function (event) {
370
				registerAgreementLanguageLoad(event);
371
			});
372
373
			var regTextStrings = {
374
				"username_valid": "', $txt['registration_username_available'], '",
375
				"username_invalid": "', $txt['registration_username_unavailable'], '",
376
				"username_check": "', $txt['registration_username_check'], '",
377
				"password_short": "', $txt['registration_password_short'], '",
378
				"password_reserved": "', $txt['registration_password_reserved'], '",
379
				"password_numbercase": "', $txt['registration_password_numbercase'], '",
380
				"password_no_match": "', $txt['registration_password_no_match'], '",
381
				"password_valid": "', $txt['registration_password_valid'], '"
382
			};
383
			var verificationHandle = new elkRegister("registration", ', empty($modSettings['password_strength']) ? 0 : $modSettings['password_strength'], ', regTextStrings);
384
		</script>';
385
}
386
387
/**
388
 * After registration... all done ;).
389
 */
390
function template_after()
391
{
392
	global $context;
393
394
	// Not much to see here, just a quick... "you're now registered!" or what have you.
395
	echo '
396
		<div id="registration_success">
397
			<h2 class="category_header">', $context['title'], '</h2>
398
			<div class="content">
399
				', $context['description'], '
400
			</div>
401
		</div>';
402
}
403
404
/**
405
 * Show a page for admins to register new members.
406
 */
407
function template_admin_register()
408
{
409
	global $context, $txt, $modSettings;
410
411
	echo '
412
	<div id="admincenter">
413
		<div id="admin_form_wrapper">
414
			<form id="postForm" action="', getUrl('admin', ['action' => 'admin', 'area' => 'regcenter']), '" method="post" autocomplete="off" accept-charset="UTF-8" name="postForm">
415
				<h2 class="category_header">', $txt['admin_browse_register_new'], '</h2>
416
				<div id="register_screen" class="content">';
417
418
	if (!empty($context['registration_done']))
419
	{
420
		echo '
421
					<div class="successbox">
422
						', $context['registration_done'], '
423
					</div>';
424
	}
425
426
	echo '
427
					<input type="password" name="autofill_honey_pot" class="hide" />
428
					<div class="flow_auto">
429
					<dl class="settings" id="admin_register_form">
430
						<dt>
431
							<label for="user_input">', $txt['admin_register_username'], ':</label>
432
							<span class="smalltext">', $txt['admin_register_username_desc'], '</span>
433
						</dt>
434
						<dd>
435
							<input type="text" name="user" id="user_input" tabindex="', $context['tabindex']++, '" size="30" maxlength="25" class="input_text" />
436
						</dd>
437
						<dt>
438
							<label for="email_input">', $txt['admin_register_email'], ':</label>
439
							<span class="smalltext">', $txt['admin_register_email_desc'], '</span>
440
						</dt>
441
						<dd>
442
							<input type="email" name="email" id="email_input" tabindex="', $context['tabindex']++, '" size="30" class="input_text" />
443
							<span id="suggestion" class="smalltext"></span>
444
						</dd>
445
						<dt>
446
							<label for="password_input">', $txt['admin_register_password'], ':</label>
447
							<span class="smalltext">', $txt['admin_register_password_desc'], '</span>
448
						</dt>
449
						<dd>
450
							<input type="password" name="password" id="password_input" tabindex="', $context['tabindex']++, '" size="30" class="input_password" onchange="onCheckChange();" />
451
						</dd>';
452
453
	if (!empty($context['member_groups']))
454
	{
455
		echo '
456
						<dt>
457
							<label for="group_select">', $txt['admin_register_group'], ':</label>
458
							<span class="smalltext">', $txt['admin_register_group_desc'], '</span>
459
						</dt>
460
						<dd>
461
							<select name="group" id="group_select" tabindex="', $context['tabindex']++, '">';
462
463
		foreach ($context['member_groups'] as $id => $name)
464
		{
465
			echo '
466
								<option value="', $id, '">', $name, '</option>';
467
		}
468
469
		echo '
470
							</select>
471
						</dd>';
472
	}
473
474
	echo '
475
						<dt>
476
							<label for="emailPassword_check">', $txt['admin_register_email_detail'], ':</label>
477
							<span class="smalltext">', $txt['admin_register_email_detail_desc'], '</span>
478
						</dt>
479
						<dd>
480
							<input type="checkbox" name="emailPassword" id="emailPassword_check" tabindex="', $context['tabindex']++, '" checked="checked" disabled="disabled" />
481
						</dd>
482
						<dt>
483
							<label for="emailActivate_check">', $txt['admin_register_email_activate'], ':</label>
484
						</dt>
485
						<dd>
486
							<input type="checkbox" name="emailActivate" id="emailActivate_check" tabindex="', $context['tabindex']++, '"', !empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1 ? ' checked="checked"' : '', ' onclick="onCheckChange();" />
487
						</dd>
488
					</dl>
489
					</div>
490
					<div class="submitbutton">
491
						<input type="submit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="right_submit" />
492
						<input type="hidden" name="sa" value="register" />
493
						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
494
						<input type="hidden" name="', $context['admin-regc_token_var'], '" value="', $context['admin-regc_token'], '" />
495
					</div>
496
				</div>
497
			</form>
498
		</div>
499
	</div>';
500
}
501
502
/**
503
 * Form for editing the agreement shown for people registering to the forum.
504
 */
505
function template_edit_agreement()
506
{
507
	global $context, $txt;
508
509
	// Just a big box to edit the text file ;).
510
	echo '
511
		<form id="admin_form_wrapper" action="', getUrl('admin', ['action' => 'admin', 'area' => 'regcenter']), '" method="post" accept-charset="UTF-8" onsubmit="return confirmAgreement(', JavaScriptEscape($txt['confirm_request_accept_agreement']), ');">
512
			<h2 class="category_header">', $context['page_title'], '</h2>';
513
514
	// Warning for if the file isn't writable.
515
	if (!empty($context['warning']))
516
	{
517
		echo '
518
			<p class="warningbox">', $context['warning'], '</p>';
519
	}
520
521
	echo '
522
			<div id="registration_agreement">
523
				<div class="content">
524
					<input type="hidden" name="agree_lang" value="', $context['current_agreement'], '" />';
525
526
	// Is there more than one language to choose from?
527
	if (count($context['editable_agreements']) > 1)
528
	{
529
		echo '
530
					<h2 class="category_header">', $txt['language_configuration'], '</h2>
531
					<div class="information">
532
						<strong>', $txt['admin_agreement_select_language'], ':</strong>&nbsp;
533
						<select name="agree_lang" onchange="document.getElementById(\'admin_form_wrapper\').submit();" tabindex="', $context['tabindex']++, '">';
534
535
		foreach ($context['editable_agreements'] as $file => $name)
536
		{
537
			echo '
538
							<option value="', $file, '" ', $context['current_agreement'] === $name ? 'selected="selected"' : '', '>', $name, '</option>';
539
		}
540
541
		echo '
542
						</select>
543
						<input type="hidden" name="sa" value="agreement" />
544
						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
545
						<noscript>
546
							<div class="submitbutton">
547
								<input type="submit" name="change" value="', $txt['admin_agreement_select_language_change'], '" tabindex="', $context['tabindex']++, '" />
548
							</div>
549
						</noscript>
550
					</div>';
551
	}
552
553
	// Show the actual agreement in an oversized text box.
554
	echo '
555
					<p class="agreement">
556
						<textarea rows="10" name="agreement" id="agreement">', $context['agreement'], '</textarea>
557
					</p>
558
					<p>
559
						<label for="requireAgreement"><input type="checkbox" name="requireAgreement" id="requireAgreement"', $context['require_agreement'] ? ' checked="checked"' : '', ' tabindex="', $context['tabindex']++, '" value="1" /> ', $txt['admin_agreement'], '.</label>';
560
561
	if (!empty($context['agreement_show_options']))
562
	{
563
		echo '
564
						<br />
565
						<label for="checkboxAgreement"><input type="checkbox" name="checkboxAgreement" id="checkboxAgreement"', $context['checkbox_agreement'] ? ' checked="checked"' : '', ' tabindex="', $context['tabindex']++, '" value="1" /> ', $txt['admin_checkbox_agreement'], '.</label>';
566
	}
567
568
	echo '
569
						<br />
570
						<label for="checkboxAcceptAgreement"><input type="checkbox" name="checkboxAcceptAgreement" id="checkboxAcceptAgreement" tabindex="', $context['tabindex']++, '" value="1" /> ', $txt['admin_checkbox_accept_agreement'], '.</label>
571
					</p>
572
					<div class="submitbutton" >
573
						<input type="submit" name="save" value="', $txt['save'], '" tabindex="', $context['tabindex']++, '" />
574
						<input type="hidden" name="sa" value="', $context['subaction'], '" />
575
						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
576
						<input type="hidden" name="', $context['admin-rega_token_var'], '" value="', $context['admin-rega_token'], '" />
577
					</div>
578
				</div>
579
			</div>
580
		</form>';
581
}
582
583
/**
584
 * Interface to edit reserved words in admin panel.
585
 */
586
function template_edit_reserved_words()
587
{
588
	global $context, $txt;
589
590
	echo '
591
		<form id="admin_form_wrapper" class="content" action="', getUrl('admin', ['action' => 'admin', 'area' => 'regcenter']), '" method="post" accept-charset="UTF-8">
592
			<h2 class="category_header">', $txt['admin_reserved_set'], '</h2>
593
			<div class="content">
594
				<h4>', $txt['admin_reserved_line'], '</h4>
595
				<p class="reserved_names">
596
					<textarea cols="30" rows="6" name="reserved" id="reserved">', implode("\n", $context['reserved_words']), '</textarea>
597
				</p>
598
				<dl class="settings">
599
					<dt>
600
						<label for="matchword">', $txt['admin_match_whole'], '</label>
601
					</dt>
602
					<dd>
603
						<input type="checkbox" name="matchword" id="matchword" tabindex="', $context['tabindex']++, '" ', $context['reserved_word_options']['match_word'] ? 'checked="checked"' : '', ' />
604
					</dd>
605
					<dt>
606
						<label for="matchcase">', $txt['admin_match_case'], '</label>
607
					</dt>
608
					<dd>
609
						<input type="checkbox" name="matchcase" id="matchcase" tabindex="', $context['tabindex']++, '" ', $context['reserved_word_options']['match_case'] ? 'checked="checked"' : '', ' />
610
					</dd>
611
					<dt>
612
						<label for="matchuser">', $txt['admin_check_user'], '</label>
613
					</dt>
614
					<dd>
615
						<input type="checkbox" name="matchuser" id="matchuser" tabindex="', $context['tabindex']++, '" ', $context['reserved_word_options']['match_user'] ? 'checked="checked"' : '', ' />
616
					</dd>
617
					<dt>
618
						<label for="matchname">', $txt['admin_check_display'], '</label>
619
					</dt>
620
					<dd>
621
						<input type="checkbox" name="matchname" id="matchname" tabindex="', $context['tabindex']++, '" ', $context['reserved_word_options']['match_name'] ? 'checked="checked"' : '', ' />
622
					</dd>
623
				</dl>
624
				<div class="submitbutton" >
625
					<input type="submit" value="', $txt['save'], '" name="save_reserved_names" tabindex="', $context['tabindex']++, '" />
626
					<input type="hidden" name="sa" value="reservednames" />
627
					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
628
					<input type="hidden" name="', $context['admin-regr_token_var'], '" value="', $context['admin-regr_token'], '" />
629
				</div>
630
			</div>
631
		</form>';
632
}
633
634
/**
635
 * Interface for contact form.
636
 */
637
function template_contact_form()
638
{
639
	global $context, $txt;
640
641
	template_mailcheck_javascript();
642
643
	echo '
644
		<h2 class="category_header">', $txt['admin_contact_form'], '</h2>
645
		<form id="contact_form" class="content" action="', getUrl('action', ['action' => 'about', 'sa' => 'contact']), '" method="post" accept-charset="UTF-8">
646
			<div class="content">';
647
648
	if (!empty($context['errors']))
649
	{
650
		echo '
651
				<div class="errorbox">', $txt['errors_contact_form'], ': <ul><li>', implode('</li><li>', $context['errors']), '</li></ul></div>';
652
	}
653
654
	echo '
655
				<dl class="settings">
656
					<dt>
657
						<label for="emailaddress">', $txt['admin_register_email'], '</label>
658
					</dt>
659
					<dd>
660
						<input type="email" name="emailaddress" id="emailaddress" value="', empty($context['emailaddress']) ? '' : $context['emailaddress'], '" tabindex="', $context['tabindex']++, '" />
661
						<span id="suggestion" class="smalltext"></span>
662
					</dd>
663
					<dt>
664
						<label for="contactmessage">', $txt['contact_your_message'], '</label>
665
					</dt>
666
					<dd>
667
						<textarea id="contactmessage" name="contactmessage" cols="50" rows="10" tabindex="', $context['tabindex']++, '">', empty($context['contactmessage']) ? '' : $context['contactmessage'], '</textarea>
668
					</dd>';
669
670
	if (!empty($context['require_verification']))
671
	{
672
		template_verification_controls($context['visual_verification_id'], '
673
					<dt>
674
							' . $txt['verification'] . ':
675
					</dt>
676
					<dd>
677
							', '
678
					</dd>');
679
	}
680
681
	echo '
682
				</dl>
683
				<hr />
684
				<div class="submitbutton" >
685
					<input type="submit" value="', $txt['sendtopic_send'], '" name="send" tabindex="', $context['tabindex']++, '" />
686
					<input type="hidden" name="sa" value="reservednames" />
687
					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
688
					<input type="hidden" name="', $context['contact_token_var'], '" value="', $context['contact_token'], '" />
689
				</div>
690
			</div>
691
		</form>';
692
}
693
694
/**
695
 * Show a success page when contact form is submitted.
696
 */
697
function template_contact_form_done()
698
{
699
	global $txt;
700
701
	echo '
702
		<h2 class="category_header">', $txt['admin_contact_form'], '</h2>
703
		<div class="content">', $txt['contact_thankyou'], '</div>';
704
}
705