Apply PHPCS fixes.

This commit is contained in:
very-ape 2021-05-17 10:55:15 -07:00
parent e39e621421
commit 092605c2c2

View file

@ -25,7 +25,9 @@ function saml_module($a)
function saml_init($a)
{
if ($a->argc < 2) return;
if ($a->argc < 2) {
return;
}
switch ($a->argv[1]) {
case "metadata.xml":
@ -101,12 +103,13 @@ function saml_is_configured()
DI::config()->get('saml', 'sp_key') &&
DI::config()->get('saml', 'sp_cert') &&
DI::config()->get('saml', 'idp_cert');
}
function saml_sso_initiate(&$a, &$b)
{
if (!saml_is_configured()) return;
if (!saml_is_configured()) {
return;
}
$auth = new \OneLogin\Saml2\Auth(saml_settings());
$ssoBuiltUrl = $auth->login(null, array(), false, false, true);
@ -162,8 +165,7 @@ function saml_sso_reply($a)
}
if (isset($_POST['RelayState'])
&& \OneLogin\Saml2\Utils::getSelfURL() != $_POST['RelayState'])
{
&& \OneLogin\Saml2\Utils::getSelfURL() != $_POST['RelayState']) {
$auth->redirectTo($_POST['RelayState']);
}
}
@ -271,8 +273,7 @@ function saml_addon_admin (&$a, &$o)
function saml_addon_admin_post(&$a)
{
$safeset = function ($key)
{
$safeset = function ($key) {
$val = (!empty($_POST[$key]) ? Strings::escapeTags(trim($_POST[$key])) : '');
DI::config()->set('saml', $key, $val);
};
@ -313,7 +314,6 @@ function saml_create_user($username, $email, $name)
]);
return $user;
} catch (Exception $e) {
Logger::error(
'Exception while creating user',
@ -323,7 +323,8 @@ function saml_create_user($username, $email, $name)
'name' => $name,
'exception' => $e->getMessage(),
'trace' => $e->getTraceAsString()
]);
]
);
return false;
}
@ -444,4 +445,3 @@ function saml_settings()
)
);
}
?>