Project

General

Profile

Download (19.3 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * vpn_ipsec.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
7
 * All rights reserved.
8
 *
9
 * originally based on m0n0wall (http://m0n0.ch/wall)
10
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
11
 * All rights reserved.
12
 *
13
 * Licensed under the Apache License, Version 2.0 (the "License");
14
 * you may not use this file except in compliance with the License.
15
 * You may obtain a copy of the License at
16
 *
17
 * http://www.apache.org/licenses/LICENSE-2.0
18
 *
19
 * Unless required by applicable law or agreed to in writing, software
20
 * distributed under the License is distributed on an "AS IS" BASIS,
21
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
 * See the License for the specific language governing permissions and
23
 * limitations under the License.
24
 */
25

    
26
##|+PRIV
27
##|*IDENT=page-vpn-ipsec
28
##|*NAME=VPN: IPsec
29
##|*DESCR=Allow access to the 'VPN: IPsec' page.
30
##|*MATCH=vpn_ipsec.php*
31
##|-PRIV
32

    
33
require_once("guiconfig.inc");
34
require_once("functions.inc");
35
require_once("filter.inc");
36
require_once("shaper.inc");
37
require_once("ipsec.inc");
38
require_once("vpn.inc");
39

    
40
if (!is_array($config['ipsec']['phase1'])) {
41
	$config['ipsec']['phase1'] = array();
42
}
43

    
44
if (!is_array($config['ipsec']['phase2'])) {
45
	$config['ipsec']['phase2'] = array();
46
}
47

    
48
$a_phase1 = &$config['ipsec']['phase1'];
49
$a_phase2 = &$config['ipsec']['phase2'];
50

    
51
if ($_POST) {
52
	if ($_POST['apply']) {
53
		$retval = vpn_ipsec_configure();
54
		/* reload the filter in the background */
55
		filter_configure();
56
		$savemsg = get_std_save_message($retval);
57
		if ($retval >= 0) {
58
			if (is_subsystem_dirty('ipsec')) {
59
				clear_subsystem_dirty('ipsec');
60
			}
61
		}
62
	} else if (isset($_POST['del'])) {
63
		/* delete selected p1 entries */
64
		if (is_array($_POST['p1entry']) && count($_POST['p1entry'])) {
65
			foreach ($_POST['p1entry'] as $p1entrydel) {
66
				unset($a_phase1[$p1entrydel]);
67
			}
68
			if (write_config()) {
69
				mark_subsystem_dirty('ipsec');
70
			}
71
		}
72
	} else if (isset($_POST['delp2'])) {
73
		/* delete selected p2 entries */
74
		if (is_array($_POST['p2entry']) && count($_POST['p2entry'])) {
75
			foreach ($_POST['p2entry'] as $p2entrydel) {
76
				unset($a_phase2[$p2entrydel]);
77
			}
78
			if (write_config()) {
79
				mark_subsystem_dirty('ipsec');
80
			}
81
		}
82
	} else {
83
		/* yuck - IE won't send value attributes for image buttons, while Mozilla does - so we use .x/.y to find move button clicks instead... */
84

    
85
		// TODO: this. is. nasty.
86
		unset($delbtn, $delbtnp2, $movebtn, $movebtnp2, $togglebtn, $togglebtnp2);
87
		foreach ($_POST as $pn => $pd) {
88
			if (preg_match("/del_(\d+)/", $pn, $matches)) {
89
				$delbtn = $matches[1];
90
			} else if (preg_match("/delp2_(\d+)/", $pn, $matches)) {
91
				$delbtnp2 = $matches[1];
92
			} else if (preg_match("/move_(\d+)/", $pn, $matches)) {
93
				$movebtn = $matches[1];
94
			} else if (preg_match("/movep2_(\d+)/", $pn, $matches)) {
95
				$movebtnp2 = $matches[1];
96
			} else if (preg_match("/toggle_(\d+)/", $pn, $matches)) {
97
				$togglebtn = $matches[1];
98
			} else if (preg_match("/togglep2_(\d+)/", $pn, $matches)) {
99
				$togglebtnp2 = $matches[1];
100
			}
101
		}
102

    
103
		$save = 1;
104

    
105
		/* move selected p1 entries before this */
106
		if (isset($movebtn) && is_array($_POST['p1entry']) && count($_POST['p1entry'])) {
107
			$a_phase1_new = array();
108

    
109
			/* copy all p1 entries < $movebtn and not selected */
110
			for ($i = 0; $i < $movebtn; $i++) {
111
				if (!in_array($i, $_POST['p1entry'])) {
112
					$a_phase1_new[] = $a_phase1[$i];
113
				}
114
			}
115

    
116
			/* copy all selected p1 entries */
117
			for ($i = 0; $i < count($a_phase1); $i++) {
118
				if ($i == $movebtn) {
119
					continue;
120
				}
121
				if (in_array($i, $_POST['p1entry'])) {
122
					$a_phase1_new[] = $a_phase1[$i];
123
				}
124
			}
125

    
126
			/* copy $movebtn p1 entry */
127
			if ($movebtn < count($a_phase1)) {
128
				$a_phase1_new[] = $a_phase1[$movebtn];
129
			}
130

    
131
			/* copy all p1 entries > $movebtn and not selected */
132
			for ($i = $movebtn+1; $i < count($a_phase1); $i++) {
133
				if (!in_array($i, $_POST['p1entry'])) {
134
					$a_phase1_new[] = $a_phase1[$i];
135
				}
136
			}
137
			if (count($a_phase1_new) > 0) {
138
				$a_phase1 = $a_phase1_new;
139
			}
140

    
141
		} else if (isset($movebtnp2) && is_array($_POST['p2entry']) && count($_POST['p2entry'])) {
142
			/* move selected p2 entries before this */
143
			$a_phase2_new = array();
144

    
145
			/* copy all p2 entries < $movebtnp2 and not selected */
146
			for ($i = 0; $i < $movebtnp2; $i++) {
147
				if (!in_array($i, $_POST['p2entry'])) {
148
					$a_phase2_new[] = $a_phase2[$i];
149
				}
150
			}
151

    
152
			/* copy all selected p2 entries */
153
			for ($i = 0; $i < count($a_phase2); $i++) {
154
				if ($i == $movebtnp2) {
155
					continue;
156
				}
157
				if (in_array($i, $_POST['p2entry'])) {
158
					$a_phase2_new[] = $a_phase2[$i];
159
				}
160
			}
161

    
162
			/* copy $movebtnp2 p2 entry */
163
			if ($movebtnp2 < count($a_phase2)) {
164
				$a_phase2_new[] = $a_phase2[$movebtnp2];
165
			}
166

    
167
			/* copy all p2 entries > $movebtnp2 and not selected */
168
			for ($i = $movebtnp2+1; $i < count($a_phase2); $i++) {
169
				if (!in_array($i, $_POST['p2entry'])) {
170
					$a_phase2_new[] = $a_phase2[$i];
171
				}
172
			}
173
			if (count($a_phase2_new) > 0) {
174
				$a_phase2 = $a_phase2_new;
175
			}
176

    
177
		} else if (isset($togglebtn)) {
178
			if (isset($a_phase1[$togglebtn]['disabled'])) {
179
				unset($a_phase1[$togglebtn]['disabled']);
180
			} else {
181
				$a_phase1[$togglebtn]['disabled'] = true;
182
			}
183
		} else if (isset($togglebtnp2)) {
184
			if (isset($a_phase2[$togglebtnp2]['disabled'])) {
185
				unset($a_phase2[$togglebtnp2]['disabled']);
186
			} else {
187
				$a_phase2[$togglebtnp2]['disabled'] = true;
188
			}
189
		} else if (isset($delbtn)) {
190
			/* remove static route if interface is not WAN */
191
			if ($a_phase1[$delbtn]['interface'] <> "wan") {
192
				mwexec("/sbin/route delete -host {$a_phase1[$delbtn]['remote-gateway']}");
193
			}
194

    
195
			/* remove all phase2 entries that match the ikeid */
196
			$ikeid = $a_phase1[$delbtn]['ikeid'];
197
			foreach ($a_phase2 as $p2index => $ph2tmp) {
198
				if ($ph2tmp['ikeid'] == $ikeid) {
199
					unset($a_phase2[$p2index]);
200
				}
201
			}
202
			unset($a_phase1[$delbtn]);
203

    
204
		} else if (isset($delbtnp2)) {
205
			unset($a_phase2[$delbtnp2]);
206

    
207
		} else {
208
			$save = 0;
209
		}
210

    
211
		if ($save === 1) {
212
			if (write_config()) {
213
				mark_subsystem_dirty('ipsec');
214
			}
215
		}
216
	}
217
}
218

    
219
$pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Tunnels"));
220
$shortcut_section = "ipsec";
221

    
222
include("head.inc");
223

    
224
$tab_array = array();
225
$tab_array[] = array(gettext("Tunnels"), true, "vpn_ipsec.php");
226
$tab_array[] = array(gettext("Mobile Clients"), false, "vpn_ipsec_mobile.php");
227
$tab_array[] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php");
228
$tab_array[] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
229
display_top_tabs($tab_array);
230

    
231
	if ($savemsg) {
232
		print_info_box($savemsg, 'success');
233
	}
234

    
235
	if (is_subsystem_dirty('ipsec')) {
236
		print_apply_box(gettext("The IPsec tunnel configuration has been changed.") . "<br />" . gettext("The changes must be applied for them to take effect."));
237
	}
238
?>
239

    
240
<form name="mainform" method="post">
241
	<div class="panel panel-default">
242
		<div class="panel-heading"><h2 class="panel-title"><?=gettext('IPsec Tunnels')?></h2></div>
243
		<div class="panel-body table-responsive">
244
			<table class="table table-striped table-hover">
245
				<thead>
246
					<tr>
247
						<th>&nbsp;</th>
248
						<th>&nbsp;</th>
249
						<th><?=gettext("IKE")?></th>
250
						<th><?=gettext("Remote Gateway")?></th>
251
						<th><?=gettext("Mode")?></th>
252
						<th><?=gettext("P1 Protocol")?></th>
253
						<th><?=gettext("P1 Transforms")?></th>
254
						<th><?=gettext("P1 Description")?></th>
255
						<th><?=gettext("Actions")?></th>
256
					</tr>
257
				</thead>
258
				<tbody class="p1-entries">
259
<?php $i = 0; foreach ($a_phase1 as $ph1ent): ?>
260
<?php
261
	$iconfn = "pass";
262

    
263
	$entryStatus = (isset($ph1ent['disabled']) ? 'disabled' : 'enabled');
264

    
265
	if ($entryStatus == 'disabled') {
266
		$iconfn .= "_d";
267
	}
268
?>
269
					<tr id="fr<?=$i?>" onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>" ondblclick="document.location='vpn_ipsec_phase1.php?p1index=<?=$i?>'" class="<?= $entryStatus ?>">
270
						<td>
271
							<input type="checkbox" id="frc<?=$i?>" onclick="fr_toggle(<?=$i?>)" name="p1entry[]" value="<?=$i?>"  />
272
							<a	class="fa fa-anchor icon-pointer" id="Xmove_<?=$i?>" title="<?=gettext("Move checked entries to here")?>"></a>
273
						</td>
274
						<td>
275
							<button value="toggle_<?=$i?>" name="toggle_<?=$i?>" title="<?=gettext("click to toggle enabled/disabled status")?>" class="btn btn-xs btn-<?= ($entryStatus == 'disabled' ? 'success' : 'warning') ?>" type="submit"><?= ($entryStatus == 'disabled' ? 'Enable' : 'Disable') ?></button>
276
						</td>
277
						<td id="frd<?=$i?>">
278
<?php
279
			if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1") {
280
				echo "V1";
281
			} elseif ($ph1ent['iketype'] == "ikev2") {
282
				echo "V2";
283
			} elseif ($ph1ent['iketype'] == "auto") {
284
				echo "Auto";
285
			}
286
?>
287
						</td>
288
						<td>
289
<?php
290
			if ($ph1ent['interface']) {
291
				$iflabels = get_configured_interface_with_descr();
292

    
293
				$viplist = get_configured_vip_list();
294
				foreach ($viplist as $vip => $address) {
295
					$iflabels[$vip] = $address;
296
					if (get_vip_descr($address)) {
297
						$iflabels[$vip] .= " (". get_vip_descr($address) .")";
298
					}
299
				}
300

    
301
				$grouplist = return_gateway_groups_array();
302
				foreach ($grouplist as $name => $group) {
303
					if ($group[0]['vip'] != "") {
304
						$vipif = $group[0]['vip'];
305
					} else {
306
						$vipif = $group[0]['int'];
307
					}
308
					$iflabels[$name] = "GW Group {$name}";
309
				}
310
				$if = htmlspecialchars($iflabels[$ph1ent['interface']]);
311
			} else {
312
				$if = "WAN";
313
			}
314

    
315
			if (!isset($ph1ent['mobile'])) {
316
				echo $if."<br />".$ph1ent['remote-gateway'];
317
			} else {
318
				echo $if."<br /><strong>" . gettext("Mobile Client") . "</strong>";
319
			}
320
?>
321
						</td>
322
						<td id="frd<?=$i?>">
323
					<?=$spans?>
324
					<?php
325
					if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1" || $ph1ent['iketype'] == "auto") {
326
						echo "{$ph1ent['mode']}";
327
					}
