From 57e8b9ddd0a26d27fbd68859d6c29b2ee2e1c2c8 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 3 Jan 2020 11:20:27 +0100 Subject: [PATCH] src: fix last bits of obvious PSR12 style issues CodeSniffer wants to have its way with authgui.inc but fortunately it doesn't break while fixing the style anymore so to keep this consistent and approachable just accept its criticism. ;) --- src/etc/inc/authgui.inc | 37 ++++++++++--------- .../OPNsense/Firewall/Api/AliasController.php | 3 +- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/etc/inc/authgui.inc b/src/etc/inc/authgui.inc index f92cd3d4e..4c3e15583 100644 --- a/src/etc/inc/authgui.inc +++ b/src/etc/inc/authgui.inc @@ -45,8 +45,10 @@ function set_language() $lang = $config['system']['language']; } - if (!empty($_SESSION['Username']) && array_key_exists($_SESSION['Username'], $userindex) && - !empty($config['system']['user'][$userindex[$_SESSION['Username']]]['language'])) { + if ( + !empty($_SESSION['Username']) && array_key_exists($_SESSION['Username'], $userindex) && + !empty($config['system']['user'][$userindex[$_SESSION['Username']]]['language']) + ) { $lang = $config['system']['user'][$userindex[$_SESSION['Username']]]['language']; } @@ -68,7 +70,7 @@ function session_auth(&$Login_Error) session_set_cookie_params( $currentCookieParams["lifetime"], $currentCookieParams["path"], - NULL, + null, ($config['system']['webgui']['protocol'] == "https"), true ); @@ -169,7 +171,7 @@ function session_auth(&$Login_Error) if (isset($_COOKIE[session_name()])) { $secure = $config['system']['webgui']['protocol'] == "https"; - setcookie(session_name(), '', time()-42000, '/', null, $secure, true); + setcookie(session_name(), '', time() - 42000, '/', null, $secure, true); } /* and destroy it */ @@ -234,7 +236,7 @@ function display_error_form($http_code, $desc) { $themename = htmlspecialchars(get_current_theme()); -?> + ?> @@ -268,7 +270,6 @@ function display_error_form($http_code, $desc) + ?> @@ -320,9 +321,9 @@ function display_login_form($Login_Error) - + - + @@ -331,19 +332,19 @@ function display_login_form($Login_Error)

')); - } - ?> + if (is_ipaddr($http_host) && !$local_ip && !isset($config['system']['webgui']['nohttpreferercheck'])) { + print_info_box(sprintf(gettext("You are accessing this router by an IP address not configured locally, which may be forwarded by NAT or other means. %sIf you did not setup this forwarding, you may be the target of a man-in-the-middle attack."), '

')); + } + ?>
@@ -369,7 +370,7 @@ function display_login_form($Login_Error)

- + diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasController.php b/src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasController.php index a41bf9986..a778d508f 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasController.php @@ -337,7 +337,8 @@ class AliasController extends ApiMutableModelControllerBase if (file_exists('/usr/local/share/GeoIP/alias.stats')) { $stats = json_decode(file_get_contents('/usr/local/share/GeoIP/alias.stats'), true); $result[static::$internalModelName]['geoip'] = array_merge( - $result[static::$internalModelName]['geoip'], $stats + $result[static::$internalModelName]['geoip'], + $stats ); } }