Passed
Push — release-2.1 ( e31624...391b74 )
by Mathias
26:03 queued 19:58
created

template_edit_reserved_words()   B

Complexity

Conditions 6
Paths 2

Size

Total Lines 47
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 20
c 0
b 0
f 0
nop 0
dl 0
loc 47
rs 8.9777
nc 2
1
<?php
2
/**
3
 * Simple Machines Forum (SMF)
4
 *
5
 * @package SMF
6
 * @author Simple Machines https://www.simplemachines.org
7
 * @copyright 2025 Simple Machines and individual contributors
8
 * @license https://www.simplemachines.org/about/smf/license.php BSD
9
 *
10
 * @version 2.1.5
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
23
	if (!empty($context['agreement']))
24
		echo '
25
			<div class="cat_bar">
26
				<h3 class="catbg">', $txt['registration_agreement'], '</h3>
27
			</div>
28
			<div class="roundframe">
29
				<div>', $context['agreement'], '</div>
30
			</div>';
31
32
	if (!empty($context['privacy_policy']))
33
		echo '
34
			<div class="cat_bar">
35
				<h3 class="catbg">', $txt['privacy_policy'], '</h3>
36
			</div>
37
			<div class="roundframe">
38
				<div>', $context['privacy_policy'], '</div>
39
			</div>';
40
41
		echo '
42
			<div id="confirm_buttons">';
43
44
	// Age restriction in effect?
45
	if ($context['show_coppa'])
46
		echo '
47
				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br>
48
				<br>
49
				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">';
50
	else
51
		echo '
52
				<input type="submit" name="accept_agreement" value="', $context['agree'], '" class="button" />';
53
54
	echo '
55
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
56
				<input type="hidden" name="', $context['register_token_var'], '" value="', $context['register_token'], '">
57
				<input type="hidden" name="step" value="1">
58
			</div>
59
		</form>';
60
}
61
62
/**
63
 * Before registering - get their information.
64
 */