328
					?>
329
					<?=$spane?>
330
				</td>
331
				<td id="frd<?=$i?>">
332
					<?=$p1_ealgos[$ph1ent['encryption-algorithm']['name']]['name']?>
333
<?php
334
			if ($ph1ent['encryption-algorithm']['keylen']) {
335
				if ($ph1ent['encryption-algorithm']['keylen'] == "auto") {
336
					echo " (" . gettext("auto") . ")";
337
				} else {
338
					echo " ({$ph1ent['encryption-algorithm']['keylen']} " . gettext("bits") . ")";
339
				}
340
			}
341
?>
342
						</td>
343
						<td>
344
							<?=$p1_halgos[$ph1ent['hash-algorithm']]?>
345
						</td>
346
						<td>
347
							<?=htmlspecialchars($ph1ent['descr'])?>
348
						</td>
349
						<td style="cursor: pointer;">
350
<!--							<a	class="fa fa-anchor" id="Xmove_<?=$i?>" title="<?=gettext("Move checked entries to here")?>"></a> -->
351
							<button style="display: none;" class="btn btn-default btn-xs" type="submit" id="move_<?=$i?>" name="move_<?=$i?>" value="move_<?=$i?>"><?=gettext("Move checked entries to here")?></button>
352
							<a class="fa fa-pencil" href="vpn_ipsec_phase1.php?p1index=<?=$i?>" title="<?=gettext("Edit phase1 entry"); ?>"></a>
