summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-05-30 12:52:54 +0545
committerPhil Davis <phil.davis@inf.org>2015-05-30 12:52:54 +0545
commit2ee8dea1357deb254f46ead392ecca6d95af4cf7 (patch)
tree6bc69471fe0777ca125497801a916ff7e1e1e25c
parent5dcec9f242a94894086dd425ecf9d2f00ccdebd5 (diff)
downloadpfsense-2ee8dea1357deb254f46ead392ecca6d95af4cf7.zip
pfsense-2ee8dea1357deb254f46ead392ecca6d95af4cf7.tar.gz
Code style system a
-rw-r--r--usr/local/www/system.php550
-rw-r--r--usr/local/www/system_advanced_admin.php186
-rw-r--r--usr/local/www/system_advanced_firewall.php358
-rw-r--r--usr/local/www/system_advanced_misc.php250
-rw-r--r--usr/local/www/system_advanced_network.php47
-rw-r--r--usr/local/www/system_advanced_notifications.php100
-rw-r--r--usr/local/www/system_advanced_sysctl.php51
-rw-r--r--usr/local/www/system_authservers.php198
8 files changed, 970 insertions, 770 deletions
diff --git a/usr/local/www/system.php b/usr/local/www/system.php
index 5202112..12444ec 100644
--- a/usr/local/www/system.php
+++ b/usr/local/www/system.php
@@ -48,7 +48,7 @@ require_once("shaper.inc");
$pconfig['hostname'] = $config['system']['hostname'];
$pconfig['domain'] = $config['system']['domain'];
-list($pconfig['dns1'],$pconfig['dns2'],$pconfig['dns3'],$pconfig['dns4']) = $config['system']['dnsserver'];
+list($pconfig['dns1'], $pconfig['dns2'], $pconfig['dns3'], $pconfig['dns4']) = $config['system']['dnsserver'];
$arr_gateways = return_gateways_array();
@@ -66,12 +66,15 @@ $pconfig['language'] = $config['system']['language'];
$pconfig['dnslocalhost'] = isset($config['system']['dnslocalhost']);
-if (!isset($pconfig['timeupdateinterval']))
+if (!isset($pconfig['timeupdateinterval'])) {
$pconfig['timeupdateinterval'] = 300;
-if (!$pconfig['timezone'])
+}
+if (!$pconfig['timezone']) {
$pconfig['timezone'] = "Etc/UTC";
-if (!$pconfig['timeservers'])
+}
+if (!$pconfig['timeservers']) {
$pconfig['timeservers'] = "pool.ntp.org";
+}
$changedesc = gettext("System") . ": ";
$changecount = 0;
@@ -80,7 +83,7 @@ function is_timezone($elt) {
return !preg_match("/\/$/", $elt);
}
-if($pconfig['timezone'] <> $_POST['timezone']) {
+if ($pconfig['timezone'] <> $_POST['timezone']) {
filter_pflog_start(true);
}
@@ -90,8 +93,8 @@ sort($timezonelist);
$multiwan = false;
$interfaces = get_configured_interface_list();
-foreach($interfaces as $interface) {
- if(interface_has_gateway($interface)) {
+foreach ($interfaces as $interface) {
+ if (interface_has_gateway($interface)) {
$multiwan = true;
}
}
@@ -99,13 +102,13 @@ foreach($interfaces as $interface) {
if ($_POST) {
$changecount++;
-
+
unset($input_errors);
$pconfig = $_POST;
/* input validation */
$reqdfields = explode(" ", "hostname domain");
- $reqdfieldsn = array(gettext("Hostname"),gettext("Domain"));
+ $reqdfieldsn = array(gettext("Hostname"), gettext("Domain"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
@@ -124,19 +127,19 @@ if ($_POST) {
$ignore_posted_dnsgw = array();
- for ($dnscounter=1; $dnscounter<5; $dnscounter++){
+ for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
$dnsname="dns{$dnscounter}";
$dnsgwname="dns{$dnscounter}gw";
if (($_POST[$dnsname] && !is_ipaddr($_POST[$dnsname]))) {
$input_errors[] = gettext("A valid IP address must be specified for DNS server $dnscounter.");
} else {
- if(($_POST[$dnsgwname] <> "") && ($_POST[$dnsgwname] <> "none")) {
+ if (($_POST[$dnsgwname] <> "") && ($_POST[$dnsgwname] <> "none")) {
// A real gateway has been selected.
if (is_ipaddr($_POST[$dnsname])) {
- if ((is_ipaddrv4($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false )) {
+ if ((is_ipaddrv4($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
$input_errors[] = gettext("You can not specify IPv6 gateway '{$_POST[$dnsgwname]}' for IPv4 DNS server '{$_POST[$dnsname]}'");
}
- if ((is_ipaddrv6($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false )) {
+ if ((is_ipaddrv6($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
$input_errors[] = gettext("You can not specify IPv4 gateway '{$_POST[$dnsgwname]}' for IPv6 DNS server '{$_POST[$dnsname]}'");
}
} else {
@@ -152,10 +155,10 @@ if ($_POST) {
$dnsitem = "dns{$dnscounter}";
$dnsgwitem = "dns{$dnscounter}gw";
if ($_POST[$dnsgwitem]) {
- if(interface_has_gateway($_POST[$dnsgwitem])) {
- foreach($direct_networks_list as $direct_network) {
- if(ip_in_subnet($_POST[$dnsitem], $direct_network)) {
- $input_errors[] = sprintf(gettext("You can not assign a gateway to DNS '%s' server which is on a directly connected network."),$_POST[$dnsitem]);
+ if (interface_has_gateway($_POST[$dnsgwitem])) {
+ foreach ($direct_networks_list as $direct_network) {
+ if (ip_in_subnet($_POST[$dnsitem], $direct_network)) {
+ $input_errors[] = sprintf(gettext("You can not assign a gateway to DNS '%s' server which is on a directly connected network."), $_POST[$dnsitem]);
}
}
}
@@ -183,37 +186,42 @@ if ($_POST) {
update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers']));
update_if_changed("NTP update interval", $config['system']['time-update-interval'], $_POST['timeupdateinterval']);
- if($_POST['language'] && $_POST['language'] != $config['system']['language']) {
+ if ($_POST['language'] && $_POST['language'] != $config['system']['language']) {
$config['system']['language'] = $_POST['language'];
set_language($config['system']['language']);
}
/* pfSense themes */
- if (! $g['disablethemeselection']) {
- update_if_changed("System Theme", $config['theme'], $_POST['theme']);
+ if (!$g['disablethemeselection']) {
+ update_if_changed("System Theme", $config['theme'], $_POST['theme']);
}
/* XXX - billm: these still need updating after figuring out how to check if they actually changed */
$olddnsservers = $config['system']['dnsserver'];
unset($config['system']['dnsserver']);
- if ($_POST['dns1'])
+ if ($_POST['dns1']) {
$config['system']['dnsserver'][] = $_POST['dns1'];
- if ($_POST['dns2'])
+ }
+ if ($_POST['dns2']) {
$config['system']['dnsserver'][] = $_POST['dns2'];
- if ($_POST['dns3'])
+ }
+ if ($_POST['dns3']) {
$config['system']['dnsserver'][] = $_POST['dns3'];
- if ($_POST['dns4'])
+ }
+ if ($_POST['dns4']) {
$config['system']['dnsserver'][] = $_POST['dns4'];
+ }
$olddnsallowoverride = $config['system']['dnsallowoverride'];
unset($config['system']['dnsallowoverride']);
$config['system']['dnsallowoverride'] = $_POST['dnsallowoverride'] ? true : false;
- if($_POST['dnslocalhost'] == "yes")
+ if ($_POST['dnslocalhost'] == "yes") {
$config['system']['dnslocalhost'] = true;
- else
+ } else {
unset($config['system']['dnslocalhost']);
+ }
/* which interface should the dns servers resolve through? */
$outdnscounter = 0;
@@ -222,10 +230,11 @@ if ($_POST) {
$dnsgwname="dns{$dnscounter}gw";
$olddnsgwname = $config['system'][$dnsgwname];
- if ($ignore_posted_dnsgw[$dnsgwname])
+ if ($ignore_posted_dnsgw[$dnsgwname]) {
$thisdnsgwname = "none";
- else
+ } else {
$thisdnsgwname = $pconfig[$dnsgwname];
+ }
// "Blank" out the settings for this index, then we set them below using the "outdnscounter" index.
$config['system'][$dnsgwname] = "none";
@@ -240,7 +249,7 @@ if ($_POST) {
$outdnsname="dns{$outdnscounter}";
$outdnsgwname="dns{$outdnscounter}gw";
$pconfig[$outdnsname] = $_POST[$dnsname];
- if($_POST[$dnsgwname]) {
+ if ($_POST[$dnsgwname]) {
$config['system'][$outdnsgwname] = $thisdnsgwname;
$pconfig[$outdnsgwname] = $thisdnsgwname;
} else {
@@ -252,41 +261,46 @@ if ($_POST) {
if (($olddnsgwname != "") && ($olddnsgwname != "none") && (($olddnsgwname != $thisdnsgwname) || ($olddnsservers[$dnscounter-1] != $_POST[$dnsname]))) {
// A previous DNS GW name was specified. It has now gone or changed, or the DNS server address has changed.
// Remove the route. Later calls will add the correct new route if needed.
- if (is_ipaddrv4($olddnsservers[$dnscounter-1]))
+ if (is_ipaddrv4($olddnsservers[$dnscounter-1])) {
mwexec("/sbin/route delete " . escapeshellarg($olddnsservers[$dnscounter-1]));
- else
- if (is_ipaddrv6($olddnsservers[$dnscounter-1]))
+ } else {
+ if (is_ipaddrv6($olddnsservers[$dnscounter-1])) {
mwexec("/sbin/route delete -inet6 " . escapeshellarg($olddnsservers[$dnscounter-1]));
+ }
+ }
}
}
- if ($changecount > 0)
+ if ($changecount > 0) {
write_config($changedesc);
+ }
$retval = 0;
$retval = system_hostname_configure();
$retval |= system_hosts_generate();
$retval |= system_resolvconf_generate();
- if (isset($config['dnsmasq']['enable']))
+ if (isset($config['dnsmasq']['enable'])) {
$retval |= services_dnsmasq_configure();
- elseif (isset($config['unbound']['enable']))
+ } elseif (isset($config['unbound']['enable'])) {
$retval |= services_unbound_configure();
+ }
$retval |= system_timezone_configure();
$retval |= system_ntp_configure();
- if ($olddnsallowoverride != $config['system']['dnsallowoverride'])
+ if ($olddnsallowoverride != $config['system']['dnsallowoverride']) {
$retval |= send_event("service reload dns");
+ }
// Reload the filter - plugins might need to be run.
$retval |= filter_configure();
-
+
$savemsg = get_std_save_message($retval);
}
unset($ignore_posted_dnsgw);
}
-$pgtitle = array(gettext("System"),gettext("General Setup"));
+$pgtitle = array(gettext("System"), gettext("General Setup"));
include("head.inc");
?>
@@ -294,237 +308,257 @@ include("head.inc");
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php
include("fbegin.inc");
- if ($input_errors)
+ if ($input_errors) {
print_input_errors($input_errors);
- if ($savemsg)
+ }
+ if ($savemsg) {
print_info_box($savemsg);
+ }
?>
<form action="system.php" method="post">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="general setup">
- <tr>
- <td id="mainarea">
- <div class="tabcont">
- <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
<tr>
- <td colspan="2" valign="top" class="listtopic"><?=gettext("System"); ?></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("Hostname"); ?></td>
- <td width="78%" class="vtable"> <input name="hostname" type="text" class="formfld unknown" id="hostname" size="40" value="<?=htmlspecialchars($pconfig['hostname']);?>" />
- <br />
- <span class="vexpl">
- <?=gettext("Name of the firewall host, without domain part"); ?>
- <br />
- <?=gettext("e.g."); ?> <em>firewall</em>
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("Domain"); ?></td>
- <td width="78%" class="vtable"> <input name="domain" type="text" class="formfld unknown" id="domain" size="40" value="<?=htmlspecialchars($pconfig['domain']);?>" />
- <br />
- <span class="vexpl">
- <?=gettext("Do not use 'local' as a domain name. It will cause local hosts running mDNS (avahi, bonjour, etc.) to be unable to resolve local hosts not running mDNS."); ?>
- <br />
- <?=gettext("e.g."); ?> <em><?=gettext("mycorp.com, home, office, private, etc."); ?></em>
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("DNS servers"); ?></td>
- <td width="78%" class="vtable">
- <br />
- <table summary="dns servers and gateways">
- <tr>
- <td><b><?=gettext("DNS Server"); ?></b></td>
- <?php if ($multiwan): ?>
- <td><b><?=gettext("Use gateway"); ?></b></td>
- <?php endif; ?>
- </tr>
- <?php
- for ($dnscounter=1; $dnscounter<5; $dnscounter++):
- $fldname="dns{$dnscounter}gw";
- ?>
- <tr>
- <td>
- <input name="dns<?php echo $dnscounter;?>" type="text" class="formfld unknown" id="dns<?php echo $dnscounter;?>" size="28" value="<?php echo $pconfig['dns'.$dnscounter];?>" />
- </td>
- <td>
-<?php if ($multiwan): ?>
- <select name='<?=$fldname;?>'>
- <?php
- $gwname = "none";
- $dnsgw = "dns{$dnscounter}gw";
- if($pconfig[$dnsgw] == $gwname) {
- $selected = "selected=\"selected\"";
- } else {
- $selected = "";
- }
- echo "<option value='$gwname' $selected>$gwname</option>\n";
- foreach($arr_gateways as $gwname => $gwitem) {
- //echo $pconfig[$dnsgw];
- if((is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv6($gwitem['gateway'])))) {
- continue;
- }
- if((is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv4($gwitem['gateway'])))) {
- continue;
- }
- if($pconfig[$dnsgw] == $gwname) {
- $selected = "selected=\"selected\"";
- } else {
- $selected = "";
- }
- echo "<option value='$gwname' $selected>$gwname - {$gwitem['friendlyiface']} - {$gwitem['gateway']}</option>\n";
- }
- ?>
- </select>
-<?php endif; ?>
- </td>
- </tr>
- <?php endfor; ?>
- </table>
- <br />
- <span class="vexpl">
- <?=gettext("Enter IP addresses to be used by the system for DNS resolution. " .
- "These are also used for the DHCP service, DNS forwarder and for PPTP VPN clients."); ?>
- <br />
- <?php if($multiwan): ?>
- <br />
- <?=gettext("In addition, optionally select the gateway for each DNS server. " .
- "When using multiple WAN connections there should be at least one unique DNS server per gateway."); ?>
- <br />
- <?php endif; ?>
- <br />
- <input name="dnsallowoverride" type="checkbox" id="dnsallowoverride" value="yes" <?php if ($pconfig['dnsallowoverride']) echo "checked=\"checked\""; ?> />
- <strong>
- <?=gettext("Allow DNS server list to be overridden by DHCP/PPP on WAN"); ?>
- </strong>
- <br />
- <?php printf(gettext("If this option is set, %s will " .
- "use DNS servers assigned by a DHCP/PPP server on WAN " .
- "for its own purposes (including the DNS forwarder). " .
- "However, they will not be assigned to DHCP and PPTP " .
- "VPN clients."), $g['product_name']); ?>
- <br />
- <br />
- <input name="dnslocalhost" type="checkbox" id="dnslocalhost" value="yes" <?php if ($pconfig['dnslocalhost']) echo "checked=\"checked\""; ?> />
- <strong>
- <?=gettext("Do not use the DNS Forwarder as a DNS server for the firewall"); ?>
- </strong>
- <br />
- <?=gettext("By default localhost (127.0.0.1) will be used as the first DNS server where the DNS Forwarder or DNS Resolver is enabled and set to listen on Localhost, so system can use the local DNS service to perform lookups. ".
- "Checking this box omits localhost from the list of DNS servers."); ?>
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("Time zone"); ?></td>
- <td width="78%" class="vtable">
- <select name="timezone" id="timezone">
- <?php foreach ($timezonelist as $value): ?>
- <?php if(strstr($value, "GMT")) continue; ?>
- <option value="<?=htmlspecialchars($value);?>" <?php if ($value == $pconfig['timezone']) echo "selected=\"selected\""; ?>>
- <?=htmlspecialchars($value);?>
- </option>
- <?php endforeach; ?>
- </select>
- <br />
- <span class="vexpl">
- <?=gettext("Select the location closest to you"); ?>
- </span>
- </td>
- </tr>
+ <td id="mainarea">
+ <div class="tabcont">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?=gettext("System"); ?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Hostname"); ?></td>
+ <td width="78%" class="vtable"> <input name="hostname" type="text" class="formfld unknown" id="hostname" size="40" value="<?=htmlspecialchars($pconfig['hostname']);?>" />
+ <br />
+ <span class="vexpl">
+ <?=gettext("Name of the firewall host, without domain part"); ?>
+ <br />
+ <?=gettext("e.g."); ?> <em>firewall</em>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Domain"); ?></td>
+ <td width="78%" class="vtable"> <input name="domain" type="text" class="formfld unknown" id="domain" size="40" value="<?=htmlspecialchars($pconfig['domain']);?>" />
+ <br />
+ <span class="vexpl">
+ <?=gettext("Do not use 'local' as a domain name. It will cause local hosts running mDNS (avahi, bonjour, etc.) to be unable to resolve local hosts not running mDNS."); ?>
+ <br />
+ <?=gettext("e.g."); ?> <em><?=gettext("mycorp.com, home, office, private, etc."); ?></em>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("DNS servers"); ?></td>
+ <td width="78%" class="vtable">
+ <br />
+ <table summary="dns servers and gateways">
+ <tr>
+ <td><b><?=gettext("DNS Server"); ?></b></td>
+ <?php if ($multiwan): ?>
+ <td><b><?=gettext("Use gateway"); ?></b></td>
+ <?php endif; ?>
+ </tr>
+<?php
+ for ($dnscounter = 1; $dnscounter < 5; $dnscounter++):
+ $fldname="dns{$dnscounter}gw";
+?>
+ <tr>
+ <td>
+ <input name="dns<?php echo $dnscounter;?>" type="text" class="formfld unknown" id="dns<?php echo $dnscounter;?>" size="28" value="<?php echo $pconfig['dns'.$dnscounter];?>" />
+ </td>
+ <td>
+<?php
+ if ($multiwan):
+?>
+ <select name='<?=$fldname;?>'>
+<?php
+ $gwname = "none";
+ $dnsgw = "dns{$dnscounter}gw";
+ if ($pconfig[$dnsgw] == $gwname) {
+ $selected = "selected=\"selected\"";
+ } else {
+ $selected = "";
+ }
+ echo "<option value='$gwname' $selected>$gwname</option>\n";
+ foreach ($arr_gateways as $gwname => $gwitem) {
+ //echo $pconfig[$dnsgw];
+ if ((is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv6($gwitem['gateway'])))) {
+ continue;
+ }
+ if ((is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv4($gwitem['gateway'])))) {
+ continue;
+ }
+ if ($pconfig[$dnsgw] == $gwname) {
+ $selected = "selected=\"selected\"";
+ } else {
+ $selected = "";
+ }
+ echo "<option value='$gwname' $selected>$gwname - {$gwitem['friendlyiface']} - {$gwitem['gateway']}</option>\n";
+ }
+?>
+ </select>
+<?php
+ endif;
+?>
+ </td>
+ </tr>
+<?php
+ endfor;
+?>
+ </table>
+ <br />
+ <span class="vexpl">
+ <?=gettext("Enter IP addresses to be used by the system for DNS resolution. " .
+ "These are also used for the DHCP service, DNS forwarder and for PPTP VPN clients."); ?>
+ <br />
+ <?php if ($multiwan): ?>
+ <br />
+ <?=gettext("In addition, optionally select the gateway for each DNS server. " .
+ "When using multiple WAN connections there should be at least one unique DNS server per gateway."); ?>
+ <br />
+ <?php endif; ?>
+ <br />
+ <input name="dnsallowoverride" type="checkbox" id="dnsallowoverride" value="yes" <?php if ($pconfig['dnsallowoverride']) echo "checked=\"checked\""; ?> />
+ <strong>
+ <?=gettext("Allow DNS server list to be overridden by DHCP/PPP on WAN"); ?>
+ </strong>
+ <br />
+ <?php printf(gettext("If this option is set, %s will " .
+ "use DNS servers assigned by a DHCP/PPP server on WAN " .
+ "for its own purposes (including the DNS forwarder). " .
+ "However, they will not be assigned to DHCP and PPTP " .
+ "VPN clients."), $g['product_name']); ?>
+ <br />
+ <br />
+ <input name="dnslocalhost" type="checkbox" id="dnslocalhost" value="yes" <?php if ($pconfig['dnslocalhost']) echo "checked=\"checked\""; ?> />
+ <strong>
+ <?=gettext("Do not use the DNS Forwarder as a DNS server for the firewall"); ?>
+ </strong>
+ <br />
+ <?=gettext("By default localhost (127.0.0.1) will be used as the first DNS server where the DNS Forwarder or DNS Resolver is enabled and set to listen on Localhost, so system can use the local DNS service to perform lookups. ".
+ "Checking this box omits localhost from the list of DNS servers."); ?>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Time zone"); ?></td>
+ <td width="78%" class="vtable">
+ <select name="timezone" id="timezone">
+ <?php foreach ($timezonelist as $value): ?>
+ <?php if (strstr($value, "GMT")) continue; ?>
+ <option value="<?=htmlspecialchars($value);?>" <?php if ($value == $pconfig['timezone']) echo "selected=\"selected\""; ?>>
+ <?=htmlspecialchars($value);?>
+ </option>
+ <?php endforeach; ?>
+ </select>
+ <br />
+ <span class="vexpl">
+ <?=gettext("Select the location closest to you"); ?>
+ </span>
+ </td>
+ </tr>
<!--
- <tr>
- <td width="22%" valign="top" class="vncell">Time update interval</td>
- <td width="78%" class="vtable">
- <input name="timeupdateinterval" type="text" class="formfld unknown" id="timeupdateinterval" size="4" value="<?=htmlspecialchars($pconfig['timeupdateinterval']);?>" />
- <br />
- <span class="vexpl">
- Minutes between network time sync. 300 recommended,
- or 0 to disable
- </span>
- </td>
- </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Time update interval</td>
+ <td width="78%" class="vtable">
+ <input name="timeupdateinterval" type="text" class="formfld unknown" id="timeupdateinterval" size="4" value="<?=htmlspecialchars($pconfig['timeupdateinterval']);?>" />
+ <br />
+ <span class="vexpl">
+ Minutes between network time sync. 300 recommended,
+ or 0 to disable
+ </span>
+ </td>
+ </tr>
-->
- <tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("NTP time server"); ?></td>
- <td width="78%" class="vtable">
- <input name="timeservers" type="text" class="formfld unknown" id="timeservers" size="40" value="<?=htmlspecialchars($pconfig['timeservers']);?>" />
- <br />
- <span class="vexpl">
- <?=gettext("Use a space to separate multiple hosts (only one " .
- "required). Remember to set up at least one DNS server " .
- "if you enter a host name here!"); ?>
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell"><?php echo gettext("Language");?></td>
- <td width="78%" class="vtable">
- <select name="language">
- <?php
- foreach(get_locale_list() as $lcode => $ldesc) {
- $selected = ' selected="selected"';
- if($lcode != $pconfig['language'])
- $selected = '';
- echo "<option value=\"{$lcode}\"{$selected}>{$ldesc}</option>";
- }
- ?>
- </select>
- <strong>
- <?=gettext("Choose a language for the webConfigurator"); ?>
- </strong>
- </td>
- </tr>
- <tr>
- <td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
- <?php if (! $g['disablethemeselection']): ?>
- <tr>
- <td colspan="2" valign="top" class="listtopic"><?=gettext("Theme"); ?></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">&nbsp;</td>
- <td width="78%" class="vtable">
- <select name="theme">
- <?php
- $files = return_dir_as_array("/usr/local/www/themes/");
- foreach($files as $f):
- if ((substr($f, 0, 1) == "_") && !isset($config['system']['developer']))
- continue;
- if ($f == "CVS")
- continue;
- $curtheme = "pfsense";
- if ($config['theme'])
- $curtheme = $config['theme'];
- $selected = "";
- if($f == $curtheme)
- $selected = " selected=\"selected\"";
- ?>
- <option <?=$selected;?>><?=$f;?></option>
- <?php endforeach; ?>
- </select>
- <strong>
- <?=gettext("This will change the look and feel of"); ?>
- <?=$g['product_name'];?>.
- </strong>
- </td>
- </tr>
- <?php endif; ?>
- <tr>
- <td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("NTP time server"); ?></td>
+ <td width="78%" class="vtable">
+ <input name="timeservers" type="text" class="formfld unknown" id="timeservers" size="40" value="<?=htmlspecialchars($pconfig['timeservers']);?>" />
+ <br />
+ <span class="vexpl">
+ <?=gettext("Use a space to separate multiple hosts (only one " .
+ "required). Remember to set up at least one DNS server " .
+ "if you enter a host name here!"); ?>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?php echo gettext("Language");?></td>
+ <td width="78%" class="vtable">
+ <select name="language">
+ <?php
+ foreach (get_locale_list() as $lcode => $ldesc) {
+ $selected = ' selected="selected"';
+ if ($lcode != $pconfig['language']) {
+ $selected = '';
+ }
+ echo "<option value=\"{$lcode}\"{$selected}>{$ldesc}</option>";
+ }
+ ?>
+ </select>
+ <strong>
+ <?=gettext("Choose a language for the webConfigurator"); ?>
+ </strong>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="list" height="12">&nbsp;</td>
+ </tr>
+<?php
+ if (!$g['disablethemeselection']):
+?>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?=gettext("Theme"); ?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">&nbsp;</td>
+ <td width="78%" class="vtable">
+ <select name="theme">
+<?php
+ $files = return_dir_as_array("/usr/local/www/themes/");
+ foreach ($files as $f):
+ if ((substr($f, 0, 1) == "_") && !isset($config['system']['developer'])) {
+ continue;
+ }
+ if ($f == "CVS") {
+ continue;
+ }
+ $curtheme = "pfsense";
+ if ($config['theme']) {
+ $curtheme = $config['theme'];
+ }
+ $selected = "";
+ if ($f == $curtheme) {
+ $selected = " selected=\"selected\"";
+ }
+?>
+ <option <?=$selected;?>><?=$f;?></option>
+<?php
+ endforeach;
+?>
+ </select>
+ <strong>
+ <?=gettext("This will change the look and feel of"); ?>
+ <?=$g['product_name'];?>.
+ </strong>
+ </td>
+ </tr>
+<?php
+ endif;
+?>
+ <tr>
+ <td colspan="2" class="list" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ </td>
+ </tr>
+ </table>
+ </div>
</td>
</tr>
</table>
- </div>
- </td></tr>
- </table>
</form>
<?php include("fend.inc"); ?>
</body>
diff --git a/usr/local/www/system_advanced_admin.php b/usr/local/www/system_advanced_admin.php
index 36eb7a3..f970822 100644
--- a/usr/local/www/system_advanced_admin.php
+++ b/usr/local/www/system_advanced_admin.php
@@ -72,11 +72,13 @@ $pconfig['quietlogin'] = isset($config['system']['webgui']['quietlogin']);
$a_cert =& $config['cert'];
$certs_available = false;
-if (is_array($a_cert) && count($a_cert))
+if (is_array($a_cert) && count($a_cert)) {
$certs_available = true;
+}
-if (!$pconfig['webguiproto'] || !$certs_available)
+if (!$pconfig['webguiproto'] || !$certs_available) {
$pconfig['webguiproto'] = "http";
+}
if ($_POST) {
@@ -84,43 +86,56 @@ if ($_POST) {
$pconfig = $_POST;
/* input validation */
- if ($_POST['webguiport'])
- if(!is_port($_POST['webguiport']))
+ if ($_POST['webguiport']) {
+ if (!is_port($_POST['webguiport'])) {
$input_errors[] = gettext("You must specify a valid webConfigurator port number");
+ }
+ }
- if ($_POST['max_procs'])
- if(!is_numericint($_POST['max_procs']) || ($_POST['max_procs'] < 1) || ($_POST['max_procs'] > 500))
+ if ($_POST['max_procs']) {
+ if (!is_numericint($_POST['max_procs']) || ($_POST['max_procs'] < 1) || ($_POST['max_procs'] > 500)) {
$input_errors[] = gettext("Max Processes must be a number 1 or greater");
+ }
+ }
if ($_POST['althostnames']) {
$althosts = explode(" ", $_POST['althostnames']);
- foreach ($althosts as $ah)
- if (!is_hostname($ah))
- $input_errors[] = sprintf(gettext("Alternate hostname %s is not a valid hostname."),htmlspecialchars($ah));
+ foreach ($althosts as $ah) {
+ if (!is_hostname($ah)) {
+ $input_errors[] = sprintf(gettext("Alternate hostname %s is not a valid hostname."), htmlspecialchars($ah));
+ }
+ }
}
- if ($_POST['sshport'])
- if(!is_port($_POST['sshport']))
+ if ($_POST['sshport']) {
+ if (!is_port($_POST['sshport'])) {
$input_errors[] = gettext("You must specify a valid port number");
+ }
+ }
- if($_POST['sshdkeyonly'] == "yes")
+ if ($_POST['sshdkeyonly'] == "yes") {
$config['system']['ssh']['sshdkeyonly'] = "enabled";
- else if (isset($config['system']['ssh']['sshdkeyonly']))
+ } else if (isset($config['system']['ssh']['sshdkeyonly'])) {
unset($config['system']['ssh']['sshdkeyonly']);
+ }
ob_flush();
flush();
if (!$input_errors) {
- if (update_if_changed("webgui protocol", $config['system']['webgui']['protocol'], $_POST['webguiproto']))
+ if (update_if_changed("webgui protocol", $config['system']['webgui']['protocol'], $_POST['webguiproto'])) {
$restart_webgui = true;
- if (update_if_changed("webgui port", $config['system']['webgui']['port'], $_POST['webguiport']))
+ }
+ if (update_if_changed("webgui port", $config['system']['webgui']['port'], $_POST['webguiport'])) {
$restart_webgui = true;
- if (update_if_changed("webgui certificate", $config['system']['webgui']['ssl-certref'], $_POST['ssl-certref']))
+ }
+ if (update_if_changed("webgui certificate", $config['system']['webgui']['ssl-certref'], $_POST['ssl-certref'])) {
$restart_webgui = true;
- if (update_if_changed("webgui max processes", $config['system']['webgui']['max_procs'], $_POST['max_procs']))
+ }
+ if (update_if_changed("webgui max processes", $config['system']['webgui']['max_procs'], $_POST['max_procs'])) {
$restart_webgui = true;
+ }
if ($_POST['disablehttpredirect'] == "yes") {
$config['system']['webgui']['disablehttpredirect'] = true;
@@ -135,85 +150,99 @@ if ($_POST) {
unset($config['system']['webgui']['quietlogin']);
}
- if($_POST['disableconsolemenu'] == "yes")
+ if ($_POST['disableconsolemenu'] == "yes") {
$config['system']['disableconsolemenu'] = true;
- else
+ } else {
unset($config['system']['disableconsolemenu']);
+ }
- if ($_POST['noantilockout'] == "yes")
+ if ($_POST['noantilockout'] == "yes") {
$config['system']['webgui']['noantilockout'] = true;
- else
+ } else {
unset($config['system']['webgui']['noantilockout']);
+ }
- if ($_POST['enableserial'] == "yes" || $g['enableserial_force'])
+ if ($_POST['enableserial'] == "yes" || $g['enableserial_force']) {
$config['system']['enableserial'] = true;
- else
+ } else {
unset($config['system']['enableserial']);
+ }
- if (is_numericint($_POST['serialspeed']))
+ if (is_numericint($_POST['serialspeed'])) {
$config['system']['serialspeed'] = $_POST['serialspeed'];
- else
+ } else {
unset($config['system']['serialspeed']);
+ }
- if ($_POST['primaryconsole'])
+ if ($_POST['primaryconsole']) {
$config['system']['primaryconsole'] = $_POST['primaryconsole'];
- else
+ } else {
unset($config['system']['primaryconsole']);
+ }
- if ($_POST['nodnsrebindcheck'] == "yes")
+ if ($_POST['nodnsrebindcheck'] == "yes") {
$config['system']['webgui']['nodnsrebindcheck'] = true;
- else
+ } else {
unset($config['system']['webgui']['nodnsrebindcheck']);
+ }
- if ($_POST['nohttpreferercheck'] == "yes")
+ if ($_POST['nohttpreferercheck'] == "yes") {
$config['system']['webgui']['nohttpreferercheck'] = true;
- else
+ } else {
unset($config['system']['webgui']['nohttpreferercheck']);
+ }
- if ($_POST['pagenamefirst'] == "yes")
+ if ($_POST['pagenamefirst'] == "yes") {
$config['system']['webgui']['pagenamefirst'] = true;
- else
+ } else {
unset($config['system']['webgui']['pagenamefirst']);
+ }
- if ($_POST['loginautocomplete'] == "yes")
+ if ($_POST['loginautocomplete'] == "yes") {
$config['system']['webgui']['loginautocomplete'] = true;
- else
+ } else {
unset($config['system']['webgui']['loginautocomplete']);
+ }
- if ($_POST['althostnames'])
+ if ($_POST['althostnames']) {
$config['system']['webgui']['althostnames'] = $_POST['althostnames'];
- else
+ } else {
unset($config['system']['webgui']['althostnames']);
+ }
$sshd_enabled = $config['system']['enablesshd'];
- if($_POST['enablesshd'])
+ if ($_POST['enablesshd']) {
$config['system']['enablesshd'] = "enabled";
- else
+ } else {
unset($config['system']['enablesshd']);
+ }
$sshd_keyonly = isset($config['system']['sshdkeyonly']);
- if ($_POST['sshdkeyonly'])
+ if ($_POST['sshdkeyonly']) {
$config['system']['sshdkeyonly'] = true;
- else
+ } else {
unset($config['system']['sshdkeyonly']);
+ }
$sshd_port = $config['system']['ssh']['port'];
- if ($_POST['sshport'])
+ if ($_POST['sshport']) {
$config['system']['ssh']['port'] = $_POST['sshport'];
- else if (isset($config['system']['ssh']['port']))
+ } else if (isset($config['system']['ssh']['port'])) {
unset($config['system']['ssh']['port']);
+ }
if (($sshd_enabled != $config['system']['enablesshd']) ||
- ($sshd_keyonly != $config['system']['sshdkeyonly']) ||
- ($sshd_port != $config['system']['ssh']['port']))
+ ($sshd_keyonly != $config['system']['sshdkeyonly']) ||
+ ($sshd_port != $config['system']['ssh']['port'])) {
$restart_sshd = true;
+ }
if ($restart_webgui) {
global $_SERVER;
$http_host_port = explode("]", $_SERVER['HTTP_HOST']);
/* IPv6 address check */
- if(strstr($_SERVER['HTTP_HOST'], "]")) {
- if(count($http_host_port) > 1) {
+ if (strstr($_SERVER['HTTP_HOST'], "]")) {
+ if (count($http_host_port) > 1) {
array_pop($http_host_port);
$host = str_replace(array("[", "]"), "", implode(":", $http_host_port));
$host = "[{$host}]";
@@ -226,32 +255,35 @@ if ($_POST) {
}
$prot = $config['system']['webgui']['protocol'];
$port = $config['system']['webgui']['port'];
- if ($port)
+ if ($port) {
$url = "{$prot}://{$host}:{$port}/system_advanced_admin.php";
- else
+ } else {
$url = "{$prot}://{$host}/system_advanced_admin.php";
+ }
}
write_config();
$retval = filter_configure();
- $savemsg = get_std_save_message($retval);
+ $savemsg = get_std_save_message($retval);
- if ($restart_webgui)
- $savemsg .= sprintf("<br />" . gettext("One moment...redirecting to %s in 20 seconds."),$url);
+ if ($restart_webgui) {
+ $savemsg .= sprintf("<br />" . gettext("One moment...redirecting to %s in 20 seconds."), $url);
+ }
conf_mount_rw();
setup_serial_port();
// Restart DNS in case dns rebinding toggled
- if (isset($config['dnsmasq']['enable']))
+ if (isset($config['dnsmasq']['enable'])) {
services_dnsmasq_configure();
- elseif (isset($config['unbound']['enable']))
+ } elseif (isset($config['unbound']['enable'])) {
services_unbound_configure();
+ }
conf_mount_ro();
}
}
-$pgtitle = array(gettext("System"),gettext("Advanced: Admin Access"));
+$pgtitle = array(gettext("System"), gettext("Advanced: Admin Access"));
include("head.inc");
?>
@@ -263,19 +295,22 @@ include("head.inc");
function prot_change() {
- if (document.iform.https_proto.checked)
+ if (document.iform.https_proto.checked) {
document.getElementById("ssl_opts").style.display="";
- else
+ } else {
document.getElementById("ssl_opts").style.display="none";
+ }
}
//]]>
</script>
<?php
- if ($input_errors)
+ if ($input_errors) {
print_input_errors($input_errors);
- if ($savemsg)
+ }
+ if ($savemsg) {
print_info_box($savemsg);
+ }
?>
<form action="system_advanced_admin.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="system advanced admin">
@@ -312,12 +347,15 @@ function prot_change() {
<td width="22%" valign="top" class="vncell"><?=gettext("Protocol"); ?></td>
<td width="78%" class="vtable">
<?php
- if ($pconfig['webguiproto'] == "http")
+ if ($pconfig['webguiproto'] == "http") {
$http_chk = "checked=\"checked\"";
- if ($pconfig['webguiproto'] == "https")
+ }
+ if ($pconfig['webguiproto'] == "https") {
$https_chk = "checked=\"checked\"";
- if (!$certs_available)
+ }
+ if (!$certs_available) {
$https_disabled = "disabled=\"disabled\"";
+ }
?>
<input name="webguiproto" id="http_proto" type="radio" value="http" <?=$http_chk;?> onclick="prot_change()" />
<?=gettext("HTTP"); ?>
@@ -337,16 +375,18 @@ function prot_change() {
<td width="78%" class="vtable">
<select name="ssl-certref" id="ssl-certref" class="formselect">
<?php
- foreach($a_cert as $cert):
+ foreach ($a_cert as $cert):
$selected = "";
- if ($pconfig['ssl-certref'] == $cert['refid'])
+ if ($pconfig['ssl-certref'] == $cert['refid']) {
$selected = "selected=\"selected\"";
+ }
?>
<option value="<?=$cert['refid'];?>" <?=$selected;?>><?=$cert['descr'];?></option>
<?php
- endforeach;
- if (!count($a_cert))
- echo "<option></option>";
+ endforeach;
+ if (!count($a_cert)) {
+ echo "<option></option>";
+ }
?>
</select>
</td>
@@ -414,10 +454,11 @@ function prot_change() {
<td width="22%" valign="top" class="vncell"><?=gettext("Anti-lockout"); ?></td>
<td width="78%" class="vtable">
<?php
- if($config['interfaces']['lan'])
+ if ($config['interfaces']['lan']) {
$lockout_interface = "LAN";
- else
+ } else {
$lockout_interface = "WAN";
+ }
?>
<input name="noantilockout" type="checkbox" id="noantilockout" value="yes" <?php if ($pconfig['noantilockout']) echo "checked=\"checked\""; ?> />
<strong><?=gettext("Disable webConfigurator anti-lockout rule"); ?></strong>
@@ -450,7 +491,7 @@ function prot_change() {
<br />
<strong><?=gettext("Alternate Hostnames for DNS Rebinding and HTTP_REFERER Checks"); ?></strong>
<br />
- <?php echo gettext("Here you can specify alternate hostnames by which the router may be queried, to " .
+ <?php echo gettext("Here you can specify alternate hostnames by which the router may be queried, to " .
"bypass the DNS Rebinding Attack checks. Separate hostnames with spaces."); ?>
</td>
</tr>
@@ -566,7 +607,7 @@ function prot_change() {
</tr>
<tr>
<td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
+ </tr>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%"><input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /></td>
@@ -588,8 +629,9 @@ function prot_change() {
<?php include("fend.inc"); ?>
<?php
- if ($restart_webgui)
+ if ($restart_webgui) {
echo "<meta http-equiv=\"refresh\" content=\"20;url={$url}\" />";
+ }
?>
</body>
</html>
diff --git a/usr/local/www/system_advanced_firewall.php b/usr/local/www/system_advanced_firewall.php
index b24a781..bcfe339 100644
--- a/usr/local/www/system_advanced_firewall.php
+++ b/usr/local/www/system_advanced_firewall.php
@@ -71,20 +71,20 @@ $pconfig['bypassstaticroutes'] = isset($config['filter']['bypassstaticroutes']);
$pconfig['disablescrub'] = isset($config['system']['disablescrub']);
$pconfig['tftpinterface'] = explode(",", $config['system']['tftpinterface']);
$pconfig['disablevpnrules'] = isset($config['system']['disablevpnrules']);
-$pconfig['tcpfirsttimeout'] = $config['system']['tcpfirsttimeout'];
-$pconfig['tcpopeningtimeout'] = $config['system']['tcpopeningtimeout'];
-$pconfig['tcpestablishedtimeout'] = $config['system']['tcpestablishedtimeout'];
-$pconfig['tcpclosingtimeout'] = $config['system']['tcpclosingtimeout'];
-$pconfig['tcpfinwaittimeout'] = $config['system']['tcpfinwaittimeout'];
-$pconfig['tcpclosedtimeout'] = $config['system']['tcpclosedtimeout'];
-$pconfig['udpfirsttimeout'] = $config['system']['udpfirsttimeout'];
-$pconfig['udpsingletimeout'] = $config['system']['udpsingletimeout'];
-$pconfig['udpmultipletimeout'] = $config['system']['udpmultipletimeout'];
-$pconfig['icmpfirsttimeout'] = $config['system']['icmpfirsttimeout'];
-$pconfig['icmperrortimeout'] = $config['system']['icmperrortimeout'];
-$pconfig['otherfirsttimeout'] = $config['system']['otherfirsttimeout'];
-$pconfig['othersingletimeout'] = $config['system']['othersingletimeout'];
-$pconfig['othermultipletimeout'] = $config['system']['othermultipletimeout'];
+$pconfig['tcpfirsttimeout'] = $config['system']['tcpfirsttimeout'];
+$pconfig['tcpopeningtimeout'] = $config['system']['tcpopeningtimeout'];
+$pconfig['tcpestablishedtimeout'] = $config['system']['tcpestablishedtimeout'];
+$pconfig['tcpclosingtimeout'] = $config['system']['tcpclosingtimeout'];
+$pconfig['tcpfinwaittimeout'] = $config['system']['tcpfinwaittimeout'];
+$pconfig['tcpclosedtimeout'] = $config['system']['tcpclosedtimeout'];
+$pconfig['udpfirsttimeout'] = $config['system']['udpfirsttimeout'];
+$pconfig['udpsingletimeout'] = $config['system']['udpsingletimeout'];
+$pconfig['udpmultipletimeout'] = $config['system']['udpmultipletimeout'];
+$pconfig['icmpfirsttimeout'] = $config['system']['icmpfirsttimeout'];
+$pconfig['icmperrortimeout'] = $config['system']['icmperrortimeout'];
+$pconfig['otherfirsttimeout'] = $config['system']['otherfirsttimeout'];
+$pconfig['othersingletimeout'] = $config['system']['othersingletimeout'];
+$pconfig['othermultipletimeout'] = $config['system']['othermultipletimeout'];
if ($_POST) {
@@ -92,8 +92,9 @@ if ($_POST) {
$pconfig = $_POST;
/* input validation */
- if ((empty($_POST['adaptivestart']) && !empty($_POST['adaptiveend'])) || (!empty($_POST['adaptivestart']) && empty($_POST['adaptiveend'])))
+ if ((empty($_POST['adaptivestart']) && !empty($_POST['adaptiveend'])) || (!empty($_POST['adaptivestart']) && empty($_POST['adaptiveend']))) {
$input_errors[] = gettext("The Firewall Adaptive values must be set together.");
+ }
if (!empty($_POST['adaptivestart']) && !is_numericint($_POST['adaptivestart'])) {
$input_errors[] = gettext("The Firewall Adaptive Start value must be an integer.");
}
@@ -115,47 +116,47 @@ if ($_POST) {
if ($_POST['reflectiontimeout'] && !is_numericint($_POST['reflectiontimeout'])) {
$input_errors[] = gettext("The Reflection timeout must be an integer.");
}
- if ($_POST['tcpfirsttimeout'] && !is_numericint($_POST['tcpfirsttimeout'])) {
+ if ($_POST['tcpfirsttimeout'] && !is_numericint($_POST['tcpfirsttimeout'])) {
$input_errors[] = gettext("The TCP first timeout value must be an integer.");
}
- if ($_POST['tcpopeningtimeout'] && !is_numericint($_POST['tcpopeningtimeout'])) {
- $input_errors[] = gettext("The TCP opening timeout value must be an integer.");
+ if ($_POST['tcpopeningtimeout'] && !is_numericint($_POST['tcpopeningtimeout'])) {
+ $input_errors[] = gettext("The TCP opening timeout value must be an integer.");
}
- if ($_POST['tcpestablishedtimeout'] && !is_numericint($_POST['tcpestablishedtimeout'])) {
- $input_errors[] = gettext("The TCP established timeout value must be an integer.");
+ if ($_POST['tcpestablishedtimeout'] && !is_numericint($_POST['tcpestablishedtimeout'])) {
+ $input_errors[] = gettext("The TCP established timeout value must be an integer.");
}
- if ($_POST['tcpclosingtimeout'] && !is_numericint($_POST['tcpclosingtimeout'])) {
- $input_errors[] = gettext("The TCP closing timeout value must be an integer.");
+ if ($_POST['tcpclosingtimeout'] && !is_numericint($_POST['tcpclosingtimeout'])) {
+ $input_errors[] = gettext("The TCP closing timeout value must be an integer.");
}
- if ($_POST['tcpfinwaittimeout'] && !is_numericint($_POST['tcpfinwaittimeout'])) {
- $input_errors[] = gettext("The TCP FIN wait timeout value must be an integer.");
+ if ($_POST['tcpfinwaittimeout'] && !is_numericint($_POST['tcpfinwaittimeout'])) {
+ $input_errors[] = gettext("The TCP FIN wait timeout value must be an integer.");
}
- if ($_POST['tcpclosedtimeout'] && !is_numericint($_POST['tcpclosedtimeout'])) {
- $input_errors[] = gettext("The TCP closed timeout value must be an integer.");
+ if ($_POST['tcpclosedtimeout'] && !is_numericint($_POST['tcpclosedtimeout'])) {
+ $input_errors[] = gettext("The TCP closed timeout value must be an integer.");
}
- if ($_POST['udpfirsttimeout'] && !is_numericint($_POST['udpfirsttimeout'])) {
- $input_errors[] = gettext("The UDP first timeout value must be an integer.");
+ if ($_POST['udpfirsttimeout'] && !is_numericint($_POST['udpfirsttimeout'])) {
+ $input_errors[] = gettext("The UDP first timeout value must be an integer.");
}
- if ($_POST['udpsingletimeout'] && !is_numericint($_POST['udpsingletimeout'])) {
- $input_errors[] = gettext("The UDP single timeout value must be an integer.");
+ if ($_POST['udpsingletimeout'] && !is_numericint($_POST['udpsingletimeout'])) {
+ $input_errors[] = gettext("The UDP single timeout value must be an integer.");
}
- if ($_POST['udpmultipletimeout'] && !is_numericint($_POST['udpmultipletimeout'])) {
- $input_errors[] = gettext("The UDP multiple timeout value must be an integer.");
+ if ($_POST['udpmultipletimeout'] && !is_numericint($_POST['udpmultipletimeout'])) {
+ $input_errors[] = gettext("The UDP multiple timeout value must be an integer.");
}
- if ($_POST['icmpfirsttimeout'] && !is_numericint($_POST['icmpfirsttimeout'])) {
- $input_errors[] = gettext("The ICMP first timeout value must be an integer.");
+ if ($_POST['icmpfirsttimeout'] && !is_numericint($_POST['icmpfirsttimeout'])) {
+ $input_errors[] = gettext("The ICMP first timeout value must be an integer.");
}
- if ($_POST['icmperrortimeout'] && !is_numericint($_POST['icmperrortimeout'])) {
- $input_errors[] = gettext("The ICMP error timeout value must be an integer.");
+ if ($_POST['icmperrortimeout'] && !is_numericint($_POST['icmperrortimeout'])) {
+ $input_errors[] = gettext("The ICMP error timeout value must be an integer.");
}
- if ($_POST['otherfirsttimeout'] && !is_numericint($_POST['otherfirsttimeout'])) {
- $input_errors[] = gettext("The Other first timeout value must be an integer.");
+ if ($_POST['otherfirsttimeout'] && !is_numericint($_POST['otherfirsttimeout'])) {
+ $input_errors[] = gettext("The Other first timeout value must be an integer.");
}
- if ($_POST['othersingletimeout'] && !is_numericint($_POST['othersingletimeout'])) {
- $input_errors[] = gettext("The Other single timeout value must be an integer.");
+ if ($_POST['othersingletimeout'] && !is_numericint($_POST['othersingletimeout'])) {
+ $input_errors[] = gettext("The Other single timeout value must be an integer.");
}
- if ($_POST['othermultipletimeout'] && !is_numericint($_POST['othermultipletimeout'])) {
- $input_errors[] = gettext("The Other multiple timeout value must be an integer.");
+ if ($_POST['othermultipletimeout'] && !is_numericint($_POST['othermultipletimeout'])) {
+ $input_errors[] = gettext("The Other multiple timeout value must be an integer.");
}
ob_flush();
@@ -163,43 +164,51 @@ if ($_POST) {
if (!$input_errors) {
- if($_POST['disablefilter'] == "yes")
+ if ($_POST['disablefilter'] == "yes") {
$config['system']['disablefilter'] = "enabled";
- else
+ } else {
unset($config['system']['disablefilter']);
+ }
- if($_POST['disablevpnrules'] == "yes")
+ if ($_POST['disablevpnrules'] == "yes") {
$config['system']['disablevpnrules'] = true;
- else
+ } else {
unset($config['system']['disablevpnrules']);
- if($_POST['rfc959workaround'] == "yes")
+ }
+ if ($_POST['rfc959workaround'] == "yes") {
$config['system']['rfc959workaround'] = "enabled";
- else
+ } else {
unset($config['system']['rfc959workaround']);
+ }
- if($_POST['scrubnodf'] == "yes")
+ if ($_POST['scrubnodf'] == "yes") {
$config['system']['scrubnodf'] = "enabled";
- else
+ } else {
unset($config['system']['scrubnodf']);
+ }
- if($_POST['scrubrnid'] == "yes")
+ if ($_POST['scrubrnid'] == "yes") {
$config['system']['scrubrnid'] = "enabled";
- else
+ } else {
unset($config['system']['scrubrnid']);
+ }
- if (!empty($_POST['adaptiveend']))
+ if (!empty($_POST['adaptiveend'])) {
$config['system']['adaptiveend'] = $_POST['adaptiveend'];
- else
+ } else {
unset($config['system']['adaptiveend']);
- if (!empty($_POST['adaptivestart']))
+ }
+ if (!empty($_POST['adaptivestart'])) {
$config['system']['adaptivestart'] = $_POST['adaptivestart'];
- else
+ } else {
unset($config['system']['adaptivestart']);
+ }
- if ($_POST['checkaliasesurlcert'] == "yes")
+ if ($_POST['checkaliasesurlcert'] == "yes") {
$config['system']['checkaliasesurlcert'] = true;
- else
+ } else {
unset($config['system']['checkaliasesurlcert']);
+ }
$config['system']['optimization'] = $_POST['optimization'];
$config['system']['maximumstates'] = $_POST['maximumstates'];
@@ -207,80 +216,80 @@ if ($_POST) {
$config['system']['maximumtableentries'] = $_POST['maximumtableentries'];
if (!empty($_POST['tcpfirsttimeout'])) {
- $config['system']['tcpfirsttimeout'] = $_POST['tcpfirsttimeout'];
- } else {
- unset($config['system']['tcpfirsttimeout']);
- }
- if (!empty($_POST['tcpopeningtimeout'])) {
- $config['system']['tcpopeningtimeout'] = $_POST['tcpopeningtimeout'];
- } else {
- unset($config['system']['tcpopeningtimeout']);
- }
- if (!empty($_POST['tcpestablishedtimeout'])) {
- $config['system']['tcpestablishedtimeout'] = $_POST['tcpestablishedtimeout'];
- } else {
- unset($config['system']['tcpestablishedtimeout']);
- }
- if (!empty($_POST['tcpclosingtimeout'])) {
- $config['system']['tcpclosingtimeout'] = $_POST['tcpclosingtimeout'];
- } else {
- unset($config['system']['tcpclosingtimeout']);
- }
- if (!empty($_POST['tcpfinwaittimeout'])) {
- $config['system']['tcpfinwaittimeout'] = $_POST['tcpfinwaittimeout'];
- } else {
- unset($config['system']['tcpfinwaittimeout']);
- }
- if (!empty($_POST['tcpclosedtimeout'])) {
- $config['system']['tcpclosedtimeout'] = $_POST['tcpclosedtimeout'];
- } else {
- unset($config['system']['tcpclosedtimeout']);
- }
- if (!empty($_POST['udpfirsttimeout'])) {
- $config['system']['udpfirsttimeout'] = $_POST['udpfirsttimeout'];
- } else {
- unset($config['system']['udpfirsttimeout']);
- }
- if (!empty($_POST['udpsingletimeout'])) {
- $config['system']['udpsingletimeout'] = $_POST['udpsingletimeout'];
- } else {
- unset($config['system']['udpsingletimeout']);
- }
- if (!empty($_POST['udpmultipletimeout'])) {
- $config['system']['udpmultipletimeout'] = $_POST['udpmultipletimeout'];
- } else {
- unset($config['system']['udpmultipletimeout']);
- }
- if (!empty($_POST['icmpfirsttimeout'])) {
- $config['system']['icmpfirsttimeout'] = $_POST['icmpfirsttimeout'];
- } else {
- unset($config['system']['icmpfirsttimeout']);
- }
- if (!empty($_POST['icmperrortimeout'])) {
- $config['system']['icmperrortimeout'] = $_POST['icmperrortimeout'];
- } else {
- unset($config['system']['icmperrortimeout']);
- }
- if (!empty($_POST['otherfirsttimeout'])) {
- $config['system']['otherfirsttimeout'] = $_POST['otherfirsttimeout'];
- } else {
- unset($config['system']['otherfirsttimeout']);
- }
- if (!empty($_POST['othersingletimeout'])) {
- $config['system']['othersingletimeout'] = $_POST['othersingletimeout'];
- } else {
- unset($config['system']['othersingletimeout']);
- }
- if (!empty($_POST['othermultipletimeout'])) {
- $config['system']['othermultipletimeout'] = $_POST['othermultipletimeout'];
- } else {
- unset($config['system']['othermultipletimeout']);
- }
-
- if($_POST['natreflection'] == "proxy") {
+ $config['system']['tcpfirsttimeout'] = $_POST['tcpfirsttimeout'];
+ } else {
+ unset($config['system']['tcpfirsttimeout']);
+ }
+ if (!empty($_POST['tcpopeningtimeout'])) {
+ $config['system']['tcpopeningtimeout'] = $_POST['tcpopeningtimeout'];
+ } else {
+ unset($config['system']['tcpopeningtimeout']);
+ }
+ if (!empty($_POST['tcpestablishedtimeout'])) {
+ $config['system']['tcpestablishedtimeout'] = $_POST['tcpestablishedtimeout'];
+ } else {
+ unset($config['system']['tcpestablishedtimeout']);
+ }
+ if (!empty($_POST['tcpclosingtimeout'])) {
+ $config['system']['tcpclosingtimeout'] = $_POST['tcpclosingtimeout'];
+ } else {
+ unset($config['system']['tcpclosingtimeout']);
+ }
+ if (!empty($_POST['tcpfinwaittimeout'])) {
+ $config['system']['tcpfinwaittimeout'] = $_POST['tcpfinwaittimeout'];
+ } else {
+ unset($config['system']['tcpfinwaittimeout']);
+ }
+ if (!empty($_POST['tcpclosedtimeout'])) {
+ $config['system']['tcpclosedtimeout'] = $_POST['tcpclosedtimeout'];
+ } else {
+ unset($config['system']['tcpclosedtimeout']);
+ }
+ if (!empty($_POST['udpfirsttimeout'])) {
+ $config['system']['udpfirsttimeout'] = $_POST['udpfirsttimeout'];
+ } else {
+ unset($config['system']['udpfirsttimeout']);
+ }
+ if (!empty($_POST['udpsingletimeout'])) {
+ $config['system']['udpsingletimeout'] = $_POST['udpsingletimeout'];
+ } else {
+ unset($config['system']['udpsingletimeout']);
+ }
+ if (!empty($_POST['udpmultipletimeout'])) {
+ $config['system']['udpmultipletimeout'] = $_POST['udpmultipletimeout'];
+ } else {
+ unset($config['system']['udpmultipletimeout']);
+ }
+ if (!empty($_POST['icmpfirsttimeout'])) {
+ $config['system']['icmpfirsttimeout'] = $_POST['icmpfirsttimeout'];
+ } else {
+ unset($config['system']['icmpfirsttimeout']);
+ }
+ if (!empty($_POST['icmperrortimeout'])) {
+ $config['system']['icmperrortimeout'] = $_POST['icmperrortimeout'];
+ } else {
+ unset($config['system']['icmperrortimeout']);
+ }
+ if (!empty($_POST['otherfirsttimeout'])) {
+ $config['system']['otherfirsttimeout'] = $_POST['otherfirsttimeout'];
+ } else {
+ unset($config['system']['otherfirsttimeout']);
+ }
+ if (!empty($_POST['othersingletimeout'])) {
+ $config['system']['othersingletimeout'] = $_POST['othersingletimeout'];
+ } else {
+ unset($config['system']['othersingletimeout']);
+ }
+ if (!empty($_POST['othermultipletimeout'])) {
+ $config['system']['othermultipletimeout'] = $_POST['othermultipletimeout'];
+ } else {
+ unset($config['system']['othermultipletimeout']);
+ }
+
+ if ($_POST['natreflection'] == "proxy") {
unset($config['system']['disablenatreflection']);
unset($config['system']['enablenatreflectionpurenat']);
- } else if($_POST['natreflection'] == "purenat") {
+ } else if ($_POST['natreflection'] == "purenat") {
unset($config['system']['disablenatreflection']);
$config['system']['enablenatreflectionpurenat'] = "yes";
} else {
@@ -288,42 +297,49 @@ if ($_POST) {
unset($config['system']['enablenatreflectionpurenat']);
}
- if($_POST['enablebinatreflection'] == "yes")
+ if ($_POST['enablebinatreflection'] == "yes") {
$config['system']['enablebinatreflection'] = "yes";
- else
+ } else {
unset($config['system']['enablebinatreflection']);
+ }
- if($_POST['disablereplyto'] == "yes")
+ if ($_POST['disablereplyto'] == "yes") {
$config['system']['disablereplyto'] = $_POST['disablereplyto'];
- else
+ } else {
unset($config['system']['disablereplyto']);
+ }
- if($_POST['disablenegate'] == "yes")
+ if ($_POST['disablenegate'] == "yes") {
$config['system']['disablenegate'] = $_POST['disablenegate'];
- else
+ } else {
unset($config['system']['disablenegate']);
+ }
- if($_POST['enablenatreflectionhelper'] == "yes")
+ if ($_POST['enablenatreflectionhelper'] == "yes") {
$config['system']['enablenatreflectionhelper'] = "yes";
- else
+ } else {
unset($config['system']['enablenatreflectionhelper']);
+ }
$config['system']['reflectiontimeout'] = $_POST['reflectiontimeout'];
- if($_POST['bypassstaticroutes'] == "yes")
+ if ($_POST['bypassstaticroutes'] == "yes") {
$config['filter']['bypassstaticroutes'] = $_POST['bypassstaticroutes'];
- elseif(isset($config['filter']['bypassstaticroutes']))
+ } elseif (isset($config['filter']['bypassstaticroutes'])) {
unset($config['filter']['bypassstaticroutes']);
+ }
- if($_POST['disablescrub'] == "yes")
+ if ($_POST['disablescrub'] == "yes") {
$config['system']['disablescrub'] = $_POST['disablescrub'];
- else
+ } else {
unset($config['system']['disablescrub']);
+ }
- if ($_POST['tftpinterface'])
+ if ($_POST['tftpinterface']) {
$config['system']['tftpinterface'] = implode(",", $_POST['tftpinterface']);
- else
+ } else {
unset($config['system']['tftpinterface']);
+ }
if ($_POST['bogonsinterval'] != $config['system']['bogons']['interval']) {
switch ($_POST['bogonsinterval']) {
@@ -345,19 +361,21 @@ if ($_POST) {
// Kill filterdns when value changes, filter_configure() will restart it
if (($old_aliasesresolveinterval != $config['system']['aliasesresolveinterval']) &&
- isvalidpid("{$g['varrun_path']}/filterdns.pid"))
+ isvalidpid("{$g['varrun_path']}/filterdns.pid")) {
killbypid("{$g['varrun_path']}/filterdns.pid");
+ }
$retval = 0;
$retval = filter_configure();
- if(stristr($retval, "error") <> true)
+ if (stristr($retval, "error") <> true) {
$savemsg = get_std_save_message($retval);
- else
+ } else {
$savemsg = $retval;
+ }
}
}
-$pgtitle = array(gettext("System"),gettext("Advanced: Firewall and NAT"));
+$pgtitle = array(gettext("System"), gettext("Advanced: Firewall and NAT"));
include("head.inc");
?>
@@ -383,10 +401,12 @@ function update_description(itemnum) {
</script>
<?php
- if ($input_errors)
+ if ($input_errors) {
print_input_errors($input_errors);
- if ($savemsg)
+ }
+ if ($savemsg) {
print_info_box($savemsg);
+ }
?>
<form action="system_advanced_firewall.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="system advanced firewall/nat">
@@ -445,10 +465,10 @@ function update_description(itemnum) {
<td width="22%" valign="top" class="vncell"><?=gettext("Firewall Optimization Options");?></td>
<td width="78%" class="vtable">
<select onchange="update_description(this.selectedIndex);" name="optimization" id="optimization">
- <option value="normal"<?php if($config['system']['optimization']=="normal") echo " selected=\"selected\""; ?>><?=gettext("normal");?></option>
- <option value="high-latency"<?php if($config['system']['optimization']=="high-latency") echo " selected=\"selected\""; ?>><?=gettext("high-latency");?></option>
- <option value="aggressive"<?php if($config['system']['optimization']=="aggressive") echo " selected=\"selected\""; ?>><?=gettext("aggressive");?></option>
- <option value="conservative"<?php if($config['system']['optimization']=="conservative") echo " selected=\"selected\""; ?>><?=gettext("conservative");?></option>
+ <option value="normal"<?php if ($config['system']['optimization'] == "normal") echo " selected=\"selected\""; ?>><?=gettext("normal");?></option>
+ <option value="high-latency"<?php if ($config['system']['optimization'] == "high-latency") echo " selected=\"selected\""; ?>><?=gettext("high-latency");?></option>
+ <option value="aggressive"<?php if ($config['system']['optimization'] == "aggressive") echo " selected=\"selected\""; ?>><?=gettext("aggressive");?></option>
+ <option value="conservative"<?php if ($config['system']['optimization'] == "conservative") echo " selected=\"selected\""; ?>><?=gettext("conservative");?></option>
</select>
<br />
<textarea readonly="readonly" cols="60" rows="2" id="info" name="info" style="padding:5px; border:1px dashed #990000; background-color: #ffffff; color: #000000; font-size: 8pt;"></textarea>
@@ -539,7 +559,8 @@ function update_description(itemnum) {
<input name="disablevpnrules" type="checkbox" id="disablevpnrules" value="yes" <?php if (isset($config['system']['disablevpnrules'])) echo "checked=\"checked\""; ?> />
<strong><?=gettext("Disable all auto-added VPN rules.");?></strong>
<br />
- <span class="vexpl"><?=gettext("Note: This disables automatically added rules for IPsec, PPTP.");?>
+ <span class="vexpl">
+ <?=gettext("Note: This disables automatically added rules for IPsec, PPTP.");?>
</span>
</td>
</tr>
@@ -594,9 +615,9 @@ function update_description(itemnum) {
<td width="22%" valign="top" class="vncell"><?=gettext("Update Frequency");?></td>
<td width="78%" class="vtable">
<select name="bogonsinterval" class="formselect">
- <option value="monthly" <?php if (empty($pconfig['bogonsinterval']) || $pconfig['bogonsinterval'] == 'monthly') echo "selected=\"selected\""; ?>><?=gettext("Monthly"); ?></option>
- <option value="weekly" <?php if ($pconfig['bogonsinterval'] == 'weekly') echo "selected=\"selected\""; ?>><?=gettext("Weekly"); ?></option>
- <option value="daily" <?php if ($pconfig['bogonsinterval'] == 'daily') echo "selected=\"selected\""; ?>><?=gettext("Daily"); ?></option>
+ <option value="monthly" <?php if (empty($pconfig['bogonsinterval']) || $pconfig['bogonsinterval'] == 'monthly') echo "selected=\"selected\""; ?>><?=gettext("Monthly"); ?></option>
+ <option value="weekly" <?php if ($pconfig['bogonsinterval'] == 'weekly') echo "selected=\"selected\""; ?>><?=gettext("Weekly"); ?></option>
+ <option value="daily" <?php if ($pconfig['bogonsinterval'] == 'daily') echo "selected=\"selected\""; ?>><?=gettext("Daily"); ?></option>
</select>
<br />
<?=gettext("The frequency of updating the lists of IP addresses that are reserved (but not RFC 1918) or not yet assigned by IANA.");?>
@@ -605,7 +626,9 @@ function update_description(itemnum) {
<tr>
<td colspan="2" class="list" height="12">&nbsp;</td>
</tr>
- <?php if(count($config['interfaces']) > 1): ?>
+<?php
+ if (count($config['interfaces']) > 1):
+?>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Network Address Translation");?></td>
</tr>
@@ -613,9 +636,9 @@ function update_description(itemnum) {
<td width="22%" valign="top" class="vncell"><?=gettext("NAT Reflection mode for port forwards");?></td>
<td width="78%" class="vtable">
<select name="natreflection" class="formselect">
- <option value="disable" <?php if (isset($config['system']['disablenatreflection'])) echo "selected=\"selected\""; ?>><?=gettext("Disable"); ?></option>
- <option value="proxy" <?php if (!isset($config['system']['disablenatreflection']) && !isset($config['system']['enablenatreflectionpurenat'])) echo "selected=\"selected\""; ?>><?=gettext("Enable (NAT + Proxy)"); ?></option>
- <option value="purenat" <?php if (!isset($config['system']['disablenatreflection']) && isset($config['system']['enablenatreflectionpurenat'])) echo "selected=\"selected\""; ?>><?=gettext("Enable (Pure NAT)"); ?></option>
+ <option value="disable" <?php if (isset($config['system']['disablenatreflection'])) echo "selected=\"selected\""; ?>><?=gettext("Disable"); ?></option>
+ <option value="proxy" <?php if (!isset($config['system']['disablenatreflection']) && !isset($config['system']['enablenatreflectionpurenat'])) echo "selected=\"selected\""; ?>><?=gettext("Enable (NAT + Proxy)"); ?></option>
+ <option value="purenat" <?php if (!isset($config['system']['disablenatreflection']) && isset($config['system']['enablenatreflectionpurenat'])) echo "selected=\"selected\""; ?>><?=gettext("Enable (Pure NAT)"); ?></option>
</select>
<br />
<strong><?=gettext("When enabled, this automatically creates additional NAT redirect rules for access to port forwards on your external IP addresses from within your internal networks.");?></strong>
@@ -670,14 +693,17 @@ function update_description(itemnum) {
?>
<option value="<?=$ifent;?>" <?php if (in_array($ifent, $pconfig['tftpinterface'])) echo "selected=\"selected\""; ?>><?=gettext($ifdesc);?></option>
<?php endforeach;
- if ($rowIndex == 0)
+ if ($rowIndex == 0) {
echo "<option></option>";
+ }
?>
</select>
<br/><strong><?=gettext("Choose the interfaces where you want TFTP proxy helper to be enabled.");?></strong>
</td>
</tr>
- <?php endif; ?>
+<?php
+ endif;
+?>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("State Timeouts");?></td>
</tr>
@@ -694,7 +720,7 @@ function update_description(itemnum) {
<?=gettext("Enter value for TCP first timeout in seconds. Leave blank for default (recommended).");?>
<br/><br/>
<strong><?=gettext("TCP Opening: ");?></strong><input name="tcpopeningtimeout" id="tcpopeningtimeout" value="<?php echo $config['system']['tcpopeningtimeout']; ?>" /><br />
- <?=gettext("Enter value for TCP opening timeout in seconds. Leave blank for default (recommended).");?>
+ <?=gettext("Enter value for TCP opening timeout in seconds. Leave blank for default (recommended).");?>
<br/><br/>
<strong><?=gettext("TCP Established: ");?></strong><input name="tcpestablishedtimeout" id="tcpestablishedtimeout" value="<?php echo $config['system']['tcpestablishedtimeout']; ?>" /><br />
<?=gettext("Enter value for TCP established timeout in seconds. Leave blank for default (recommended).");?>
@@ -706,7 +732,7 @@ function update_description(itemnum) {
<?=gettext("Enter value for TCP FIN wait timeout in seconds. Leave blank for default (recommended).");?>
<br/><br/>
<strong><?=gettext("TCP Closed: ");?></strong><input name="tcpclosedtimeout" id="tcpclosedtimeout" value="<?php echo $config['system']['tcpclosedtimeout']; ?>" /><br />
- <?=gettext("Enter value for TCP closed timeout in seconds. Leave blank for default (recommended).");?>
+ <?=gettext("Enter value for TCP closed timeout in seconds. Leave blank for default (recommended).");?>
</td>
</tr>
<tr>
diff --git a/usr/local/www/system_advanced_misc.php b/usr/local/www/system_advanced_misc.php
index 6d927df..3863eeb 100644
--- a/usr/local/www/system_advanced_misc.php
+++ b/usr/local/www/system_advanced_misc.php
@@ -71,22 +71,27 @@ $pconfig['use_mfs_var_size'] = $config['system']['use_mfs_var_size'];
$pconfig['pkg_nochecksig'] = isset($config['system']['pkg_nochecksig']);
$pconfig['powerd_ac_mode'] = "hadp";
-if (!empty($config['system']['powerd_ac_mode']))
+if (!empty($config['system']['powerd_ac_mode'])) {
$pconfig['powerd_ac_mode'] = $config['system']['powerd_ac_mode'];
+}
$pconfig['powerd_battery_mode'] = "hadp";
-if (!empty($config['system']['powerd_battery_mode']))
+if (!empty($config['system']['powerd_battery_mode'])) {
$pconfig['powerd_battery_mode'] = $config['system']['powerd_battery_mode'];
+}
$pconfig['powerd_normal_mode'] = "hadp";
-if (!empty($config['system']['powerd_normal_mode']))
+if (!empty($config['system']['powerd_normal_mode'])) {
$pconfig['powerd_normal_mode'] = $config['system']['powerd_normal_mode'];
+}
-$crypto_modules = array('glxsb' => gettext("AMD Geode LX Security Block"),
- 'aesni' => gettext("AES-NI CPU-based Acceleration"));
+$crypto_modules = array(
+ 'glxsb' => gettext("AMD Geode LX Security Block"),
+ 'aesni' => gettext("AES-NI CPU-based Acceleration"));
-$thermal_hardware_modules = array( 'coretemp' => gettext("Intel Core* CPU on-die thermal sensor"),
- 'amdtemp' => gettext("AMD K8, K10 and K11 CPU on-die thermal sensor"));
+$thermal_hardware_modules = array(
+ 'coretemp' => gettext("Intel Core* CPU on-die thermal sensor"),
+ 'amdtemp' => gettext("AMD K8, K10 and K11 CPU on-die thermal sensor"));
if ($_POST) {
@@ -96,48 +101,57 @@ if ($_POST) {
ob_flush();
flush();
- if (!empty($_POST['crypto_hardware']) && !array_key_exists($_POST['crypto_hardware'], $crypto_modules))
+ if (!empty($_POST['crypto_hardware']) && !array_key_exists($_POST['crypto_hardware'], $crypto_modules)) {
$input_errors[] = gettext("Please select a valid Cryptographic Accelerator.");
+ }
- if (!empty($_POST['thermal_hardware']) && !array_key_exists($_POST['thermal_hardware'], $thermal_hardware_modules))
+ if (!empty($_POST['thermal_hardware']) && !array_key_exists($_POST['thermal_hardware'], $thermal_hardware_modules)) {
$input_errors[] = gettext("Please select a valid Thermal Hardware Sensor.");
+ }
- if (!empty($_POST['use_mfs_tmp_size']) && (!is_numeric($_POST['use_mfs_tmp_size']) || ($_POST['use_mfs_tmp_size'] < 40)))
+ if (!empty($_POST['use_mfs_tmp_size']) && (!is_numeric($_POST['use_mfs_tmp_size']) || ($_POST['use_mfs_tmp_size'] < 40))) {
$input_errors[] = gettext("/tmp Size must be numeric and should not be less than 40MB.");
+ }
- if (!empty($_POST['use_mfs_var_size']) && (!is_numeric($_POST['use_mfs_var_size']) || ($_POST['use_mfs_var_size'] < 60)))
+ if (!empty($_POST['use_mfs_var_size']) && (!is_numeric($_POST['use_mfs_var_size']) || ($_POST['use_mfs_var_size'] < 60))) {
$input_errors[] = gettext("/var Size must be numeric and should not be less than 60MB.");
+ }
if (!$input_errors) {
- if($_POST['harddiskstandby'] <> "") {
+ if ($_POST['harddiskstandby'] <> "") {
$config['system']['harddiskstandby'] = $_POST['harddiskstandby'];
system_set_harddisk_standby();
- } else
+ } else {
unset($config['system']['harddiskstandby']);
+ }
- if($_POST['proxyurl'] <> "")
+ if ($_POST['proxyurl'] <> "") {
$config['system']['proxyurl'] = $_POST['proxyurl'];
- else
+ } else {
unset($config['system']['proxyurl']);
+ }
- if($_POST['proxyport'] <> "")
+ if ($_POST['proxyport'] <> "") {
$config['system']['proxyport'] = $_POST['proxyport'];
- else
+ } else {
unset($config['system']['proxyport']);
+ }
- if($_POST['proxyuser'] <> "")
+ if ($_POST['proxyuser'] <> "") {
$config['system']['proxyuser'] = $_POST['proxyuser'];
- else
+ } else {
unset($config['system']['proxyuser']);
+ }
- if($_POST['proxypass'] <> "")
+ if ($_POST['proxypass'] <> "") {
$config['system']['proxypass'] = $_POST['proxypass'];
- else
+ } else {
unset($config['system']['proxypass']);
+ }
$need_relayd_restart = false;
- if($_POST['lb_use_sticky'] == "yes") {
+ if ($_POST['lb_use_sticky'] == "yes") {
if (!isset($config['system']['lb_use_sticky'])) {
$config['system']['lb_use_sticky'] = true;
$need_relayd_restart = true;
@@ -153,65 +167,76 @@ if ($_POST) {
}
}
- if($_POST['gw_switch_default'] == "yes")
+ if ($_POST['gw_switch_default'] == "yes") {
$config['system']['gw_switch_default'] = true;
- else
+ } else {
unset($config['system']['gw_switch_default']);
+ }
- if($_POST['pkg_nochecksig'] == "yes")
+ if ($_POST['pkg_nochecksig'] == "yes") {
$config['system']['pkg_nochecksig'] = true;
- elseif (isset($config['system']['pkg_nochecksig']))
+ } elseif (isset($config['system']['pkg_nochecksig'])) {
unset($config['system']['pkg_nochecksig']);
+ }
- if($_POST['powerd_enable'] == "yes")
+ if ($_POST['powerd_enable'] == "yes") {
$config['system']['powerd_enable'] = true;
- else
+ } else {
unset($config['system']['powerd_enable']);
+ }
$config['system']['powerd_ac_mode'] = $_POST['powerd_ac_mode'];
$config['system']['powerd_battery_mode'] = $_POST['powerd_battery_mode'];
$config['system']['powerd_normal_mode'] = $_POST['powerd_normal_mode'];
- if($_POST['crypto_hardware'])
+ if ($_POST['crypto_hardware']) {
$config['system']['crypto_hardware'] = $_POST['crypto_hardware'];
- else
+ } else {
unset($config['system']['crypto_hardware']);
+ }
- if($_POST['thermal_hardware'])
+ if ($_POST['thermal_hardware']) {
$config['system']['thermal_hardware'] = $_POST['thermal_hardware'];
- else
+ } else {
unset($config['system']['thermal_hardware']);
+ }
- if($_POST['schedule_states'] == "yes")
+ if ($_POST['schedule_states'] == "yes") {
$config['system']['schedule_states'] = true;
- else
+ } else {
unset($config['system']['schedule_states']);
+ }
- if($_POST['kill_states'] == "yes")
+ if ($_POST['kill_states'] == "yes") {
$config['system']['kill_states'] = true;
- else
+ } else {
unset($config['system']['kill_states']);
+ }
- if($_POST['skip_rules_gw_down'] == "yes")
+ if ($_POST['skip_rules_gw_down'] == "yes") {
$config['system']['skip_rules_gw_down'] = true;
- else
+ } else {
unset($config['system']['skip_rules_gw_down']);
+ }
$need_apinger_restart = false;
- if($_POST['apinger_debug'] == "yes") {
- if (!isset($config['system']['apinger_debug']))
+ if ($_POST['apinger_debug'] == "yes") {
+ if (!isset($config['system']['apinger_debug'])) {
$need_apinger_restart = true;
+ }
$config['system']['apinger_debug'] = true;
} else {
- if (isset($config['system']['apinger_debug']))
+ if (isset($config['system']['apinger_debug'])) {
$need_apinger_restart = true;
+ }
unset($config['system']['apinger_debug']);
}
- if($_POST['use_mfs_tmpvar'] == "yes")
+ if ($_POST['use_mfs_tmpvar'] == "yes") {
$config['system']['use_mfs_tmpvar'] = true;
- else
+ } else {
unset($config['system']['use_mfs_tmpvar']);
+ }
$config['system']['use_mfs_tmp_size'] = $_POST['use_mfs_tmp_size'];
$config['system']['use_mfs_var_size'] = $_POST['use_mfs_var_size'];
@@ -230,22 +255,25 @@ if ($_POST) {
$retval = 0;
system_resolvconf_generate(true);
$retval = filter_configure();
- if(stristr($retval, "error") <> true)
+ if (stristr($retval, "error") <> true) {
$savemsg = get_std_save_message(gettext($retval));
- else
+ } else {
$savemsg = gettext($retval);
+ }
activate_powerd();
load_crypto();
load_thermal_hardware();
- if ($need_relayd_restart)
+ if ($need_relayd_restart) {
relayd_configure();
- if ($need_apinger_restart)
+ }
+ if ($need_apinger_restart) {
setup_gateways_monitor();
+ }
}
}
-$pgtitle = array(gettext("System"),gettext("Advanced: Miscellaneous"));
+$pgtitle = array(gettext("System"), gettext("Advanced: Miscellaneous"));
include("head.inc");
?>
@@ -253,30 +281,33 @@ include("head.inc");
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php
include("fbegin.inc");
- if ($input_errors)
+ if ($input_errors) {
print_input_errors($input_errors);
- if ($savemsg)
+ }
+ if ($savemsg) {
print_info_box($savemsg);
+ }
?>
<script type="text/javascript">
//<![CDATA[
function sticky_checked(obj) {
- if (obj.checked)
- jQuery('#srctrack').attr('disabled',false);
- else
- jQuery('#srctrack').attr('disabled','true');
+ if (obj.checked) {
+ jQuery('#srctrack').attr('disabled', false);
+ } else {
+ jQuery('#srctrack').attr('disabled', 'true');
+ }
}
function tmpvar_checked(obj) {
if (obj.checked) {
- jQuery('#use_mfs_tmp_size').attr('disabled',false);
- jQuery('#use_mfs_var_size').attr('disabled',false);
- jQuery('#rrdbackup').attr('disabled',false);
- jQuery('#dhcpbackup').attr('disabled',false);
+ jQuery('#use_mfs_tmp_size').attr('disabled', false);
+ jQuery('#use_mfs_var_size').attr('disabled', false);
+ jQuery('#rrdbackup').attr('disabled', false);
+ jQuery('#dhcpbackup').attr('disabled', false);
} else {
- jQuery('#use_mfs_tmp_size').attr('disabled','true');
- jQuery('#use_mfs_var_size').attr('disabled','true');
- jQuery('#rrdbackup').attr('disabled','true');
- jQuery('#dhcpbackup').attr('disabled','true');
+ jQuery('#use_mfs_tmp_size').attr('disabled', 'true');
+ jQuery('#use_mfs_var_size').attr('disabled', 'true');
+ jQuery('#rrdbackup').attr('disabled', 'true');
+ jQuery('#dhcpbackup').attr('disabled', 'true');
}
}
//]]>
@@ -353,19 +384,19 @@ function tmpvar_checked(obj) {
<input name="lb_use_sticky" type="checkbox" id="lb_use_sticky" value="yes" <?php if ($pconfig['lb_use_sticky']) echo "checked=\"checked\""; ?> onclick="sticky_checked(this)" />
<strong><?=gettext("Use sticky connections"); ?></strong><br />
<?=gettext("Successive connections will be redirected to the servers " .
- "in a round-robin manner with connections from the same " .
- "source being sent to the same web server. This 'sticky " .
- "connection' will exist as long as there are states that " .
- "refer to this connection. Once the states expire, so will " .
- "the sticky connection. Further connections from that host " .
- "will be redirected to the next web server in the round " .
- "robin. Changing this option will restart the Load Balancing service."); ?>
+ "in a round-robin manner with connections from the same " .
+ "source being sent to the same web server. This 'sticky " .
+ "connection' will exist as long as there are states that " .
+ "refer to this connection. Once the states expire, so will " .
+ "the sticky connection. Further connections from that host " .
+ "will be redirected to the next web server in the round " .
+ "robin. Changing this option will restart the Load Balancing service."); ?>
<br />
<input name="srctrack" id="srctrack" value="<?php if ($pconfig['srctrack'] <> "") echo $pconfig['srctrack']; else "1400"; ?>" class="formfld unknown" <?php if ($pconfig['lb_use_sticky'] == false) echo "disabled=\"disabled\""; ?> />
<br />
<?=gettext("Set the source tracking timeout for sticky connections. " .
- "By default this is 0, so source tracking is removed as soon as the state expires. " .
- "Setting this timeout higher will cause the source/destination relationship to persist for longer periods of time."); ?>
+ "By default this is 0, so source tracking is removed as soon as the state expires. " .
+ "Setting this timeout higher will cause the source/destination relationship to persist for longer periods of time."); ?>
</td>
</tr>
<tr>
@@ -373,8 +404,7 @@ function tmpvar_checked(obj) {
<td width="78%" class="vtable">
<input name="gw_switch_default" type="checkbox" id="gw_switch_default" value="yes" <?php if ($pconfig['gw_switch_default']) echo "checked=\"checked\""; ?> />
<strong><?=gettext("Enable default gateway switching"); ?></strong><br />
- <?=gettext("If the default gateway goes down, " .
- "switch the default gateway to another available one. This is not enabled by default, as it's unnecessary in most all scenarios, which instead use gateway groups."); ?>
+ <?=gettext("If the default gateway goes down, switch the default gateway to another available one. This is not enabled by default, as it's unnecessary in most all scenarios, which instead use gateway groups."); ?>
</td>
</tr>
<tr>
@@ -394,10 +424,10 @@ function tmpvar_checked(obj) {
<td><?=gettext("On AC Power Mode:");?> &nbsp;</td>
<td>
<select name="powerd_ac_mode" id="powerd_ac_mode">
- <option value="hadp"<?php if($pconfig['powerd_ac_mode']=="hadp") echo " selected=\"selected\""; ?>><?=gettext("Hiadaptive");?></option>
- <option value="adp"<?php if($pconfig['powerd_ac_mode']=="adp") echo " selected=\"selected\""; ?>><?=gettext("Adaptive");?></option>
- <option value="min"<?php if($pconfig['powerd_ac_mode']=="min") echo " selected=\"selected\""; ?>><?=gettext("Minimum");?></option>
- <option value="max"<?php if($pconfig['powerd_ac_mode']=="max") echo " selected=\"selected\""; ?>><?=gettext("Maximum");?></option>
+ <option value="hadp"<?php if ($pconfig['powerd_ac_mode'] == "hadp") echo " selected=\"selected\""; ?>><?=gettext("Hiadaptive");?></option>
+ <option value="adp"<?php if ($pconfig['powerd_ac_mode'] == "adp") echo " selected=\"selected\""; ?>><?=gettext("Adaptive");?></option>
+ <option value="min"<?php if ($pconfig['powerd_ac_mode'] == "min") echo " selected=\"selected\""; ?>><?=gettext("Minimum");?></option>
+ <option value="max"<?php if ($pconfig['powerd_ac_mode'] == "max") echo " selected=\"selected\""; ?>><?=gettext("Maximum");?></option>
</select>
</td>
</tr>
@@ -405,10 +435,10 @@ function tmpvar_checked(obj) {
<td><?=gettext("On Battery Power Mode:");?> &nbsp;</td>
<td>
<select name="powerd_battery_mode" id="powerd_battery_mode">
- <option value="hadp"<?php if($pconfig['powerd_battery_mode']=="hadp") echo " selected=\"selected\""; ?>><?=gettext("Hiadaptive");?></option>
- <option value="adp"<?php if($pconfig['powerd_battery_mode']=="adp") echo " selected=\"selected\""; ?>><?=gettext("Adaptive");?></option>
- <option value="min"<?php if($pconfig['powerd_battery_mode']=="min") echo " selected=\"selected\""; ?>><?=gettext("Minimum");?></option>
- <option value="max"<?php if($pconfig['powerd_battery_mode']=="max") echo " selected=\"selected\""; ?>><?=gettext("Maximum");?></option>
+ <option value="hadp"<?php if ($pconfig['powerd_battery_mode'] == "hadp") echo " selected=\"selected\""; ?>><?=gettext("Hiadaptive");?></option>
+ <option value="adp"<?php if ($pconfig['powerd_battery_mode'] == "adp") echo " selected=\"selected\""; ?>><?=gettext("Adaptive");?></option>
+ <option value="min"<?php if ($pconfig['powerd_battery_mode'] == "min") echo " selected=\"selected\""; ?>><?=gettext("Minimum");?></option>
+ <option value="max"<?php if ($pconfig['powerd_battery_mode'] == "max") echo " selected=\"selected\""; ?>><?=gettext("Maximum");?></option>
</select>
</td>
</tr>
@@ -416,28 +446,28 @@ function tmpvar_checked(obj) {
<td><?=gettext("On Unknown Power Mode:");?> &nbsp;</td>
<td>
<select name="powerd_normal_mode" id="powerd_normal_mode">
- <option value="hadp"<?php if($pconfig['powerd_normal_mode']=="hadp") echo " selected=\"selected\""; ?>><?=gettext("Hiadaptive");?></option>
- <option value="adp"<?php if($pconfig['powerd_normal_mode']=="adp") echo " selected=\"selected\""; ?>><?=gettext("Adaptive");?></option>
- <option value="min"<?php if($pconfig['powerd_normal_mode']=="min") echo " selected=\"selected\""; ?>><?=gettext("Minimum");?></option>
- <option value="max"<?php if($pconfig['powerd_normal_mode']=="max") echo " selected=\"selected\""; ?>><?=gettext("Maximum");?></option>
+ <option value="hadp"<?php if ($pconfig['powerd_normal_mode'] == "hadp") echo " selected=\"selected\""; ?>><?=gettext("Hiadaptive");?></option>
+ <option value="adp"<?php if ($pconfig['powerd_normal_mode'] == "adp") echo " selected=\"selected\""; ?>><?=gettext("Adaptive");?></option>
+ <option value="min"<?php if ($pconfig['powerd_normal_mode'] == "min") echo " selected=\"selected\""; ?>><?=gettext("Minimum");?></option>
+ <option value="max"<?php if ($pconfig['powerd_normal_mode'] == "max") echo " selected=\"selected\""; ?>><?=gettext("Maximum");?></option>
</select>
</td>
</tr>
</table>
<br />
<?=gettext("The powerd utility monitors the system state and sets various power control " .
- "options accordingly. It offers four modes (maximum, minimum, adaptive " .
- "and hiadaptive) that can be individually selected while on AC power or batteries. " .
- "The modes maximum, minimum, adaptive and hiadaptive may be abbreviated max, " .
- "min, adp, hadp. Maximum mode chooses the highest performance values. Minimum " .
- "mode selects the lowest performance values to get the most power savings. " .
- "Adaptive mode attempts to strike a balance by degrading performance when " .
- "the system appears idle and increasing it when the system is busy. It " .
- "offers a good balance between a small performance loss for greatly " .
- "increased power savings. Hiadaptive mode is alike adaptive mode, but " .
- "tuned for systems where performance and interactivity are more important " .
- "than power consumption. It raises frequency faster, drops slower and " .
- "keeps twice lower CPU load."); ?>
+ "options accordingly. It offers four modes (maximum, minimum, adaptive " .
+ "and hiadaptive) that can be individually selected while on AC power or batteries. " .
+ "The modes maximum, minimum, adaptive and hiadaptive may be abbreviated max, " .
+ "min, adp, hadp. Maximum mode chooses the highest performance values. Minimum " .
+ "mode selects the lowest performance values to get the most power savings. " .
+ "Adaptive mode attempts to strike a balance by degrading performance when " .
+ "the system appears idle and increasing it when the system is busy. It " .
+ "offers a good balance between a small performance loss for greatly " .
+ "increased power savings. Hiadaptive mode is alike adaptive mode, but " .
+ "tuned for systems where performance and interactivity are more important " .
+ "than power consumption. It raises frequency faster, drops slower and " .
+ "keeps twice lower CPU load."); ?>
</td>
</tr>
<tr>
@@ -465,7 +495,7 @@ function tmpvar_checked(obj) {
"acceleration."); ?>
<br /><br />
<?=gettext("If you do not have a crypto chip in your system, this option will have no " .
- "effect. To unload the selected module, set this option to 'none' and then reboot."); ?>
+ "effect. To unload the selected module, set this option to 'none' and then reboot."); ?>
</td>
</tr>
<tr>
@@ -485,8 +515,8 @@ function tmpvar_checked(obj) {
</select>
<br />
<?=gettext("If you have a supported CPU, selecting a themal sensor will load the appropriate " .
- "driver to read its temperature. Setting this to 'None' will attempt to read the " .
- "temperature from an ACPI-compliant motherboard sensor instead, if one is present."); ?>
+ "driver to read its temperature. Setting this to 'None' will attempt to read the " .
+ "temperature from an ACPI-compliant motherboard sensor instead, if one is present."); ?>
<br /><br />
<?=gettext("If you do not have a supported thermal sensor chip in your system, this option will have no " .
"effect. To unload the selected module, set this option to 'none' and then reboot."); ?>
@@ -516,7 +546,7 @@ function tmpvar_checked(obj) {
<input name="schedule_states" type="checkbox" id="schedule_states" value="yes" <?php if ($pconfig['schedule_states']) echo "checked=\"checked\""; ?> />
<br />
<?=gettext("By default, when a schedule expires, connections permitted by that schedule are killed. ".
- "This option overrides that behavior by not clearing states for existing connections."); ?>
+ "This option overrides that behavior by not clearing states for existing connections."); ?>
</td>
</tr>
<tr>
@@ -539,8 +569,8 @@ function tmpvar_checked(obj) {
<input name="skip_rules_gw_down" type="checkbox" id="skip_rules_gw_down" value="yes" <?php if ($pconfig['skip_rules_gw_down']) echo "checked=\"checked\""; ?> />
<br />
<?=gettext("By default, when a rule has a gateway specified and this gateway is down, ".
- "the rule is created omitting the gateway. This option overrides that behavior by omitting ".
- "the entire rule instead."); ?>
+ "the rule is created omitting the gateway. This option overrides that behavior by omitting ".
+ "the entire rule instead."); ?>
</td>
</tr>
<tr>
@@ -561,7 +591,7 @@ function tmpvar_checked(obj) {
<input name="use_mfs_tmpvar" type="checkbox" id="use_mfs_tmpvar" value="yes" <?php if ($pconfig['use_mfs_tmpvar']) echo "checked=\"checked\""; ?> onclick="tmpvar_checked(this)" />
<strong><?=gettext("Use memory file system for /tmp and /var"); ?></strong><br />
<?=gettext("Set this if you wish to use /tmp and /var as RAM disks (memory file system disks) on a full install " .
- "rather than use the hard disk. Setting this will cause the data in /tmp and /var to be lost at reboot, including log data. RRD and DHCP Leases will be retained."); ?>
+ "rather than use the hard disk. Setting this will cause the data in /tmp and /var to be lost at reboot, including log data. RRD and DHCP Leases will be retained."); ?>
</td>
</tr>
<?php endif; ?>
@@ -571,7 +601,7 @@ function tmpvar_checked(obj) {
<input name="use_mfs_tmp_size" id="use_mfs_tmp_size" value="<?php if ($pconfig['use_mfs_tmp_size'] <> "") echo $pconfig['use_mfs_tmp_size']; ?>" class="formfld unknown" <?php if (($g['platform'] == "pfSense") && ($pconfig['use_mfs_tmpvar'] == false)) echo "disabled=\"disabled\""; ?> /> MB
<br />
<?=gettext("Set the size, in MB, for the /tmp RAM disk. " .
- "Leave blank for 40MB. Do not set lower than 40."); ?>
+ "Leave blank for 40MB. Do not set lower than 40."); ?>
</td>
</tr>
<tr>
@@ -580,7 +610,7 @@ function tmpvar_checked(obj) {
<input name="use_mfs_var_size" id="use_mfs_var_size" value="<?php if ($pconfig['use_mfs_var_size'] <> "") echo $pconfig['use_mfs_var_size']; ?>" class="formfld unknown" <?php if (($g['platform'] == "pfSense") && ($pconfig['use_mfs_tmpvar'] == false)) echo "disabled=\"disabled\""; ?> /> MB
<br />
<?=gettext("Set the size, in MB, for the /var RAM disk. " .
- "Leave blank for 60MB. Do not set lower than 60."); ?>
+ "Leave blank for 60MB. Do not set lower than 60."); ?>
</td>
</tr>
<tr>
@@ -618,7 +648,7 @@ function tmpvar_checked(obj) {
<tr>
<td colspan="2" class="list" height="12">&nbsp;</td>
</tr>
- <?php if($g['platform'] == "pfSenseDISABLED"): ?>
+ <?php if ($g['platform'] == "pfSenseDISABLED"): ?>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Hardware Settings"); ?></td>
</tr>
@@ -630,12 +660,12 @@ function tmpvar_checked(obj) {
## Values from ATA-2 http://www.t13.org/project/d0948r3-ATA-2.pdf (Page 66)
$sbvals = explode(" ", "0.5,6 1,12 2,24 3,36 4,48 5,60 7.5,90 10,120 15,180 20,240 30,241 60,242");
?>
- <option value="" <?php if(!$pconfig['harddiskstandby']) echo('selected="selected"');?>><?=gettext("Always on"); ?></option>
+ <option value="" <?php if (!$pconfig['harddiskstandby']) echo('selected="selected"');?>><?=gettext("Always on"); ?></option>
<?php
foreach ($sbvals as $sbval):
- list($min,$val) = explode(",", $sbval);
+ list($min, $val) = explode(",", $sbval);
?>
- <option value="<?=$val;?>" <?php if($pconfig['harddiskstandby'] == $val) echo('selected="selected"');?>><?=$min;?> <?=gettext("minutes"); ?></option>
+ <option value="<?=$val;?>" <?php if ($pconfig['harddiskstandby'] == $val) echo('selected="selected"');?>><?=$min;?> <?=gettext("minutes"); ?></option>
<?php endforeach; ?>
</select>
<br />
diff --git a/usr/local/www/system_advanced_network.php b/usr/local/www/system_advanced_network.php
index 8a1debd..a9a6a2c 100644
--- a/usr/local/www/system_advanced_network.php
+++ b/usr/local/www/system_advanced_network.php
@@ -64,38 +64,39 @@ if ($_POST) {
unset($input_errors);
$pconfig = $_POST;
- if ($_POST['ipv6nat_enable'] && !is_ipaddr($_POST['ipv6nat_ipaddr']))
+ if ($_POST['ipv6nat_enable'] && !is_ipaddr($_POST['ipv6nat_ipaddr'])) {
$input_errors[] = gettext("You must specify an IP address to NAT IPv6 packets.");
+ }
ob_flush();
flush();
if (!$input_errors) {
- if($_POST['ipv6nat_enable'] == "yes") {
+ if ($_POST['ipv6nat_enable'] == "yes") {
$config['diag']['ipv6nat']['enable'] = true;
$config['diag']['ipv6nat']['ipaddr'] = $_POST['ipv6nat_ipaddr'];
} else {
- if($config['diag']) {
- if($config['diag']['ipv6nat']) {
+ if ($config['diag']) {
+ if ($config['diag']['ipv6nat']) {
unset($config['diag']['ipv6nat']['enable']);
unset($config['diag']['ipv6nat']['ipaddr']);
}
}
}
- if($_POST['ipv6allow'] == "yes") {
+ if ($_POST['ipv6allow'] == "yes") {
$config['system']['ipv6allow'] = true;
} else {
unset($config['system']['ipv6allow']);
}
- if($_POST['prefer_ipv4'] == "yes") {
+ if ($_POST['prefer_ipv4'] == "yes") {
$config['system']['prefer_ipv4'] = true;
} else {
unset($config['system']['prefer_ipv4']);
}
- if($_POST['sharednet'] == "yes") {
+ if ($_POST['sharednet'] == "yes") {
$config['system']['sharednet'] = true;
system_disable_arp_wrong_if();
} else {
@@ -103,7 +104,7 @@ if ($_POST) {
system_enable_arp_wrong_if();
}
- if($_POST['polling_enable'] == "yes") {
+ if ($_POST['polling_enable'] == "yes") {
$config['system']['polling'] = true;
setup_polling();
} else {
@@ -111,25 +112,25 @@ if ($_POST) {
setup_polling();
}
- if($_POST['flowtable'] == "yes") {
+ if ($_POST['flowtable'] == "yes") {
$config['system']['flowtable'] = $_POST['flowtable'];
} else {
unset($config['system']['flowtable']);
}
- if($_POST['disablechecksumoffloading'] == "yes") {
+ if ($_POST['disablechecksumoffloading'] == "yes") {
$config['system']['disablechecksumoffloading'] = true;
} else {
unset($config['system']['disablechecksumoffloading']);
}
- if($_POST['disablesegmentationoffloading'] == "yes") {
+ if ($_POST['disablesegmentationoffloading'] == "yes") {
$config['system']['disablesegmentationoffloading'] = true;
} else {
unset($config['system']['disablesegmentationoffloading']);
}
- if($_POST['disablelargereceiveoffloading'] == "yes") {
+ if ($_POST['disablelargereceiveoffloading'] == "yes") {
$config['system']['disablelargereceiveoffloading'] = true;
} else {
unset($config['system']['disablelargereceiveoffloading']);
@@ -144,14 +145,15 @@ if ($_POST) {
prefer_ipv4_or_ipv6();
$retval = filter_configure();
- if(stristr($retval, "error") <> true)
+ if (stristr($retval, "error") <> true) {
$savemsg = get_std_save_message(gettext($retval));
- else
+ } else {
$savemsg = gettext($retval);
+ }
}
}
-$pgtitle = array(gettext("System"),gettext("Advanced: Networking"));
+$pgtitle = array(gettext("System"), gettext("Advanced: Networking"));
include("head.inc");
?>
@@ -163,10 +165,11 @@ include("head.inc");
//<![CDATA[
function enable_change(enable_over) {
- if (document.iform.ipv6nat_enable.checked || enable_over)
+ if (document.iform.ipv6nat_enable.checked || enable_over) {
document.iform.ipv6nat_ipaddr.disabled = 0;
- else
+ } else {
document.iform.ipv6nat_ipaddr.disabled = 1;
+ }
}
//]]>
@@ -174,10 +177,12 @@ function enable_change(enable_over) {
<?
- if ($input_errors)
+ if ($input_errors) {
print_input_errors($input_errors);
- if ($savemsg)
+ }
+ if ($savemsg) {
print_info_box($savemsg);
+ }
?>
<form action="system_advanced_network.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="system advanced newtwork">
@@ -199,7 +204,7 @@ function enable_change(enable_over) {
<td id="mainarea">
<div class="tabcont">
<span class="vexpl">
- <span class="red">
+ <span class="red">
<strong><?=gettext("NOTE:"); ?>&nbsp;</strong>
</span>
<?=gettext("The options on this page are intended for use by advanced users only."); ?>
@@ -302,7 +307,7 @@ function enable_change(enable_over) {
<?php
/*
$version = get_freebsd_version();
- if($version == "8"):
+ if ($version == "8"):
<tr>
<td colspan="2" class="list" height="12">&nbsp;</td>
diff --git a/usr/local/www/system_advanced_notifications.php b/usr/local/www/system_advanced_notifications.php
index da0c418..67df042 100644
--- a/usr/local/www/system_advanced_notifications.php
+++ b/usr/local/www/system_advanced_notifications.php
@@ -43,42 +43,55 @@ require_once("notices.inc");
// Growl
$pconfig['disable_growl'] = isset($config['notifications']['growl']['disable']);
-if($config['notifications']['growl']['password'])
+if ($config['notifications']['growl']['password']) {
$pconfig['password'] = $config['notifications']['growl']['password'];
-if($config['notifications']['growl']['ipaddress'])
+}
+if ($config['notifications']['growl']['ipaddress']) {
$pconfig['ipaddress'] = $config['notifications']['growl']['ipaddress'];
+}
-if($config['notifications']['growl']['notification_name'])
+if ($config['notifications']['growl']['notification_name']) {
$pconfig['notification_name'] = $config['notifications']['growl']['notification_name'];
-else
+} else {
$pconfig['notification_name'] = "{$g['product_name']} growl alert";
-
-if($config['notifications']['growl']['name'])
+}
+
+if ($config['notifications']['growl']['name']) {
$pconfig['name'] = $config['notifications']['growl']['name'];
-else
+} else {
$pconfig['name'] = 'PHP-Growl';
+}
// SMTP
$pconfig['disable_smtp'] = isset($config['notifications']['smtp']['disable']);
-if ($config['notifications']['smtp']['ipaddress'])
+if ($config['notifications']['smtp']['ipaddress']) {
$pconfig['smtpipaddress'] = $config['notifications']['smtp']['ipaddress'];
-if ($config['notifications']['smtp']['port'])
+}
+if ($config['notifications']['smtp']['port']) {
$pconfig['smtpport'] = $config['notifications']['smtp']['port'];
-if (isset($config['notifications']['smtp']['ssl']))
+}
+if (isset($config['notifications']['smtp']['ssl'])) {
$pconfig['smtpssl'] = true;
-if (isset($config['notifications']['smtp']['tls']))
+}
+if (isset($config['notifications']['smtp']['tls'])) {
$pconfig['smtptls'] = true;
-if ($config['notifications']['smtp']['notifyemailaddress'])
+}
+if ($config['notifications']['smtp']['notifyemailaddress']) {
$pconfig['smtpnotifyemailaddress'] = $config['notifications']['smtp']['notifyemailaddress'];
-if ($config['notifications']['smtp']['username'])
+}
+if ($config['notifications']['smtp']['username']) {
$pconfig['smtpusername'] = $config['notifications']['smtp']['username'];
-if ($config['notifications']['smtp']['password'])
+}
+if ($config['notifications']['smtp']['password']) {
$pconfig['smtppassword'] = $config['notifications']['smtp']['password'];
-if ($config['notifications']['smtp']['authentication_mechanism'])
+}
+if ($config['notifications']['smtp']['authentication_mechanism']) {
$pconfig['smtpauthmech'] = $config['notifications']['smtp']['authentication_mechanism'];
-if ($config['notifications']['smtp']['fromaddress'])
+}
+if ($config['notifications']['smtp']['fromaddress']) {
$pconfig['smtpfromaddress'] = $config['notifications']['smtp']['fromaddress'];
+}
// System Sounds
$pconfig['disablebeep'] = isset($config['system']['disablebeep']);
@@ -96,7 +109,7 @@ if ($_POST) {
if ($_POST['apply']) {
$retval = 0;
- system_setup_sysctl();
+ system_setup_sysctl();
$savemsg = get_std_save_message($retval);
}
@@ -109,38 +122,43 @@ if ($_POST) {
$config['notifications']['growl']['name'] = $_POST['name'];
$config['notifications']['growl']['notification_name'] = $_POST['notification_name'];
- if($_POST['disable_growl'] == "yes")
+ if ($_POST['disable_growl'] == "yes") {
$config['notifications']['growl']['disable'] = true;
- else
+ } else {
unset($config['notifications']['growl']['disable']);
+ }
// SMTP
$config['notifications']['smtp']['ipaddress'] = $_POST['smtpipaddress'];
$config['notifications']['smtp']['port'] = $_POST['smtpport'];
- if (isset($_POST['smtpssl']))
+ if (isset($_POST['smtpssl'])) {
$config['notifications']['smtp']['ssl'] = true;
- else
+ } else {
unset($config['notifications']['smtp']['ssl']);
- if (isset($_POST['smtptls']))
+ }
+ if (isset($_POST['smtptls'])) {
$config['notifications']['smtp']['tls'] = true;
- else
+ } else {
unset($config['notifications']['smtp']['tls']);
+ }
$config['notifications']['smtp']['notifyemailaddress'] = $_POST['smtpnotifyemailaddress'];
$config['notifications']['smtp']['username'] = $_POST['smtpusername'];
$config['notifications']['smtp']['password'] = $_POST['smtppassword'];
$config['notifications']['smtp']['authentication_mechanism'] = $_POST['smtpauthmech'];
$config['notifications']['smtp']['fromaddress'] = $_POST['smtpfromaddress'];
- if($_POST['disable_smtp'] == "yes")
+ if ($_POST['disable_smtp'] == "yes") {
$config['notifications']['smtp']['disable'] = true;
- else
+ } else {
unset($config['notifications']['smtp']['disable']);
+ }
// System Sounds
- if($_POST['disablebeep'] == "yes")
+ if ($_POST['disablebeep'] == "yes") {
$config['system']['disablebeep'] = true;
- else
+ } else {
unset($config['system']['disablebeep']);
+ }
write_config();
pfSenseHeader("system_advanced_notifications.php");
@@ -149,8 +167,8 @@ if ($_POST) {
}
if ($_POST['test_growl'] == gettext("Test Growl")) {
// Send test message via growl
- if($config['notifications']['growl']['ipaddress'] &&
- $config['notifications']['growl']['password'] = $_POST['password']) {
+ if ($config['notifications']['growl']['ipaddress'] &&
+ $config['notifications']['growl']['password'] = $_POST['password']) {
unlink_if_exists($g['vardb_path'] . "/growlnotices_lastmsg.txt");
register_via_growl();
notify_via_growl(sprintf(gettext("This is a test message from %s. It is safe to ignore this message."), $g['product_name']), true);
@@ -158,13 +176,14 @@ if ($_POST) {
}
if ($_POST['test_smtp'] == gettext("Test SMTP")) {
// Send test message via smtp
- if(file_exists("/var/db/notices_lastmsg.txt"))
+ if (file_exists("/var/db/notices_lastmsg.txt")) {
unlink("/var/db/notices_lastmsg.txt");
+ }
$savemsg = notify_via_smtp(sprintf(gettext("This is a test message from %s. It is safe to ignore this message."), $g['product_name']), true);
}
}
-$pgtitle = array(gettext("System"),gettext("Advanced: Notifications"));
+$pgtitle = array(gettext("System"), gettext("Advanced: Notifications"));
include("head.inc");
?>
@@ -173,10 +192,12 @@ include("head.inc");
<?php include("fbegin.inc"); ?>
<form action="system_advanced_notifications.php" method="post">
<?php
- if ($input_errors)
+ if ($input_errors) {
print_input_errors($input_errors);
- if ($savemsg)
+ }
+ if ($savemsg) {
print_info_box($savemsg);
+ }
?>
</form>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="system advanced notifications">
@@ -217,7 +238,7 @@ include("head.inc");
<?=gettext("Enter the name to register with the Growl server (default: PHP-Growl)."); ?>
</td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Notification Name"); ?></td>
<td width="78%" class="vtable">
<input name='notification_name' value='<?php echo htmlspecialchars($pconfig['notification_name']); ?>' /><br />
@@ -249,7 +270,7 @@ include("head.inc");
</tr>
<tr>
<td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
+ </tr>
<!-- SMTP -->
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("SMTP E-Mail"); ?></td>
@@ -317,10 +338,11 @@ include("head.inc");
<?php
foreach ($smtp_authentication_mechanisms as $name => $desc):
$selected = "";
- if ($pconfig['smtpauthmech'] == $name)
+ if ($pconfig['smtpauthmech'] == $name) {
$selected = "selected=\"selected\"";
+ }
?>
- <option value="<?=$name;?>" <?=$selected;?>><?=$desc;?></option>
+ <option value="<?=$name;?>" <?=$selected;?>><?=$desc;?></option>
<?php endforeach; ?>
</select>
<br />
@@ -338,7 +360,7 @@ include("head.inc");
</tr>
<tr>
<td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
+ </tr>
<!-- System Sounds -->
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("System Sounds"); ?></td>
@@ -354,7 +376,7 @@ include("head.inc");
</tr>
<tr>
<td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
+ </tr>
<tr>
<td valign="top" class="">
&nbsp;
diff --git a/usr/local/www/system_advanced_sysctl.php b/usr/local/www/system_advanced_sysctl.php
index 9d93850..b9abd99 100644
--- a/usr/local/www/system_advanced_sysctl.php
+++ b/usr/local/www/system_advanced_sysctl.php
@@ -47,22 +47,27 @@ require("guiconfig.inc");
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_advanced_sysctl.php');
-if (!is_array($config['sysctl']))
+if (!is_array($config['sysctl'])) {
$config['sysctl'] = array();
-if (!is_array($config['sysctl']['item']))
+}
+if (!is_array($config['sysctl']['item'])) {
$config['sysctl']['item'] = array();
+}
$a_tunable = &$config['sysctl']['item'];
$tunables = system_get_sysctls();
-if (isset($_GET['id']))
+if (isset($_GET['id'])) {
$id = htmlspecialchars_decode($_GET['id']);
-if (isset($_POST['id']))
+}
+if (isset($_POST['id'])) {
$id = htmlspecialchars_decode($_POST['id']);
+}
$act = $_GET['act'];
-if (isset($_POST['act']))
+if (isset($_POST['act'])) {
$act = $_POST['act'];
+}
if ($act == "edit") {
if (isset($a_tunable[$id])) {
@@ -79,7 +84,7 @@ if ($act == "edit") {
if ($act == "del") {
if ($a_tunable[$id]) {
/* if this is an AJAX caller then handle via JSON */
- if(isAjax() && is_array($input_errors)) {
+ if (isAjax() && is_array($input_errors)) {
input_errors2Ajax($input_errors);
exit;
}
@@ -106,7 +111,7 @@ if ($_POST) {
if ($_POST['apply']) {
$retval = 0;
- system_setup_sysctl();
+ system_setup_sysctl();
$savemsg = get_std_save_message($retval);
clear_subsystem_dirty('sysctl');
}
@@ -118,10 +123,11 @@ if ($_POST) {
$tunableent['value'] = $_POST['value'];
$tunableent['descr'] = $_POST['descr'];
- if (isset($id) && isset($a_tunable[$id]))
+ if (isset($id) && isset($a_tunable[$id])) {
$a_tunable[$id] = $tunableent;
- else
+ } else {
$a_tunable[] = $tunableent;
+ }
mark_subsystem_dirty('sysctl');
@@ -129,10 +135,10 @@ if ($_POST) {
pfSenseHeader("system_advanced_sysctl.php");
exit;
- }
+ }
}
-$pgtitle = array(gettext("System"),gettext("Advanced: System Tunables"));
+$pgtitle = array(gettext("System"), gettext("Advanced: System Tunables"));
include("head.inc");
?>
@@ -141,12 +147,15 @@ include("head.inc");
<?php include("fbegin.inc"); ?>
<form action="system_advanced_sysctl.php" method="post">
<?php
- if ($input_errors)
+ if ($input_errors) {
print_input_errors($input_errors);
- if ($savemsg)
+ }
+ if ($savemsg) {
print_info_box($savemsg);
- if (is_subsystem_dirty('sysctl') && ($act != "edit" ))
+ }
+ if (is_subsystem_dirty('sysctl') && ($act != "edit")) {
print_info_box_np(gettext("The firewall tunables have changed. You must apply the configuration to take affect."));
+ }
?>
</form>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="system advanced tunables">
@@ -164,7 +173,7 @@ include("head.inc");
?>
</td>
</tr>
- <?php if ($act != "edit" ): ?>
+ <?php if ($act != "edit"): ?>
<tr>
<td id="mainarea">
<div class="tabcont">
@@ -184,8 +193,9 @@ include("head.inc");
</tr>
<?php foreach ($tunables as $i => $tunable):
- if (!isset($tunable['modified']))
+ if (!isset($tunable['modified'])) {
$i = $tunable['tunable'];
+ }
?>
<tr>
<td class="listlr" ondblclick="document.location='system_advanced_sysctl.php?act=edit&amp;id=<?=$i;?>';">
@@ -196,9 +206,10 @@ include("head.inc");
</td>
<td class="listr" align="left" ondblclick="document.location='system_advanced_sysctl.php?act=edit&amp;id=<?=$i;?>';">
<?php echo $tunable['value']; ?>
- <?php
- if($tunable['value'] == "default")
- echo "(" . get_default_sysctl_value($tunable['tunable']) . ")";
+ <?php
+ if ($tunable['value'] == "default") {
+ echo "(" . get_default_sysctl_value($tunable['tunable']) . ")";
+ }
?>
</td>
<td class="list nowrap">
@@ -222,7 +233,7 @@ include("head.inc");
</tr>
<?php endforeach; unset($tunables); ?>
<tr>
- <td class="list" colspan="3">
+ <td class="list" colspan="3">
</td>
<td class="list">
<table border="0" cellspacing="0" cellpadding="1" summary="edit">
diff --git a/usr/local/www/system_authservers.php b/usr/local/www/system_authservers.php
index 2588dda..3834916 100644
--- a/usr/local/www/system_authservers.php
+++ b/usr/local/www/system_authservers.php
@@ -45,25 +45,31 @@ require_once("auth.inc");
$pgtitle = array(gettext("System"), gettext("Authentication Servers"));
$shortcut_section = "authentication";
-if (is_numericint($_GET['id']))
+if (is_numericint($_GET['id'])) {
$id = $_GET['id'];
-if (isset($_POST['id']) && is_numericint($_POST['id']))
+}
+if (isset($_POST['id']) && is_numericint($_POST['id'])) {
$id = $_POST['id'];
+}
-if (!is_array($config['system']['authserver']))
+if (!is_array($config['system']['authserver'])) {
$config['system']['authserver'] = array();
+}
$a_servers = auth_get_authserver_list();
-foreach ($a_servers as $servers)
+foreach ($a_servers as $servers) {
$a_server[] = $servers;
+}
-if (!is_array($config['ca']))
- $config['ca'] = array();
+if (!is_array($config['ca'])) {
+ $config['ca'] = array();
+}
$a_ca =& $config['ca'];
$act = $_GET['act'];
-if ($_POST['act'])
+if ($_POST['act']) {
$act = $_POST['act'];
+}
if ($act == "del") {
@@ -75,15 +81,15 @@ if ($act == "del") {
/* Remove server from main list. */
$serverdeleted = $a_server[$_GET['id']]['name'];
foreach ($config['system']['authserver'] as $k => $as) {
- if ($config['system']['authserver'][$k]['name'] == $serverdeleted)
+ if ($config['system']['authserver'][$k]['name'] == $serverdeleted) {
unset($config['system']['authserver'][$k]);
+ }
}
/* Remove server from temp list used later on this page. */
unset($a_server[$_GET['id']]);
- $savemsg = gettext("Authentication Server")." ". htmlspecialchars($serverdeleted) ." ".
- gettext("deleted")."<br />";
+ $savemsg = gettext("Authentication Server") . " " . htmlspecialchars($serverdeleted) . " " . gettext("deleted") . "<br />";
write_config($savemsg);
}
@@ -112,8 +118,9 @@ if ($act == "edit") {
$pconfig['ldap_utf8'] = isset($a_server[$id]['ldap_utf8']);
$pconfig['ldap_nostrip_at'] = isset($a_server[$id]['ldap_nostrip_at']);
- if (!$pconfig['ldap_binddn'] || !$pconfig['ldap_bindpw'])
+ if (!$pconfig['ldap_binddn'] || !$pconfig['ldap_bindpw']) {
$pconfig['ldap_anon'] = true;
+ }
}
if ($pconfig['type'] == "radius") {
@@ -124,18 +131,18 @@ if ($act == "edit") {
$pconfig['radius_timeout'] = $a_server[$id]['radius_timeout'];
if ($pconfig['radius_auth_port'] &&
- $pconfig['radius_acct_port'] ) {
+ $pconfig['radius_acct_port']) {
$pconfig['radius_srvcs'] = "both";
}
- if ( $pconfig['radius_auth_port'] &&
- !$pconfig['radius_acct_port'] ) {
+ if ($pconfig['radius_auth_port'] &&
+ !$pconfig['radius_acct_port']) {
$pconfig['radius_srvcs'] = "auth";
$pconfig['radius_acct_port'] = 1813;
}
if (!$pconfig['radius_auth_port'] &&
- $pconfig['radius_acct_port'] ) {
+ $pconfig['radius_acct_port']) {
$pconfig['radius_srvcs'] = "acct";
$pconfig['radius_auth_port'] = 1812;
}
@@ -159,9 +166,10 @@ if ($_POST) {
/* input validation */
if ($pconfig['type'] == "ldap") {
- $reqdfields = explode(" ", "name type ldap_host ldap_port ".
- "ldap_urltype ldap_protver ldap_scope ".
- "ldap_attr_user ldap_attr_group ldap_attr_member ldapauthcontainers");
+ $reqdfields = explode(" ",
+ "name type ldap_host ldap_port " .
+ "ldap_urltype ldap_protver ldap_scope " .
+ "ldap_attr_user ldap_attr_group ldap_attr_member ldapauthcontainers");
$reqdfieldsn = array(
gettext("Descriptive name"),
gettext("Type"),
@@ -192,13 +200,13 @@ if ($_POST) {
gettext("Services"));
if ($pconfig['radisu_srvcs'] == "both" ||
- $pconfig['radisu_srvcs'] == "auth") {
+ $pconfig['radisu_srvcs'] == "auth") {
$reqdfields[] = "radius_auth_port";
$reqdfieldsn[] = gettext("Authentication port value");
}
if ($pconfig['radisu_srvcs'] == "both" ||
- $pconfig['radisu_srvcs'] == "acct") {
+ $pconfig['radisu_srvcs'] == "acct") {
$reqdfields[] = "radius_acct_port";
$reqdfieldsn[] = gettext("Accounting port value");
}
@@ -211,14 +219,17 @@ if ($_POST) {
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
- if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['host']))
+ if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['host'])) {
$input_errors[] = gettext("The host name contains invalid characters.");
+ }
- if (auth_get_authserver($pconfig['name']) && !isset($id))
+ if (auth_get_authserver($pconfig['name']) && !isset($id)) {
$input_errors[] = gettext("An authentication server with the same name already exists.");
+ }
- if (($pconfig['type'] == "radius") && isset($_POST['radius_timeout']) && !empty($_POST['radius_timeout']) && (!is_numeric($_POST['radius_timeout']) || (is_numeric($_POST['radius_timeout']) && ($_POST['radius_timeout'] <= 0))))
+ if (($pconfig['type'] == "radius") && isset($_POST['radius_timeout']) && !empty($_POST['radius_timeout']) && (!is_numeric($_POST['radius_timeout']) || (is_numeric($_POST['radius_timeout']) && ($_POST['radius_timeout'] <= 0)))) {
$input_errors[] = gettext("RADIUS Timeout value must be numeric and positive.");
+ }
/* if this is an AJAX caller then handle via JSON */
if (isAjax() && is_array($input_errors)) {
@@ -229,16 +240,18 @@ if ($_POST) {
if (!$input_errors) {
$server = array();
$server['refid'] = uniqid();
- if (isset($id) && $a_server[$id])
+ if (isset($id) && $a_server[$id]) {
$server = $a_server[$id];
+ }
$server['type'] = $pconfig['type'];
$server['name'] = $pconfig['name'];
if ($server['type'] == "ldap") {
- if (!empty($pconfig['ldap_caref']))
+ if (!empty($pconfig['ldap_caref'])) {
$server['ldap_caref'] = $pconfig['ldap_caref'];
+ }
$server['host'] = $pconfig['ldap_host'];
$server['ldap_port'] = $pconfig['ldap_port'];
$server['ldap_urltype'] = $pconfig['ldap_urltype'];
@@ -251,14 +264,16 @@ if ($_POST) {
$server['ldap_attr_user'] = $pconfig['ldap_attr_user'];
$server['ldap_attr_group'] = $pconfig['ldap_attr_group'];
$server['ldap_attr_member'] = $pconfig['ldap_attr_member'];
- if ($pconfig['ldap_utf8'] == "yes")
+ if ($pconfig['ldap_utf8'] == "yes") {
$server['ldap_utf8'] = true;
- else
+ } else {
unset($server['ldap_utf8']);
- if ($pconfig['ldap_nostrip_at'] == "yes")
+ }
+ if ($pconfig['ldap_nostrip_at'] == "yes") {
$server['ldap_nostrip_at'] = true;
- else
+ } else {
unset($server['ldap_nostrip_at']);
+ }
if (!$pconfig['ldap_anon']) {
@@ -274,13 +289,15 @@ if ($_POST) {
$server['host'] = $pconfig['radius_host'];
- if ($pconfig['radius_secret'])
+ if ($pconfig['radius_secret']) {
$server['radius_secret'] = $pconfig['radius_secret'];
+ }
- if ($pconfig['radius_timeout'])
+ if ($pconfig['radius_timeout']) {
$server['radius_timeout'] = $pconfig['radius_timeout'];
- else
+ } else {
$server['radius_timeout'] = 5;
+ }
if ($pconfig['radius_srvcs'] == "both") {
$server['radius_auth_port'] = $pconfig['radius_auth_port'];
@@ -298,10 +315,11 @@ if ($_POST) {
}
}
- if (isset($id) && $config['system']['authserver'][$id])
+ if (isset($id) && $config['system']['authserver'][$id]) {
$config['system']['authserver'][$id] = $server;
- else
+ } else {
$config['system']['authserver'][] = $server;
+ }
write_config();
@@ -325,7 +343,7 @@ function server_typechange(typ) {
typ = document.getElementById("type").options[idx].value;
}
- switch (typ) {
+ switch (typ) {
case "ldap":
document.getElementById("ldap").style.display="";
document.getElementById("radius").style.display="none";
@@ -338,7 +356,7 @@ function server_typechange(typ) {
}
function ldap_urlchange() {
- switch (document.getElementById("ldap_urltype").selectedIndex) {
+ switch (document.getElementById("ldap_urltype").selectedIndex) {
<?php
$index = 0;
foreach ($ldap_urltypes as $urltype => $urlport):
@@ -355,14 +373,15 @@ function ldap_urlchange() {
function ldap_bindchange() {
- if (document.getElementById("ldap_anon").checked)
+ if (document.getElementById("ldap_anon").checked) {
document.getElementById("ldap_bind").style.display="none";
- else
+ } else {
document.getElementById("ldap_bind").style.display="";
+ }
}
-function ldap_tmplchange(){
- switch (document.getElementById("ldap_tmpltype").selectedIndex) {
+function ldap_tmplchange() {
+ switch (document.getElementById("ldap_tmpltype").selectedIndex) {
<?php
$index = 0;
foreach ($ldap_templates as $tmpldata):
@@ -379,8 +398,8 @@ function ldap_tmplchange(){
}
}
-function radius_srvcschange(){
- switch (document.getElementById("radius_srvcs").selectedIndex) {
+function radius_srvcschange() {
+ switch (document.getElementById("radius_srvcs").selectedIndex) {
case 0: // both
document.getElementById("radius_auth").style.display="";
document.getElementById("radius_acct").style.display="";
@@ -408,19 +427,19 @@ function select_clicked() {
if (!document.getElementById("ldap_anon").checked) {
if (document.getElementById("ldap_binddn").value == '' ||
document.getElementById("ldap_bindpw").value == '') {
- alert("<?=gettext("Please fill the bind username/password.");?>");
+ alert("<?=gettext("Please fill the bind username/password.");?>");
return;
}
}
- var url = 'system_usermanager_settings_ldapacpicker.php?';
- url += 'port=' + document.getElementById("ldap_port").value;
- url += '&host=' + document.getElementById("ldap_host").value;
- url += '&scope=' + document.getElementById("ldap_scope").value;
- url += '&basedn=' + document.getElementById("ldap_basedn").value;
- url += '&binddn=' + document.getElementById("ldap_binddn").value;
- url += '&bindpw=' + document.getElementById("ldap_bindpw").value;
- url += '&urltype=' + document.getElementById("ldap_urltype").value;
- url += '&proto=' + document.getElementById("ldap_protver").value;
+ var url = 'system_usermanager_settings_ldapacpicker.php?';
+ url += 'port=' + document.getElementById("ldap_port").value;
+ url += '&host=' + document.getElementById("ldap_host").value;
+ url += '&scope=' + document.getElementById("ldap_scope").value;
+ url += '&basedn=' + document.getElementById("ldap_basedn").value;
+ url += '&binddn=' + document.getElementById("ldap_binddn").value;
+ url += '&bindpw=' + document.getElementById("ldap_bindpw").value;
+ url += '&urltype=' + document.getElementById("ldap_urltype").value;
+ url += '&proto=' + document.getElementById("ldap_protver").value;
url += '&authcn=' + document.getElementById("ldapauthcontainers").value;
<?php if (count($a_ca) > 0): ?>
url += '&cert=' + document.getElementById("ldap_caref").value;
@@ -428,17 +447,20 @@ function select_clicked() {
url += '&cert=';
<?php endif; ?>
- var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
- if (oWin==null || typeof(oWin)=="undefined")
- alert("<?=gettext('Popup blocker detected. Action aborted.');?>");
+ var oWin = window.open(url, "pfSensePop", "width=620,height=400,top=150,left=150");
+ if (oWin == null || typeof(oWin) == "undefined") {
+ alert("<?=gettext('Popup blocker detected. Action aborted.');?>");
+ }
}
//]]>
</script>
<?php
- if ($input_errors)
+ if ($input_errors) {
print_input_errors($input_errors);
- if ($savemsg)
+ }
+ if ($savemsg) {
print_info_box($savemsg);
+ }
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="auth servers">
<tr>
@@ -467,9 +489,9 @@ function select_clicked() {
<?php if (!isset($id)): ?>
<input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>"/>
<?php else: ?>
- <strong><?=htmlspecialchars($pconfig['name']);?></strong>
- <input name='name' type='hidden' id='name' value="<?=htmlspecialchars($pconfig['name']);?>"/>
- <?php endif; ?>
+ <strong><?=htmlspecialchars($pconfig['name']);?></strong>
+ <input name='name' type='hidden' id='name' value="<?=htmlspecialchars($pconfig['name']);?>"/>
+ <?php endif; ?>
</td>
</tr>
<tr>
@@ -478,10 +500,11 @@ function select_clicked() {
<?php if (!isset($id)): ?>
<select name='type' id='type' class="formselect" onchange='server_typechange()'>
<?php
- foreach ($auth_server_types as $typename => $typedesc ):
+ foreach ($auth_server_types as $typename => $typedesc):
$selected = "";
- if ($pconfig['type'] == $typename)
+ if ($pconfig['type'] == $typename) {
$selected = "selected=\"selected\"";
+ }
?>
<option value="<?=$typename;?>" <?=$selected;?>><?=$typedesc;?></option>
<?php endforeach; ?>
@@ -521,8 +544,9 @@ function select_clicked() {
<?php
foreach ($ldap_urltypes as $urltype => $urlport):
$selected = "";
- if ($pconfig['ldap_urltype'] == $urltype)
+ if ($pconfig['ldap_urltype'] == $urltype) {
$selected = "selected=\"selected\"";
+ }
?>
<option value="<?=$urltype;?>" <?=$selected;?>><?=$urltype;?></option>
<?php endforeach; ?>
@@ -531,24 +555,25 @@ function select_clicked() {
</tr>
<tr id="tls_ca">
<td width="22%" valign="top" class="vncell"><?=gettext("Peer Certificate Authority"); ?></td>
- <td width="78%" class="vtable">
- <?php if (count($a_ca)): ?>
+ <td width="78%" class="vtable">
+ <?php if (count($a_ca)): ?>
<select id='ldap_caref' name='ldap_caref' class="formselect">
- <?php
- foreach ($a_ca as $ca):
- $selected = "";
- if ($pconfig['ldap_caref'] == $ca['refid'])
- $selected = "selected=\"selected\"";
- ?>
+ <?php
+ foreach ($a_ca as $ca):
+ $selected = "";
+ if ($pconfig['ldap_caref'] == $ca['refid']) {
+ $selected = "selected=\"selected\"";
+ }
+ ?>
<option value="<?=$ca['refid'];?>" <?=$selected;?>><?=$ca['descr'];?></option>
- <?php endforeach; ?>
+ <?php endforeach; ?>
</select>
<br /><span><?=gettext("This option is used if 'SSL Encrypted' option is choosen.");?> <br />
<?=gettext("It must match with the CA in the AD otherwise problems will arise.");?></span>
- <?php else: ?>
- <b>No Certificate Authorities defined.</b> <br />Create one under <a href="system_camanager.php">System &gt; Cert Manager</a>.
- <?php endif; ?>
- </td>
+ <?php else: ?>
+ <b>No Certificate Authorities defined.</b> <br />Create one under <a href="system_camanager.php">System &gt; Cert Manager</a>.
+ <?php endif; ?>
+ </td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Protocol version");?></td>
@@ -557,8 +582,9 @@ function select_clicked() {
<?php
foreach ($ldap_protvers as $version):
$selected = "";
- if ($pconfig['ldap_protver'] == $version)
+ if ($pconfig['ldap_protver'] == $version) {
$selected = "selected=\"selected\"";
+ }
?>
<option value="<?=$version;?>" <?=$selected;?>><?=$version;?></option>
<?php endforeach; ?>
@@ -576,8 +602,9 @@ function select_clicked() {
<?php
foreach ($ldap_scopes as $scopename => $scopedesc):
$selected = "";
- if ($pconfig['ldap_scope'] == $scopename)
+ if ($pconfig['ldap_scope'] == $scopename) {
$selected = "selected=\"selected\"";
+ }
?>
<option value="<?=$scopename;?>" <?=$selected;?>><?=$scopedesc;?></option>
<?php endforeach; ?>
@@ -591,7 +618,6 @@ function select_clicked() {
</td>
</tr>
</table>
-
</td>
</tr>
<tr>
@@ -668,8 +694,9 @@ function select_clicked() {
<?php
foreach ($ldap_templates as $tmplname => $tmpldata):
$selected = "";
- if ($pconfig['ldap_template'] == $tmplname)
+ if ($pconfig['ldap_template'] == $tmplname) {
$selected = "selected=\"selected\"";
+ }
?>
<option value="<?=$tmplname;?>" <?=$selected;?>><?=$tmpldata['desc'];?></option>
<?php endforeach; ?>
@@ -753,8 +780,9 @@ function select_clicked() {
<?php
foreach ($radius_srvcs as $srvcname => $srvcdesc):
$selected = "";
- if ($pconfig['radius_srvcs'] == $srvcname)
+ if ($pconfig['radius_srvcs'] == $srvcname) {
$selected = "selected=\"selected\"";
+ }
?>
<option value="<?=$srvcname;?>" <?=$selected;?>><?=$srvcdesc;?></option>
<?php endforeach; ?>
@@ -828,7 +856,7 @@ function select_clicked() {
<tbody>
<?php
$i = 0;
- foreach($a_server as $server):
+ foreach ($a_server as $server):
$name = htmlspecialchars($server['name']);
$type = htmlspecialchars($auth_server_types[$server['type']]);
$host = htmlspecialchars($server['host']);
@@ -850,7 +878,8 @@ function select_clicked() {
</td>
</tr>
<?php
- $i++; endforeach;
+ $i++;
+ endforeach;
?>
</tbody>
</table>
@@ -867,8 +896,9 @@ function select_clicked() {
server_typechange('<?=htmlspecialchars($pconfig['type']);?>');
<?php if (!isset($id) || $pconfig['type'] == "ldap"): ?>
ldap_bindchange();
-if (document.getElementById("ldap_port").value == "")
+if (document.getElementById("ldap_port").value == "") {
ldap_urlchange();
+}
<?php if (!isset($id)): ?>
ldap_tmplchange();
<?php endif; ?>
OpenPOWER on IntegriCloud