65
function template_registration_form()
66
{
67
	global $context, $scripturl, $txt, $modSettings;
68
69
	echo '
70
		<script>
71
			function verifyAgree()
72
			{
73
				if (currentAuthMethod == \'passwd\' && document.forms.registration.smf_autov_pwmain.value != document.forms.registration.smf_autov_pwverify.value)
74
				{
75
					alert("', $txt['register_passwords_differ_js'], '");
76
					return false;
77
				}
78
79
				return true;
80
			}
81
82
			var currentAuthMethod = \'passwd\';
83
		</script>';
84
85
	// Any errors?
86
	if (!empty($context['registration_errors']))
87
	{
88
		echo '
89
		<div class="errorbox">
90
			<span>', $txt['registration_errors_occurred'], '</span>
91
			<ul>';
92
93
		// Cycle through each error and display an error message.
94
		foreach ($context['registration_errors'] as $error)
95
			echo '
96
				<li>', $error, '</li>';
97
98
		echo '
99
			</ul>
100
		</div>';
101
	}
102
103
	echo '
104
		<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();">
105
			<div class="cat_bar">
106
				<h3 class="catbg">', $txt['registration_form'], '</h3>
107
			</div>
108
			<div class="title_bar">
109
				<h3 class="titlebg">', $txt['required_info'], '</h3>
110
			</div>
111
			<div class="roundframe noup">
112
				<fieldset>
113
					<dl class="register_form">
114
						<dt>
115
							<strong><label for="smf_autov_username">', $txt['username'], ':</label></strong>
116
						</dt>
117
						<dd>
118
							<input type="text" name="user" id="smf_autov_username" size="50" tabindex="', $context['tabindex']++, '" maxlength="25" value="', isset($context['username']) ? $context['username'] : '', '">
119
							<span id="smf_autov_username_div" style="display: none;">
120
								<a id="smf_autov_username_link" href="#">
121
									<span id="smf_autov_username_img" class="main_icons check"></span>
122
								</a>
123
							</span>
124
						</dd>
125
						<dt><strong><label for="smf_autov_reserve1">', $txt['user_email_address'], ':</label></strong></dt>
126
						<dd>
127
							<input type="email" name="email" id="smf_autov_reserve1" size="50" tabindex="', $context['tabindex']++, '" value="', isset($context['email']) ? $context['email'] : '', '">
128
						</dd>
129
					</dl>
130
					<dl class="register_form" id="password1_group">
131
						<dt><strong><label for="smf_autov_pwmain">', $txt['choose_pass'], ':</label></strong></dt>
132
						<dd>
133
							<input type="password" name="passwrd1" id="smf_autov_pwmain" size="50" tabindex="', $context['tabindex']++, '">
134
							<span id="smf_autov_pwmain_div" style="display: none;">
135
								<span id="smf_autov_pwmain_img" class="main_icons invalid"></span>
136
							</span>
137
						</dd>
138
					</dl>
139
					<dl class="register_form" id="password2_group">
140
						<dt>
141
							<strong><label for="smf_autov_pwverify">', $txt['verify_pass'], ':</label></strong>
142
						</dt>
143
						<dd>
144
							<input type="password" name="passwrd2" id="smf_autov_pwverify" size="50" tabindex="', $context['tabindex']++, '">
145
							<span id="smf_autov_pwverify_div" style="display: none;">
146
								<span id="smf_autov_pwverify_img" class="main_icons valid"></span>
147
							</span>
148
						</dd>
149
					</dl>
150
					<dl class="register_form" id="notify_announcements">
151
						<dt>
152
							<strong><label for="notify_announcements">', $txt['notify_announcements'], ':</label></strong>
153
						</dt>
154
						<dd>
155
							<input type="checkbox" name="notify_announcements" id="notify_announcements" tabindex="', $context['tabindex']++, '"', $context['notify_announcements'] ? ' checked="checked"' : '', '>
156
						</dd>
157
					</dl>';
158
159
	// If there is any field marked as required, show it here!
160
	if (!empty($context['custom_fields_required']) && !empty($context['custom_fields']))
161
	{
162
		echo '
163
					<dl class="register_form">';
164
165
		foreach ($context['custom_fields'] as $field)
166
			if ($field['show_reg'] > 1)
167
				echo '
168
						<dt>
169
							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong>
170
							<span class="smalltext">', $field['desc'], '</span>
171
						</dt>
172
						<dd>', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '</dd>';
173
174
		echo '
175
					</dl>';
176
	}
177
178
	echo '
179
				</fieldset>
180
			</div><!-- .roundframe -->';
181
182
	// If we have either of these, show the extra group.
183
	if (!empty($context['profile_fields']) || !empty($context['custom_fields']))
184
		echo '
185
			<div class="title_bar">
186
				<h3 class="titlebg">', $txt['additional_information'], '</h3>
187
			</div>
188
			<div class="roundframe noup">
189
				<fieldset>
190
					<dl class="register_form" id="custom_group">';
191
192
	if (!empty($context['profile_fields']))
193
	{
194
		// Any fields we particularly want?
195
		foreach ($context['profile_fields'] as $key => $field)
196
		{
197
			if ($field['type'] == 'callback')
198
			{
199
				if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func']))
200
				{
201
					$callback_func = 'template_profile_' . $field['callback_func'];
202
					$callback_func();
203
				}
204
			}
205
			else
206
			{
207
				echo '
208
						<dt>
209
							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['label'], ':</strong>';
210
211
				// Does it have any subtext to show?
212
				if (!empty($field['subtext']))
213
					echo '
214
							<span class="smalltext">', $field['subtext'], '</span>';
215
216
				echo '
217
						</dt>
218
						<dd>';
219
220
				// Want to put something infront of the box?
221
				if (!empty($field['preinput']))
222
					echo '
223
							', $field['preinput'];
224
225
				// What type of data are we showing?
226
				if ($field['type'] == 'label')
227
					echo '
228
							', $field['value'];
229
230
				// Maybe it's a text box - very likely!
231
				elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'url')))
232
					echo '
233
							<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'], '>';
234
235
				// You "checking" me out? ;)
236
				elseif ($field['type'] == 'check')
237
					echo '
238
							<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'], '>';
239
240
				// Always fun - select boxes!
241
				elseif ($field['type'] == 'select')
242
				{
243
					echo '
244
							<select name="', $key, '" id="', $key, '" tabindex="', $context['tabindex']++, '">';
245
246
					if (isset($field['options']))
247
					{
248
						// Is this some code to generate the options?
249
						if (!is_array($field['options']))
250
							$field['options'] = eval($field['options']);
0 ignored issues
show
introduced by
The use of eval() is discouraged.
Loading history...
251
252
						// Assuming we now have some!
253
						if (is_array($field['options']))
254
							foreach ($field['options'] as $value => $name)
255
								echo '
256
								<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>';
257
					}
258
259
					echo '
260
							</select>';
261
				}
262
263
				// Something to end with?
264
				if (!empty($field['postinput']))
265
					echo '
266
							', $field['postinput'];
267
268
				echo '
269
						</dd>';
270
			}
271
		}
272
	}
273
274
	// Are there any custom fields?
275
	if (!empty($context['custom_fields']))
276
	{
277
		foreach ($context['custom_fields'] as $field)
278
			if ($field['show_reg'] < 2)
279
				echo '
280
						<dt>
281
							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong>
282
							<span class="smalltext">', $field['desc'], '</span>
283
						</dt>
284
						<dd>', $field['input_html'], '</dd>';
285
	}
286
287
	// If we have either of these, close the list like a proper gent.
288
	if (!empty($context['profile_fields']) || !empty($context['custom_fields']))
289
		echo '
290
					</dl>
291
				</fieldset>
292
			</div><!-- .roundframe -->';
293
294
	if ($context['visual_verification'])
295
		echo '
296
			<div class="title_bar">
297
				<h3 class="titlebg">', $txt['verification'], '</h3>
298
			</div>
299
			<div class="roundframe noup">
300
				<fieldset class="centertext">
301
					', template_control_verification($context['visual_verification_id'], 'all'), '
302
				</fieldset>
303
			</div>';
304
305
	echo '
306
			<div id="confirm_buttons" class="flow_auto">';
307
308
	// Age restriction in effect?
309
	if (empty($context['agree']) && $context['show_coppa'])
310
		echo '
311
				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br>
312
				<br>
313
				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">';
314
	else
315
		echo '
316
				<input type="submit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="button" onclick="this.disabled = true;form.submit();">';
317
318
	echo '
319
			</div>
320
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
321
			<input type="hidden" name="', $context['register_token_var'], '" value="', $context['register_token'], '">
322
			<input type="hidden" name="step" value="2">
323
		</form>
324
		<script>
325
			var regTextStrings = {
326
				"username_valid": "', $txt['registration_username_available'], '",
327
				"username_invalid": "', $txt['registration_username_unavailable'], '",
328
				"username_check": "', $txt['registration_username_check'], '",
329
				"password_short": "', $txt['registration_password_short'], '",
330
				"password_reserved": "', $txt['registration_password_reserved'], '",
331
				"password_numbercase": "', $txt['registration_password_numbercase'], '",
332
				"password_no_match": "', $txt['registration_password_no_match'], '",
333
				"password_valid": "', $txt['registration_password_valid'], '"
334
			};
335
			var verificationHandle = new smfRegister("registration", ', empty($modSettings['password_strength']) ? 0 : $modSettings['password_strength'], ', regTextStrings);
336
		</script>';
337
}
338
339
/**
340
 * After registration... all done ;).
341
 */
342
function template_after()
343
{
344
	global $context;
345
346
	// Not much to see here, just a quick... "you're now registered!" or what have you.
347
	echo '
348
		<div id="registration_success">
349
			<div class="cat_bar">
350
				<h3 class="catbg">', $context['title'], '</h3>
351
			</div>
352
			<div class="windowbg">
353
				<p>', $context['description'], '</p>
354
			</div>
355
		</div>';
356
}
357
358
/**
359
 * Template for giving instructions about COPPA activation.
360
 */
361
function template_coppa()
362
{
363
	global $context, $txt, $scripturl;
364
365
	// Formulate a nice complicated message!
366
	echo '
367
			<div class="title_bar">
368
				<h3 class="titlebg">', $context['page_title'], '</h3>
369
			</div>
370
			<div id="coppa" class="roundframe noup">
371
				<p>', $context['coppa']['body'], '</p>
372
				<p>
373
					<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>
374
				</p>
375
				<p>', $context['coppa']['many_options'] ? $txt['coppa_send_to_two_options'] : $txt['coppa_send_to_one_option'], '</p>';
376
377
	// Can they send by post?
378
	if (!empty($context['coppa']['post']))
379
		echo '
380
				<h4>1) ', $txt['coppa_send_by_post'], '</h4>
