Project

General

Profile

« Previous | Next » 

Revision be11b6f1

Added by Warren Baker over 10 years ago

Add braces

View differences:

usr/local/www/services_unbound.php
41 41
require_once("guiconfig.inc");
42 42
require_once("unbound.inc");
43 43

  
44
if (!is_array($config['unbound']))
44
if (!is_array($config['unbound'])) {
45 45
	$config['unbound'] = array();
46
}
47

  
46 48
$a_unboundcfg =& $config['unbound'];
47 49

  
48
if (!is_array($config['unbound']['hosts']))
50
if (!is_array($config['unbound']['hosts'])) {
49 51
	$config['unbound']['hosts'] = array();
52
}
53

  
50 54
$a_hosts =& $config['unbound']['hosts'];
51 55

  
52
if (!is_array($config['unbound']['domainoverrides']))
56
if (!is_array($config['unbound']['domainoverrides'])) {
53 57
	$config['unbound']['domainoverrides'] = array();
58
}
59

  
54 60
$a_domainOverrides = &$config['unbound']['domainoverrides'];
55 61

  
56
if (isset($config['unbound']['enable']))
57
	$pconfig['enable'] = true;
58
if (isset($config['unbound']['dnssec']))
59
	$pconfig['dnssec'] = true;
60
if (isset($config['unbound']['forwarding']))
61
	$pconfig['forwarding'] = true;
62
if (isset($config['unbound']['regdhcp']))
63
	$pconfig['regdhcp'] = true;
64
if (isset($config['unbound']['regdhcpstatic']))
65
	$pconfig['regdhcpstatic'] = true;
66
if (isset($config['unbound']['txtsupport']))
67
	$pconfig['txtsupport'] = true;
