diff options
author | Renato Botelho <garga@FreeBSD.org> | 2015-05-06 14:02:37 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2015-05-06 14:02:37 -0300 |
commit | b128b22a7fb0fb855e362ef3705e4d3a703abe1e (patch) | |
tree | 52b7238d600f024cfd3de3ff0790d676986e6640 /config/squid3 | |
parent | 12cf0d301455c8a4261f62f9c7c6c2383999d53e (diff) | |
download | pfsense-packages-b128b22a7fb0fb855e362ef3705e4d3a703abe1e.tar.gz pfsense-packages-b128b22a7fb0fb855e362ef3705e4d3a703abe1e.tar.bz2 pfsense-packages-b128b22a7fb0fb855e362ef3705e4d3a703abe1e.zip |
Simplify logic
Diffstat (limited to 'config/squid3')
-rwxr-xr-x | config/squid3/34/squid.inc | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/config/squid3/34/squid.inc b/config/squid3/34/squid.inc index f5cd1c31..b53ec37a 100755 --- a/config/squid3/34/squid.inc +++ b/config/squid3/34/squid.inc @@ -516,23 +516,24 @@ function squid_validate_general($post, &$input_errors) { } function squid_validate_upstream($post, &$input_errors) { - if ($post['enabled'] == 'on') { - $addr = trim($post['proxyaddr']); - if (empty($addr)) { - $input_errors[] = 'The field \'Hostname\' is required'; - } else { - if (!is_ipaddr($addr) && !is_domain($addr)) - $input_errors[] = 'You must enter a valid IP address or host name in the \'Proxy hostname\' field'; - } + if ($post['enabled'] != 'on') + return; - foreach (array('proxyport' => 'TCP port', 'icpport' => 'ICP port') as $field => $name) { - $port = trim($post[$field]); - if (empty($port)) { - $input_errors[] = "The field '$name' is required"; - } else { - if (!is_port($port)) - $input_errors[] = "The field '$name' must contain a valid port number, between 0 and 65535"; - } + $addr = trim($post['proxyaddr']); + if (empty($addr)) { + $input_errors[] = 'The field \'Hostname\' is required'; + } else { + if (!is_ipaddr($addr) && !is_domain($addr)) + $input_errors[] = 'You must enter a valid IP address or host name in the \'Proxy hostname\' field'; + } + + foreach (array('proxyport' => 'TCP port', 'icpport' => 'ICP port') as $field => $name) { + $port = trim($post[$field]); + if (empty($port)) { + $input_errors[] = "The field '$name' is required"; + } else { + if (!is_port($port)) + $input_errors[] = "The field '$name' must contain a valid port number, between 0 and 65535"; } } } |