381
				<div class="coppa_contact">
382
					', $context['coppa']['post'], '
383
				</div>';
384
385
	// Can they send by fax??
386
	if (!empty($context['coppa']['fax']))
387
		echo '
388
				<h4>', !empty($context['coppa']['post']) ? '2' : '1', ') ', $txt['coppa_send_by_fax'], '</h4>
389
				<div class="coppa_contact">
390
					', $context['coppa']['fax'], '
391
				</div>';
392
393
	// Offer an alternative Phone Number?
394
	if ($context['coppa']['phone'])
395
		echo '
396
				<p>', $context['coppa']['phone'], '</p>';
397
398
	echo '
399
			</div><!-- #coppa -->';
400
}
401
402
/**
403
 * An easily printable form for giving permission to access the forum for a minor.
404
 */
405
function template_coppa_form()
406
{
407
	global $context, $txt;
408
409
	// Show the form (As best we can)
410
	echo '
411
		<table style="width: 100%; padding: 3px; border: 0" class="tborder">
412
			<tr>
413
				<td>', $context['forum_contacts'], '</td>
414
			</tr>
415
			<tr>
416
				<td class="righttext">
417
					<em>', $txt['coppa_form_address'], '</em>: ', $context['ul'], '<br>
418
					', $context['ul'], '<br>
419
					', $context['ul'], '<br>
420
					', $context['ul'], '
421
				</td>
422
			</tr>
423
			<tr>
424
				<td class="righttext">
425
					<em>', $txt['coppa_form_date'], '</em>: ', $context['ul'], '
426
					<br><br>
427
				</td>
428
			</tr>
429
			<tr>
430
				<td>
431
					', $context['coppa_body'], '
432
				</td>
433
			</tr>
434
		</table>
435
		<br>';
436
}
437
438
/**
439
 * Show a window containing the spoken verification code.
440
 */
441
function template_verification_sound()
442
{
443
	global $context, $settings, $txt, $modSettings;
444
445
	echo '<!DOCTYPE html>
446
<html', $context['right_to_left'] ? ' dir="rtl"' : '', '>
447
	<head>
448
		<meta charset="', $context['character_set'], '">
449
		<title>', $txt['visual_verification_sound'], '</title>
450
		<meta name="robots" content="noindex">
451
		', template_css(), '
0 ignored issues
show
Bug introduced by
Are you sure the usage of template_css() is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
452
		<style>';
453
454
	// Just show the help text and a "close window" link.
455
	echo '
456
		</style>
457
	</head>
458
	<body style="margin: 1ex;">
459
		<div class="windowbg description" style="text-align: center;">';
460
461
	if (isBrowser('is_ie') || isBrowser('is_ie11'))
462
		echo '
463
			<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="audio/x-wav">
464
				<param name="AutoStart" value="1">
465
				<param name="FileName" value="', $context['verification_sound_href'], '">
466
			</object>';
467
	else
468
		echo '
469
			<audio src="', $context['verification_sound_href'], '" controls>
470
				<object type="audio/x-wav" data="', $context['verification_sound_href'], '">
471
					<a href="', $context['verification_sound_href'], '" rel="nofollow">', $context['verification_sound_href'], '</a>
472
				</object>
473
			</audio>';
474
475
	echo '
476
			<br>
477
			<a href="', $context['verification_sound_href'], ';sound" rel="nofollow">', $txt['visual_verification_sound_again'], '</a><br>
478
			<a href="', $context['verification_sound_href'], '" rel="nofollow">', $txt['visual_verification_sound_direct'], '</a><br><br>
479
			<a href="javascript:self.close();">', $txt['visual_verification_sound_close'], '</a><br>
480
		</div><!-- .description -->
481
	</body>
482
</html>';
483
}
484
485
/**
486
 * The template for the form allowing an admin to register a user from the admin center.
487
 */
