Commit a52e5e1d authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(legacy) fix spacing, add toggle in vpn_openvpn_server.php

(cherry picked from commit 3f2c5304)
parent 0ad90288
...@@ -127,7 +127,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -127,7 +127,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} }
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['id']) && is_numericint($_POST['id'])) { if (isset($_POST['id']) && isset($a_server[$_POST['id']])) {
$id = $_POST['id']; $id = $_POST['id'];
} }
if (isset($_POST['act'])) { if (isset($_POST['act'])) {
...@@ -136,15 +136,25 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -136,15 +136,25 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if ($act == "del") { if ($act == "del") {
// action delete // action delete
if (!isset($a_server[$id])) { if (isset($a_server[$id])) {
openvpn_delete('server', $a_server[$id]);
unset($a_server[$id]);
write_config();
}
header("Location: vpn_openvpn_server.php"); header("Location: vpn_openvpn_server.php");
exit; exit;
} elseif ($act == "toggle") {
if (isset($id)) {
if (isset($a_server[$id]['disable'])) {
unset($a_server[$id]['disable']);
} else {
$a_server[$id]['disable'] = true;
} }
if (!empty($a_server[$id])) { openvpn_resync('server', $a_server[$id]);
openvpn_delete('server', $a_server[$id]);
}
unset($a_server[$id]);
write_config(); write_config();
}
header("Location: vpn_openvpn_server.php");
exit;
} else { } else {
// action add/update // action add/update
$input_errors = array(); $input_errors = array();
...@@ -439,6 +449,14 @@ $( document ).ready(function() { ...@@ -439,6 +449,14 @@ $( document ).ready(function() {
}] }]
}); });
}); });
// link toggle buttons
$(".act_toggle").click(function(){
$.post(window.location, {act: 'toggle', id:$(this).data("id")}, function(data) {
location.reload();
});
});
// init form (old stuff) // init form (old stuff)
if (document.iform != undefined) { if (document.iform != undefined) {
mode_change(); mode_change();
...@@ -700,24 +718,18 @@ function tuntap_change() { ...@@ -700,24 +718,18 @@ function tuntap_change() {
<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($input_errors) && count($input_errors) > 0) { if (isset($input_errors) && count($input_errors) > 0) {
print_input_errors($input_errors); print_input_errors($input_errors);
} }
if (isset($savemsg)) { if (isset($savemsg)) {
print_info_box($savemsg); print_info_box($savemsg);
} }?>
?>
<section class="col-xs-12"> <section class="col-xs-12">
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
<?php
<?php if ($act=="new" || $act=="edit") : if ($act=="new" || $act=="edit") :?>
?>
<form action="vpn_openvpn_server.php" method="post" name="iform" id="iform"> <form action="vpn_openvpn_server.php" method="post" name="iform" id="iform">
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
...@@ -745,7 +757,7 @@ function tuntap_change() { ...@@ -745,7 +757,7 @@ function tuntap_change() {
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Server Mode");?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Server Mode");?></td>
<td> <td>
<select name='mode' id='mode' class="form-control" onchange='mode_change(); tuntap_change()'> <select name='mode' id='mode' class="form-control" onchange='mode_change(); tuntap_change()'>
<?php <?php
$openvpn_server_modes = array( $openvpn_server_modes = array(
'p2p_tls' => gettext("Peer to Peer ( SSL/TLS )"), 'p2p_tls' => gettext("Peer to Peer ( SSL/TLS )"),
'p2p_shared_key' => gettext("Peer to Peer ( Shared Key )"), 'p2p_shared_key' => gettext("Peer to Peer ( Shared Key )"),
...@@ -756,12 +768,9 @@ function tuntap_change() { ...@@ -756,12 +768,9 @@ function tuntap_change() {
$selected = ""; $selected = "";
if ($pconfig['mode'] == $name) { if ($pconfig['mode'] == $name) {
$selected = "selected=\"selected\""; $selected = "selected=\"selected\"";
} }?>
?> <option value="<?=$name;?>" <?=$selected;?>><?=$desc;?></option>
<option value="<?=$name; <?php
?>" <?=$selected;
?>><?=$desc;?></option>
<?php
endforeach; ?> endforeach; ?>
</select> </select>
</td> </td>
...@@ -770,7 +779,7 @@ function tuntap_change() { ...@@ -770,7 +779,7 @@ function tuntap_change() {
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Backend for authentication");?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Backend for authentication");?></td>
<td> <td>
<select name='authmode[]' id='authmode' class="form-control" multiple="multiple" size="5"> <select name='authmode[]' id='authmode' class="form-control" multiple="multiple" size="5">
<?php <?php
if (isset($pconfig['authmode'])) { if (isset($pconfig['authmode'])) {
$authmodes = explode(",", $pconfig['authmode']); $authmodes = explode(",", $pconfig['authmode']);
} else { } else {
...@@ -781,10 +790,10 @@ function tuntap_change() { ...@@ -781,10 +790,10 @@ function tuntap_change() {
$selected = ""; $selected = "";
if (in_array($auth_key, $authmodes)) { if (in_array($auth_key, $authmodes)) {
$selected = "selected=\"selected\""; $selected = "selected=\"selected\"";
} }?>
?>
<option value="<?=htmlspecialchars($auth_key); ?>" <?=$selected; ?>><?=htmlspecialchars($auth_server['name']);?></option> <option value="<?=htmlspecialchars($auth_key); ?>" <?=$selected; ?>><?=htmlspecialchars($auth_server['name']);?></option>
<?php endforeach; ?> <?php
endforeach; ?>
</select> </select>
</td> </td>
</tr> </tr>
...@@ -792,17 +801,14 @@ function tuntap_change() { ...@@ -792,17 +801,14 @@ function tuntap_change() {
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Protocol");?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Protocol");?></td>
<td> <td>
<select name='protocol' class="form-control"> <select name='protocol' class="form-control">
<?php <?php
foreach (array("UDP", "UDP6", "TCP", "TCP6") as $prot) : foreach (array("UDP", "UDP6", "TCP", "TCP6") as $prot) :
$selected = ""; $selected = "";
if ($pconfig['protocol'] == $prot) { if ($pconfig['protocol'] == $prot) {
$selected = "selected=\"selected\""; $selected = "selected=\"selected\"";
} }?>
?> <option value="<?=$prot;?>" <?=$selected;?>><?=$prot;?></option>
<option value="<?=$prot; <?php
?>" <?=$selected;
?>><?=$prot;?></option>
<?php
endforeach; ?> endforeach; ?>
</select> </select>
</td> </td>
...@@ -811,7 +817,7 @@ function tuntap_change() { ...@@ -811,7 +817,7 @@ function tuntap_change() {
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Device Mode"); ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Device Mode"); ?></td>
<td> <td>
<select name="dev_mode" class="form-control" onchange='tuntap_change()'> <select name="dev_mode" class="form-control" onchange='tuntap_change()'>
<?php <?php
foreach (array("tun", "tap") as $device) : foreach (array("tun", "tap") as $device) :
$selected = ""; $selected = "";
if (! empty($pconfig['dev_mode'])) { if (! empty($pconfig['dev_mode'])) {
...@@ -822,12 +828,9 @@ function tuntap_change() { ...@@ -822,12 +828,9 @@ function tuntap_change() {
if ($device == "tun") { if ($device == "tun") {
$selected = "selected=\"selected\""; $selected = "selected=\"selected\"";
} }
} }?>
?> <option value="<?=$device;?>" <?=$selected;?>><?=$device;?></option>
<option value="<?=$device; <?php
?>" <?=$selected;
?>><?=$device;?></option>
<?php
endforeach; ?> endforeach; ?>
</select> </select>
</td> </td>
...@@ -836,7 +839,7 @@ function tuntap_change() { ...@@ -836,7 +839,7 @@ function tuntap_change() {
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Interface"); ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Interface"); ?></td>
<td> <td>
<select name="interface" class="form-control"> <select name="interface" class="form-control">
<?php <?php
$interfaces = get_configured_interface_with_descr(); $interfaces = get_configured_interface_with_descr();
$carplist = get_configured_carp_interface_list(); $carplist = get_configured_carp_interface_list();
foreach ($carplist as $cif => $carpip) { foreach ($carplist as $cif => $carpip) {
...@@ -867,7 +870,8 @@ function tuntap_change() { ...@@ -867,7 +870,8 @@ function tuntap_change() {
} }
?> ?>
<option value="<?=$iface; ?>"<?=$selected;?>><?=htmlspecialchars($ifacename);?></option> <option value="<?=$iface; ?>"<?=$selected;?>><?=htmlspecialchars($ifacename);?></option>
<?php endforeach; ?> <?php
endforeach; ?>
</select> <br /> </select> <br />
</td> </td>
</tr> </tr>
...@@ -887,7 +891,7 @@ function tuntap_change() { ...@@ -887,7 +891,7 @@ function tuntap_change() {
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2" class="list" height="12"></td> <td colspan="2" height="12"></td>
</tr> </tr>
<tr> <tr>
<td colspan="2"><?=gettext("Cryptographic Settings"); ?></td> <td colspan="2"><?=gettext("Cryptographic Settings"); ?></td>
...@@ -936,39 +940,38 @@ endif; ?> ...@@ -936,39 +940,38 @@ endif; ?>
<tr id="tls_ca"> <tr id="tls_ca">
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Peer Certificate Authority"); ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Peer Certificate Authority"); ?></td>
<td> <td>
<?php if (isset($config['ca'])) : <?php
?> if (isset($config['ca'])) :?>
<select name='caref' class="form-control"> <select name='caref' class="form-control">
<?php <?php
foreach ($config['ca'] as $ca) : foreach ($config['ca'] as $ca) :
$selected = ""; $selected = "";
if ($pconfig['caref'] == $ca['refid']) { if ($pconfig['caref'] == $ca['refid']) {
$selected = "selected=\"selected\""; $selected = "selected=\"selected\"";
} }
?> ?>
<option value="<?=htmlspecialchars($ca['refid']); <option value="<?=htmlspecialchars($ca['refid']);?>" <?=$selected;?>>
?>" <?=$selected; <?=htmlspecialchars($ca['descr']);?>
?>><?=htmlspecialchars($ca['descr']);?></option> </option>
<?php <?php
endforeach; ?> endforeach; ?>
</select> </select>
<?php <?php
else : else :?>
?> <b><?=gettext("No Certificate Authorities defined.");?></b>
<b><?=gettext("No Certificate Authorities defined."); <br /><?=gettext("Create one under")?> <a href="system_camanager.php"> <?=gettext("System: Certificates");?></a>.
?></b> <br /><?=gettext("Create one under")?> <a href="system_camanager.php"> <?=gettext("System: Certificates");?></a>. <?php
<?php endif; ?>
endif; ?>
</td> </td>
</tr> </tr>
<tr id="tls_crl"> <tr id="tls_crl">
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Peer Certificate Revocation List"); ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Peer Certificate Revocation List"); ?></td>
<td> <td>
<?php if (isset($config['crl'])) : <?php
?> if (isset($config['crl'])) :?>
<select name='crlref' class="form-control"> <select name='crlref' class="form-control">
<option value="">None</option> <option value="">None</option>
<?php <?php
foreach ($config['crl'] as $crl) : foreach ($config['crl'] as $crl) :
if (isset($acrl['refid'])) { if (isset($acrl['refid'])) {
$selected = ""; $selected = "";
...@@ -980,31 +983,28 @@ endif; ?> ...@@ -980,31 +983,28 @@ endif; ?>
$selected = "selected=\"selected\""; $selected = "selected=\"selected\"";
} }
} }
} }?>
?> <option value="<?=htmlspecialchars($crl['refid']);?>" <?=$selected;?>>
<option value="<?=htmlspecialchars($crl['refid']); <?=htmlspecialchars($crl['descr'] . $caname);?>
?>" <?=$selected; </option>
?>><?=htmlspecialchars($crl['descr'] . $caname);?></option> <?php
<?php
endforeach; ?> endforeach; ?>
</select> </select>
<?php <?php
else : else :?>
?> <b><?=gettext("No Certificate Revocation Lists (CRLs) defined.");?></b>
<b><?=gettext("No Certificate Revocation Lists (CRLs) defined."); <br /><?=gettext("Create one under");?> <a href="system_crlmanager.php"><?=gettext("System: Certificates");?></a>.
?></b> <br /><?=gettext("Create one under"); <?php
?> <a href="system_crlmanager.php"><?=gettext("System: Certificates");?></a>. endif; ?>
<?php
endif; ?>
</td> </td>
</tr> </tr>
<tr id="tls_cert"> <tr id="tls_cert">
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Server Certificate"); ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Server Certificate"); ?></td>
<td> <td>
<?php if (isset($config['cert'])) : <?php
?> if (isset($config['cert'])) :?>
<select name='certref' class="form-control"> <select name='certref' class="form-control">
<?php <?php
foreach ($config['cert'] as $cert) : foreach ($config['cert'] as $cert) :
$selected = ""; $selected = "";
$caname = ""; $caname = "";
...@@ -1026,27 +1026,25 @@ endif; ?> ...@@ -1026,27 +1026,25 @@ endif; ?>
$revoked = " *Revoked"; $revoked = " *Revoked";
} }
?> ?>
<option value="<?=htmlspecialchars($cert['refid']); <option value="<?=htmlspecialchars($cert['refid']);?>" <?=$selected;?>>
?>" <?=$selected; <?=htmlspecialchars($cert['descr'] . $caname . $inuse . $revoked);?>
?>><?=htmlspecialchars($cert['descr'] . $caname . $inuse . $revoked);?></option> </option>
<?php <?php
endforeach; ?> endforeach; ?>
</select> </select>
<?php <?php
else : else :?>
?> <b><?=gettext("No Certificates defined.");?></b>
<b><?=gettext("No Certificates defined."); <br /><?=gettext("Create one under");?> <a href="system_certmanager.php"><?=gettext("System: Certificates");?></a>.
?></b> <br /><?=gettext("Create one under"); <?php
?> <a href="system_certmanager.php"><?=gettext("System: Certificates");?></a>. endif; ?>
<?php
endif; ?>
</td> </td>
</tr> </tr>
<tr id="tls_dh"> <tr id="tls_dh">
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("DH Parameters Length"); ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("DH Parameters Length"); ?></td>
<td> <td>
<select name="dh_length" class="form-control"> <select name="dh_length" class="form-control">
<?php <?php
foreach (array(1024, 2048, 4096) as $length) : foreach (array(1024, 2048, 4096) as $length) :
$selected = ""; $selected = "";
if ($length == $pconfig['dh_length']) { if ($length == $pconfig['dh_length']) {
...@@ -1054,7 +1052,7 @@ endif; ?> ...@@ -1054,7 +1052,7 @@ endif; ?>
} }
?> ?>
<option<?=$selected?>><?=$length;?></option> <option<?=$selected?>><?=$length;?></option>
<?php <?php
endforeach; ?> endforeach; ?>
</select> </select>
<span> <span>
...@@ -1065,8 +1063,8 @@ endif; ?> ...@@ -1065,8 +1063,8 @@ endif; ?>
<tr id="psk"> <tr id="psk">
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Shared Key"); ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Shared Key"); ?></td>
<td> <td>
<?php if (empty($pconfig['shared_key'])) : <?php
?> if (empty($pconfig['shared_key'])) :?>
<table border="0" cellpadding="2" cellspacing="0" summary="shared key"> <table border="0" cellpadding="2" cellspacing="0" summary="shared key">
<tr> <tr>
<td> <td>
...@@ -1079,8 +1077,8 @@ endif; ?> ...@@ -1079,8 +1077,8 @@ endif; ?>
</td> </td>
</tr> </tr>
</table> </table>
<?php <?php
endif; ?> endif; ?>
<table border="0" cellpadding="2" cellspacing="0" id="autokey_opts" summary="shared key"> <table border="0" cellpadding="2" cellspacing="0" id="autokey_opts" summary="shared key">
<tr> <tr>
<td> <td>
...@@ -1095,7 +1093,7 @@ endif; ?> ...@@ -1095,7 +1093,7 @@ endif; ?>
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Encryption algorithm"); ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Encryption algorithm"); ?></td>
<td> <td>
<select name="crypto" class="form-control"> <select name="crypto" class="form-control">
<?php <?php
$cipherlist = openvpn_get_cipherlist(); $cipherlist = openvpn_get_cipherlist();
foreach ($cipherlist as $name => $desc) : foreach ($cipherlist as $name => $desc) :
$selected = ""; $selected = "";
...@@ -1106,7 +1104,7 @@ endif; ?> ...@@ -1106,7 +1104,7 @@ endif; ?>
<option value="<?=$name;?>"<?=$selected?>> <option value="<?=$name;?>"<?=$selected?>>
<?=htmlspecialchars($desc);?> <?=htmlspecialchars($desc);?>
</option> </option>
<?php <?php
endforeach; ?> endforeach; ?>
</select> </select>
</td> </td>
...@@ -1115,7 +1113,7 @@ endif; ?> ...@@ -1115,7 +1113,7 @@ endif; ?>
<td><a id="help_for_digest" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Auth Digest Algorithm"); ?></td> <td><a id="help_for_digest" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Auth Digest Algorithm"); ?></td>
<td> <td>
<select name="digest" class="form-control"> <select name="digest" class="form-control">
<?php <?php
$digestlist = openvpn_get_digestlist(); $digestlist = openvpn_get_digestlist();
foreach ($digestlist as $name => $desc) : foreach ($digestlist as $name => $desc) :
$selected = ""; $selected = "";
...@@ -1126,7 +1124,8 @@ endif; ?> ...@@ -1126,7 +1124,8 @@ endif; ?>
<option value="<?=$name;?>"<?=$selected?>> <option value="<?=$name;?>"<?=$selected?>>
<?=htmlspecialchars($desc);?> <?=htmlspecialchars($desc);?>
</option> </option>
<?php endforeach; ?> <?php
endforeach; ?>
</select> </select>
<div class="hidden" for="help_for_digest"> <div class="hidden" for="help_for_digest">
<?php echo gettext("NOTE: Leave this set to SHA1 unless all clients are set to match. SHA1 is the default for OpenVPN."); ?> <?php echo gettext("NOTE: Leave this set to SHA1 unless all clients are set to match. SHA1 is the default for OpenVPN."); ?>
...@@ -1137,7 +1136,7 @@ endif; ?> ...@@ -1137,7 +1136,7 @@ endif; ?>
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Hardware Crypto"); ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Hardware Crypto"); ?></td>
<td> <td>
<select name="engine" class="form-control"> <select name="engine" class="form-control">
<?php <?php
$engines = openvpn_get_engines(); $engines = openvpn_get_engines();
foreach ($engines as $name => $desc) : foreach ($engines as $name => $desc) :
$selected = ""; $selected = "";
...@@ -1148,7 +1147,8 @@ endif; ?> ...@@ -1148,7 +1147,8 @@ endif; ?>
<option value="<?=$name;?>"<?=$selected?>> <option value="<?=$name;?>"<?=$selected?>>
<?=htmlspecialchars($desc);?> <?=htmlspecialchars($desc);?>
</option> </option>
<?php endforeach; ?> <?php
endforeach; ?>
</select> </select>
</td> </td>
</tr> </tr>
...@@ -1159,7 +1159,7 @@ endif; ?> ...@@ -1159,7 +1159,7 @@ endif; ?>
<tr><td> <tr><td>
<select name="cert_depth" class="form-control"> <select name="cert_depth" class="form-control">
<option value=""><?=gettext('Do Not Check') ?></option> <option value=""><?=gettext('Do Not Check') ?></option>
<?php <?php
$openvpn_cert_depths = array( $openvpn_cert_depths = array(
1 => gettext('One (Client+Server)'), 1 => gettext('One (Client+Server)'),
2 => gettext('Two (Client+Intermediate+Server)'), 2 => gettext('Two (Client+Intermediate+Server)'),
...@@ -1174,11 +1174,13 @@ endif; ?> ...@@ -1174,11 +1174,13 @@ endif; ?>
} }
?> ?>
<option value="<?= $depth ?>" <?= $selected ?>><?= $depthdesc ?></option> <option value="<?= $depth ?>" <?= $selected ?>><?= $depthdesc ?></option>
<?php <?php
endforeach; ?> endforeach; ?>
</select> </select>
</td></tr> </td>
<tr><td> </tr>
<tr>
<td>
<div class="hidden" for="help_for_cert_depth"> <div class="hidden" for="help_for_cert_depth">
<span> <span>
<?=gettext("When a certificate-based client logs in, do not accept certificates below this depth. Useful for denying certificates made with intermediate CAs generated from the same CA as the server."); ?> <?=gettext("When a certificate-based client logs in, do not accept certificates below this depth. Useful for denying certificates made with intermediate CAs generated from the same CA as the server."); ?>
...@@ -1200,7 +1202,7 @@ endif; ?> ...@@ -1200,7 +1202,7 @@ endif; ?>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2" class="list" height="12"></td> <td colspan="2" height="12"></td>
</tr> </tr>
<tr> <tr>
<td colspan="2"><?=gettext("Tunnel Settings"); ?></td> <td colspan="2"><?=gettext("Tunnel Settings"); ?></td>
...@@ -1250,7 +1252,7 @@ endif; ?> ...@@ -1250,7 +1252,7 @@ endif; ?>
<td width="22%" ><a id="help_for_serverbridge_interface" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Bridge Interface"); ?></td> <td width="22%" ><a id="help_for_serverbridge_interface" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Bridge Interface"); ?></td>
<td> <td>
<select name="serverbridge_interface" class="form-control"> <select name="serverbridge_interface" class="form-control">
<?php <?php
$serverbridge_interface['none'] = "none"; $serverbridge_interface['none'] = "none";
$serverbridge_interface = array_merge($serverbridge_interface, get_configured_interface_with_descr()); $serverbridge_interface = array_merge($serverbridge_interface, get_configured_interface_with_descr());
$carplist = get_configured_carp_interface_list(); $carplist = get_configured_carp_interface_list();
...@@ -1267,11 +1269,10 @@ endif; ?> ...@@ -1267,11 +1269,10 @@ endif; ?>
$selected = "selected=\"selected\""; $selected = "selected=\"selected\"";
} }
?> ?>
<option value="<?=$iface; <option value="<?=$iface;?>" <?=$selected;?>>
?>" <?=$selected;?>>
<?=htmlspecialchars($ifacename);?> <?=htmlspecialchars($ifacename);?>
</option> </option>
<?php <?php
endforeach; ?> endforeach; ?>
</select> </select>
<div class="hidden" for="help_for_serverbridge_interface"> <div class="hidden" for="help_for_serverbridge_interface">
...@@ -1387,7 +1388,7 @@ endif; ?> ...@@ -1387,7 +1388,7 @@ endif; ?>
<td width="22%" ><a id="help_for_compression" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Compression"); ?></td> <td width="22%" ><a id="help_for_compression" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Compression"); ?></td>
<td> <td>
<select name="compression" class="form-control"> <select name="compression" class="form-control">
<?php <?php
foreach ($openvpn_compression_modes as $cmode => $cmodedesc) : foreach ($openvpn_compression_modes as $cmode => $cmodedesc) :
$selected = ""; $selected = "";
if ($cmode == $pconfig['compression']) { if ($cmode == $pconfig['compression']) {
...@@ -1395,7 +1396,7 @@ endif; ?> ...@@ -1395,7 +1396,7 @@ endif; ?>
} }
?> ?>
<option value="<?= $cmode ?>" <?= $selected ?>><?= $cmodedesc ?></option> <option value="<?= $cmode ?>" <?= $selected ?>><?= $cmodedesc ?></option>
<?php <?php
endforeach; ?> endforeach; ?>
</select> </select>
<div class="hidden" for="help_for_compression"> <div class="hidden" for="help_for_compression">
...@@ -1448,7 +1449,7 @@ endif; ?> ...@@ -1448,7 +1449,7 @@ endif; ?>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2" class="list" height="12"></td> <td colspan="2" height="12"></td>
</tr> </tr>
<tr> <tr>
<td colspan="2"><?=gettext("Client Settings"); ?></td> <td colspan="2"><?=gettext("Client Settings"); ?></td>
...@@ -1578,16 +1579,14 @@ endif; ?> ...@@ -1578,16 +1579,14 @@ endif; ?>
<?=gettext("Node Type"); ?>:&nbsp; <?=gettext("Node Type"); ?>:&nbsp;
</span> </span>
<select name='netbios_ntype' class="form-control"> <select name='netbios_ntype' class="form-control">
<?php <?php
foreach ($netbios_nodetypes as $type => $name) : foreach ($netbios_nodetypes as $type => $name) :
$selected = ""; $selected = "";
if ($pconfig['netbios_ntype'] == $type) { if ($pconfig['netbios_ntype'] == $type) {
$selected = "selected=\"selected\""; $selected = "selected=\"selected\"";
} }
?> ?>
<option value="<?=$type; <option value="<?=$type;?>" <?=$selected;?>><?=$name;?></option>
?>" <?=$selected;
?>><?=$name;?></option>
<?php <?php
endforeach; ?> endforeach; ?>
</select> </select>
...@@ -1647,7 +1646,7 @@ endif; ?> ...@@ -1647,7 +1646,7 @@ endif; ?>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2" class="list" height="12"></td> <td colspan="2" height="12"></td>
</tr> </tr>
<tr> <tr>
<td colspan="2"><?=gettext("Advanced configuration"); ?></td> <td colspan="2"><?=gettext("Advanced configuration"); ?></td>
...@@ -1666,7 +1665,7 @@ endif; ?> ...@@ -1666,7 +1665,7 @@ endif; ?>
<td width="22%" ><a id="help_for_verbosity_level" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Verbosity level");?></td> <td width="22%" ><a id="help_for_verbosity_level" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Verbosity level");?></td>
<td> <td>
<select name="verbosity_level" class="form-control"> <select name="verbosity_level" class="form-control">
<?php <?php
foreach ($openvpn_verbosity_level as $verb_value => $verb_desc) : foreach ($openvpn_verbosity_level as $verb_value => $verb_desc) :
$selected = ''; $selected = '';
if ($pconfig['verbosity_level'] == $verb_value) { if ($pconfig['verbosity_level'] == $verb_value) {
...@@ -1674,7 +1673,8 @@ endif; ?> ...@@ -1674,7 +1673,8 @@ endif; ?>
} }
?> ?>
<option value="<?=$verb_value; ?>" <?=$selected; ?>><?=$verb_desc;?></option> <option value="<?=$verb_value; ?>" <?=$selected; ?>><?=$verb_desc;?></option>
<?php endforeach; ?> <?php
endforeach; ?>
</select> </select>
<div class="hidden" for="help_for_verbosity_level"> <div class="hidden" for="help_for_verbosity_level">
<?=gettext("Each level shows all info from the previous levels. Level 3 is recommended if you want a good summary of what's happening without being swamped by output."); ?><br /> <br /> <?=gettext("Each level shows all info from the previous levels. Level 3 is recommended if you want a good summary of what's happening without being swamped by output."); ?><br /> <br />
...@@ -1690,66 +1690,57 @@ endif; ?> ...@@ -1690,66 +1690,57 @@ endif; ?>
<td width="78%"> <td width="78%">
<input name="save" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" /> <input name="save" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" />
<input name="act" type="hidden" value="<?=$act;?>" /> <input name="act" type="hidden" value="<?=$act;?>" />
<?php if (isset($id) && $a_server[$id]) : <?php
?> if (isset($id) && $a_server[$id]) :?>
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
<?php <?php
endif; ?> endif; ?>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
</form> </form>
<?php
<?php else :?>
else :
?>
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<td width="10%" class="listhdrr"><?=gettext("Disabled"); ?></td> <td></td>
<td width="10%" class="listhdrr"><?=gettext("Protocol / Port"); ?></td> <td><?=gettext("Protocol / Port"); ?></td>
<td width="30%" class="listhdrr"><?=gettext("Tunnel Network"); ?></td> <td><?=gettext("Tunnel Network"); ?></td>
<td width="40%" class="listhdrr"><?=gettext("Description"); ?></td> <td><?=gettext("Description"); ?></td>
<td width="10%" class="list"></td> <td></td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
$i = 0; $i = 0;
foreach ($a_server as $server) : foreach ($a_server as $server) :?>
$disabled = "NO";
if (!empty($server['disable'])) {
$disabled = "YES";
}
?>
<tr> <tr>
<td ondblclick="document.location='vpn_openvpn_server.php?act=edit&amp;id=<?=$i;?>'"> <td>
<?=$disabled;?> <a href="#" class="act_toggle" data-id="<?=$i;?>" data-toggle="tooltip" title="<?=(empty($server['disable'])) ? gettext("disable") : gettext("enable");?>">
<span class="glyphicon glyphicon-play <?=(empty($server['disable'])) ? "text-success" : "text-muted";?>"></span>
</a>
</td> </td>
<td ondblclick="document.location='vpn_openvpn_server.php?act=edit&amp;id=<?=$i;?>'"> <td>
<?=htmlspecialchars($server['protocol']); <?=htmlspecialchars($server['protocol']);?> / <?=htmlspecialchars($server['local_port']);?>
?> / <?=htmlspecialchars($server['local_port']);?>
</td> </td>
<td ondblclick="document.location='vpn_openvpn_server.php?act=edit&amp;id=<?=$i;?>'"> <td>
<?=htmlspecialchars($server['tunnel_network']);?> <?=!empty($server['tunnel_networkv6']) ? "," :""?> <?=htmlspecialchars($server['tunnel_network']);?> <?=!empty($server['tunnel_networkv6']) ? "," :""?>
<?=htmlspecialchars($server['tunnel_networkv6']);?> <?=htmlspecialchars($server['tunnel_networkv6']);?>
</td> </td>
<td ondblclick="document.location='vpn_openvpn_server.php?act=edit&amp;id=<?=$i;?>'"> <td>
<?=htmlspecialchars($server['description']);?> <?=htmlspecialchars($server['description']);?>
</td> </td>
<td valign="middle"> <td>
<a href="vpn_openvpn_server.php?act=edit&amp;id=<?=$i; <a href="vpn_openvpn_server.php?act=edit&amp;id=<?=$i;?>" title="<?=gettext("edit server"); ?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a>
?>" title="<?=gettext("edit server"); ?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a> <a id="del_<?=$i;?>" title="<?=gettext("delete server"); ?>" class="act_delete btn btn-default btn-xs"><span class="fa fa-trash text-muted"></span></a>
<a id="del_<?=$i;
?>" title="<?=gettext("delete server"); ?>" class="act_delete btn btn-default btn-xs"><span class="fa fa-trash text-muted"></span></a>
</td> </td>
</tr> </tr>
<?php <?php
$i++; $i++;
endforeach; endforeach;?>
?>
<tr><td colspan="5">&nbsp;</td></tr> <tr><td colspan="5">&nbsp;</td></tr>
</tbody> </tbody>
<tfoot> <tfoot>
...@@ -1759,10 +1750,8 @@ else : ...@@ -1759,10 +1750,8 @@ else :
</td></tr> </td></tr>
</tfoot> </tfoot>
</table> </table>
<?php
<?php endif; ?>
endif; ?>
</div> </div>
</section> </section>
</div> </div>
......
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