Commit 305ba62b authored by Ad Schellevis's avatar Ad Schellevis

(legacy) refactor services_snmp.php

parent 46265467
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2014-2016 Deciso B.V.
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
All rights reserved.
......@@ -32,468 +32,321 @@ require_once("interfaces.inc");
require_once("services.inc");
require_once("system.inc");
if (!is_array($config['snmpd'])) {
$config['snmpd'] = array();
$config['snmpd']['rocommunity'] = "public";
$config['snmpd']['pollport'] = "161";
}
if (!is_array($config['snmpd']['modules'])) {
$config['snmpd']['modules'] = array();
$config['snmpd']['modules']['mibii'] = true;
$config['snmpd']['modules']['netgraph'] = true;
$config['snmpd']['modules']['pf'] = true;
$config['snmpd']['modules']['hostres'] = true;
$config['snmpd']['modules']['bridge'] = true;
$config['snmpd']['modules']['ucd'] = true;
$config['snmpd']['modules']['regex'] = true;
}
$pconfig['enable'] = isset($config['snmpd']['enable']);
$pconfig['pollport'] = $config['snmpd']['pollport'];
$pconfig['syslocation'] = $config['snmpd']['syslocation'];
$pconfig['syscontact'] = $config['snmpd']['syscontact'];
$pconfig['rocommunity'] = $config['snmpd']['rocommunity'];
/* disabled until some docs show up on what this does.
$pconfig['rwenable'] = isset($config['snmpd']['rwenable']);
$pconfig['rwcommunity'] = $config['snmpd']['rwcommunity'];
*/
$pconfig['trapenable'] = isset($config['snmpd']['trapenable']);
$pconfig['trapserver'] = $config['snmpd']['trapserver'];
$pconfig['trapserverport'] = $config['snmpd']['trapserverport'];
$pconfig['trapstring'] = $config['snmpd']['trapstring'];
$pconfig['mibii'] = isset($config['snmpd']['modules']['mibii']);
$pconfig['netgraph'] = isset($config['snmpd']['modules']['netgraph']);
$pconfig['pf'] = isset($config['snmpd']['modules']['pf']);
$pconfig['hostres'] = isset($config['snmpd']['modules']['hostres']);
$pconfig['bridge'] = isset($config['snmpd']['modules']['bridge']);
$pconfig['ucd'] = isset($config['snmpd']['modules']['ucd']);
$pconfig['regex'] = isset($config['snmpd']['modules']['regex']);
$pconfig['bindip'] = $config['snmpd']['bindip'];
if ($_POST) {
unset($input_errors);
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig = array();
if (empty($config['snmpd']) || !is_array($config['snmpd'])) {
// set defaults (no config)
$pconfig['rocommunity'] = "public";
$pconfig['pollport'] = "161";
$pconfig['mibii'] = true;
$pconfig['netgraph'] = true;
$pconfig['pf'] = true;
$pconfig['hostres'] = true;
$pconfig['bridge'] = true;
$pconfig['ucd'] = true;
$pconfig['regex'] = true;
} else {
// modules
foreach (array('mibii', 'netgraph', 'pf', 'hostres', 'bridge', 'ucd', 'regex') as $module) {
$pconfig[$module] = !empty($config['snmpd']['modules'][$module]);
}
// booleans
$pconfig['enable'] = isset($config['snmpd']['enable']);
$pconfig['trapenable'] = isset($config['snmpd']['trapenable']);
// text fields
foreach (array('rocommunity', 'pollport', 'syslocation', 'syscontact',
'trapserver', 'trapserverport', 'trapstring', 'bindip') as $fieldname) {
$pconfig[$fieldname] = !empty($config['snmpd'][$fieldname]) ? $config['snmpd'][$fieldname] : null;
}
}
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
$input_errors = array();
$pconfig = $_POST;
/* input validation */
if ($_POST['enable']) {
if (strstr($_POST['syslocation'],"#")) $input_errors[] = gettext("Invalid character '#' in system location");
if (strstr($_POST['syscontact'],"#")) $input_errors[] = gettext("Invalid character '#' in system contact");
if (strstr($_POST['rocommunity'],"#")) $input_errors[] = gettext("Invalid character '#' in read community string");
$reqdfields = explode(" ", "rocommunity");
$reqdfieldsn = array(gettext("Community"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
$reqdfields = explode(" ", "pollport");
$reqdfieldsn = array(gettext("Polling Port"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
// input validation
if (strstr($pconfig['syslocation'],"#")) {
$input_errors[] = gettext("Invalid character '#' in system location");
}
if ($_POST['trapenable']) {
if (strstr($_POST['trapstring'],"#")) $input_errors[] = gettext("Invalid character '#' in SNMP trap string");
$reqdfields = explode(" ", "trapserver");
$reqdfieldsn = array(gettext("Trap server"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
$reqdfields = explode(" ", "trapserverport");
$reqdfieldsn = array(gettext("Trap server port"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
$reqdfields = explode(" ", "trapstring");
$reqdfieldsn = array(gettext("Trap string"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
if (strstr($pconfig['syscontact'],"#")) {
$input_errors[] = gettext("Invalid character '#' in system contact");
}
/* disabled until some docs show up on what this does.
if ($_POST['rwenable']) {
$reqdfields = explode(" ", "rwcommunity");
$reqdfieldsn = explode(",", "Write community string");
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
if (strstr($pconfig['rocommunity'],"#")) {
$input_errors[] = gettext("Invalid character '#' in read community string");
}
*/
if (!empty($pconfig['enable'])) {
$reqdfields = array("rocommunity", "pollport");
$reqdfieldsn = array(gettext("Community"), gettext("Polling Port"));
do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
}
if (!$input_errors) {
$config['snmpd']['enable'] = $_POST['enable'] ? true : false;
$config['snmpd']['pollport'] = $_POST['pollport'];
$config['snmpd']['syslocation'] = $_POST['syslocation'];
$config['snmpd']['syscontact'] = $_POST['syscontact'];
$config['snmpd']['rocommunity'] = $_POST['rocommunity'];
/* disabled until some docs show up on what this does.
$config['snmpd']['rwenable'] = $_POST['rwenable'] ? true : false;
$config['snmpd']['rwcommunity'] = $_POST['rwcommunity'];
*/
$config['snmpd']['trapenable'] = $_POST['trapenable'] ? true : false;
$config['snmpd']['trapserver'] = $_POST['trapserver'];
$config['snmpd']['trapserverport'] = $_POST['trapserverport'];
$config['snmpd']['trapstring'] = $_POST['trapstring'];
if (strstr($pconfig['trapstring'],"#")) {
$input_errors[] = gettext("Invalid character '#' in SNMP trap string");
}
$config['snmpd']['modules']['mibii'] = $_POST['mibii'] ? true : false;
$config['snmpd']['modules']['netgraph'] = $_POST['netgraph'] ? true : false;
$config['snmpd']['modules']['pf'] = $_POST['pf'] ? true : false;
$config['snmpd']['modules']['hostres'] = $_POST['hostres'] ? true : false;
$config['snmpd']['modules']['bridge'] = $_POST['bridge'] ? true : false;
$config['snmpd']['modules']['ucd'] = $_POST['ucd'] ? true : false;
$config['snmpd']['modules']['regex'] = $_POST['regex'] ? true : false;
$config['snmpd']['bindip'] = $_POST['bindip'];
if (!empty($pconfig['trapenable'])) {
$reqdfields = array("trapserver", "trapserverport", "trapstring");
$reqdfieldsn = array(gettext("Trap server"), gettext("Trap server port"), gettext("Trap string"));
do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
}
if (count($input_errors) == 0) {
// save form data
// modules
$snmp = array();
$snmp['modules'] = array();
foreach (array('mibii', 'netgraph', 'pf', 'hostres', 'bridge', 'ucd', 'regex') as $module) {
$snmp['modules'][$module] = !empty($pconfig[$module]);
}
// booleans
$snmp['enable'] = !empty($pconfig['enable']);
$snmp['trapenable'] = !empty($pconfig['trapenable']);
// text fields
foreach (array('rocommunity', 'pollport', 'syslocation', 'syscontact',
'trapserver', 'trapserverport', 'trapstring', 'bindip') as $fieldname) {
$snmp[$fieldname] = $pconfig[$fieldname];
}
$config['snmpd'] = $snmp;
// save and apply
write_config();
$retval = 0;
$retval = services_snmpd_configure();
$savemsg = get_std_save_message();
services_snmpd_configure();
get_std_save_message();
header("Location: services_snmp.php");
exit;
}
}
$service_hook = 'bsnmpd';
$service_hook = 'bsnmpd';
legacy_html_escape_form_data($pconfig);
include("head.inc");
?>
<body>
<script type="text/javascript">
//<![CDATA[
function check_deps() {
if (jQuery('#hostres').prop('checked') == true) {
jQuery('#mibii').prop('checked',true);
$( document ).ready(function() {
$("#hostres").change(function(){
if ($('#hostres').prop('checked')) {
$('#mibii').prop('checked',true);
}
}
function enable_change(whichone) {
if( whichone.name == "trapenable" )
{
if( whichone.checked == true )
{
document.iform.trapserver.disabled = false;
document.iform.trapserverport.disabled = false;
document.iform.trapstring.disabled = false;
})
$("#mibii").change(function(){
if ($('#hostres').prop('checked')) {
$('#mibii').prop('checked',true);
}
else
{
document.iform.trapserver.disabled = true;
document.iform.trapserverport.disabled = true;
document.iform.trapstring.disabled = true;
}
}
/* disabled until some docs show up on what this does.
if( whichone.name == "rwenable" )
{
if( whichone.checked == true )
{
document.iform.rwcommunity.disabled = false;
}
else
{
document.iform.rwcommunity.disabled = true;
}
}
*/
if( document.iform.enable.checked == true )
{
document.iform.pollport.disabled = false;
document.iform.syslocation.disabled = false;
document.iform.syscontact.disabled = false;
document.iform.rocommunity.disabled = false;
document.iform.trapenable.disabled = false;
/* disabled until some docs show up on what this does.
document.iform.rwenable.disabled = false;
if( document.iform.rwenable.checked == true )
{
document.iform.rwcommunity.disabled = false;
}
else
{
document.iform.rwcommunity.disabled = true;
}
*/
if( document.iform.trapenable.checked == true )
{
document.iform.trapserver.disabled = false;
document.iform.trapserverport.disabled = false;
document.iform.trapstring.disabled = false;
}
else
{
document.iform.trapserver.disabled = true;
document.iform.trapserverport.disabled = true;
document.iform.trapstring.disabled = true;
}
document.iform.mibii.disabled = false;
document.iform.netgraph.disabled = false;
document.iform.pf.disabled = false;
document.iform.hostres.disabled = false;
document.iform.ucd.disabled = false;
document.iform.regex.disabled = false;
//document.iform.bridge.disabled = false;
}
else
{
document.iform.pollport.disabled = true;
document.iform.syslocation.disabled = true;
document.iform.syscontact.disabled = true;
document.iform.rocommunity.disabled = true;
/*
document.iform.rwenable.disabled = true;
document.iform.rwcommunity.disabled = true;
*/
document.iform.trapenable.disabled = true;
document.iform.trapserver.disabled = true;
document.iform.trapserverport.disabled = true;
document.iform.trapstring.disabled = true;
document.iform.mibii.disabled = true;
document.iform.netgraph.disabled = true;
document.iform.pf.disabled = true;
document.iform.hostres.disabled = true;
document.iform.ucd.disabled = true;
document.iform.regex.disabled = true;
//document.iform.bridge.disabled = true;
}
}
//]]>
})
});
</script>
<?php include("fbegin.inc"); ?>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?>
<form action="services_snmp.php" method="post" name="iform" id="iform">
<form method="post" name="iform" id="iform">
<section class="col-xs-12">
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("SNMP Daemon");?></h3>
</header>
<div class="content-box-main">
<div class="table-responsive">
<table class="table table-striped table-sort">
<table class="table table-striped">
<thead>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Enable");?></td>
<td width="78%" class="vtable">
<input name="enable" id="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onclick="enable_change(this)" />
<td width="22%">
<strong><?=gettext("SNMP Daemon");?></strong>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Polling Port ");?></td>
<td width="78%" class="vtable">
<input name="pollport" type="text" class="formfld unknown" id="pollport" size="40" value="<?=htmlspecialchars($pconfig['pollport']) ? htmlspecialchars($pconfig['pollport']) : htmlspecialchars(161);?>" />
<br /><?=gettext("Enter the port to accept polling events on (default 161)");?><br />
<td width="78%" align="right">
<small><?=gettext("full help"); ?> </small>
<i class="fa fa-toggle-off text-danger" style="cursor: pointer;" id="show_all_help_page" type="button"></i>
&nbsp;&nbsp;
</td>
</tr>
</thead>
<tbody>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("System location");?></td>
<td width="78%" class="vtable">
<input name="syslocation" type="text" class="formfld unknown" id="syslocation" size="40" value="<?=htmlspecialchars($pconfig['syslocation']);?>" />
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Enable");?></td>
<td>
<input name="enable" id="enable" type="checkbox" value="yes" <?=!empty($pconfig['enable']) ? "checked=\"checked\"" : ""; ?> />
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("System contact");?></td>
<td width="78%" class="vtable">
<input name="syscontact" type="text" class="formfld unknown" id="syscontact" size="40" value="<?=htmlspecialchars($pconfig['syscontact']);?>" />
<td><a id="help_for_pollport" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Polling Port ");?></td>
<td>
<input name="pollport" type="text" value="<?=$pconfig['pollport'];?>" />
<div class="hidden" for="help_for_pollport">
<?=gettext("Enter the port to accept polling events on (default 161)");?>
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Read Community String");?></td>
<td width="78%" class="vtable">
<input name="rocommunity" type="text" class="formfld unknown" id="rocommunity" size="40" value="<?=htmlspecialchars($pconfig['rocommunity']);?>" />
<br /><?=gettext("The community string is like a password, restricting access to querying SNMP to hosts knowing the community string. Use a strong value here to protect from unauthorized information disclosure.");?><br />
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("System location");?></td>
<td>
<input name="syslocation" type="text" value="<?=$pconfig['syslocation'];?>" />
</td>
</tr>
<?php
/* disabled until some docs show up on what this does.
<tr>
<td width="22%" valign="top" class="vtable">&nbsp;</td>
<td width="78%" class="vtable">
<input name="rwenable" id="rwenable" type="checkbox" value="yes" <?php if ($pconfig['rwenable']) echo "checked=\"checked\""; ?> onclick="enable_change(this)" />
<strong>Enable Write Community String</strong>
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("System contact");?></td>
<td>
<input name="syscontact" type="text" value="<?=$pconfig['syscontact'];?>" />
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq">Write community string</td>
<td width="78%" class="vtable">
<input name="rwcommunity" type="text" class="formfld unknown" id="rwcommunity" size="40" value="<?=htmlspecialchars($pconfig['rwcommunity']);?>" />
<br />Please use something other than &quot;private&quot; here<br />
<td><a id="help_for_rocommunity" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Read Community String");?></td>
<td>
<input name="rocommunity" type="text" value="<?=$pconfig['rocommunity'];?>" />
<div class="hidden" for="help_for_rocommunity">
<?=gettext("The community string is like a password, restricting access to querying SNMP to hosts knowing the community string. Use a strong value here to protect from unauthorized information disclosure.");?>
</div>
</td>
</tr>
*/
?>
</tbody>
</table>
</div>
</div>
</div>
</section>
<section class="col-xs-12">
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("SNMP Traps");?></h3>
</header>
<div class="content-box-main">
<div class="table-responsive">
<table class="table table-striped table-sort">
<table class="table table-striped">
<thead>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Enable");?></td>
<td width="78%" class="vtable">
<input name="trapenable" id="trapenable" type="checkbox" value="yes" <?php if ($pconfig['trapenable']) echo "checked=\"checked\""; ?> onclick="enable_change(this)" /> <strong><?=gettext("Enable");?>
<th colspan="2"><?=gettext("SNMP Traps");?></th>
</tr>
</thead>
<tbody>
<tr>
<td width="22%"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Enable");?></td>
<td width="78%">
<input name="trapenable" type="checkbox" value="yes" <?=!empty($pconfig['trapenable']) ? "checked=\"checked\"" : ""; ?> />
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Trap server");?></td>
<td width="78%" class="vtable">
<input name="trapserver" type="text" class="formfld unknown" id="trapserver" size="40" value="<?=htmlspecialchars($pconfig['trapserver']);?>" />
<br /><?=gettext("Enter trap server name");?><br />
<td><a id="help_for_trapserver" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Trap server");?></td>
<td>
<input name="trapserver" type="text" value="<?=$pconfig['trapserver'];?>" />
<div class="hidden" for="help_for_trapserver">
<?=gettext("Enter trap server name");?>
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Trap server port ");?></td>
<td width="78%" class="vtable">
<input name="trapserverport" type="text" class="formfld unknown" id="trapserverport" size="40" value="<?=htmlspecialchars($pconfig['trapserverport']) ? htmlspecialchars($pconfig['trapserverport']) : htmlspecialchars(162);?>" />
<br /><?=gettext("Enter the port to send the traps to (default 162)");?><br />
<td><a id="help_for_trapserverport" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Trap server port ");?></td>
<td>
<input name="trapserverport" type="text" id="trapserverport" size="40" value="<?=htmlspecialchars($pconfig['trapserverport']) ? htmlspecialchars($pconfig['trapserverport']) : htmlspecialchars(162);?>" />
<div class="hidden" for="help_for_trapserverport">
<?=gettext("Enter the port to send the traps to (default 162)");?>
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Enter the SNMP trap string");?></td>
<td width="78%" class="vtable">
<input name="trapstring" type="text" class="formfld unknown" id="trapstring" size="40" value="<?=htmlspecialchars($pconfig['trapstring']);?>" />
<br /><?=gettext("Trap string");?><br />
<td><a id="help_for_trapstring" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Enter the SNMP trap string");?></td>
<td>
<input name="trapstring" type="text" value="<?=$pconfig['trapstring'];?>" />
<div class="hidden" for="help_for_trapstring">
<?=gettext("Trap string");?>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</section>
<section class="col-xs-12">
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("Modules");?></h3>
</header>
<div class="content-box-main">
<div class="table-responsive">
<table class="table table-striped table-sort">
<table class="table table-striped">
<thead>
<tr>
<th colspan="2"><?=gettext("Modules");?></th>
</tr>
</thead>
<tbody>
<tr>
<td width="22%"><?=gettext("SNMP Modules");?></td>
<td width="78%">
<table class="table table-condensed">
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("SNMP Modules");?></td>
<td width="78%" class="vtable">
<input name="mibii" type="checkbox" id="mibii" value="yes" onclick="check_deps()" <?php if ($pconfig['mibii']) echo "checked=\"checked\""; ?> /><?=gettext("MibII"); ?>
<br />
<input name="netgraph" type="checkbox" id="netgraph" value="yes" <?php if ($pconfig['netgraph']) echo "checked=\"checked\""; ?> /><?=gettext("Netgraph"); ?>
<br />
<input name="pf" type="checkbox" id="pf" value="yes" <?php if ($pconfig['pf']) echo "checked=\"checked\""; ?> /><?=gettext("PF"); ?>
<br />
<input name="hostres" type="checkbox" id="hostres" value="yes" onclick="check_deps()" <?php if ($pconfig['hostres']) echo "checked=\"checked\""; ?> /><?=gettext("Host Resources (Requires MibII)");?>
<br />
<input name="ucd" type="checkbox" id="ucd" value="yes" <?php if ($pconfig['ucd']) echo "checked=\"checked\""; ?> /><?=gettext("UCD"); ?>
<br />
<input name="regex" type="checkbox" id="regex" value="yes" <?php if ($pconfig['regex']) echo "checked=\"checked\""; ?> /><?=gettext("Regex"); ?>
<br />
<td>
<input name="mibii" type="checkbox" id="mibii" value="yes" <?=!empty($pconfig['mibii']) ? "checked=\"checked\"" : ""; ?> />
</td>
<td><?=gettext("MibII"); ?></td>
</tr>
<tr>
<td>
<input name="netgraph" type="checkbox" id="netgraph" value="yes" <?=!empty($pconfig['netgraph']) ? "checked=\"checked\"" : ""; ?> />
</td>
<td><?=gettext("Netgraph"); ?></td>
</tr>
<tr>
<td>
<input name="pf" type="checkbox" id="pf" value="yes" <?=!empty($pconfig['pf']) ? "checked=\"checked\"" : ""; ?> />
</td>
<td><?=gettext("PF"); ?></td>
</tr>
<tr>
<td>
<input name="hostres" type="checkbox" id="hostres" value="yes" <?=!empty($pconfig['hostres']) ? "checked=\"checked\"" : ""; ?> />
</td>
<td><?=gettext("Host Resources (Requires MibII)");?></td>
</tr>
<tr>
<td>
<input name="ucd" type="checkbox" id="ucd" value="yes" <?=!empty($pconfig['ucd']) ? "checked=\"checked\"" : ""; ?> />
</td>
<td><?=gettext("UCD"); ?></td>
</tr>
<tr>
<td>
<input name="regex" type="checkbox" id="regex" value="yes" <?=!empty($pconfig['regex']) ? "checked=\"checked\"" : ""; ?> />
</td>
<td><?=gettext("Regex"); ?></td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</section>
<section class="col-xs-12">
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("Interface Binding");?></h3>
</header>
<div class="content-box-main ">
<div class="table-responsive">
<table class="table table-striped table-sort">
<table class="table table-striped">
<thead>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Bind Interface"); ?></td>
<td width="78%" class="vtable">
<select name="bindip" class="formselect">
<th colspan="2"><?=gettext("Interface Binding");?></th>
</tr>
</thead>
<tbody>
<tr>
<td><?=gettext("Bind Interface"); ?></td>
<td>
<select name="bindip" class="selectpicker">
<option value=""><?= gettext('All') ?></option>
<?php $listenips = get_possible_listen_ips();
foreach ($listenips as $lip):
$selected = "";
if ($lip['value'] == $pconfig['bindip'])
$selected = "selected=\"selected\"";
?>
<option value="<?=$lip['value'];?>" <?=$selected;?>>
<?php
foreach (get_possible_listen_ips() as $lip):?>
<option value="<?=$lip['value'];?>" <?=$lip['value'] == $pconfig['bindip'] ? "selected=\"selected\"" : "";?>>
<?=htmlspecialchars($lip['name']);?>
</option>
<?php endforeach; ?>
<?php
endforeach; ?>
</select>
</td>
</tr>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save");?>" onclick="enable_change(true)" />
<input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save");?>" />
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</section>
</form>
</div>
</div>
</section>
<script type="text/javascript">
//<![CDATA[
enable_change(this);
//]]>
</script>
<?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