62
if (isset($config['unbound']['enable'])) {
63
    $pconfig['enable'] = true;
64
}
65
if (isset($config['unbound']['dnssec'])) {
66
    $pconfig['dnssec'] = true;
67
}
68
if (isset($config['unbound']['forwarding'])) {
69
    $pconfig['forwarding'] = true;
70
}
71
if (isset($config['unbound']['regdhcp'])) {
72
    $pconfig['regdhcp'] = true;
73
}
74
if (isset($config['unbound']['regdhcpstatic'])) {
75
    $pconfig['regdhcpstatic'] = true;
76
}
77
if (isset($config['unbound']['txtsupport'])) {
78
    $pconfig['txtsupport'] = true;
79
}
68 80

  
69 81
$pconfig['port'] = $config['unbound']['port'];
70 82
$pconfig['custom_options'] = $config['unbound']['custom_options'];
71 83

  
72
if (empty($config['unbound']['active_interface']))
84
if (empty($config['unbound']['active_interface'])) {
73 85
	$pconfig['active_interface'] = array();
74
else
86
} else {
75 87
	$pconfig['active_interface'] = explode(",", $config['unbound']['active_interface']);
76
if (empty($config['unbound']['outgoing_interface']))
88
}
89
if (empty($config['unbound']['outgoing_interface'])) {
77 90
	$pconfig['outgoing_interface'] = array();
78
else
91
} else {
79 92
	$pconfig['outgoing_interface'] = explode(",", $config['unbound']['outgoing_interface']);
93
}
80 94

  
81 95
if ($_POST) {
82 96
	$pconfig = $_POST;
......
85 99
	if ($_POST['apply']) {
86 100
		$retval = services_unbound_configure();
87 101
		$savemsg = get_std_save_message($retval);
88
		if ($retval == 0)
102
		if ($retval == 0) {
89 103
			clear_subsystem_dirty('unbound');
104
        }
90 105
		/* Update resolv.conf in case the interface bindings exclude localhost. */
91 106
		system_resolvconf_generate();
92 107
	} else {
93
		if (isset($_POST['enable']) && isset($config['dnsmasq']['enable']))
108
		if (isset($_POST['enable']) && isset($config['dnsmasq']['enable'])) {
94 109
			$input_errors[] = "The system dns-forwarder is still active. Disable it before enabling the DNS Resolver.";
110
        }
95 111

  
96
		if (empty($_POST['active_interface']))
112
		if (empty($_POST['active_interface'])) {
97 113
			$input_errors[] = "A single network interface needs to be selected for the DNS Resolver to bind to.";
114
        }
98 115

  
99
		if (empty($_POST['outgoing_interface']))
116
		if (empty($_POST['outgoing_interface'])) {
100 117
			$input_errors[] = "A single outgoing network interface needs to be selected for the DNS Resolver to use for outgoing DNS requests.";
118
        }
101 119

  
102
		if ($_POST['port'])
103
			if (is_port($_POST['port']))
120
		if ($_POST['port']) {
121
			if (is_port($_POST['port'])) {
104 122
				$a_unboundcfg['port'] = $_POST['port'];
105
			else
123
            } else {
106 124
				$input_errors[] = gettext("You must specify a valid port number.");
107
		else if (isset($config['unbound']['port']))
125
            }
126
        } else if (isset($config['unbound']['port'])) {
108 127
			unset($config['unbound']['port']);
128
        }
109 129

  
110
		if (isset($_POST['enable']))
130
		if (isset($_POST['enable'])) {
111 131
			$a_unboundcfg['enable'] = true;
112
		else
132
        } else {
113 133
			unset($a_unboundcfg['enable']);
114
		if (isset($_POST['dnssec']))
134
        }
135
		if (isset($_POST['dnssec'])) {
115 136
			$a_unboundcfg['dnssec'] = true;
116
		else
137
        } else {
117 138
			unset($a_unboundcfg['dnssec']);
118
		if (isset($_POST['forwarding']))
139
        }
140
		if (isset($_POST['forwarding'])) {
119 141
			$a_unboundcfg['forwarding'] = true;
120
		else
142
        } else {
121 143
			unset($a_unboundcfg['forwarding']);
122
		if (isset($_POST['regdhcp']))
144
        }
145
        if (isset($_POST['regdhcp'])) {
123 146
			$a_unboundcfg['regdhcp'] = true;
124
		else
147
        } else {
125 148
			unset($a_unboundcfg['regdhcp']);
126
		if (isset($_POST['regdhcpstatic']))
149
        }
150
		if (isset($_POST['regdhcpstatic'])) {
127 151
			$a_unboundcfg['regdhcpstatic'] = true;
128
		else
152
        } else {
129 153
			unset($a_unboundcfg['regdhcpstatic']);
130
		if (isset($_POST['txtsupport']))
154
        }
155
		if (isset($_POST['txtsupport'])) {
131 156
			$a_unboundcfg['txtsupport'] = true;
132
		else
157
        } else {
133 158
			unset($a_unboundcfg['txtsupport']);
134
		if (is_array($_POST['active_interface']) && !empty($_POST['active_interface']))
159
        }
160
		if (is_array($_POST['active_interface']) && !empty($_POST['active_interface'])) {
135 161
			$a_unboundcfg['active_interface'] = implode(",", $_POST['active_interface']);
162
        }
136 163

  
137
		if (is_array($_POST['outgoing_interface']) && !empty($_POST['outgoing_interface']))
164
		if (is_array($_POST['outgoing_interface']) && !empty($_POST['outgoing_interface'])) {
138 165
			$a_unboundcfg['outgoing_interface'] = implode(",", $_POST['outgoing_interface']);
166
        }
139 167

  
140 168
		$a_unboundcfg['custom_options'] = str_replace("\r\n", "\n", $_POST['custom_options']);
141 169

  
usr/local/www/services_unbound_acls.php
34 34

  
35 35
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_unbound_acls.php');
36 36

  
37
if (!is_array($config['unbound']['acls']))
37
if (!is_array($config['unbound']['acls'])) {
38 38
	$config['unbound']['acls'] = array();
39
}
39 40

  
40 41
$a_acls = &$config['unbound']['acls'];
41 42

  
42 43
$id = $_GET['id'];
43
if (isset($_POST['aclid']))
44
if (isset($_POST['aclid'])) {
44 45
	$id = $_POST['aclid'];
46
}
45 47

  
46 48
$act = $_GET['act'];
47
if (isset($_POST['act']))
49
if (isset($_POST['act'])) {
48 50
	$act = $_POST['act'];
51
}
49 52

  
50 53
if ($act == "del") {
51 54
	if (!$a_acls[$id]) {
......
87 90
				$networkacl[$x]['acl_network'] = $pconfig["acl_network{$x}"];
88 91
				$networkacl[$x]['mask'] = $pconfig["mask{$x}"];
89 92
				$networkacl[$x]['description'] = $pconfig["description{$x}"];
90
				if (!is_ipaddr($networkacl[$x]['acl_network']))
93
				if (!is_ipaddr($networkacl[$x]['acl_network'])) {
91 94
					$input_errors[] = gettext("You must enter a valid network IP address for {$networkacl[$x]['acl_network']}.");
95
                }
92 96

  
93 97
				if (is_ipaddr($networkacl[$x]['acl_network'])) {
94
					if (!is_subnet($networkacl[$x]['acl_network']."/".$networkacl[$x]['mask']))
98
					if (!is_subnet($networkacl[$x]['acl_network']."/".$networkacl[$x]['mask'])) {
95 99
						$input_errors[] = gettext("You must enter a valid IPv4 netmask for {$networkacl[$x]['acl_network']}/{$networkacl[$x]['mask']}.");
100
                    }
96 101
				} else if (function_exists("is_ipaddrv6")) {
97
					if (!is_ipaddrv6($networkacl[$x]['acl_network']))
102
					if (!is_ipaddrv6($networkacl[$x]['acl_network'])) {
98 103
						$input_errors[] = gettext("You must enter a valid IPv6 address for {$networkacl[$x]['acl_network']}.");
99
					else if (!is_subnetv6($networkacl[$x]['acl_network']."/".$networkacl[$x]['mask']))
104
                    } else if (!is_subnetv6($networkacl[$x]['acl_network']."/".$networkacl[$x]['mask'])) {
100 105
						$input_errors[] = gettext("You must enter a valid IPv6 netmask for {$networkacl[$x]['acl_network']}/{$networkacl[$x]['mask']}.");
101
				} else
106
                    }
107
				} else {
102 108
					$input_errors[] = gettext("You must enter a valid IPv4 address for {$networkacl[$x]['acl_network']}.");
103
			} else if (isset($networkacl[$x]))
109
                }
110
			} else if (isset($networkacl[$x])) {
104 111
				unset($networkacl[$x]);
112
            }
105 113
		}