488
function template_admin_register()
489
{
490
	global $context, $scripturl, $txt, $modSettings;
491
492
	echo '
493
		<div id="admin_form_wrapper">
494
			<form id="postForm" action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '" name="postForm">
495
				<div class="cat_bar">
496
					<h3 class="catbg">', $txt['admin_browse_register_new'], '</h3>
497
				</div>
498
				<div id="register_screen" class="windowbg">';
499
500
	if (!empty($context['registration_done']))
501
		echo '
502
					<div class="infobox">
503
						', $context['registration_done'], '
504
					</div>';
505
506
	echo '
507
					<dl class="register_form" id="admin_register_form">
508
						<dt>
509
							<strong><label for="user_input">', $txt['admin_register_username'], ':</label></strong>
510
							<span class="smalltext">', $txt['admin_register_username_desc'], '</span>
511
						</dt>
512
						<dd>
513
							<input type="text" name="user" id="user_input" tabindex="', $context['tabindex']++, '" size="50" maxlength="25">
514
						</dd>
515
						<dt>
516
							<strong><label for="email_input">', $txt['admin_register_email'], ':</label></strong>
517
							<span class="smalltext">', $txt['admin_register_email_desc'], '</span>
518
						</dt>
519
						<dd>
520
							<input type="email" name="email" id="email_input" tabindex="', $context['tabindex']++, '" size="50">
521
						</dd>
522
						<dt>
523
							<strong><label for="password_input">', $txt['admin_register_password'], ':</label></strong>
524
							<span class="smalltext">', $txt['admin_register_password_desc'], '</span>
525
						</dt>
526
						<dd>
527
							<input type="password" name="password" id="password_input" tabindex="', $context['tabindex']++, '" size="50" onchange="onCheckChange();">
528
						</dd>';
529
530
	if (!empty($context['member_groups']))
531
	{
532
		echo '
533
						<dt>
534
							<strong><label for="group_select">', $txt['admin_register_group'], ':</label></strong>
535
							<span class="smalltext">', $txt['admin_register_group_desc'], '</span>
536
						</dt>
537
						<dd>
538
							<select name="group" id="group_select" tabindex="', $context['tabindex']++, '">';
539
540
		foreach ($context['member_groups'] as $id => $name)
541
			echo '
542
								<option value="', $id, '">', $name, '</option>';
543
544
		echo '
545
							</select>
546
						</dd>';
547
	}
548
549
	// If there is any field marked as required, show it here!
550
	if (!empty($context['custom_fields_required']) && !empty($context['custom_fields']))
551
		foreach ($context['custom_fields'] as $field)
552
			if ($field['show_reg'] > 1)
553
				echo '
554
						<dt>
555
							<strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong>
556
							<span class="smalltext">', $field['desc'], '</span>
557
						</dt>
558
						<dd>
559
							', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '
560
						</dd>';
561
562
	echo '
563
						<dt>
564
							<strong><label for="emailPassword_check">', $txt['admin_register_email_detail'], ':</label></strong>
565
							<span class="smalltext">', $txt['admin_register_email_detail_desc'], '</span>
566
						</dt>
567
						<dd>
568
							<input type="checkbox" name="emailPassword" id="emailPassword_check" tabindex="', $context['tabindex']++, '" checked disabled>
569
						</dd>
570
						<dt>
571
							<strong><label for="emailActivate_check">', $txt['admin_register_email_activate'], ':</label></strong>
572
						</dt>
573
						<dd>
574
							<input type="checkbox" name="emailActivate" id="emailActivate_check" tabindex="', $context['tabindex']++, '"', !empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1 ? ' checked' : '', ' onclick="onCheckChange();">
575
						</dd>
576
					</dl>
577
					<div class="flow_auto">
578
						<input type="submit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="button">
579
						<input type="hidden" name="sa" value="register">
580
						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
581
						<input type="hidden" name="', $context['admin-regc_token_var'], '" value="', $context['admin-regc_token'], '">
582
					</div>
583
				</div><!-- #register_screen -->
584
			</form>
585
		</div><!-- #admin_form_wrapper -->
586
	<br class="clear">';
587
}
588
589
/**
590
 * Form for editing the agreement shown for people registering to the forum.
591
 */
