Completed
Pull Request — development (#3620)
by Emanuele
07:38 queued 07:38
created

template_mailcheck_javascript()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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