353
<?php if (!isset($ph1ent['mobile'])): ?>
354
							<a class="fa fa-clone" href="vpn_ipsec_phase1.php?dup=<?=$i?>" title="<?=gettext("Copy phase1 entry"); ?>"></a>
355
<?php endif; ?>
356
							<a	class="fa fa-trash no-confirm" id="Xdel_<?=$i?>" title="<?=gettext('Delete phase1 entry'); ?>"></a>
357
							<button style="display: none;" class="btn btn-xs btn-warning" type="submit" id="del_<?=$i?>" name="del_<?=$i?>" value="del_<?=$i?>" title="<?=gettext('Delete phase1 entry'); ?>">delete</button>
358

    
359
						</td>
360
					</tr>
361
					<tr class="<?= $entryStatus ?>">
362
						<td colspan="2"></td>
363
						<td colspan="7" class="contains-table">
364
<?php
365
			if (isset($_POST["tdph2-{$i}-visible"])) {
366
				$tdph2_visible = htmlspecialchars($_POST["tdph2-{$i}-visible"]);
367
			} else {
368
				$tdph2_visible = 0;
369
			}
370
?>
371
							<input type="hidden" name="tdph2-<?=$i?>-visible" id="tdph2-<?=$i?>-visible" value="<?=$tdph2_visible?>" />
