summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarren Baker <warren@decoy.co.za>2014-11-03 10:37:27 +0200
committerWarren Baker <warren@decoy.co.za>2014-11-03 12:03:08 +0200
commitbe11b6f1b88c6bf5880a9eb7b41759b62b1cf403 (patch)
tree7351c9d3d1f42fcff7cc2c899d097efd67ec8d3d
parent0a89d05955987e0b991c18f740aa8c79fbb5ddfe (diff)
downloadpfsense-be11b6f1b88c6bf5880a9eb7b41759b62b1cf403.zip
pfsense-be11b6f1b88c6bf5880a9eb7b41759b62b1cf403.tar.gz
Add braces
-rw-r--r--usr/local/www/services_unbound.php110
-rw-r--r--usr/local/www/services_unbound_acls.php48
-rw-r--r--usr/local/www/services_unbound_advanced.php55
3 files changed, 135 insertions, 78 deletions
diff --git a/usr/local/www/services_unbound.php b/usr/local/www/services_unbound.php
index 88634ef..b23cb4d 100644
--- a/usr/local/www/services_unbound.php
+++ b/usr/local/www/services_unbound.php
@@ -41,42 +41,56 @@
require_once("guiconfig.inc");
require_once("unbound.inc");
-if (!is_array($config['unbound']))
+if (!is_array($config['unbound'])) {
$config['unbound'] = array();
+}
+
$a_unboundcfg =& $config['unbound'];
-if (!is_array($config['unbound']['hosts']))
+if (!is_array($config['unbound']['hosts'])) {
$config['unbound']['hosts'] = array();
+}
+
$a_hosts =& $config['unbound']['hosts'];
-if (!is_array($config['unbound']['domainoverrides']))
+if (!is_array($config['unbound']['domainoverrides'])) {
$config['unbound']['domainoverrides'] = array();
+}
+
$a_domainOverrides = &$config['unbound']['domainoverrides'];
-if (isset($config['unbound']['enable']))
- $pconfig['enable'] = true;
-if (isset($config['unbound']['dnssec']))
- $pconfig['dnssec'] = true;
-if (isset($config['unbound']['forwarding']))
- $pconfig['forwarding'] = true;
-if (isset($config['unbound']['regdhcp']))
- $pconfig['regdhcp'] = true;
-if (isset($config['unbound']['regdhcpstatic']))
- $pconfig['regdhcpstatic'] = true;
-if (isset($config['unbound']['txtsupport']))
- $pconfig['txtsupport'] = true;
+if (isset($config['unbound']['enable'])) {
+ $pconfig['enable'] = true;
+}
+if (isset($config['unbound']['dnssec'])) {
+ $pconfig['dnssec'] = true;
+}
+if (isset($config['unbound']['forwarding'])) {
+ $pconfig['forwarding'] = true;
+}
+if (isset($config['unbound']['regdhcp'])) {
+ $pconfig['regdhcp'] = true;
+}
+if (isset($config['unbound']['regdhcpstatic'])) {
+ $pconfig['regdhcpstatic'] = true;
+}
+if (isset($config['unbound']['txtsupport'])) {
+ $pconfig['txtsupport'] = true;
+}
$pconfig['port'] = $config['unbound']['port'];
$pconfig['custom_options'] = $config['unbound']['custom_options'];
-if (empty($config['unbound']['active_interface']))
+if (empty($config['unbound']['active_interface'])) {
$pconfig['active_interface'] = array();
-else
+} else {
$pconfig['active_interface'] = explode(",", $config['unbound']['active_interface']);
-if (empty($config['unbound']['outgoing_interface']))
+}
+if (empty($config['unbound']['outgoing_interface'])) {
$pconfig['outgoing_interface'] = array();
-else
+} else {
$pconfig['outgoing_interface'] = explode(",", $config['unbound']['outgoing_interface']);
+}
if ($_POST) {
$pconfig = $_POST;
@@ -85,57 +99,71 @@ if ($_POST) {
if ($_POST['apply']) {
$retval = services_unbound_configure();
$savemsg = get_std_save_message($retval);
- if ($retval == 0)
+ if ($retval == 0) {
clear_subsystem_dirty('unbound');
+ }
/* Update resolv.conf in case the interface bindings exclude localhost. */
system_resolvconf_generate();
} else {
- if (isset($_POST['enable']) && isset($config['dnsmasq']['enable']))
+ if (isset($_POST['enable']) && isset($config['dnsmasq']['enable'])) {
$input_errors[] = "The system dns-forwarder is still active. Disable it before enabling the DNS Resolver.";
+ }
- if (empty($_POST['active_interface']))
+ if (empty($_POST['active_interface'])) {
$input_errors[] = "A single network interface needs to be selected for the DNS Resolver to bind to.";
+ }
- if (empty($_POST['outgoing_interface']))
+ if (empty($_POST['outgoing_interface'])) {
$input_errors[] = "A single outgoing network interface needs to be selected for the DNS Resolver to use for outgoing DNS requests.";
+ }
- if ($_POST['port'])
- if (is_port($_POST['port']))
+ if ($_POST['port']) {
+ if (is_port($_POST['port'])) {
$a_unboundcfg['port'] = $_POST['port'];
- else
+ } else {
$input_errors[] = gettext("You must specify a valid port number.");
- else if (isset($config['unbound']['port']))
+ }
+ } else if (isset($config['unbound']['port'])) {
unset($config['unbound']['port']);
+ }
- if (isset($_POST['enable']))
+ if (isset($_POST['enable'])) {
$a_unboundcfg['enable'] = true;
- else
+ } else {
unset($a_unboundcfg['enable']);
- if (isset($_POST['dnssec']))
+ }
+ if (isset($_POST['dnssec'])) {
$a_unboundcfg['dnssec'] = true;
- else
+ } else {
unset($a_unboundcfg['dnssec']);
- if (isset($_POST['forwarding']))
+ }
+ if (isset($_POST['forwarding'])) {
$a_unboundcfg['forwarding'] = true;
- else
+ } else {
unset($a_unboundcfg['forwarding']);
- if (isset($_POST['regdhcp']))
+ }
+ if (isset($_POST['regdhcp'])) {
$a_unboundcfg['regdhcp'] = true;
- else
+ } else {
unset($a_unboundcfg['regdhcp']);
- if (isset($_POST['regdhcpstatic']))
+ }
+ if (isset($_POST['regdhcpstatic'])) {
$a_unboundcfg['regdhcpstatic'] = true;
- else
+ } else {
unset($a_unboundcfg['regdhcpstatic']);
- if (isset($_POST['txtsupport']))
+ }
+ if (isset($_POST['txtsupport'])) {
$a_unboundcfg['txtsupport'] = true;
- else
+ } else {
unset($a_unboundcfg['txtsupport']);
- if (is_array($_POST['active_interface']) && !empty($_POST['active_interface']))
+ }
+ if (is_array($_POST['active_interface']) && !empty($_POST['active_interface'])) {
$a_unboundcfg['active_interface'] = implode(",", $_POST['active_interface']);
+ }
- if (is_array($_POST['outgoing_interface']) && !empty($_POST['outgoing_interface']))
+ if (is_array($_POST['outgoing_interface']) && !empty($_POST['outgoing_interface'])) {
$a_unboundcfg['outgoing_interface'] = implode(",", $_POST['outgoing_interface']);
+ }
$a_unboundcfg['custom_options'] = str_replace("\r\n", "\n", $_POST['custom_options']);
diff --git a/usr/local/www/services_unbound_acls.php b/usr/local/www/services_unbound_acls.php
index 6ec2250..c7568c1 100644
--- a/usr/local/www/services_unbound_acls.php
+++ b/usr/local/www/services_unbound_acls.php
@@ -34,18 +34,21 @@ require("unbound.inc");
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_unbound_acls.php');
-if (!is_array($config['unbound']['acls']))
+if (!is_array($config['unbound']['acls'])) {
$config['unbound']['acls'] = array();
+}
$a_acls = &$config['unbound']['acls'];
$id = $_GET['id'];
-if (isset($_POST['aclid']))
+if (isset($_POST['aclid'])) {
$id = $_POST['aclid'];
+}
$act = $_GET['act'];
-if (isset($_POST['act']))
+if (isset($_POST['act'])) {
$act = $_POST['act'];
+}
if ($act == "del") {
if (!$a_acls[$id]) {
@@ -87,21 +90,26 @@ if ($_POST) {
$networkacl[$x]['acl_network'] = $pconfig["acl_network{$x}"];
$networkacl[$x]['mask'] = $pconfig["mask{$x}"];
$networkacl[$x]['description'] = $pconfig["description{$x}"];
- if (!is_ipaddr($networkacl[$x]['acl_network']))
+ if (!is_ipaddr($networkacl[$x]['acl_network'])) {
$input_errors[] = gettext("You must enter a valid network IP address for {$networkacl[$x]['acl_network']}.");
+ }
if (is_ipaddr($networkacl[$x]['acl_network'])) {
- if (!is_subnet($networkacl[$x]['acl_network']."/".$networkacl[$x]['mask']))
+ if (!is_subnet($networkacl[$x]['acl_network']."/".$networkacl[$x]['mask'])) {
$input_errors[] = gettext("You must enter a valid IPv4 netmask for {$networkacl[$x]['acl_network']}/{$networkacl[$x]['mask']}.");
+ }
} else if (function_exists("is_ipaddrv6")) {
- if (!is_ipaddrv6($networkacl[$x]['acl_network']))
+ if (!is_ipaddrv6($networkacl[$x]['acl_network'])) {
$input_errors[] = gettext("You must enter a valid IPv6 address for {$networkacl[$x]['acl_network']}.");
- else if (!is_subnetv6($networkacl[$x]['acl_network']."/".$networkacl[$x]['mask']))
+ } else if (!is_subnetv6($networkacl[$x]['acl_network']."/".$networkacl[$x]['mask'])) {
$input_errors[] = gettext("You must enter a valid IPv6 netmask for {$networkacl[$x]['acl_network']}/{$networkacl[$x]['mask']}.");
- } else
+ }
+ } else {
$input_errors[] = gettext("You must enter a valid IPv4 address for {$networkacl[$x]['acl_network']}.");
- } else if (isset($networkacl[$x]))
+ }
+ } else if (isset($networkacl[$x])) {
unset($networkacl[$x]);
+ }
}
if (!$input_errors) {
@@ -113,14 +121,15 @@ if ($_POST) {
$acl_entry['description'] = $pconfig['description'];
$acl_entry['aclid'] = $pconfig['aclid'];
$acl_entry['row'] = array();
- foreach ($networkacl as $acl)
+ foreach ($networkacl as $acl) {
$acl_entry['row'][] = $acl;
+ }
- if (isset($id) && $a_acls[$id])
+ if (isset($id) && $a_acls[$id]) {
$a_acls[$id] = $acl_entry;
- else
+ } else {
$a_acls[] = $acl_entry;
-
+ }
mark_subsystem_dirty("unbound");
write_config();
@@ -164,17 +173,22 @@ include("head.inc");
<?php include("fbegin.inc"); ?>
<form action="services_unbound_acls.php" method="post" name="iform" id="iform">
<?php
-if (!$savemsg)
+if (!$savemsg) {
$savemsg = "";
+}
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg);
+}
-if (is_subsystem_dirty("unbound"))
+if (is_subsystem_dirty("unbound")) {
print_info_box_np(gettext("The settings for the DNS Resolver have changed. You must apply the configuration to take affect."));
+}
+
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="services unbound acls">
<tbody>
diff --git a/usr/local/www/services_unbound_advanced.php b/usr/local/www/services_unbound_advanced.php
index b0b77a7..9640074 100644
--- a/usr/local/www/services_unbound_advanced.php
+++ b/usr/local/www/services_unbound_advanced.php
@@ -41,21 +41,29 @@
require_once("guiconfig.inc");
require_once("unbound.inc");
-if(!is_array($config['unbound']))
+if(!is_array($config['unbound'])) {
$config['unbound'] = array();
+}
-if (isset($config['unbound']['hideidentity']))
+if (isset($config['unbound']['hideidentity'])) {
$pconfig['hideidentity'] = true;
-if (isset($config['unbound']['hideversion']))
+}
+if (isset($config['unbound']['hideversion'])){
$pconfig['hideversion'] = true;
-if (isset($config['unbound']['prefetch']))
+}
+if (isset($config['unbound']['prefetch'])) {
$pconfig['prefetch'] = true;
-if (isset($config['unbound']['prefetchkey']))
+}
+if (isset($config['unbound']['prefetchkey'])) {
$pconfig['prefetchkey'] = true;
-if (isset($config['unbound']['hardenglue']))
+}
+if (isset($config['unbound']['hardenglue'])) {
$pconfig['hardenglue'] = true;
-if (isset($config['unbound']['dnssecstripped']))
+}
+if (isset($config['unbound']['dnssecstripped'])) {
$pconfig['dnssecstripped'] = true;
+}
+
$pconfig['msgcachesize'] = $config['unbound']['msgcachesize'];
$pconfig['outgoing_num_tcp'] = $config['unbound']['outgoing_num_tcp'];
$pconfig['incoming_num_tcp'] = $config['unbound']['incoming_num_tcp'];
@@ -76,33 +84,40 @@ if ($_POST) {
if ($_POST['apply']) {
$retval = services_unbound_configure();
$savemsg = get_std_save_message($retval);
- if ($retval == 0)
+ if ($retval == 0) {
clear_subsystem_dirty('unbound');
+ }
} else {
- if (isset($_POST['hideidentity']))
+ if (isset($_POST['hideidentity'])) {
$config['unbound']['hideidentity'] = true;
- else
+ } else {
unset($config['unbound']['hideidentity']);
- if (isset($_POST['hideversion']))
+ }
+ if (isset($_POST['hideversion'])) {
$config['unbound']['hideversion'] = true;
- else
+ } else {
unset($config['unbound']['hideversion']);
- if (isset($_POST['prefetch']))
+ }
+ if (isset($_POST['prefetch'])) {
$config['unbound']['prefetch'] = true;
- else
+ } else {
unset($config['unbound']['prefetch']);
- if (isset($_POST['prefetchkey']))
+ }
+ if (isset($_POST['prefetchkey'])) {
$config['unbound']['prefetchkey'] = true;
- else
+ } else {
unset($config['unbound']['prefetchkey']);
- if (isset($_POST['hardenglue']))
+ }
+ if (isset($_POST['hardenglue'])) {
$config['unbound']['hardenglue'] = true;
- else
+ } else {
unset($config['unbound']['hardenglue']);
- if (isset($_POST['dnssecstripped']))
+ }
+ if (isset($_POST['dnssecstripped'])) {
$config['unbound']['dnssecstripped'] = true;
- else
+ } else {
unset($config['unbound']['dnssecstripped']);
+ }
$config['unbound']['msgcachesize'] = $_POST['msgcachesize'];
$config['unbound']['outgoing_num_tcp'] = $_POST['outgoing_num_tcp'];
$config['unbound']['incoming_num_tcp'] = $_POST['incoming_num_tcp'];
OpenPOWER on IntegriCloud