106 114

  
107 115
		if (!$input_errors) {
......
113 121
				$acl_entry['description'] = $pconfig['description'];
114 122
				$acl_entry['aclid'] = $pconfig['aclid'];
115 123
				$acl_entry['row'] = array();
116
				foreach ($networkacl as $acl)
124
				foreach ($networkacl as $acl) {
117 125
					$acl_entry['row'][] = $acl;
126
                }
118 127

  
119
				if (isset($id) && $a_acls[$id])
128
				if (isset($id) && $a_acls[$id]) {
120 129
					$a_acls[$id] = $acl_entry;
121
				else
130
                } else {
122 131
					$a_acls[] = $acl_entry;
123

  
132
                }
124 133

  
125 134
				mark_subsystem_dirty("unbound");
126 135
				write_config();
......
164 173
<?php include("fbegin.inc"); ?>
165 174
<form action="services_unbound_acls.php" method="post" name="iform" id="iform">
166 175
<?php
167
if (!$savemsg)
176
if (!$savemsg) {
168 177
	$savemsg = "";
178
}
169 179

  
170
if ($input_errors)
180
if ($input_errors) {
171 181
	print_input_errors($input_errors);
182
}
172 183

  
173
if ($savemsg)
184
if ($savemsg) {
174 185
	print_info_box($savemsg);
186
}
175 187

  
176
if (is_subsystem_dirty("unbound"))
188
if (is_subsystem_dirty("unbound")) {
177 189
		print_info_box_np(gettext("The settings for the DNS Resolver have changed. You must apply the configuration to take affect."));
190
}
191

  
178 192
?>
179 193
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="services unbound acls">
180 194
	<tbody>
usr/local/www/services_unbound_advanced.php
41 41
require_once("guiconfig.inc");
42 42
require_once("unbound.inc");
43 43

  
44
if(!is_array($config['unbound']))
44
if(!is_array($config['unbound'])) {
45 45
	$config['unbound'] = array();
46
}
46 47

  
47
if (isset($config['unbound']['hideidentity']))
48
if (isset($config['unbound']['hideidentity'])) {
48 49
	$pconfig['hideidentity'] = true;
49
if (isset($config['unbound']['hideversion']))
50
}
51
if (isset($config['unbound']['hideversion'])){
50 52
	$pconfig['hideversion'] = true;
51
if (isset($config['unbound']['prefetch']))
53
}
54
if (isset($config['unbound']['prefetch'])) {
52 55
	$pconfig['prefetch'] = true;
53
if (isset($config['unbound']['prefetchkey']))
56
}
57
if (isset($config['unbound']['prefetchkey'])) {
54 58
	$pconfig['prefetchkey'] = true;
55
if (isset($config['unbound']['hardenglue']))
59
}
60
if (isset($config['unbound']['hardenglue'])) {
56 61
	$pconfig['hardenglue'] = true;
57
if (isset($config['unbound']['dnssecstripped']))
62
}
63
if (isset($config['unbound']['dnssecstripped'])) {
58 64
	$pconfig['dnssecstripped'] = true;
65
}
66

  
59 67
$pconfig['msgcachesize'] = $config['unbound']['msgcachesize'];
60 68
$pconfig['outgoing_num_tcp'] = $config['unbound']['outgoing_num_tcp'];
61 69
$pconfig['incoming_num_tcp'] = $config['unbound']['incoming_num_tcp'];
......
76 84
	if ($_POST['apply']) {
77 85
		$retval = services_unbound_configure();
78 86
		$savemsg = get_std_save_message($retval);
79
		if ($retval == 0)
87
		if ($retval == 0) {
80 88
			clear_subsystem_dirty('unbound');
89
        }
81 90
	} else {
82
		if (isset($_POST['hideidentity']))
91
		if (isset($_POST['hideidentity'])) {
83 92
			$config['unbound']['hideidentity'] = true;
84
		else
93
        } else {
85 94
			unset($config['unbound']['hideidentity']);
86
		if (isset($_POST['hideversion']))
95
        }
96
		if (isset($_POST['hideversion'])) {
87 97
			$config['unbound']['hideversion'] = true;
88
		else
98
        } else {
89 99
			unset($config['unbound']['hideversion']);
90
		if (isset($_POST['prefetch']))
100
        }
101
		if (isset($_POST['prefetch'])) {
91 102
			$config['unbound']['prefetch'] = true;
92
		else
103
        } else {
93 104
			unset($config['unbound']['prefetch']);
94
		if (isset($_POST['prefetchkey']))
105
        }
106
		if (isset($_POST['prefetchkey'])) {
95 107
			$config['unbound']['prefetchkey'] = true;
96
		else
108
        } else {
97 109
			unset($config['unbound']['prefetchkey']);
98
		if (isset($_POST['hardenglue']))
110
        }
111
		if (isset($_POST['hardenglue'])) {
99 112
			$config['unbound']['hardenglue'] = true;
100
		else
113
        } else {
101 114
			unset($config['unbound']['hardenglue']);
102
		if (isset($_POST['dnssecstripped']))
115
        }
116
		if (isset($_POST['dnssecstripped'])) {
103 117
			$config['unbound']['dnssecstripped'] = true;
104
		else
118
        } else {
105 119
			unset($config['unbound']['dnssecstripped']);
120
        }
106 121
		$config['unbound']['msgcachesize'] = $_POST['msgcachesize'];
107 122
		$config['unbound']['outgoing_num_tcp'] = $_POST['outgoing_num_tcp'];
108 123
		$config['unbound']['incoming_num_tcp'] = $_POST['incoming_num_tcp'];

Also available in: Unified diff