From 8201c62bd6da283e186f13da7fcb372439de329e Mon Sep 17 00:00:00 2001 From: Per von Zweigbergk Date: Thu, 4 Aug 2016 15:33:38 +0200 Subject: [PATCH] Style cleanup (ran make stylefix) --- .../Api/SystemhealthController.php | 1 - .../OPNsense/Auth/AuthenticationFactory.php | 38 +++++++++---------- .../app/library/OPNsense/Auth/LocalTOTP.php | 6 +-- .../mvc/app/library/OPNsense/Auth/Voucher.php | 6 +-- .../Base/FieldTypes/CertificateField.php | 6 +-- 5 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php index 402373dc6..1a914fa90 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php @@ -603,5 +603,4 @@ class SystemhealthController extends ApiControllerBase } return $intfmap; } - } diff --git a/src/opnsense/mvc/app/library/OPNsense/Auth/AuthenticationFactory.php b/src/opnsense/mvc/app/library/OPNsense/Auth/AuthenticationFactory.php index eacfc1021..636722a9f 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Auth/AuthenticationFactory.php +++ b/src/opnsense/mvc/app/library/OPNsense/Auth/AuthenticationFactory.php @@ -65,7 +65,7 @@ class AuthenticationFactory { $connectors = array(); foreach (glob(__DIR__."/*.php") as $filename) { - $pathParts = explode('/',$filename); + $pathParts = explode('/', $filename); $vendor = $pathParts[count($pathParts)-3]; $module = $pathParts[count($pathParts)-2]; $classname = explode('.php', $pathParts[count($pathParts)-1])[0]; @@ -144,22 +144,22 @@ class AuthenticationFactory * list configuration options for pluggable auth modules * @return array */ - public function listConfigOptions() - { - $result = array(); - foreach ($this->listConnectors() as $connector) { - if ($connector['classHandle']->hasMethod('getDescription')) { - $obj = $connector['classHandle']->newInstance(); - $authItem = $connector; - $authItem['description'] = $obj->getDescription(); - if ($connector['classHandle']->hasMethod('getConfigurationOptions')) { - $authItem['additionalFields'] = $obj->getConfigurationOptions(); - } else { - $authItem['additionalFields'] = array(); - } - $result[$obj->getType()] = $authItem; - } - } - return $result; - } + public function listConfigOptions() + { + $result = array(); + foreach ($this->listConnectors() as $connector) { + if ($connector['classHandle']->hasMethod('getDescription')) { + $obj = $connector['classHandle']->newInstance(); + $authItem = $connector; + $authItem['description'] = $obj->getDescription(); + if ($connector['classHandle']->hasMethod('getConfigurationOptions')) { + $authItem['additionalFields'] = $obj->getConfigurationOptions(); + } else { + $authItem['additionalFields'] = array(); + } + $result[$obj->getType()] = $authItem; + } + } + return $result; + } } diff --git a/src/opnsense/mvc/app/library/OPNsense/Auth/LocalTOTP.php b/src/opnsense/mvc/app/library/OPNsense/Auth/LocalTOTP.php index f28eef70b..170acaf5e 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Auth/LocalTOTP.php +++ b/src/opnsense/mvc/app/library/OPNsense/Auth/LocalTOTP.php @@ -206,7 +206,7 @@ class LocalTOTP extends Local $fields["otpLength"]["options"]["6"] = "6"; $fields["otpLength"]["options"]["8"] = "8"; $fields["otpLength"]["help"] = gettext("Token length to use"); - $fields["otpLength"]["validate"] = function($value) { + $fields["otpLength"]["validate"] = function ($value) { if (!in_array($value, array(6,8))) { return array(gettext("Only token lengths of 6 or 8 characters are supported")); } else { @@ -219,7 +219,7 @@ class LocalTOTP extends Local $fields["timeWindow"]["default"] = null; $fields["timeWindow"]["help"] = gettext("The time period in which the token will be valid,". " default is 30 seconds (google authenticator)") ; - $fields["timeWindow"]["validate"] = function($value) { + $fields["timeWindow"]["validate"] = function ($value) { if (!empty($value) && filter_var($value, FILTER_SANITIZE_NUMBER_INT) != $value) { return array(gettext("Please enter a valid time window in seconds")); } else { @@ -232,7 +232,7 @@ class LocalTOTP extends Local $fields["graceperiod"]["default"] = null; $fields["graceperiod"]["help"] = gettext("Time in seconds in which this server and the token may differ,". " default is 10 seconds. Set higher for a less secure easier match."); - $fields["graceperiod"]["validate"] = function($value) { + $fields["graceperiod"]["validate"] = function ($value) { if (!empty($value) && filter_var($value, FILTER_SANITIZE_NUMBER_INT) != $value) { return array(gettext("Please enter a valid grace period in seconds")); } else { diff --git a/src/opnsense/mvc/app/library/OPNsense/Auth/Voucher.php b/src/opnsense/mvc/app/library/OPNsense/Auth/Voucher.php index 667cb0ee3..9e22208ad 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Auth/Voucher.php +++ b/src/opnsense/mvc/app/library/OPNsense/Auth/Voucher.php @@ -401,7 +401,7 @@ class Voucher implements IAuthConnector $fields["simplePasswords"]["name"] = gettext("Use simple passwords (less secure)"); $fields["simplePasswords"]["type"] = "checkbox"; $fields["simplePasswords"]["help"] = gettext("Use simple (less secure) passwords, which are easier to read") ; - $fields["simplePasswords"]["validate"] = function($value) { + $fields["simplePasswords"]["validate"] = function ($value) { return array(); }; $fields["usernameLength"] = array(); @@ -409,7 +409,7 @@ class Voucher implements IAuthConnector $fields["usernameLength"]["type"] = "text"; $fields["usernameLength"]["default"] = null; $fields["usernameLength"]["help"] = gettext("Specify alternative username length for generating vouchers"); - $fields["usernameLength"]["validate"] = function($value) { + $fields["usernameLength"]["validate"] = function ($value) { if (!empty($value) && filter_var($value, FILTER_SANITIZE_NUMBER_INT) != $value) { return array(gettext("Username length must be a number or empty for default.")); } else { @@ -421,7 +421,7 @@ class Voucher implements IAuthConnector $fields["passwordLength"]["type"] = "text"; $fields["passwordLength"]["default"] = null; $fields["passwordLength"]["help"] = gettext("Specify alternative password length for generating vouchers"); - $fields["passwordLength"]["validate"] = function($value) { + $fields["passwordLength"]["validate"] = function ($value) { if (!empty($value) && filter_var($value, FILTER_SANITIZE_NUMBER_INT) != $value) { return array(gettext("Password length must be a number or empty for default.")); } else { diff --git a/src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/CertificateField.php b/src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/CertificateField.php index c82f42597..2a45884b9 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/CertificateField.php +++ b/src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/CertificateField.php @@ -101,9 +101,9 @@ class CertificateField extends BaseField if (!array_key_exists($this->certificateType, self::$internalOptionList)) { self::$internalOptionList[$this->certificateType] = array(); $configObj = Config::getInstance()->object(); - foreach ($configObj->{$this->certificateType} as $cert) { - self::$internalOptionList[$this->certificateType][(string)$cert->refid] = (string)$cert->descr ; - } + foreach ($configObj->{$this->certificateType} as $cert) { + self::$internalOptionList[$this->certificateType][(string)$cert->refid] = (string)$cert->descr ; + } } }