372
							<div id="shph2but-<?=$i?>" <?=($tdph2_visible == '1' ? 'style="display:none"' : '')?>>
373
<?php
374
				$phase2count=0;
375

    
376
				foreach ($a_phase2 as $ph2ent) {
377
					if ($ph2ent['ikeid'] != $ph1ent['ikeid']) {
378
						continue;
379
					}
380
					$phase2count++;
381
				}
382
				$fr_prefix = "frp2{$i}";
383
				$fr_header = $fr_prefix . "header";
384
?>
385
								<button class="btn btn-info" type="button" onclick="show_phase2('tdph2-<?=$i?>','shph2but-<?=$i?>')" value="+"><i class="fa fa-plus-circle"></i> <?php printf(gettext("Show Phase 2 Entries (%s)"), $phase2count); ?></button>
386
							</div>
387
							<div id="tdph2-<?=$i?>" <?=($tdph2_visible != '1' ? 'style="display:none"' : '')?>>
388
								<table class="table table-striped table-hover">
389
									<thead>
390
										<tr>
391
											<th>&nbsp;</th>
392
											<th>&nbsp;</th>
393
											<th><?=gettext("Mode"); ?></th>
394
											<th><?=gettext("Local Subnet"); ?></th>
395
											<th><?=gettext("Remote Subnet"); ?></th>