592
function template_edit_agreement()
593
{
594
	global $context, $scripturl, $txt;
595
596
	if (!empty($context['saved_successful']))
597
		echo '
598
		<div class="infobox">', $txt['settings_saved'], '</div>';
599
600
	elseif (!empty($context['could_not_save']))
601
		echo '
602
		<div class="errorbox">', $txt['admin_agreement_not_saved'], '</div>';
603
604
	// Warning for if the file isn't writable.
605
	if (!empty($context['warning']))
606
		echo '
607
		<div class="errorbox">', $context['warning'], '</div>';
608
609
	// Just a big box to edit the text file ;)
610
	echo '
611
		<div id="admin_form_wrapper">
612
			<div class="cat_bar">
613
				<h3 class="catbg">', $txt['registration_agreement'], '</h3>
614
			</div>
615
			<div class="windowbg" id="registration_agreement">';
616
617
	// Is there more than one language to choose from?
618
	if (count($context['editable_agreements']) > 1)
619
	{
620
		echo '
621
				<div class="cat_bar">
622
					<h3 class="catbg">', $txt['language_configuration'], '</h3>
623
				</div>
624
				<div class="information">
625
					<form action="', $scripturl, '?action=admin;area=regcenter" id="change_reg" method="post" accept-charset="', $context['character_set'], '" style="display: inline;">
626
						<strong>', $txt['admin_agreement_select_language'], ':</strong>
627
						<select name="agree_lang" onchange="document.getElementById(\'change_reg\').submit();" tabindex="', $context['tabindex']++, '">';
628
629
		foreach ($context['editable_agreements'] as $file => $name)
630
			echo '
631
							<option value="', $file, '"', $context['current_agreement'] == $file ? ' selected' : '', '>', $name, '</option>';
632
633
		echo '
634
						</select>
635
						<div class="righttext">
636
							<input type="hidden" name="sa" value="agreement">
637
							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
638
							<input type="hidden" name="', $context['admin-rega_token_var'], '" value="', $context['admin-rega_token'], '">
639
							<input type="submit" name="change" value="', $txt['admin_agreement_select_language_change'], '" tabindex="', $context['tabindex']++, '" class="button">
640
						</div>
641
					</form>
642
				</div><!-- .information -->';
643
	}
644
645
	// Show the actual agreement in an oversized text box.
646
	echo '
647
				<form action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '">
648
					<textarea cols="70" rows="20" name="agreement" id="agreement">', $context['agreement'], '</textarea>
649
					<div class="information">
650
						<span>', $context['agreement_info'], '</span>
651
					</div>
652
					<input type="submit" value="', $txt['save'], '" tabindex="', $context['tabindex']++, '" class="button" onclick="return resetAgreementConfirm()" />
653
					<input type="hidden" name="agree_lang" value="', $context['current_agreement'], '">
654
					<input type="hidden" name="sa" value="agreement">
655
					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
656
					<script>
657
						function resetAgreementConfirm()
658
						{
659
							return true;
660
						}
661
					</script>
662
					<input type="hidden" name="', $context['admin-rega_token_var'], '" value="', $context['admin-rega_token'], '">
663
				</form>
664
			</div><!-- #registration_agreement -->
665
		</div><!-- #admin_form_wrapper -->';
666
}
667
668
/**
669
 * Template for editing reserved words.
670
 */
