Project

General

Profile

Download (16.7 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
<?php
2
/*
3
	vpn_ipsec_mobile.php
4
	
5 3462a529 Matthew Grooms
	Copyright (C) 2008 Shrew Soft Inc
6 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
7 5b237745 Scott Ullrich
	All rights reserved.
8
	
9
	Redistribution and use in source and binary forms, with or without
10
	modification, are permitted provided that the following conditions are met:
11
	
12
	1. Redistributions of source code must retain the above copyright notice,
13
	   this list of conditions and the following disclaimer.
14
	
15
	2. Redistributions in binary form must reproduce the above copyright
16
	   notice, this list of conditions and the following disclaimer in the
17
	   documentation and/or other materials provided with the distribution.
18
	
19
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
	POSSIBILITY OF SUCH DAMAGE.
29
*/
30
31 6b07c15a Matthew Grooms
##|+PRIV
32
##|*IDENT=page-vpn-ipsec-mobile
33
##|*NAME=VPN: IPsec: Mobile page
34
##|*DESCR=Allow access to the 'VPN: IPsec: Mobile' page.
35
##|*MATCH=vpn_ipsec_mobile.php*
36
##|-PRIV
37
38 0f84b741 Scott Ullrich
require("functions.inc");
39 5b237745 Scott Ullrich
require("guiconfig.inc");
40 483e6de8 Scott Ullrich
require_once("ipsec.inc");
41
require_once("vpn.inc");
42 caaaf9ce Renato Botelho
require_once("filter.inc");
43 5b237745 Scott Ullrich
44 3462a529 Matthew Grooms
if (!is_array($config['ipsec']['phase1']))
45
	$config['ipsec']['phase1'] = array();
46
47
$a_phase1 = &$config['ipsec']['phase1'];
48
49
if (!is_array($config['ipsec']['client']))
50
	$config['ipsec']['client'] = array();
51
52
$a_client = &$config['ipsec']['client'];
53
54
if (count($a_client)) {
55
56
	$pconfig['enable'] = $a_client['enable'];
57
58
	$pconfig['user_source'] = $a_client['user_source'];
59
	$pconfig['group_source'] = $a_client['group_source'];
60
61
	$pconfig['pool_address'] = $a_client['pool_address'];
62
	$pconfig['pool_netbits'] = $a_client['pool_netbits'];
63
	$pconfig['net_list'] = $a_client['net_list'];
64 4178a1dd jim-p
	$pconfig['save_passwd'] = $a_client['save_passwd'];
65 3462a529 Matthew Grooms
	$pconfig['dns_domain'] = $a_client['dns_domain'];
66 d7402222 jim-p
	$pconfig['dns_split'] = $a_client['dns_split'];
67 3462a529 Matthew Grooms
	$pconfig['dns_server1'] = $a_client['dns_server1'];
68
	$pconfig['dns_server2'] = $a_client['dns_server2'];
69
	$pconfig['dns_server3'] = $a_client['dns_server3'];
70
	$pconfig['dns_server4'] = $a_client['dns_server4'];
71
	$pconfig['wins_server1'] = $a_client['wins_server1'];
72
	$pconfig['wins_server2'] = $a_client['wins_server2'];
73
	$pconfig['pfs_group'] = $a_client['pfs_group'];
74
	$pconfig['login_banner'] = $a_client['login_banner'];
75
76
	if (isset($pconfig['enable']))
77
		$pconfig['enable'] = true;
78
79
	if ($pconfig['pool_address']&&$pconfig['pool_netbits'])
80
		$pconfig['pool_enable'] = true;
81
	else
82
		$pconfig['pool_netbits'] = 24;
83
84
	if (isset($pconfig['net_list']))
85
		$pconfig['net_list_enable'] = true;
86
87 4178a1dd jim-p
	if (isset($pconfig['save_passwd']))
88
		$pconfig['save_passwd_enable'] = true;
89
90 3462a529 Matthew Grooms
	if ($pconfig['dns_domain'])
91
		$pconfig['dns_domain_enable'] = true;
92
93 d7402222 jim-p
	if ($pconfig['dns_split'])
94
		$pconfig['dns_split_enable'] = true;
95
96 3462a529 Matthew Grooms
	if ($pconfig['dns_server1']||$pconfig['dns_server2']||$pconfig['dns_server3']||$pconfig['dns_server4'])
97
		$pconfig['dns_server_enable'] = true;
98
99
	if ($pconfig['wins_server1']||$pconfig['wins_server2'])
100
		$pconfig['wins_server_enable'] = true;
101
102
	if (isset($pconfig['pfs_group']))
103
		$pconfig['pfs_group_enable'] = true;
104
105
	if ($pconfig['login_banner'])
106
		$pconfig['login_banner_enable'] = true;
107 5b237745 Scott Ullrich
}
108 3462a529 Matthew Grooms
109
if ($_POST['create']) {
110
	header("Location: vpn_ipsec_phase1.php?mobile=true");
111
}
112
113
if ($_POST['apply']) {
114
	$retval = 0;
115
	$retval = vpn_ipsec_configure();
116
	$savemsg = get_std_save_message($retval);
117 d17c7b79 jim-p
	if ($retval >= 0)
118 a368a026 Ermal Lu?i
		if (is_subsystem_dirty('ipsec'))
119
			clear_subsystem_dirty('ipsec');
120 5b237745 Scott Ullrich
}
121
122 df7bc7cb Sander van Leeuwen
if ($_POST['save']) {
123 3462a529 Matthew Grooms
124 5b237745 Scott Ullrich
	unset($input_errors);
125
	$pconfig = $_POST;
126
127 3462a529 Matthew Grooms
	/* input consolidation */
128
129 df7bc7cb Sander van Leeuwen
130 3462a529 Matthew Grooms
131
	/* input validation */
132
133
	$reqdfields = explode(" ", "user_source group_source");
134 bfbd2610 Carlos Eduardo Ramos
	$reqdfieldsn =  array(gettext("User Authentication Source"),gettext("Group Authentication Source"));
135 3462a529 Matthew Grooms
136 df7bc7cb Sander van Leeuwen
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
137 3462a529 Matthew Grooms
138
	if ($pconfig['pool_enable'])
139
		if (!is_ipaddr($pconfig['pool_address']))
140 bfbd2610 Carlos Eduardo Ramos
			$input_errors[] = gettext("A valid IP address for 'Virtual Address Pool Network' must be specified.");
141 3462a529 Matthew Grooms
142
	if ($pconfig['dns_domain_enable'])
143
		if (!is_domain($pconfig['dns_domain']))
144 bfbd2610 Carlos Eduardo Ramos
			$input_errors[] = gettext("A valid value for 'DNS Default Domain' must be specified.");
145 3462a529 Matthew Grooms
146 d7402222 jim-p
	if ($pconfig['dns_split_enable']) {
147
		if (!empty($pconfig['dns_split'])) {
148
			$domain_array=preg_split("/[ ,]+/",$pconfig['dns_split']);
149
			foreach ($domain_array as $curdomain) {
150
				if (!is_domain($curdomain)) {
151
					$input_errors[] = gettext("A valid split DNS domain list must be specified.");
152
					break;
153
				}
154
			}
155
		}
156
	}
157
158 3462a529 Matthew Grooms
	if ($pconfig['dns_server_enable']) {
159
		if (!$pconfig['dns_server1'] && !$pconfig['dns_server2'] &&
160
			!$pconfig['dns_server3'] && !$pconfig['dns_server4'] )
161 bfbd2610 Carlos Eduardo Ramos
			$input_errors[] = gettext("At least one DNS server must be specified to enable the DNS Server option.");
162 3462a529 Matthew Grooms
		if ($pconfig['dns_server1'] && !is_ipaddr($pconfig['dns_server1']))
163 bfbd2610 Carlos Eduardo Ramos
			$input_errors[] = gettext("A valid IP address for 'DNS Server #1' must be specified.");
164 3462a529 Matthew Grooms
		if ($pconfig['dns_server2'] && !is_ipaddr($pconfig['dns_server2']))
165 bfbd2610 Carlos Eduardo Ramos
			$input_errors[] = gettext("A valid IP address for 'DNS Server #2' must be specified.");
166 3462a529 Matthew Grooms
		if ($pconfig['dns_server3'] && !is_ipaddr($pconfig['dns_server3']))
167 bfbd2610 Carlos Eduardo Ramos
			$input_errors[] = gettext("A valid IP address for 'DNS Server #3' must be specified.");
168 3462a529 Matthew Grooms
		if ($pconfig['dns_server4'] && !is_ipaddr($pconfig['dns_server4']))
169 bfbd2610 Carlos Eduardo Ramos
			$input_errors[] = gettext("A valid IP address for 'DNS Server #4' must be specified.");
170 5b237745 Scott Ullrich
	}
171 3462a529 Matthew Grooms
172
	if ($pconfig['wins_server_enable']) {
173
		if (!$pconfig['wins_server1'] && !$pconfig['wins_server2'])
174 bfbd2610 Carlos Eduardo Ramos
			$input_errors[] = gettext("At least one WINS server must be specified to enable the DNS Server option.");
175 3462a529 Matthew Grooms
		if ($pconfig['wins_server1'] && !is_ipaddr($pconfig['wins_server1']))
176 bfbd2610 Carlos Eduardo Ramos
			$input_errors[] = gettext("A valid IP address for 'WINS Server #1' must be specified.");
177 3462a529 Matthew Grooms
		if ($pconfig['wins_server2'] && !is_ipaddr($pconfig['wins_server2']))
178 bfbd2610 Carlos Eduardo Ramos
			$input_errors[] = gettext("A valid IP address for 'WINS Server #2' must be specified.");
179 5b237745 Scott Ullrich
	}
180 3462a529 Matthew Grooms
181
	if ($pconfig['login_banner_enable'])
182
		if (!strlen($pconfig['login_banner']))
183 bfbd2610 Carlos Eduardo Ramos
			$input_errors[] = gettext("A valid value for 'Login Banner' must be specified.");
184 5b237745 Scott Ullrich
185
	if (!$input_errors) {
186 3462a529 Matthew Grooms
		$client = array();
187 df7bc7cb Sander van Leeuwen
188 3462a529 Matthew Grooms
		if ($pconfig['enable'])
189
			$client['enable'] = true;
190
191 52c9f9fa Ermal
		if (!empty($pconfig['user_source']))
192
			$client['user_source'] = implode(",", $pconfig['user_source']);
193 3462a529 Matthew Grooms
		$client['group_source'] = $pconfig['group_source'];
194
195
		if ($pconfig['pool_enable']) {
196
			$client['pool_address'] = $pconfig['pool_address'];
197
			$client['pool_netbits'] = $pconfig['pool_netbits'];
198 5b237745 Scott Ullrich
		}
199 3462a529 Matthew Grooms
200
		if ($pconfig['net_list_enable'])
201
			$client['net_list'] = true;
202
203 4178a1dd jim-p
		if ($pconfig['save_passwd_enable'])
204
			$client['save_passwd'] = true;
205
206 3462a529 Matthew Grooms
		if ($pconfig['dns_domain_enable'])
207
			$client['dns_domain'] = $pconfig['dns_domain'];
208
209 d7402222 jim-p
		if ($pconfig['dns_split_enable'])
210
			$client['dns_split'] = $pconfig['dns_split'];
211
212 3462a529 Matthew Grooms
		if ($pconfig['dns_server_enable']) {
213
			$client['dns_server1'] = $pconfig['dns_server1'];
214
			$client['dns_server2'] = $pconfig['dns_server2'];
215
			$client['dns_server3'] = $pconfig['dns_server3'];
216
			$client['dns_server4'] = $pconfig['dns_server4'];
217
		}
218
219
		if ($pconfig['wins_server_enable']) {
220
			$client['wins_server1'] = $pconfig['wins_server1'];
221
			$client['wins_server2'] = $pconfig['wins_server2'];
222
		}
223
224
		if ($pconfig['pfs_group_enable'])
225
			$client['pfs_group'] = $pconfig['pfs_group'];
226
227
		if ($pconfig['login_banner_enable'])
228
			$client['login_banner'] = $pconfig['login_banner'];
229
230
//		$echo "login banner = {$pconfig['login_banner']}";
231
232
		$a_client = $client;
233 df7bc7cb Sander van Leeuwen
234 5b237745 Scott Ullrich
		write_config();
235 a368a026 Ermal Lu?i
		mark_subsystem_dirty('ipsec');
236 df7bc7cb Sander van Leeuwen
237 5b237745 Scott Ullrich
		header("Location: vpn_ipsec_mobile.php");
238
		exit;
239
	}
240
}
241 422f27c0 Scott Ullrich
242 bfbd2610 Carlos Eduardo Ramos
$pgtitle = array(gettext("VPN"),gettext("IPsec"),gettext("Mobile"));
243 b32dd0a6 jim-p
$shortcut_section = "ipsec";
244 6deedfde jim-p
245 4df96eff Scott Ullrich
include("head.inc");
246
?>
247 3462a529 Matthew Grooms
248 df7bc7cb Sander van Leeuwen
	<script type="text/javascript">
249
		//<![CDATA[
250 3462a529 Matthew Grooms
251 df7bc7cb Sander van Leeuwen
		function pool_change() {
252 3462a529 Matthew Grooms
253 df7bc7cb Sander van Leeuwen
			if (document.iform.pool_enable.checked) {
254
				document.iform.pool_address.disabled = 0;
255
				document.iform.pool_netbits.disabled = 0;
256
			} else {
257
				document.iform.pool_address.disabled = 1;
258
				document.iform.pool_netbits.disabled = 1;
259
			}
260
		}
261 3462a529 Matthew Grooms
262 df7bc7cb Sander van Leeuwen
		function dns_domain_change() {
263 3462a529 Matthew Grooms
264 df7bc7cb Sander van Leeuwen
			if (document.iform.dns_domain_enable.checked)
265
				document.iform.dns_domain.disabled = 0;
266
			else
267
				document.iform.dns_domain.disabled = 1;
268
		}
269 d7402222 jim-p
270 df7bc7cb Sander van Leeuwen
		function dns_split_change() {
271 d7402222 jim-p
272 df7bc7cb Sander van Leeuwen
			if (document.iform.dns_split_enable.checked)
273
				document.iform.dns_split.disabled = 0;
274
			else
275
				document.iform.dns_split.disabled = 1;
276
		}
277 3462a529 Matthew Grooms
278 df7bc7cb Sander van Leeuwen
		function dns_server_change() {
279
280
			if (document.iform.dns_server_enable.checked) {
281
				document.iform.dns_server1.disabled = 0;
282
				document.iform.dns_server2.disabled = 0;
283
				document.iform.dns_server3.disabled = 0;
284
				document.iform.dns_server4.disabled = 0;
285
			} else {
286
				document.iform.dns_server1.disabled = 1;
287
				document.iform.dns_server2.disabled = 1;
288
				document.iform.dns_server3.disabled = 1;
289
				document.iform.dns_server4.disabled = 1;
290
			}
291
		}
292 3462a529 Matthew Grooms
293 df7bc7cb Sander van Leeuwen
		function wins_server_change() {
294 3462a529 Matthew Grooms
295 df7bc7cb Sander van Leeuwen
			if (document.iform.wins_server_enable.checked) {
296
				document.iform.wins_server1.disabled = 0;
297
				document.iform.wins_server2.disabled = 0;
298
			} else {
299
				document.iform.wins_server1.disabled = 1;
300
				document.iform.wins_server2.disabled = 1;
301
			}
302
		}
303 3462a529 Matthew Grooms
304 df7bc7cb Sander van Leeuwen
		function pfs_group_change() {
305 3462a529 Matthew Grooms
306 df7bc7cb Sander van Leeuwen
			if (document.iform.pfs_group_enable.checked)
307
				document.iform.pfs_group.disabled = 0;
308
			else
309
				document.iform.pfs_group.disabled = 1;
310
		}
311 3462a529 Matthew Grooms
312 df7bc7cb Sander van Leeuwen
		function login_banner_change() {
313 3462a529 Matthew Grooms
314 df7bc7cb Sander van Leeuwen
			if (document.iform.login_banner_enable.checked)
315
				document.iform.login_banner.disabled = 0;
316
			else
317
				document.iform.login_banner.disabled = 1;
318
		}
319 3462a529 Matthew Grooms
320 df7bc7cb Sander van Leeuwen
		//]]>
321
	</script>
322 59e0b480 Sander van Leeuwen
323 323d040b Scott Ullrich
<?php
324 df7bc7cb Sander van Leeuwen
if ($savemsg)
325
	print_info_box($savemsg);
326
if (isset($config['ipsec']['enable']) && is_subsystem_dirty('ipsec'))
327
	print_info_box_np(gettext("The IPsec tunnel configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));
328
foreach ($a_phase1 as $ph1ent)
329
	if (isset($ph1ent['mobile']))
330
		$ph1found = true;
331
if ($pconfig['enable'] && !$ph1found)
332
	print_info_box_np(gettext("Support for IPsec Mobile clients is enabled but a Phase1 definition was not found") . ".<br />" . gettext("Please click Create to define one."),gettext("create"),gettext("Create Phase1"));
333
if ($input_errors)
334
	print_input_errors($input_errors);
335 323d040b Scott Ullrich
?>
336 5a3b0d3b mgrooms
337 3462a529 Matthew Grooms
<?php
338
339 df7bc7cb Sander van Leeuwen
$tab_array = array();
340
$tab_array[0] = array(gettext("Tunnels"), false, "vpn_ipsec.php");
341
$tab_array[1] = array(gettext("Mobile clients"), true, "vpn_ipsec_mobile.php");
342
$tab_array[2] = array(gettext("Pre-Shared Key"), false, "vpn_ipsec_keys.php");
343
$tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
344
display_top_tabs($tab_array, false, 'pills');
345
346
require('classes/Form.class.php');
347
$form = new Form;
348
349
$section = new Form_Section('Enable IPsec Mobile Client Support');
350
$section->addInput(new Form_Checkbox(
351
	'enable',
352
	'IKE Extensions',
353
	'Enable IPsec Mobile Client Support',
354
	$pconfig['enable']
355
));
356
357
$form->add($section);
358
359
$section = new Form_Section('Extended Authentication (Xauth)');
360
361
$authServers = array();
362
363
foreach (auth_get_authserver_list() as $authServer)
364
	$authServers[$authServer['name']] = $authServer['name']; // Value == name
365
366
$section->addInput(new Form_Select(
367
	'user_source',
368
	'User Authentication',
369
	explode(",", $pconfig['user_source']),
370
	$authServers,
371
	true
372
))->setHelp('Source');
373
374
$section->addInput(new Form_Select(
375
	'group_source',
376
	'Group Authentication',
377
	$pconfig['group_source'],
378
	array(
379
		'none' => 'none',
380
		'system' => 'system',
381
	)
382
))->setHelp('Source');
383
384
$form->add($section);
385
386
$section = new Form_Section('Client Configuration (mode-cfg)');
387
388
$section->addInput(new Form_Checkbox(
389
	'pool_enable',
390
	'Virtual Address Pool',
391
	'Provide a virtual IP address to clients',
392
	$pconfig['pool_enable']
393
))->setAttribute('data-toggle', 'collapse')->setAttribute('data-target', '.toggle-pool_enable');
394
395
// TODO: Refactor this manual setup
396
$group = new Form_Group('');
397
$group->addClass('toggle-pool_enable collapse');
398
399
if (!empty($pconfig['pool_enable']))
400
	$group->addClass('in');
401
402
$group->add(new Form_Input(
403
	'pool_address',
404
	'Network',
405
	'text',
406
	htmlspecialchars($pconfig['pool_address'])
407
))->setWidth(4)->setHelp('Network configuration for Virtual Address Pool');
408
409
$netBits = array();
410
411
for ($i = 32; $i >= 0; $i--)
412
	$netBits[$i] = $i;
413
414
$group->add(new Form_Select(
415
	'pool_netbits',
416
	'',
417
	$pconfig['pool_netbits'],
418
	$netBits
419
))->setWidth(2);
420
421
$section->add($group);
422
423
$section->addInput(new Form_Checkbox(
424
	'net_list_enable',
425
	'Network List',
426
	'Provide a list of accessible networks to clients',
427
	$pconfig['net_list_enable']
428
));
429
430
$section->addInput(new Form_Checkbox(
431
	'save_passwd_enable',
432
	'Save Xauth Password',
433
	'Allow clients to save Xauth passwords (Cisco VPN client only).',
434
	$pconfig['save_passwd_enable']
435
))->setHelp('NOTE: With iPhone clients, this does not work when deployed via the iPhone configuration utility, only by manual entry.');
436
437
$section->addInput(new Form_Checkbox(
438
	'dns_domain_enable',
439
	'DNS Default Domain',
440
	'Provide a default domain name to clients',
441
	$pconfig['dns_domain_enable']
442
))->setAttribute('data-toggle', 'collapse')->setAttribute('data-target', '.toggle-dns_domain');
443
444
$group = new Form_Group('');
445
$group->addClass('toggle-dns_domain collapse');
446
447
if (!empty($pconfig['dns_domain_enable']))
448
	$group->addClass('in');
449
450
$group->add(new Form_Input(
451
	'dns_domain',
452
	'',
453
	'text',
454
	htmlspecialchars($pconfig['dns_domain'])
455
))->setHelp('Specify domain as DNS Default Domain');
456
457
$section->add($group);
458
459
$section->addInput(new Form_Checkbox(
460
	'dns_split_enable',
461
	'Split DNS',
462
	'Provide a list of split DNS domain names to clients. Enter a comma separated list.',
463
	$pconfig['dns_split_enable']
464
))->setAttribute('data-toggle', 'collapse')->setAttribute('data-target', '.toggle-dns_split');
465
466
$group = new Form_Group('');
467
$group->addClass('toggle-dns_split collapse');
468
469
if (!empty($pconfig['dns_split_enable']))
470
	$group->addClass('in');
471
472
$group->add(new Form_Input(
473
	'dns_split',
474
	'',
475
	'text',
476
	htmlspecialchars($pconfig['dns_split'])
477
))->setHelp('NOTE: If left blank, and a default domain is set, it will be used for this value.');
478
479
$section->add($group);
480
481
$section->addInput(new Form_Checkbox(
482
	'dns_server_enable',
483
	'DNS Servers',
484
	'Provide a DNS server list to clients',
485
	$pconfig['dns_server_enable']
486
))->setAttribute('data-toggle', 'collapse')->setAttribute('data-target', '.toggle-dns_server_enable');
487
488
for ($i = 1; $i <= 4; $i++)
489
{
490
	$group = new Form_Group('Server #' . $i);
491
	$group->addClass('toggle-dns_server_enable collapse');
492
493
	if (!empty($pconfig['dns_server_enable']))
494
		$group->addClass('in');
495
496
	$group->add(new Form_Input(
497
		'dns_server' . $i,
498
		'Server #' . $i,
499
		'text',
500
		htmlspecialchars($pconfig['dns_server' . $i])
501
	));
502
503
	$section->add($group);
504
}
505 3462a529 Matthew Grooms
506 df7bc7cb Sander van Leeuwen
$section->addInput(new Form_Checkbox(
507
	'wins_server_enable',
508
	'WINS Servers',
509
	'Provide a WINS server list to clients',
510
	$pconfig['wins_server_enable']
511
))->setAttribute('data-toggle', 'collapse')->setAttribute('data-target', '.toggle-wins_server_enable');
512
513
for ($i = 1; $i <= 2; $i++)
514
{
515
	$group = new Form_Group('Server #' . $i);
516
	$group->addClass('toggle-wins_server_enable collapse');
517
518
	if (!empty($pconfig['wins_server_enable']))
519
		$group->addClass('in');
520
521
	$group->add(new Form_Input(
522
		'wins_server' . $i,
523
		'Server #' . $i,
524
		'text',
525
		htmlspecialchars($pconfig['wins_server' . $i]),
526
		array('size' => 20)
527
	));
528
529
	$section->add($group);
530 3462a529 Matthew Grooms
}
531
532 df7bc7cb Sander van Leeuwen
$section->addInput(new Form_Checkbox(
533
	'pfs_group_enable',
534
	'Phase2 PFS Group',
535
	'Provide the Phase2 PFS group to clients ( overrides all mobile phase2 settings )',
536
	$pconfig['pfs_group_enable']
537
))->setAttribute('data-toggle', 'collapse')->setAttribute('data-target', '.toggle-pfs_group');
538
539
$group = new Form_Group('Group');
540
$group->addClass('toggle-pfs_group collapse');
541
542
if (!empty($pconfig['pfs_group_enable']))
543
	$group->addClass('in');
544
545
$group->add(new Form_Select(
546
	'pfs_group',
547
	'Group',
548
	$pconfig['pfs_group'],
549
	$p2_pfskeygroups
550
))->setWidth(2);
551
552
$section->add($group);
553
554
$section->addInput(new Form_Checkbox(
555
	'login_banner_enable',
556
	'Login Banner',
557
	'Provide a login banner to clients',
558
	$pconfig['login_banner_enable']
559
))->setAttribute('data-toggle', 'collapse')->setAttribute('data-target', '.toggle-login_banner');
560
561
$group = new Form_Group('');
562
$group->addClass('toggle-login_banner collapse');
563
564
if (!empty($pconfig['login_banner_enable']))
565
	$group->addClass('in');
566
567
// TODO: should be a textarea
568
$group->add(new Form_Input(
569
	'login_banner',
570
	'',
571
	'text',
572
	htmlspecialchars($pconfig['login_banner'])
573
));
574
575
$section->add($group);
576
577
$form->add($section);
578
579
print $form;
580
581
include("foot.inc");