396
											<th><?=gettext("P2 Protocol"); ?></th>
397
											<th><?=gettext("P2 Transforms"); ?></th>
398
											<th><?=gettext("P2 Auth Methods"); ?></th>
399
											<th><?=gettext("P2 actions")?></th>
400
										</tr>
401
									</thead>
402
									<tbody class="p2-entries">
403
<?php $j = 0; foreach ($a_phase2 as $ph2index => $ph2ent): ?>
404
<?php
405
						if ($ph2ent['ikeid'] != $ph1ent['ikeid']) {
406
							continue;
407
						}
408

    
409
						$fr_c = $fr_prefix . "c" . $j;
410
						$fr_d = $fr_prefix . "d" . $j;
411

    
412
						$iconfn = "pass";
413
						$entryStatus = (isset($ph2ent['disabled']) || isset($ph1ent['disabled']) ? 'disabled' : 'enabled');
414

    
415
						if ($entryStatus == 'disabled') {
416
							$iconfn .= "_d";
417
						}
418
?>
419
										<tr id="<?=$fr_prefix . $j?>" ondblclick="document.location='vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid']?>'" class="<?= $entryStatus ?>">
420
											<td>
421
												<input type="checkbox" id="<?=$fr_c?>" name="p2entry[]" value="<?=$ph2index?>" onclick="fr_bgcolor('<?=$j?>', '<?=$fr_prefix?>')" />
422
												<button class="fa fa-anchor button-icon" type="submit" name="movep2_<?=$j?>" value="movep2_<?=$j?>" title="<?=gettext("Move checked P2s here")?>"></button>
423
											</td>
424
											<td>
425
												<button value="togglep2_<?=$ph2index?>" name="togglep2_<?=$ph2index?>" title="<?=gettext("click to toggle enabled/disabled status")?>" class="btn btn-xs btn-<?= ($entryStatus == 'disabled'? 'success' : 'warning') ?>" type="submit"><?= ($entryStatus == 'disabled'? 'Enable' : 'Disable') ?></button>
426
											</td>
427
											<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
428
												<?=$ph2ent['mode']?>
429
											</td>
430
<?php if (($ph2ent['mode'] == "tunnel") or ($ph2ent['mode'] == "tunnel6")): ?>
431
											<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
432
												<?=ipsec_idinfo_to_text($ph2ent['localid']); ?>
433
											</td>
434
											<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
435
												<?=ipsec_idinfo_to_text($ph2ent['remoteid']); ?>
436
											</td>
437
		<?php else: ?>
438
											<td colspan="2"></td>
439
<?php endif; ?>
440
											<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
441
												<?=$p2_protos[$ph2ent['protocol']]; ?>
442
											</td>
443
											<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
444
<?php
445
								foreach ($ph2ent['encryption-algorithm-option'] as $k => $ph2ea) {
446
									if ($k) {
447
										echo ", ";
448
									}
449
									echo $p2_ealgos[$ph2ea['name']]['name'];
450
									if ($ph2ea['keylen']) {
451
										if ($ph2ea['keylen'] == "auto") {
452
											echo " (" . gettext("auto") . ")";
453
										} else {
454
											echo " ({$ph2ea['keylen']} " . gettext("bits") . ")";
455
										}
456
									}
457
								}
458
?>
459
											</td>
460
											<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
461
<?php
462
								if (!empty($ph2ent['hash-algorithm-option']) && is_array($ph2ent['hash-algorithm-option'])) {
463
									foreach ($ph2ent['hash-algorithm-option'] as $k => $ph2ha) {
464
										if ($k) {
465
											echo ", ";
466
										}
467
										echo $p2_halgos[$ph2ha];
468
									}
469
								}
470
?>
471
											</td>
472
											<td style="cursor: pointer;">
473
<!--												<button class="fa fa-anchor button-icon" type="submit" name="movep2_<?=$j?>" value="movep2_<?=$j?>" title="<?=gettext("Move checked P2s here")?>"></button> -->
474
												<a class="fa fa-pencil" href="vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid']?>" title="<?=gettext("Edit phase2 entry"); ?>"></a>
475
												<a class="fa fa-clone" href="vpn_ipsec_phase2.php?dup=<?=$ph2ent['uniqid']?>" title="<?=gettext("Add a new Phase 2 based on this one"); ?>"></a>
