diff options
author | Steve Beaver <sbeaver@netgate.com> | 2017-05-18 09:11:39 -0400 |
---|---|---|
committer | Steve Beaver <sbeaver@netgate.com> | 2017-05-18 09:11:39 -0400 |
commit | ee8f5c6a4719aac90b9cd58371ceb7370fb50131 (patch) | |
tree | 6a93c279837c80f750b773412bb6a92b22f3c85f /src/etc | |
parent | a828f612483026a361c879973700a043ff7b223b (diff) | |
download | pfsense-ee8f5c6a4719aac90b9cd58371ceb7370fb50131.zip pfsense-ee8f5c6a4719aac90b9cd58371ceb7370fb50131.tar.gz |
Improve indenting/readability
Diffstat (limited to 'src/etc')
-rw-r--r-- | src/etc/inc/authgui.inc | 122 |
1 files changed, 65 insertions, 57 deletions
diff --git a/src/etc/inc/authgui.inc b/src/etc/inc/authgui.inc index db76b88..e4ec4f5 100644 --- a/src/etc/inc/authgui.inc +++ b/src/etc/inc/authgui.inc @@ -159,73 +159,81 @@ function display_login_form() { exit; } -/* Check against locally configured IP addresses, which will catch when someone - port forwards WebGUI access from WAN to an internal IP on the router. */ -global $FilterIflist, $nifty_background; -$local_ip = false; -if (strpos($_SERVER['HTTP_HOST'], ":") === FALSE) { - $http_host_port = explode(":", $_SERVER['HTTP_HOST']); - $http_host = $http_host_port[0]; -} else { - $http_host = $_SERVER['HTTP_HOST']; -} -if (empty($FilterIflist)) { - require_once('filter.inc'); - require_once('shaper.inc'); - filter_generate_optcfg_array(); -} -foreach ($FilterIflist as $iflist) { - if ($iflist['ip'] == $http_host) { - $local_ip = true; - } else if ($iflist['ipv6'] == $http_host) { - $local_ip = true; - } else if (is_array($iflist['vips'])) { - foreach ($iflist['vips'] as $vip) { - if ($vip['ip'] == $http_host) { - $local_ip = true; - break; - } - } - unset($vip); + /* Check against locally configured IP addresses, which will catch when someone + port forwards WebGUI access from WAN to an internal IP on the router. */ + global $FilterIflist, $nifty_background; + + $local_ip = false; + + if (strpos($_SERVER['HTTP_HOST'], ":") === FALSE) { + $http_host_port = explode(":", $_SERVER['HTTP_HOST']); + $http_host = $http_host_port[0]; + } else { + $http_host = $_SERVER['HTTP_HOST']; } - if ($local_ip == true) { - break; + + if (empty($FilterIflist)) { + require_once('filter.inc'); + require_once('shaper.inc'); + filter_generate_optcfg_array(); } -} -unset($FilterIflist); -unset($iflist); - -if ($local_ip == false) { - if (is_array($config['openvpn']['openvpn-server'])) { - foreach ($config['openvpn']['openvpn-server'] as $ovpns) { - if (is_ipaddrv4($http_host) && !empty($ovpns['tunnel_network']) && ip_in_subnet($http_host, $ovpns['tunnel_network'])) { - $local_ip = true; - } else if (is_ipaddrv6($http_host) && !empty($ovpns['tunnel_networkv6']) && ip_in_subnet($http_host, $ovpns['tunnel_networkv6'])) { - $local_ip = true; + + foreach ($FilterIflist as $iflist) { + if ($iflist['ip'] == $http_host) { + $local_ip = true; + } else if ($iflist['ipv6'] == $http_host) { + $local_ip = true; + } else if (is_array($iflist['vips'])) { + foreach ($iflist['vips'] as $vip) { + if ($vip['ip'] == $http_host) { + $local_ip = true; + break; + } } - if ($local_ip == true) { - break; + + unset($vip); + } + + if ($local_ip == true) { + break; + } + } + + unset($FilterIflist); + unset($iflist); + + if ($local_ip == false) { + if (is_array($config['openvpn']['openvpn-server'])) { + foreach ($config['openvpn']['openvpn-server'] as $ovpns) { + if (is_ipaddrv4($http_host) && !empty($ovpns['tunnel_network']) && ip_in_subnet($http_host, $ovpns['tunnel_network'])) { + $local_ip = true; + } else if (is_ipaddrv6($http_host) && !empty($ovpns['tunnel_networkv6']) && ip_in_subnet($http_host, $ovpns['tunnel_networkv6'])) { + $local_ip = true; + } + + if ($local_ip == true) { + break; + } } } } -} -// For the login form, get the settings of no particular user. -// That ensures we will use the system default theme for the login form. -$user_settings = get_user_settings(""); -$cssfile = "/css/pfSense.css"; + // For the login form, get the settings of no particular user. + // That ensures we will use the system default theme for the login form. + $user_settings = get_user_settings(""); + $cssfile = "/css/pfSense.css"; -if (isset($user_settings['webgui']['webguicss'])) { - if (file_exists("/usr/local/www/css/" . $user_settings['webgui']['webguicss'])) { - $cssfile = "/css/" . $user_settings['webgui']['webguicss']; + if (isset($user_settings['webgui']['webguicss'])) { + if (file_exists("/usr/local/www/css/" . $user_settings['webgui']['webguicss'])) { + $cssfile = "/css/" . $user_settings['webgui']['webguicss']; + } } -} -if (isset($config['system']['webgui']['loginshowhost'])) { - $loginbannerstr = sprintf(gettext('Login to %1$s on %2$s.%3$s'), $g['product_name'], htmlspecialchars($config['system']['hostname']), htmlspecialchars($config['system']['domain'])); -} else { - $loginbannerstr = sprintf(gettext('Login to %1$s'), $g['product_name']); -} + if (isset($config['system']['webgui']['loginshowhost'])) { + $loginbannerstr = sprintf(gettext('Login to %1$s on %2$s.%3$s'), $g['product_name'], htmlspecialchars($config['system']['hostname']), htmlspecialchars($config['system']['domain'])); + } else { + $loginbannerstr = sprintf(gettext('Login to %1$s'), $g['product_name']); + } ?> <!DOCTYPE html> |