From be11b6f1b88c6bf5880a9eb7b41759b62b1cf403 Mon Sep 17 00:00:00 2001 From: Warren Baker Date: Mon, 3 Nov 2014 10:37:27 +0200 Subject: Add braces --- usr/local/www/services_unbound_acls.php | 48 +++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 17 deletions(-) (limited to 'usr/local/www/services_unbound_acls.php') 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");
-- cgit v1.1 From 1b436de1acea765e75c9155702c9b728153f8f8f Mon Sep 17 00:00:00 2001 From: Warren Baker Date: Mon, 3 Nov 2014 10:39:06 +0200 Subject: Be consistent with the other pages --- usr/local/www/services_unbound_acls.php | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'usr/local/www/services_unbound_acls.php') diff --git a/usr/local/www/services_unbound_acls.php b/usr/local/www/services_unbound_acls.php index c7568c1..9d124e8 100644 --- a/usr/local/www/services_unbound_acls.php +++ b/usr/local/www/services_unbound_acls.php @@ -172,24 +172,12 @@ include("head.inc"); - + +
+" . gettext("You must apply the changes in order for them to take effect."));?>
+ -if ($input_errors) { - print_input_errors($input_errors); -} - -if ($savemsg) { - print_info_box($savemsg); -} - -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.")); -} - -?>
-- cgit v1.1 From a431bfc9e698c753d9a54218af9076184deb6251 Mon Sep 17 00:00:00 2001 From: Warren Baker Date: Mon, 3 Nov 2014 10:40:24 +0200 Subject: Indent better --- usr/local/www/services_unbound_acls.php | 572 ++++++++++++++++---------------- 1 file changed, 286 insertions(+), 286 deletions(-) (limited to 'usr/local/www/services_unbound_acls.php') diff --git a/usr/local/www/services_unbound_acls.php b/usr/local/www/services_unbound_acls.php index 9d124e8..46ae4d3 100644 --- a/usr/local/www/services_unbound_acls.php +++ b/usr/local/www/services_unbound_acls.php @@ -35,111 +35,111 @@ require("unbound.inc"); $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_unbound_acls.php'); if (!is_array($config['unbound']['acls'])) { - $config['unbound']['acls'] = array(); + $config['unbound']['acls'] = array(); } $a_acls = &$config['unbound']['acls']; $id = $_GET['id']; if (isset($_POST['aclid'])) { - $id = $_POST['aclid']; + $id = $_POST['aclid']; } $act = $_GET['act']; if (isset($_POST['act'])) { - $act = $_POST['act']; + $act = $_POST['act']; } if ($act == "del") { - if (!$a_acls[$id]) { - pfSenseHeader("services_unbound_acls.php"); - exit; - } - - unset($a_acls[$id]); - write_config(); - mark_subsystem_dirty('unbound'); + if (!$a_acls[$id]) { + pfSenseHeader("services_unbound_acls.php"); + exit; + } + + unset($a_acls[$id]); + write_config(); + mark_subsystem_dirty('unbound'); } if ($act == "new") { - $id = unbound_get_next_id(); + $id = unbound_get_next_id(); } if ($act == "edit") { - if (isset($id) && $a_acls[$id]) { - $pconfig = $a_acls[$id]; - $networkacl = $a_acls[$id]['row']; - } + if (isset($id) && $a_acls[$id]) { + $pconfig = $a_acls[$id]; + $networkacl = $a_acls[$id]['row']; + } } if ($_POST) { - unset($input_errors); - $pconfig = $_POST; - - if ($_POST['apply']) { - $retval = services_unbound_configure(); - $savemsg = get_std_save_message($retval); - if ($retval == 0) - clear_subsystem_dirty('unbound'); - } else { - - // input validation - only allow 50 entries in a single ACL - for($x=0; $x<50; $x++) { - if (isset($pconfig["acl_network{$x}"])) { - $networkacl[$x] = array(); - $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'])) { - $input_errors[] = gettext("You must enter a valid network IP address for {$networkacl[$x]['acl_network']}."); + unset($input_errors); + $pconfig = $_POST; + + if ($_POST['apply']) { + $retval = services_unbound_configure(); + $savemsg = get_std_save_message($retval); + if ($retval == 0) + clear_subsystem_dirty('unbound'); + } else { + + // input validation - only allow 50 entries in a single ACL + for($x=0; $x<50; $x++) { + if (isset($pconfig["acl_network{$x}"])) { + $networkacl[$x] = array(); + $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'])) { + $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'])) { - $input_errors[] = gettext("You must enter a valid IPv4 netmask for {$networkacl[$x]['acl_network']}/{$networkacl[$x]['mask']}."); + if (is_ipaddr($networkacl[$x]['acl_network'])) { + 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'])) { - $input_errors[] = gettext("You must enter a valid IPv6 address for {$networkacl[$x]['acl_network']}."); + } else if (function_exists("is_ipaddrv6")) { + 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'])) { - $input_errors[] = gettext("You must enter a valid IPv6 netmask for {$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 { - $input_errors[] = gettext("You must enter a valid IPv4 address for {$networkacl[$x]['acl_network']}."); + } else { + $input_errors[] = gettext("You must enter a valid IPv4 address for {$networkacl[$x]['acl_network']}."); } - } else if (isset($networkacl[$x])) { - unset($networkacl[$x]); + } else if (isset($networkacl[$x])) { + unset($networkacl[$x]); } - } - - if (!$input_errors) { - if ($pconfig['Submit'] == gettext("Save")) { - $acl_entry = array(); - $acl_entry['aclid'] = $pconfig['aclid']; - $acl_entry['aclname'] = $pconfig['aclname']; - $acl_entry['aclaction'] = $pconfig['aclaction']; - $acl_entry['description'] = $pconfig['description']; - $acl_entry['aclid'] = $pconfig['aclid']; - $acl_entry['row'] = array(); - foreach ($networkacl as $acl) { - $acl_entry['row'][] = $acl; + } + + if (!$input_errors) { + if ($pconfig['Submit'] == gettext("Save")) { + $acl_entry = array(); + $acl_entry['aclid'] = $pconfig['aclid']; + $acl_entry['aclname'] = $pconfig['aclname']; + $acl_entry['aclaction'] = $pconfig['aclaction']; + $acl_entry['description'] = $pconfig['description']; + $acl_entry['aclid'] = $pconfig['aclid']; + $acl_entry['row'] = array(); + foreach ($networkacl as $acl) { + $acl_entry['row'][] = $acl; } - if (isset($id) && $a_acls[$id]) { - $a_acls[$id] = $acl_entry; + if (isset($id) && $a_acls[$id]) { + $a_acls[$id] = $acl_entry; } else { - $a_acls[] = $acl_entry; + $a_acls[] = $acl_entry; } - mark_subsystem_dirty("unbound"); - write_config(); + mark_subsystem_dirty("unbound"); + write_config(); - pfSenseHeader("/services_unbound_acls.php"); - exit; - } + pfSenseHeader("/services_unbound_acls.php"); + exit; + } - } - } + } + } } $closehead = false; @@ -152,19 +152,19 @@ include("head.inc"); @@ -175,216 +175,216 @@ include("head.inc");
-" . gettext("You must apply the changes in order for them to take effect."));?>
+ " . gettext("You must apply the changes in order for them to take effect."));?>
- - - - - - + +
- -
-
- - - - - - - - - - - - - - - + + + + + - - + + + + + + + + + + + + + + + + + + +
- -
- -
- -
+
+ +
+
+ + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - -
+ +
+ +
+ +

- Deny: This action stops queries from hosts within the netblock defined below.");?>
- Refuse: This action also stops queries from hosts within the netblock defined below, but sends a DNS rcode REFUSED error message back to the client.");?>
- Allow: This action allows queries from hosts within the netblock defined below.");?>
- Allow Snoop: This action allows recursive and nonrecursive access from hosts within the netblock defined below. Used for cache snooping and ideally should only be configured for your administrative host.");?>
+ Deny: This action stops queries from hosts within the netblock defined below.");?>
+ Refuse: This action also stops queries from hosts within the netblock defined below, but sends a DNS rcode REFUSED error message back to the client.");?>
+ Allow: This action allows queries from hosts within the netblock defined below.");?>
+ Allow Snoop: This action allows recursive and nonrecursive access from hosts within the netblock defined below. Used for cache snooping and ideally should only be configured for your administrative host.");?>
-
- - - - - - - - - - - - - - - - - - - -
- - - - - - - delete -
- - " /> - - - -
- -
- -
 
  -  
  - " /> - " onclick="window.location.href=''" /> -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
  - - - - - -
  - " border="0" alt="add" /> -
-
-

- -

-
- - - - - - - - - - - -
- " width="17" height="17" border="0" alt="edit" /> - ')"> - " width="17" height="17" border="0" alt="delete" /> -
-
- -
-
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + delete +
+ + " /> + + + +
+ +
+ +
 
  +  
  + " /> + " onclick="window.location.href=''" /> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
  + + + + + +
  + " border="0" alt="add" /> +
+
+

+ +

+
+ + + + + + + + + + + +
+ " width="17" height="17" border="0" alt="edit" /> + ')"> + " width="17" height="17" border="0" alt="delete" /> +
+
+ +
+
-- cgit v1.1