476
												<a	class="fa fa-trash no-confirm" id="Xdelp2_<?=$ph2index?>" title="<?=gettext('Delete phase2 entry'); ?>"></a>
477
												<button style="display: none;" class="btn btn-xs btn-warning" type="submit" id="delp2_<?=$ph2index?>" name="delp2_<?=$ph2index?>" value="delp2_<?=$ph2index?>" title="<?=gettext('delete phase2 entry'); ?>">delete</button>
478
											</td>
479
										</tr>
480
<?php $j++; endforeach; ?>
481
										<tr>
482
											<td></td>
483
											<td>
484
												<a class="btn btn-xs btn-success" href="vpn_ipsec_phase2.php?ikeid=<?=$ph1ent['ikeid']?><?php if (isset($ph1ent['mobile'])) echo "&amp;mobile=true"?>">
485
													<i class="fa fa-plus icon-embed-btn"></i>
486
													<?=gettext("Add P2")?>
487
												</a>
488
											</td>
489
											<td colspan="7"></td>
490
										</tr>
491
									</tbody>
492
								</table>
493
							</div>
494
						</td>
495
					</tr>
496
<?php
497
					$i++;
498
				endforeach;	 // $a_phase1 as $ph1ent
499
?>
500
				</tbody>
501
			</table>
502
		</div>
503
	</div>
504

    
505
	<nav class="action-buttons">
506
<?php
507
/*
508
	if ($i !== 0): ?>
509
	<input type="submit" name="move_<?=$i?>" class="btn btn-default" value="<?=gettext("move selected phase1 entries to end")?>" />
510
<?php endif;
511
*/
512
?>
513
		<a href="vpn_ipsec_phase1.php" class="btn btn-success btn-sm">
514
			<i class="fa fa-plus icon-embed-btn"></i>
515
			<?=gettext("Add P1")?>
516
		</a>
517
<?php if ($i !== 0): ?>
518
		<button type="submit" name="del" class="btn btn-danger btn-sm" value="<?=gettext("Delete selected P1s")?>">
519
			<i class="fa fa-trash icon-embed-btn"></i>
520
			<?=gettext("Delete P1s")?>
521
		</button>
522
<?php endif; ?>
523
	</nav>
524
</form>
525

    
526
<div class="infoblock">
527
	<?php print_info_box(sprintf(gettext("The IPsec status can be checked at %s%s%s."), '<a href="status_ipsec.php">', gettext("Status:IPsec"), '</a>') . '<br />' .
528
	sprintf(gettext("IPsec debug mode can be enabled at %s%s%s."), '<a href="vpn_ipsec_settings.php">', gettext("VPN:IPsec:Advanced Settings"), '</a>') . '<br />' .
529
	sprintf(gettext("IPsec can be set to prefer older SAs at %s%s%s."), '<a href="vpn_ipsec_settings.php">', gettext("VPN:IPsec:Advanced Settings"), '</a>'), 'info', false); ?>
530
</div>
531

    
532
<script type="text/javascript">
533
//<![CDATA[
534
function show_phase2(id, buttonid) {
535
	document.getElementById(buttonid).innerHTML='';
536
	document.getElementById(id).style.display = "block";
537
	var visible = id + '-visible';
538
	document.getElementById(visible).value = "1";
539
}
540

    
541
events.push(function() {
542
	$('[id^=Xmove_]').click(function (event) {
543
		// ToDo: We POST shift="yes" if the user has the shift key depressed, but that is not yet used
544
		// by the $_POST code. It is intended to allow the user to choose to move stuff to the row before or
545
		// after the clicked anchor icon
546
		if (event.shiftKey) {
547
			$('form').append('<input type="hidden" id="shift" name="shift" value="yes" />');
548
		}
549

    
550
		$('#' + event.target.id.slice(1)).click();
551
	});
552

    
553
	$('[id^=Xdel_]').click(function (event) {
554
		if (confirm("<?=gettext('Confirmation required to delete this P1 entry.')?>")) {
555
			$('#' + event.target.id.slice(1)).click();
556
		}
557
	});
558

    
559
	$('[id^=Xdelp2_]').click(function (event) {
560
		if (confirm("<?=gettext('Confirmation required to delete this P2 entry.')?>")) {
561
			$('#' + event.target.id.slice(1)).click();
562
		}
563
	});
564
});
565
//]]>
566
</script>
567

    
568
<?php
569
include("foot.inc");
(211-211/225)