671
function template_edit_reserved_words()
672
{
673
	global $context, $scripturl, $txt;
674
675
	if (!empty($context['saved_successful']))
676
		echo '
677
	<div class="infobox">', $txt['settings_saved'], '</div>';
678
679
	echo '
680
	<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '">
681
		<div class="cat_bar">
682
			<h3 class="catbg">', $txt['admin_reserved_set'], '</h3>
683
		</div>
684
		<div class="windowbg">
685
			<h4>', $txt['admin_reserved_line'], '</h4>
686
			<textarea cols="30" rows="6" name="reserved" id="reserved">', implode("\n", $context['reserved_words']), '</textarea>
687
			<dl class="settings">
688
				<dt>
689
					<label for="matchword">', $txt['admin_match_whole'], '</label>
690
				</dt>
691
				<dd>
692
					<input type="checkbox" name="matchword" id="matchword" tabindex="', $context['tabindex']++, '"', $context['reserved_word_options']['match_word'] ? ' checked' : '', '>
693
				</dd>
694
				<dt>
695
					<label for="matchcase">', $txt['admin_match_case'], '</label>
696
				</dt>
697
				<dd>
698
					<input type="checkbox" name="matchcase" id="matchcase" tabindex="', $context['tabindex']++, '"', $context['reserved_word_options']['match_case'] ? ' checked' : '', '>
699
				</dd>
700
				<dt>
701
					<label for="matchuser">', $txt['admin_check_user'], '</label>
702
				</dt>
703
				<dd>
704
					<input type="checkbox" name="matchuser" id="matchuser" tabindex="', $context['tabindex']++, '"', $context['reserved_word_options']['match_user'] ? ' checked' : '', '>
705
				</dd>
706
				<dt>
707
					<label for="matchname">', $txt['admin_check_display'], '</label>
708
				</dt>
709
				<dd>
710
					<input type="checkbox" name="matchname" id="matchname" tabindex="', $context['tabindex']++, '"', $context['reserved_word_options']['match_name'] ? ' checked' : '', '>
711
				</dd>
712
			</dl>
713
			<div class="flow_auto">
714
				<input type="submit" value="', $txt['save'], '" name="save_reserved_names" tabindex="', $context['tabindex']++, '" class="button">
715
				<input type="hidden" name="sa" value="reservednames">
716
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
717
				<input type="hidden" name="', $context['admin-regr_token_var'], '" value="', $context['admin-regr_token'], '">
718
			</div>
719
		</div><!-- .windowbg -->
720
	</form>';
721
}
722
723
// Form for editing the privacy policy shown to people registering to the forum.
724
function template_edit_privacy_policy()
725
{
726
	global $context, $settings, $options, $scripturl, $txt;
727
728
	if (!empty($context['saved_successful']))
729
		echo '
730
		<div class="infobox">', $txt['settings_saved'], '</div>';
731
732
	// Just a big box to edit the text file ;).
733
	echo '
734
		<div class="cat_bar">
735
			<h3 class="catbg">', $txt['privacy_policy'], '</h3>
736
		</div>
737
		<div class="windowbg" id="privacy_policy">';
738
739
	// Is there more than one language to choose from?
740
	if (count($context['editable_policies']) > 1)
741
	{
742
		echo '
743
			<div class="information">
744
				<form action="', $scripturl, '?action=admin;area=regcenter" id="change_policy" method="post" accept-charset="', $context['character_set'], '" style="display: inline;">
745
					<strong>', $txt['admin_agreement_select_language'], ':</strong>
746
					<select name="policy_lang" onchange="document.getElementById(\'change_policy\').submit();" tabindex="', $context['tabindex']++, '">';
747
748
		foreach ($context['editable_policies'] as $lang => $name)
749
			echo '
750
						<option value="', $lang, '" ', $context['current_policy_lang'] == $lang ? 'selected="selected"' : '', '>', $name, '</option>';
751
752
		echo '
753
					</select>
754
					<div class="righttext">
755
						<input type="hidden" name="sa" value="policy">
756
						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
757
						<input type="submit" name="change" value="', $txt['admin_agreement_select_language_change'], '" tabindex="', $context['tabindex']++, '" class="button">
758
					</div>
759
				</form>
760
			</div>';
761
	}
762
763
	echo '
764
			<form action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '">';
765
766
	// Show the actual policy in an oversized text box.
767
	echo '
768
			<textarea cols="70" rows="20" name="policy" id="agreement">', $context['privacy_policy'], '</textarea>
769
				<div class="information">', $context['privacy_policy_info'], '</div>
770
				<div class="righttext">
771
					<input type="submit" value="', $txt['save'], '" tabindex="', $context['tabindex']++, '" class="button" onclick="return resetPolicyConfirm()" />
772
					<input type="hidden" name="policy_lang" value="', $context['current_policy_lang'], '" />
773
					<input type="hidden" name="sa" value="policy" />
774
					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
775
					<input type="hidden" name="', $context['admin-regp_token_var'], '" value="', $context['admin-regp_token'], '" />
776
					<script>
777
						function resetPolicyConfirm()
778
						{
779
							return true;
780
						}
781
					</script>
782
				</div>
783
			</form>
784
		</div>';
785
}
786
787
?>