Commit 95649093 authored by Ad Schellevis's avatar Ad Schellevis

(legacy) refactor / fix code styling in vpn_ipsec.php

parent 1654e853
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
require_once("guiconfig.inc"); require_once("guiconfig.inc");
require_once("filter.inc"); require_once("filter.inc");
require_once("vpn.inc"); require_once("vpn.inc");
...@@ -34,26 +33,20 @@ require_once("services.inc"); ...@@ -34,26 +33,20 @@ require_once("services.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
if (!is_array($config['ipsec'])) { if (!isset($config['ipsec'])) {
$config['ipsec'] = array(); $config['ipsec'] = array();
} }
if (!isset($config['ipsec']['phase1'])) {
if (!is_array($config['ipsec']['phase1'])) {
$config['ipsec']['phase1'] = array(); $config['ipsec']['phase1'] = array();
} }
if (!isset($config['ipsec']['phase2'])) {
if (!is_array($config['ipsec']['phase2'])) {
$config['ipsec']['phase2'] = array(); $config['ipsec']['phase2'] = array();
} }
$a_phase1 = &$config['ipsec']['phase1']; if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$a_phase2 = &$config['ipsec']['phase2']; $a_phase1 = &$config['ipsec']['phase1'];
$a_phase2 = &$config['ipsec']['phase2'];
$pconfig['enable'] = isset($config['ipsec']['enable']); if (isset($_POST['apply'])) {
if ($_POST) {
if ($_POST['apply']) {
$retval = 0;
$retval = vpn_ipsec_configure(); $retval = vpn_ipsec_configure();
/* reload the filter in the background */ /* reload the filter in the background */
filter_configure(); filter_configure();
...@@ -63,19 +56,15 @@ if ($_POST) { ...@@ -63,19 +56,15 @@ if ($_POST) {
clear_subsystem_dirty('ipsec'); clear_subsystem_dirty('ipsec');
} }
} }
} elseif ($_POST['submit']) { } elseif (isset($_POST['submit'])) {
$pconfig = $_POST; $config['ipsec']['enable'] = !empty($_POST['enable']) ? true : false;
$config['ipsec']['enable'] = $_POST['enable'] ? true : false;
write_config(); write_config();
vpn_ipsec_configure();
$retval = vpn_ipsec_configure();
} elseif (isset($_POST['del_x'])) { } elseif (isset($_POST['del_x'])) {
/* delete selected p1 entries */ /* delete selected p1 entries */
if (is_array($_POST['p1entry']) && count($_POST['p1entry'])) { if (isset($_POST['p1entry']) && count($_POST['p1entry'])) {
foreach ($_POST['p1entry'] as $p1entrydel) { foreach ($_POST['p1entry'] as $p1entrydel) {
unset($a_phase1[$p1entrydel]); unset($config['ipsec']['phase1'][$p1entrydel]);
} }
if (write_config()) { if (write_config()) {
mark_subsystem_dirty('ipsec'); mark_subsystem_dirty('ipsec');
...@@ -83,16 +72,19 @@ if ($_POST) { ...@@ -83,16 +72,19 @@ if ($_POST) {
} }
} elseif (isset($_POST['delp2_x'])) { } elseif (isset($_POST['delp2_x'])) {
/* delete selected p2 entries */ /* delete selected p2 entries */
if (is_array($_POST['p2entry']) && count($_POST['p2entry'])) { if (isset($_POST['p2entry']) && count($_POST['p2entry'])) {
foreach ($_POST['p2entry'] as $p2entrydel) { foreach ($_POST['p2entry'] as $p2entrydel) {
unset($a_phase2[$p2entrydel]); unset($config['ipsec']['phase2'][$p2entrydel]);
} }
if (write_config()) { if (write_config()) {
mark_subsystem_dirty('ipsec'); mark_subsystem_dirty('ipsec');
} }
} }
} else { } else {
/* yuck - IE won't send value attributes for image buttons, while Mozilla does - so we use .x/.y to find move button clicks instead... */ // move, delete, toggle items by id.
//
/* yuck - IE won't send value attributes for image buttons,
while Mozilla does - so we use .x/.y to find move button clicks instead... */
unset($delbtn, $delbtnp2, $movebtn, $movebtnp2, $togglebtn, $togglebtnp2); unset($delbtn, $delbtnp2, $movebtn, $movebtnp2, $togglebtn, $togglebtnp2);
foreach ($_POST as $pn => $pd) { foreach ($_POST as $pn => $pd) {
if (preg_match("/del_(\d+)_x/", $pn, $matches)) { if (preg_match("/del_(\d+)_x/", $pn, $matches)) {
...@@ -109,11 +101,10 @@ if ($_POST) { ...@@ -109,11 +101,10 @@ if ($_POST) {
$togglebtnp2 = $matches[1]; $togglebtnp2 = $matches[1];
} }
} }
$save = 1; $save = 1;
/* move selected p1 entries before this */ /* move selected p1 entries before this */
if (isset($movebtn) && is_array($_POST['p1entry']) && count($_POST['p1entry'])) { if (isset($movebtn) && isset($_POST['p1entry']) && count($_POST['p1entry'])) {
$a_phase1_new = array(); $a_phase1_new = array();
/* copy all p1 entries < $movebtn and not selected */ /* copy all p1 entries < $movebtn and not selected */
...@@ -148,7 +139,7 @@ if ($_POST) { ...@@ -148,7 +139,7 @@ if ($_POST) {
$a_phase1 = $a_phase1_new; $a_phase1 = $a_phase1_new;
} }
} elseif (isset($movebtnp2) && is_array($_POST['p2entry']) && count($_POST['p2entry'])) { } elseif (isset($movebtnp2) && isset($_POST['p2entry']) && count($_POST['p2entry'])) {
/* move selected p2 entries before this */ /* move selected p2 entries before this */
$a_phase2_new = array(); $a_phase2_new = array();
...@@ -229,6 +220,11 @@ if ($_POST) { ...@@ -229,6 +220,11 @@ if ($_POST) {
} }
} }
// form data
$pconfig = $config['ipsec'];
$pconfig['enable'] = isset($config['ipsec']['enable']);
legacy_html_escape_form_data($pconfig);
$pgtitle = array(gettext("VPN"),gettext("IPsec")); $pgtitle = array(gettext("VPN"),gettext("IPsec"));
$shortcut_section = "ipsec"; $shortcut_section = "ipsec";
...@@ -238,14 +234,23 @@ include("head.inc"); ...@@ -238,14 +234,23 @@ include("head.inc");
<body> <body>
<script type="text/javascript" src="/javascript/row_toggle.js"></script>
<?php include("fbegin.inc"); ?> <?php include("fbegin.inc"); ?>
<script type="text/javascript">
//<![CDATA[
function show_phase2(id, buttonid) {
document.getElementById(buttonid).innerHTML='';
document.getElementById(id).style.display = "block";
var visible = id + '-visible';
document.getElementById(visible).value = "1";
}
//]]>
</script>
<form action="vpn_ipsec.php" method="post"> <form action="vpn_ipsec.php" method="post">
<section class="page-content-main"> <section class="page-content-main">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<?php <?php
if (isset($savemsg)) { if (isset($savemsg)) {
print_info_box($savemsg); print_info_box($savemsg);
...@@ -254,70 +259,48 @@ include("head.inc"); ...@@ -254,70 +259,48 @@ include("head.inc");
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.")); 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."));
} }
?> ?>
<section class="col-xs-12"> <section class="col-xs-12">
<? $active_tab = "/vpn_ipsec.php";
<? $active_tab = "/vpn_ipsec.php"; include('vpn_ipsec_tabs.inc');
include('vpn_ipsec_tabs.inc'); ?> ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-sort"> <table class="table table-striped">
<thead>
<tr id="frheader"> <tr>
<td class="list">&nbsp;</td> <td>&nbsp;</td>
<td class="list">&nbsp;</td> <td>&nbsp;</td>
<td class="listhdrr"><?=gettext("IKE"); ?></td> <td><?=gettext("IKE"); ?></td>
<td class="listhdrr"><?=gettext("Remote Gateway"); ?></td> <td><?=gettext("Remote Gateway"); ?></td>
<td class="listhdrr"><?=gettext("Mode"); ?></td> <td><?=gettext("Mode"); ?></td>
<td class="listhdrr"><?=gettext("P1 Protocol"); ?></td> <td><?=gettext("P1 Protocol"); ?></td>
<td class="listhdrr"><?=gettext("P1 Transforms"); ?></td> <td><?=gettext("P1 Transforms"); ?></td>
<td class="listhdrr"><?=gettext("P1 Description"); ?></td> <td><?=gettext("P1 Description"); ?></td>
<td class="list"> <td>
</td> </td>
</tr> </tr>
</thead>
<tbody>
<?php <?php
$i = 0; $i = 0;
foreach ($a_phase1 as $ph1ent) : foreach ($pconfig['phase1'] as $ph1ent) :
$iconfn = "success";
$spans = $spane = "";
if (isset($ph1ent['disabled'])) {
$spans = "<span class=\"gray\">";
$spane = "</span>";
$iconfn = "default";
}
?> ?>
<tr valign="top" id="fr<?=$i; <tr id="fr<?=$i;?>" ondblclick="document.location='vpn_ipsec_phase1.php?p1index=<?=$i;?>'">
?>" ondblclick="document.location='vpn_ipsec_phase1.php?p1index=<?=$i;?>'"> <td>
<td class="listt" align="center" valign="middle"> <input type="checkbox" name="p1entry[]" value="<?=$i;?>"/>
<input type="checkbox" id="frc<?=$i;
?>" name="p1entry[]" value="<?=$i;
?>" onclick="fr_bgcolor('<?=$i;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" />
</td> </td>
<td class="listt" align="center" valign="middle"> <td>
<button name="toggle_<?=$i;?>_x" <button name="toggle_<?=$i;?>_x" title="<?=gettext("click to toggle enabled/disabled status");?>" type="submit" class="btn btn-<?= isset($ph1ent['disabled'])? "default":"success"?> btn-xs">
title="<?=gettext("click to toggle enabled/disabled status");?>" <span class="glyphicon glyphicon-play"></span>
type="submit" class="btn btn-<?php echo $iconfn?> btn-xs"><span class="glyphicon glyphicon-play"></span>
</button> </button>
</td> </td>
<td class="listlr" onclick="fr_toggle(<?=$i; <td>
?>)" id="frd<?=$i;?>"> <?=empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1"?"V1":"V2";?>
<?=$spans;?>
<?php
if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1") {
echo "V1";
} else {
echo "V2";
}
?>
<?=$spane;?>
</td> </td>
<td class="listr" onclick="fr_toggle(<?=$i; <td>
?>)" id="frd<?=$i;?>">
<?=$spans;?>
<?php <?php
if ($ph1ent['interface']) { if (!empty($ph1ent['interface'])) {
$iflabels = get_configured_interface_with_descr(); $iflabels = get_configured_interface_with_descr();
$carplist = get_configured_carp_interface_list(); $carplist = get_configured_carp_interface_list();
...@@ -339,73 +322,44 @@ if ($ph1ent['interface']) { ...@@ -339,73 +322,44 @@ if ($ph1ent['interface']) {
} }
$iflabels[$name] = "GW Group {$name}"; $iflabels[$name] = "GW Group {$name}";
} }
$if = htmlspecialchars($iflabels[$ph1ent['interface']]); $if = $iflabels[$ph1ent['interface']];
} else { } else {
$if = "WAN"; $if = "WAN";
} }
if (!isset($ph1ent['mobile'])) {
echo $if."<br />".$ph1ent['remote-gateway'];
} else {
echo $if."<br /><strong>" . gettext("Mobile Client") . "</strong>";
}
?> ?>
<?=$spane;?> <?=htmlspecialchars($if);?>
</td> <?=!isset($ph1ent['mobile'])?
<td class="listr" onclick="fr_toggle(<?=$i; $ph1ent['remote-gateway']
?>)" id="frd<?=$i;?>"> :
<?=$spans;?> "<strong>" . gettext("Mobile Client") . "</strong>";
<?=$ph1ent['mode'];?> ?>
<?=$spane;?>
</td> </td>
<td class="listr" onclick="fr_toggle(<?=$i; <td><?=$ph1ent['mode'];?></td>
?>)" id="frd<?=$i;?>"> <td>
<?=$spans;?>
<?=$p1_ealgos[$ph1ent['encryption-algorithm']['name']]['name'];?> <?=$p1_ealgos[$ph1ent['encryption-algorithm']['name']]['name'];?>
<?php <?php
if ($ph1ent['encryption-algorithm']['keylen']) { if (!empty($ph1ent['encryption-algorithm']['keylen'])) {
if ($ph1ent['encryption-algorithm']['keylen']=="auto") { if ($ph1ent['encryption-algorithm']['keylen']=="auto") {
echo " (" . gettext("auto") . ")"; echo " (" . gettext("auto") . ")";
} else { } else {
echo " ({$ph1ent['encryption-algorithm']['keylen']} " . gettext("bits") . ")"; echo " ({$ph1ent['encryption-algorithm']['keylen']} " . gettext("bits") . ")";
} }
} }
?> ?>
<?=$spane;?>
</td> </td>
<td class="listr" onclick="fr_toggle(<?=$i; <td>
?>)" id="frd<?=$i;?>">
<?=$spans;?>
<?=$p1_halgos[$ph1ent['hash-algorithm']];?> <?=$p1_halgos[$ph1ent['hash-algorithm']];?>
<?=$spane;?>
</td> </td>
<td class="listbg" onclick="fr_toggle(<?=$i;?>)"> <td>
<?=$spans;?> <?=$ph1ent['descr'];?>&nbsp;
<?=htmlspecialchars($ph1ent['descr']);?>&nbsp;
<?=$spane;?>
</td> </td>
<td valign="middle" class="list nowrap">
<table border="0" cellspacing="0" cellpadding="1" summary="icons">
<tr>
<td> <td>
<button onmouseover="fr_insline(<?=$i; <button name="move_<?=$i;?>_x" title="<?=gettext("move selected entries before this");?>" type="submit" class="btn btn-default btn-xs">
?>, true)" onmouseout="fr_insline(<?=$i;?>, false)"
name="move_<?=$i;?>_x"
title="<?=gettext("move selected entries before this");?>"
type="submit"
class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-arrow-left"></span> <span class="glyphicon glyphicon-arrow-left"></span>
</button> </button>
</td> <a href="vpn_ipsec_phase1.php?p1index=<?=$i;?>" title="<?=gettext("edit phase1 entry"); ?>" class="btn btn-default btn-xs" alt="edit">
<td>
<a href="vpn_ipsec_phase1.php?p1index=<?=$i;
?>" title="<?=gettext("edit phase1 entry"); ?>" class="btn btn-default btn-xs" alt="edit">
<span class="glyphicon glyphicon-pencil"></span> <span class="glyphicon glyphicon-pencil"></span>
</a> </a><br/>
</td>
</tr>
<tr>
<td>
<button name="del_<?=$i;?>_x" <button name="del_<?=$i;?>_x"
title="<?=gettext("delete phase1 entry");?>" title="<?=gettext("delete phase1 entry");?>"
type="submit" type="submit"
...@@ -413,302 +367,182 @@ if ($ph1ent['encryption-algorithm']['keylen']) { ...@@ -413,302 +367,182 @@ if ($ph1ent['encryption-algorithm']['keylen']) {
class="btn btn-default btn-xs"> class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-remove"></span> <span class="glyphicon glyphicon-remove"></span>
</button> </button>
<?php if (!isset($ph1ent['mobile'])) :
</td>
<td>
<?php
if (!isset($ph1ent['mobile'])) :
?> ?>
<a href="vpn_ipsec_phase1.php?dup=<?=$i; <a href="vpn_ipsec_phase1.php?dup=<?=$i;?>" title="<?=gettext("copy phase1 entry"); ?>" class="btn btn-default btn-xs" alt="add">
?>" title="<?=gettext("copy phase1 entry"); ?>" class="btn btn-default btn-xs" alt="add">
<span class="glyphicon glyphicon-plus"></span> <span class="glyphicon glyphicon-plus"></span>
</a> </a>
<?php <?php endif;
endif;
?> ?>
</td> </td>
</tr> </tr>
</table>
</td>
</tr>
<tr> <tr>
<td class="listt">&nbsp;</td> <td colspan="9">
<td class="listt">&nbsp;</td>
<td class="listrborder" colspan="6">
<?php
if (isset($_POST["tdph2-{$i}-visible"])) {
$tdph2_visible = htmlspecialchars($_POST["tdph2-{$i}-visible"]);
} else {
$tdph2_visible = 0;
}
?>
<input type="hidden" name="tdph2-<?=$i;
?>-visible" id="tdph2-<?=$i;?>-visible" value="<?=$tdph2_visible?>" />
<div id="shph2but-<?=$i?>" <?php echo ($tdph2_visible == '1' ? 'style="display:none"' : '');?>>
<?php <?php
$phase2count=0; $phase2count=0;
foreach ($a_phase2 as $ph2ent) { foreach ($pconfig['phase2'] as $ph2ent) {
if ($ph2ent['ikeid'] != $ph1ent['ikeid']) { if ($ph2ent['ikeid'] != $ph1ent['ikeid']) {
continue; continue;
} }
$phase2count++; $phase2count++;
} }
$fr_prefix = "frp2{$i}"; $fr_prefix = "frp2{$i}";
$fr_header = $fr_prefix . "header";
?> ?>
<div id="shph2but-<?=$i?>">
<input type="button" onclick="show_phase2('tdph2-<?=$i?>','shph2but-<?=$i?>')" value="+" /> - <?php printf(gettext("Show %s Phase-2 entries"), $phase2count); ?> <input type="button" onclick="show_phase2('tdph2-<?=$i?>','shph2but-<?=$i?>')" value="+" /> - <?php printf(gettext("Show %s Phase-2 entries"), $phase2count); ?>
</div> </div>
<div id="tdph2-<?=$i?>" <?php echo ($tdph2_visible != '1' ? 'style="display:none"' : '');?>> <div id="tdph2-<?=$i?>" style="display:none">
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="phase-2 entries"> <table class="table table-striped table-condensed">
<tr id="<?=$fr_header;?>"> <thead>
<tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td>&nbsp;</td> <td>&nbsp;</td>
<td class="listhdrr"><?=gettext("Mode"); ?></td> <td><?=gettext("Mode"); ?></td>
<td class="listhdrr"><?=gettext("Local Subnet"); ?></td> <td><?=gettext("Local Subnet"); ?></td>
<td class="listhdrr"><?=gettext("Remote Subnet"); ?></td> <td><?=gettext("Remote Subnet"); ?></td>
<td class="listhdrr"><?=gettext("P2 Protocol"); ?></td> <td><?=gettext("P2 Protocol"); ?></td>
<td class="listhdrr"><?=gettext("P2 Transforms"); ?></td> <td><?=gettext("P2 Transforms"); ?></td>
<td class="listhdrr"><?=gettext("P2 Auth Methods"); ?></td> <td><?=gettext("P2 Auth Methods"); ?></td>
<td class ="list">&nbsp;</td> <td class ="list">&nbsp;</td>
</tr> </tr>
</thead>
<tbody>
<?php <?php
$j = 0; $j = 0;
foreach ($a_phase2 as $ph2index => $ph2ent) : foreach ($pconfig['phase2'] as $ph2index => $ph2ent) :
if ($ph2ent['ikeid'] != $ph1ent['ikeid']) { if ($ph2ent['ikeid'] != $ph1ent['ikeid']) {
continue; continue;
} }
$fr_c = $fr_prefix . "c" . $j;
$fr_d = $fr_prefix . "d" . $j;
$iconfn = "success";
$spans = $spane = "";
if (isset($ph2ent['disabled'])) {
$spans = "<span class=\"gray\">";
$spane = "</span>";
$iconfn = "default";
}
?> ?>
<tr valign="top" id="<?=$fr_prefix . $j; <tr id="<?=$fr_prefix . $j;?>" ondblclick="document.location='vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid'];?>'">
?>" ondblclick="document.location='vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid'];?>'"> <td>
<td class="listt" align="center" valign="middle"> <input type="checkbox" name="p2entry[]" value="<?=$ph2index;?>"/>
<input type="checkbox" id="<?=$fr_c;
?>" name="p2entry[]" value="<?=$ph2index;
?>" onclick="fr_bgcolor('<?=$j;
?>', '<?=$fr_prefix;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" />
</td> </td>
<td class="listt" align="center" valign="middle"> <td>
<input name="togglep2_<?=$ph2index; <button name="togglep2_<?=$ph2index;?>_x" title="<?=gettext("click to toggle enabled/disabled status");?>" type="submit" class="btn btn-<?= isset($ph2ent['disabled'])?"default":"success";?> btn-xs">
?>" src="/themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfn?>.gif"
title="<?=gettext("click to toggle enabled/disabled status");?>"
type="image" style="height:11;width:11;border:0" value="" />
<button name="togglep2_<?=$ph2index;?>_x"
title="<?=gettext("click to toggle enabled/disabled status");?>"
type="submit"
class="btn btn-<?php echo $iconfn?> btn-xs">
<span class="glyphicon glyphicon-play"></span> <span class="glyphicon glyphicon-play"></span>
</button> </button>
</td> </td>
<td class="listlr nowrap" id="<?=$fr_d; <td> <?=$ph2ent['mode'];?> </td>
?>" onclick="fr_toggle('<?=$j;
?>', '<?=$fr_prefix;?>')">
<?=$spans;?>
<?=$ph2ent['mode'];?>
<?=$spane;?>
</td>
<?php <?php
if (($ph2ent['mode'] == "tunnel") or ($ph2ent['mode'] == "tunnel6")) : if (($ph2ent['mode'] == "tunnel") || ($ph2ent['mode'] == "tunnel6")) :
?> ?>
<td class="listr nowrap" id="<?=$fr_d; <td>
?>" onclick="fr_toggle('<?=$j;
?>', '<?=$fr_prefix;?>')">
<?=$spans;?>
<?=ipsec_idinfo_to_text($ph2ent['localid']); ?> <?=ipsec_idinfo_to_text($ph2ent['localid']); ?>
<?=$spane;?>
</td> </td>
<td class="listr nowrap" id="<?=$fr_d; <td>
?>" onclick="fr_toggle('<?=$j;
?>', '<?=$fr_prefix;?>')">
<?=$spans;?>
<?=ipsec_idinfo_to_text($ph2ent['remoteid']); ?> <?=ipsec_idinfo_to_text($ph2ent['remoteid']); ?>
<?=$spane;?>
</td> </td>
<?php else :
?> <td>&nbsp;</td>
<td>&nbsp;</td>
<?php <?php
else : endif;
echo "<td class=\"listr nowrap\">&nbsp;</td><td class=\"listr nowrap\">&nbsp;</td>";
endif;
?> ?>
<td class="listr nowrap" id="<?=$fr_d; <td><?=$p2_protos[$ph2ent['protocol']];?> </td>
?>" onclick="fr_toggle('<?=$j; <td>
?>', '<?=$fr_prefix;?>')">
<?=$spans;?>
<?php echo $p2_protos[$ph2ent['protocol']]; ?>
<?=$spane;?>
</td>
<td class="listr" id="<?=$fr_d;
?>" onclick="fr_toggle('<?=$j;
?>', '<?=$fr_prefix;?>')">
<?=$spans;?>
<?php <?php
foreach ($ph2ent['encryption-algorithm-option'] as $k => $ph2ea) { foreach ($ph2ent['encryption-algorithm-option'] as $k => $ph2ea) {
if ($k) { if ($k > 0) {
echo ", "; echo ", ";
} }
echo $p2_ealgos[$ph2ea['name']]['name']; echo $p2_ealgos[$ph2ea['name']]['name'];
if ($ph2ea['keylen']) { if (!empty($ph2ea['keylen'])) {
if ($ph2ea['keylen']=="auto") { if ($ph2ea['keylen']=="auto") {
echo " (" . gettext("auto") . ")"; echo " (" . gettext("auto") . ")";
} else { } else {
echo " ({$ph2ea['keylen']} " . gettext("bits") . ")"; echo " ({$ph2ea['keylen']} " . gettext("bits") . ")";
} }
} }
} }
?> ?>
<?=$spane;?>
</td> </td>
<td class="listr nowrap" id="<?=$fr_d; <td>
?>" onclick="fr_toggle('<?=$j;
?>', '<?=$fr_prefix;?>')">
<?=$spans;?>
<?php <?php
if (!empty($ph2ent['hash-algorithm-option']) && is_array($ph2ent['hash-algorithm-option'])) { if (!empty($ph2ent['hash-algorithm-option']) && is_array($ph2ent['hash-algorithm-option'])) {
foreach ($ph2ent['hash-algorithm-option'] as $k => $ph2ha) { foreach ($ph2ent['hash-algorithm-option'] as $k => $ph2ha) {
if ($k) { if ($k) {
echo ", "; echo ", ";
} }
echo $p2_halgos[$ph2ha]; echo $p2_halgos[$ph2ha];
} }
} }
?> ?>
<?=$spane;?>
</td> </td>
<td class="list nowrap" valign="middle"> <td>
<button onmouseover="fr_insline(<?=$j; <button name="movep2_<?=$j;?>_x"
?>, true, '<?=$fr_prefix;
?>')" onmouseout="fr_insline(<?=$j;
?>, false, '<?=$fr_prefix;?>')"
name="movep2_<?=$j;?>_x"
title="<?=gettext("move selected entries before this");?>" title="<?=gettext("move selected entries before this");?>"
type="submit" type="submit"
class="btn btn-default btn-xs"> class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-arrow-left"></span> <span class="glyphicon glyphicon-arrow-left"></span>
</button> </button>
<a href="vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid']; <a href="vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid'];?>" title="<?=gettext("edit phase2 entry"); ?>" alt="edit" class="btn btn-default btn-xs">
?>" title="<?=gettext("edit phase2 entry"); ?>" alt="edit" class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-pencil"></span> <span class="glyphicon glyphicon-pencil"></span>
</a> </a>
<button name="delp2_<?=$ph2index; <button name="delp2_<?=$ph2index;?>_x" title="<?=gettext("delete phase2 entry");?>"
?>_x" src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif"
title="<?=gettext("delete phase2 entry");?>"
type="submit" type="submit"
onclick="return confirm('<?=gettext("Do you really want to delete this phase2 entry?"); ?>')" onclick="return confirm('<?=gettext("Do you really want to delete this phase2 entry?"); ?>')"
class="btn btn-default btn-xs"> class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-remove"><span> <span class="glyphicon glyphicon-remove"><span>
</button> </button>
<a href="vpn_ipsec_phase2.php?dup=<?=$ph2ent['uniqid']; <a href="vpn_ipsec_phase2.php?dup=<?=$ph2ent['uniqid'];?>" title="<?=gettext("add a new Phase 2 based on this one"); ?>" alt="add" class="btn btn-default btn-xs">
?>" title="<?=gettext("add a new Phase 2 based on this one"); ?>" alt="add" class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-plus"></span> <span class="glyphicon glyphicon-plus"></span>
</a> </a>
</td> </td>
</tr> </tr>
<?php <?php
$j++; $j++;
endforeach; endforeach;
?>
<tr valign="top" id="<?=$fr_prefix . $j;?>">
<td class="list" colspan="8"></td>
<td class="list nowrap" valign="middle">
<?php
if ($j == 0) :
?> ?>
<span title="<?=gettext("move selected phase2 entries to end");?>" alt="move" class="btn btn-default btn-xs glyphicon glyphicon-arrow-down hide"></span> <tr>
<?php <td colspan="8"></td>
else : <td>
<?php if ($j > 0) :
?> ?>
<button onmouseover="fr_insline(<?=$j;
?>, true, '<?=$fr_prefix; <button name="movep2_<?=$j;?>_x" type="submit"
?>')" onmouseout="fr_insline(<?=$j;
?>, false, '<?=$fr_prefix;?>')"
name="movep2_<?=$j;?>_x" type="submit"
title="<?=gettext("move selected phase2 entries to end");?>" title="<?=gettext("move selected phase2 entries to end");?>"
class="btn btn-default btn-xs"> class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-arrow-down"></span> <span class="glyphicon glyphicon-arrow-down"></span>
</button> </button>
<?php <?php endif;
endif;
?> ?>
<a href="vpn_ipsec_phase2.php?ikeid=<?=$ph1ent['ikeid'];?><?php if (isset($ph1ent['mobile'])) { <a href="vpn_ipsec_phase2.php?ikeid=<?=$ph1ent['ikeid'];?><?= isset($ph1ent['mobile'])?"&amp;mobile=true":"";?>" class="btn btn-default btn-xs">
echo "&amp;mobile=true";
}?>" class="btn btn-default btn-xs">
<span title="<?=gettext("add phase2 entry"); ?>" alt="add" class="glyphicon glyphicon-plus"></span> <span title="<?=gettext("add phase2 entry"); ?>" alt="add" class="glyphicon glyphicon-plus"></span>
</a> </a>
<?php <?php if ($j > 0) :
if ($j == 0) :
?>
<span title="<?=gettext("delete selected phase2 entries");?>" alt="delete" class="btn btn-default btn-xs glyphicon glyphicon-remove hide"></span>
<?php
else :
?> ?>
<button name="delp2_x" <button name="delp2_x" type="submit" title="<?=gettext("delete selected phase2 entries");?>"
type="submit"
title="<?=gettext("delete selected phase2 entries");?>"
onclick="return confirm('<?=gettext("Do you really want to delete the selected phase2 entries?");?>')" onclick="return confirm('<?=gettext("Do you really want to delete the selected phase2 entries?");?>')"
class="btn btn-default btn-xs"> class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-remove"></span> <span class="glyphicon glyphicon-remove"></span>
</button> </button>
<?php <?php endif;
endif;
?> ?>
</td> </td>
</tr> </tr>
</tbody>
</table> </table>
</div> </div>
</td> </td>
</tr> </tr>
<?php <?php
$i++; $i++;
endforeach; // $a_phase1 as $ph1ent endforeach; // $a_phase1 as $ph1ent
?> ?>
<tr valign="top" id="fr<?=$i;?>">
<td class="list" colspan="8"></td>
<td class="list nowrap" valign="middle">
<table border="0" cellspacing="0" cellpadding="1" summary="edit">
<tr> <tr>
<td colspan="8"> </td>
<td> <td>
<?php <button name="move_<?=$i;?>_x"
if ($i == 0) :
?>
<span title="<?=gettext("move selected phase1 entries to end");?>" alt="move" class="btn btn-default btn-xs glyphicon glyphicon-arrow-down hide"></span>
<?php
else :
?>
<button onmouseover="fr_insline(<?=$i;
?>, true)" onmouseout="fr_insline(<?=$i;?>, false)"
name="move_<?=$i;?>_x"
type="submit" type="submit"
title="<?=gettext("move selected phase1 entries to end");?>" title="<?=gettext("move selected phase1 entries to end");?>"
class="btn btn-default btn-xs"> class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-arrow-down"></span> <span class="glyphicon glyphicon-arrow-down"></span>
</button> </button>
<?php
endif;
?>
</td>
<td>
<a href="vpn_ipsec_phase1.php" title="<?=gettext("add new phase1");?>" alt="add" class="btn btn-default btn-xs"> <a href="vpn_ipsec_phase1.php" title="<?=gettext("add new phase1");?>" alt="add" class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-plus"></span> <span class="glyphicon glyphicon-plus"></span>
</a> </a>
</td>
</tr>
<tr>
<td>
<?php
if ($i == 0) :
?>
<span title="<?=gettext("delete selected phase1 entries");?>" alt="delete" class="btn btn-default btn-xs glyphicon glyphicon-remove hide"></span>
<?php
else :
?>
<button <button
name="del_x" name="del_x"
type="submit" type="submit"
...@@ -717,69 +551,34 @@ else : ...@@ -717,69 +551,34 @@ else :
class="btn btn-default btn-xs"> class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-remove"></span> <span class="glyphicon glyphicon-remove"></span>
</button> </button>
<?php
endif;
?>
</td>
</tr>
</table>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="8"> <td colspan="9">
<p>
<span class="vexpl">
<span class="red">
<strong><?=gettext("Note"); ?>:<br /></strong> <strong><?=gettext("Note"); ?>:<br /></strong>
</span> <?=gettext("You can check your IPsec status at");?> <a href="diag_ipsec.php"><?=gettext("Status:IPsec"); ?></a>.<br />
<?=gettext("You can check your IPsec status at"); <?=gettext("IPsec Debug Mode can be enabled at");?> <a href="vpn_ipsec_settings.php"><?=gettext("VPN:IPsec:Advanced Settings"); ?></a>.<br />
?> <a href="diag_ipsec.php"><?=gettext("Status:IPsec"); ?></a>.<br /> <?=gettext("IPsec can be set to prefer older SAs at");?> <a href="vpn_ipsec_settings.php"><?=gettext("VPN:IPsec:Advanced Settings"); ?></a>.
<?=gettext("IPsec Debug Mode can be enabled at");
?> <a href="vpn_ipsec_settings.php"><?=gettext("VPN:IPsec:Advanced Settings"); ?></a>.<br />
<?=gettext("IPsec can be set to prefer older SAs at");
?> <a href="vpn_ipsec_settings.php"><?=gettext("VPN:IPsec:Advanced Settings"); ?></a>.
</span>
</p>
</td>
</tr>
</table>
</div>
</td> </td>
</tr> </tr>
</table>
</form>
<form action="vpn_ipsec.php" method="post">
<table border="0" cellspacing="2" cellpadding="0" summary="enable" class="table table-striped">
<tr> <tr>
<td> <td colspan=9>
<input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) { <input name="enable" type="checkbox" id="enable" value="yes" <?=!empty($pconfig['enable']) ? "checked=\"checked\"":"";?>/>
echo "checked=\"checked\"";
}?> />
</td>
<td>
<strong><?=gettext("Enable IPsec"); ?></strong> <strong><?=gettext("Enable IPsec"); ?></strong>
</td> </td>
<td> </tr>
<tr>
<td colspan=9>
<input name="submit" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" /> <input name="submit" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" />
</td> </td>
</tr> </tr>
</tbody>
</table> </table>
</form> </div>
</div> </div>
</section> </section>
</div> </div>
</div> </div>
</section> </section>
<script type="text/javascript"> </form>
//<![CDATA[
function show_phase2(id, buttonid) {
document.getElementById(buttonid).innerHTML='';
document.getElementById(id).style.display = "block";
var visible = id + '-visible';
document.getElementById(visible).value = "1";
}
//]]>
</script>
<?php include("foot.inc"); <?php include("foot.inc");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment