diff --git a/composer.json b/composer.json index 594c926f9a4015c0a6bc23c7a4f04f9479b2b913..18f8a873e1b7777b8adc57f61b49f63135e53951 100644 --- a/composer.json +++ b/composer.json @@ -22,6 +22,6 @@ "ext-curl": "*" }, "require-dev": { - "symplify/easy-coding-standard": "^9.2" + "symplify/easy-coding-standard": "^10.0" } } diff --git a/config-templates/module_cesnet_IsCesnetEligible.php b/config-templates/module_cesnet_IsCesnetEligible.php index eecabda67bba0f67bcc51b4a5e5d5f0a8b88056f..cd07a6b86f64fc29eba105597cac352dda4bc6d5 100644 --- a/config-templates/module_cesnet_IsCesnetEligible.php +++ b/config-templates/module_cesnet_IsCesnetEligible.php @@ -9,12 +9,12 @@ declare(strict_types=1); * copy command (from SimpleSAML base dir) cp modules/perun/module_cesnet_IsCesnetEligible.php config/ */ $config = [ - /** + /* * hostname of CESNET ldap with ldap(s):// at the beginning. */ 'ldap.hostname' => '', - /** + /* * ldap credentials if ldap search is protected. If it is null or not set at all. No user is used for bind. */ 'ldap.username' => '', diff --git a/ecs.php b/ecs.php index 9acbefbc4dcfd283b714f27b4e474a0108b10720..9c9fdb6199a4bba5ce04c9b286ae26daaad41a7f 100644 --- a/ecs.php +++ b/ecs.php @@ -8,13 +8,6 @@ use Symplify\EasyCodingStandard\ValueObject\Option; use Symplify\EasyCodingStandard\ValueObject\Set\SetList; return static function (ContainerConfigurator $containerConfigurator): void { - $services = $containerConfigurator->services(); - $services->set(ArraySyntaxFixer::class) - ->call('configure', [[ - 'syntax' => 'short', - ]]) - ; - $parameters = $containerConfigurator->parameters(); $parameters->set(Option::PATHS, [ __DIR__ . '/ecs.php', @@ -25,7 +18,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { __DIR__ . '/www', __DIR__ . '/composer.json', ]); - + $parameters->set(Option::PARALLEL, true); + $parameters->set(Option::SKIP, [NotOperatorWithSuccessorSpaceFixer::class, FunctionTypehintSpaceFixer::class]); + $containerConfigurator->import(SetList::PHP_CS_FIXER); $containerConfigurator->import(SetList::CLEAN_CODE); $containerConfigurator->import(SetList::SYMPLIFY); $containerConfigurator->import(SetList::ARRAY); @@ -36,5 +31,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $containerConfigurator->import(SetList::NAMESPACES); $containerConfigurator->import(SetList::PHPUNIT); $containerConfigurator->import(SetList::SPACES); + $containerConfigurator->import(SetList::STRICT); + $containerConfigurator->import(SetList::SYMFONY); $containerConfigurator->import(SetList::PSR_12); + + $services = $containerConfigurator->services(); + $services->set(ArraySyntaxFixer::class) + ->call('configure', [[ + 'syntax' => 'short', + ]]) + ; }; diff --git a/lib/Auth/Process/ComputeLoA.php b/lib/Auth/Process/ComputeLoA.php index eecd1ebb4fa828c22e76383326decf255f2f4f1d..7d4475bb26754547695740c62793c4f0b66ea446 100644 --- a/lib/Auth/Process/ComputeLoA.php +++ b/lib/Auth/Process/ComputeLoA.php @@ -8,7 +8,7 @@ use SimpleSAML\Logger; use SimpleSAML\Metadata\MetaDataStorageHandler; /** - * Class ComputeLoA + * Class ComputeLoA. * * Filter compute the LoA and save it to attribute defined by 'attrName' config property. */ @@ -32,7 +32,7 @@ class ComputeLoA extends \SimpleSAML\Auth\ProcessingFilter private $metadata; - private $entityCategory = null; + private $entityCategory; private $eduPersonScopedAffiliation = []; @@ -75,7 +75,7 @@ class ComputeLoA extends \SimpleSAML\Auth\ProcessingFilter } foreach ($entityCategoryAttributes as $entityCategoryAttribute) { - if (substr($entityCategoryAttribute, 0, strlen(self::EDUID_IDP_GROUP)) === self::EDUID_IDP_GROUP) { + if (self::EDUID_IDP_GROUP === substr($entityCategoryAttribute, 0, strlen(self::EDUID_IDP_GROUP))) { $this->entityCategory = substr( $entityCategoryAttribute, strlen(self::EDUID_IDP_GROUP), @@ -91,15 +91,16 @@ class ComputeLoA extends \SimpleSAML\Auth\ProcessingFilter } /** - * Get LoA by CESNET filter + * Get LoA by CESNET filter. * * @return int 2 if combination of IdP attributes and User attributes corresponds to the filter, 0 if not */ private function getLoA() { - if ($this->entityCategory === null || empty($this->entityCategory)) { + if (null === $this->entityCategory || empty($this->entityCategory)) { return 0; - } elseif ($this->entityCategory === self::UNIVERSITY) { + } + if (self::UNIVERSITY === $this->entityCategory) { foreach ($this->eduPersonScopedAffiliation as $affiliation) { if (preg_match( '/(^employee@.+\.cz$)|' . @@ -114,31 +115,32 @@ class ComputeLoA extends \SimpleSAML\Auth\ProcessingFilter return 2; } } - } elseif ($this->entityCategory === self::AVCR) { + } elseif (self::AVCR === $this->entityCategory) { foreach ($this->eduPersonScopedAffiliation as $affiliation) { if (preg_match('/^member@.+\.cz$/', $affiliation, $matches)) { return 2; } } - } elseif ($this->entityCategory === self::LIBRARY) { + } elseif (self::LIBRARY === $this->entityCategory) { foreach ($this->eduPersonScopedAffiliation as $affiliation) { if (preg_match('/^employee@.+\.cz$/', $affiliation, $matches)) { return 2; } } - } elseif ($this->entityCategory === self::HOSPITAL) { + } elseif (self::HOSPITAL === $this->entityCategory) { foreach ($this->eduPersonScopedAffiliation as $affiliation) { if (preg_match('/^employee@.+\.cz$/', $affiliation, $matches)) { return 2; } } - } elseif ($this->entityCategory === self::OTHER) { + } elseif (self::OTHER === $this->entityCategory) { foreach ($this->eduPersonScopedAffiliation as $affiliation) { if (preg_match('/(^employee@.+\.cz$)|(^member@.+\.cz$)/', $affiliation, $matches)) { return 2; } } } + return 0; } } diff --git a/lib/Auth/Process/IsCesnetEligible.php b/lib/Auth/Process/IsCesnetEligible.php index 6e8a10fc32f72101cda48ed4782536c1d81ca011..33c584623a707123db83520a9a84ac4b5f14baff 100644 --- a/lib/Auth/Process/IsCesnetEligible.php +++ b/lib/Auth/Process/IsCesnetEligible.php @@ -17,7 +17,7 @@ use SimpleSAML\Module\perun\LdapConnector; use SimpleSAML\Module\perun\model\User; /** - * Class IsCesnetEligible + * Class IsCesnetEligible. * * This class put the timestamp of last login into list of Attributes, when at least one value of attribute * 'eduPersonScopedAffiliation' is marked as isCesnetEligible in CESNET LDAP @@ -87,8 +87,7 @@ class IsCesnetEligible extends ProcessingFilter $conf = Configuration::loadFromArray($config); if (! isset($config[self::RPC_ATTRIBUTE_NAME]) || empty($config[self::RPC_ATTRIBUTE_NAME])) { throw new Exception( - 'cesnet:IsCesnetEligible - missing mandatory configuration option \'' . - self::RPC_ATTRIBUTE_NAME . '\'.' + 'cesnet:IsCesnetEligible - missing mandatory configuration option \'' . self::RPC_ATTRIBUTE_NAME . '\'.' ); } @@ -102,7 +101,7 @@ class IsCesnetEligible extends ProcessingFilter } if (isset($config[self::INTERFACE_PROPNAME], $config[self::LDAP_ATTRIBUTE_NAME]) && - $config[self::INTERFACE_PROPNAME] === self::LDAP && ! empty($config[self::LDAP_ATTRIBUTE_NAME])) { + self::LDAP === $config[self::INTERFACE_PROPNAME] && ! empty($config[self::LDAP_ATTRIBUTE_NAME])) { $this->interface = $config[self::INTERFACE_PROPNAME]; $this->ldapAttrName = $config[self::LDAP_ATTRIBUTE_NAME]; $this->adapter = Adapter::getInstance(Adapter::LDAP); @@ -150,7 +149,7 @@ class IsCesnetEligible extends ProcessingFilter } if (! empty($user)) { - if ($this->interface === self::LDAP) { + if (self::LDAP === $this->interface) { $attrs = $this->adapter->getUserAttributes($user, [$this->ldapAttrName]); if (isset($attrs[$this->ldapAttrName][0])) { $this->cesnetEligibleLastSeenValue = $attrs[$this->ldapAttrName][0]; @@ -188,7 +187,7 @@ class IsCesnetEligible extends ProcessingFilter } } - if ($this->cesnetEligibleLastSeenValue !== null) { + if (null !== $this->cesnetEligibleLastSeenValue) { $request['Attributes'][$this->returnAttrName] = [$this->cesnetEligibleLastSeenValue]; Logger::debug( 'cesnet:IsCesnetEligible - Attribute ' . $this->returnAttrName . ' was set to value ' . @@ -197,7 +196,7 @@ class IsCesnetEligible extends ProcessingFilter } $request['Attributes']['isCesnetEligible'] = ['false']; - if (($this->cesnetEligibleLastSeenValue !== null) && $this->cesnetEligibleLastSeenValue > date( + if ((null !== $this->cesnetEligibleLastSeenValue) && $this->cesnetEligibleLastSeenValue > date( 'Y-m-d H:i:s', strtotime('-1 year') )) { @@ -207,7 +206,7 @@ class IsCesnetEligible extends ProcessingFilter } /** - * Returns true if one of user's affiliation is in allowed affiliations for this IdP , False if not + * Returns true if one of user's affiliation is in allowed affiliations for this IdP , False if not. * * @param User $user or Null */ @@ -218,7 +217,7 @@ class IsCesnetEligible extends ProcessingFilter return true; } - # Check if user has isCesnetEligible by sponsoring in some organization + // Check if user has isCesnetEligible by sponsoring in some organization try { if (isset($user, $this->userAffiliationsAttrName, $this->userSponsoringOrganizationsAttrName)) { $userAttributes = $this->rpcAdapter->getUserAttributesValues( @@ -235,10 +234,12 @@ class IsCesnetEligible extends ProcessingFilter json_encode($perunUserAffiliations) . ', ' . $this->userSponsoringOrganizationsAttrName . ':' . json_encode($perunUserSponsoringOrganizations) . '] has empty value!' ); + return false; } $allowedSponsoredAffiliations = $this->getAllowedAffiliations($perunUserSponsoringOrganizations); + return $this->compareAffiliations($perunUserAffiliations, $allowedSponsoredAffiliations); } } catch (\Exception $exception) { @@ -252,9 +253,10 @@ class IsCesnetEligible extends ProcessingFilter } /** - * Return list of allowed affiliations for IdP from CESNET LDAP + * Return list of allowed affiliations for IdP from CESNET LDAP. * * @param array $idpEntityIds of entityId of IdPs + * * @return array of allowed affiliations */ private function getAllowedAffiliations($idpEntityIds): array @@ -298,7 +300,7 @@ class IsCesnetEligible extends ProcessingFilter /** * Compare two lists of affiliations and returns true if one of affiliations without scope is in booth lists. * - * @param array $userAffiliations of user scoped affiliations + * @param array $userAffiliations of user scoped affiliations * @param array $allowedAffiliations of allowed unscoped affiliations */ private function compareAffiliations($userAffiliations, $allowedAffiliations): bool @@ -307,6 +309,7 @@ class IsCesnetEligible extends ProcessingFilter if (! empty($result)) { return true; } + return false; } } diff --git a/themes/cesnet/default/includes/footer.php b/themes/cesnet/default/includes/footer.php index 57dca8b58f53cd97526f2f943d6998294a2b1fa5..e3259c9e589bca5fff486bc7d70e39c306389ef9 100644 --- a/themes/cesnet/default/includes/footer.php +++ b/themes/cesnet/default/includes/footer.php @@ -20,7 +20,7 @@ if (! empty($this->data['htmlinject']['htmlContentPost'])) { <div class="row"> <div class="col-md-4 logo"> <a href="http://www.cesnet.cz/"> - <img src="<?php echo Module::getModuleUrl('cesnet/res/img/logo-cesnet.png') ?>" + <img src="<?php echo Module::getModuleUrl('cesnet/res/img/logo-cesnet.png'); ?>" width="250px"> </a> </div> diff --git a/themes/cesnet/default/includes/header.php b/themes/cesnet/default/includes/header.php index c768358cd9e12afa4187311b87e3d058df5a2c87..8eb3bd3ac02315d3e2bcde93fd4c9f00e399426e 100644 --- a/themes/cesnet/default/includes/header.php +++ b/themes/cesnet/default/includes/header.php @@ -3,7 +3,7 @@ use SimpleSAML\Module; use SimpleSAML\Utils\HTTP; -/** +/* * Support the htmlinject hook, which allows modules to change header, pre and post body on all pages. */ $this->data['htmlinject'] = [ @@ -30,7 +30,7 @@ if (array_key_exists('pageid', $this->data)) { } // - o - o - o - o - o - o - o - o - o - o - o - o - -/** +/* * Do not allow to frame SimpleSAMLphp pages from another location. This prevents clickjacking attacks in modern * browsers. * @@ -66,7 +66,7 @@ header('X-Frame-Options: SAMEORIGIN'); $version = $jquery['version']; } - if ($version === '1.8') { + if ('1.8' === $version) { if (isset($jquery['core']) && $jquery['core']) { echo '<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery-1.8.js"></script>' . "\n" @@ -97,7 +97,6 @@ header('X-Frame-Options: SAMEORIGIN'); } } - if ($this->isLanguageRTL()) { ?> <link rel="stylesheet" type="text/css" @@ -133,7 +132,7 @@ if (isset($this->data['onLoad'])) { $onLoad .= $this->data['onLoad']; } -if ($onLoad !== '') { +if ('' !== $onLoad) { $onLoad = ' onload="' . $onLoad . '"'; } @@ -147,7 +146,7 @@ if ($onLoad !== '') { <?php $includeLanguageBar = true; - if (isset($this->data['hideLanguageBar']) && $this->data['hideLanguageBar'] === true) { + if (isset($this->data['hideLanguageBar']) && true === $this->data['hideLanguageBar']) { $includeLanguageBar = false; } diff --git a/themes/cesnet/perun/disco-tpl.php b/themes/cesnet/perun/disco-tpl.php index 3fba63b9e1e734b1af772f98ef30bc74177fe789..fee9ce5cbae5ee87caa8c3698f30900fcab57155 100644 --- a/themes/cesnet/perun/disco-tpl.php +++ b/themes/cesnet/perun/disco-tpl.php @@ -10,13 +10,12 @@ use SimpleSAML\Module\perun\model\WarningConfiguration; use SimpleSAML\Utils\HTTP; /** - * This is simple example of template for perun Discovery service + * This is simple example of template for perun Discovery service. * * Allow type hinting in IDE * * @var DiscoTemplate $this */ - $canContinue = false; if (isset($_POST['continue'])) { @@ -63,19 +62,19 @@ $this->data['jquery'] = [ ]; $this->includeAtTemplateBase('includes/header.php'); -if ($authContextClassRef !== null) { +if (null !== $authContextClassRef) { foreach ($authContextClassRef as $value) { - if (substr($value, 0, strlen(URN_CESNET_PROXYIDP_FILTER)) === URN_CESNET_PROXYIDP_FILTER) { + if (URN_CESNET_PROXYIDP_FILTER === substr($value, 0, strlen(URN_CESNET_PROXYIDP_FILTER))) { $filter = substr($value, strlen(URN_CESNET_PROXYIDP_FILTER), strlen($value)); - } elseif (substr($value, 0, strlen(URN_CESNET_PROXYIDP_EFILTER)) === URN_CESNET_PROXYIDP_EFILTER) { + } elseif (URN_CESNET_PROXYIDP_EFILTER === substr($value, 0, strlen(URN_CESNET_PROXYIDP_EFILTER))) { $efilter = substr($value, strlen(URN_CESNET_PROXYIDP_EFILTER), strlen($value)); - } elseif (substr($value, 0, strlen(URN_CESNET_PROXYIDP_IDPENTITYID)) === URN_CESNET_PROXYIDP_IDPENTITYID) { + } elseif (URN_CESNET_PROXYIDP_IDPENTITYID === substr($value, 0, strlen(URN_CESNET_PROXYIDP_IDPENTITYID))) { $idpEntityId = substr($value, strlen(URN_CESNET_PROXYIDP_IDPENTITYID), strlen($value)); } } } -if ($idpEntityId !== null) { +if (null !== $idpEntityId) { $url = $this->getContinueUrl($idpEntityId); HTTP::redirectTrustedURL($url); @@ -84,11 +83,11 @@ if ($idpEntityId !== null) { $url = $this->getContinueUrlWithoutIdPEntityId(); if ($warningAttributes->isEnabled()) { - if ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_INFO) { + if (WarningConfiguration::WARNING_TYPE_INFO === $warningAttributes->getType()) { echo '<div class="alert alert-info">'; - } elseif ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_WARNING) { + } elseif (WarningConfiguration::WARNING_TYPE_WARNING === $warningAttributes->getType()) { echo '<div class="alert alert-warning">'; - } elseif ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_ERROR) { + } elseif (WarningConfiguration::WARNING_TYPE_ERROR === $warningAttributes->getType()) { echo '<div class="alert alert-danger">'; } echo '<h4> <strong>' . $warningAttributes->getTitle() . '</strong> </h4>'; @@ -116,29 +115,33 @@ if ($idpEntityId !== null) { true ) )) { - if ($efilter !== null) { + if (null !== $efilter) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&efilter=' . $efilter); exit; - } elseif ($filter !== null) { + } + if (null !== $filter) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $filter); exit; - } elseif (isset($this->data['originalsp']['efilter'])) { + } + if (isset($this->data['originalsp']['efilter'])) { $efilter = $this->data['originalsp']['efilter']; header('Location: https://ds.eduid.cz/wayf.php' . $url . '&efilter=' . $efilter); exit; - } elseif (isset($this->data['originalsp']['filter'])) { + } + if (isset($this->data['originalsp']['filter'])) { $filter = $this->data['originalsp']['filter']; header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $filter); exit; - } elseif ($defaultEFilter !== null) { + } + if (null !== $defaultEFilter) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&efilter=' . $defaultEFilter); exit; - } elseif ($defaultFilter !== null) { + } + if (null !== $defaultFilter) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $defaultFilter); exit; } throw new Exception('cesnet:disco-tpl: Filter did not set. '); } - $this->includeAtTemplateBase('includes/footer.php'); diff --git a/themes/einfra/core/loginuserpass.php b/themes/einfra/core/loginuserpass.php index 8b8446b78c1e689b9b1a92b09baed2986ac03ac7..0b9dd3c59f0aa7d0d024fdcb45e9831e88b55150 100644 --- a/themes/einfra/core/loginuserpass.php +++ b/themes/einfra/core/loginuserpass.php @@ -10,7 +10,7 @@ if (strlen($this->data['username']) > 0) { $this->includeAtTemplateBase('includes/header.php'); -if ($this->data['errorcode'] !== null) { +if (null !== $this->data['errorcode']) { ?> <div class="alert alert-danger"> <span class="glyphicon glyphicon-exclamation-sign" diff --git a/themes/einfra/default/includes/footer.php b/themes/einfra/default/includes/footer.php index 5fe120f7131883de791e574e5ec4b59717ec5a91..0ef1ba1c910af1781f2892e91fa2e5f5223151a4 100644 --- a/themes/einfra/default/includes/footer.php +++ b/themes/einfra/default/includes/footer.php @@ -19,7 +19,7 @@ if (! empty($this->data['htmlinject']['htmlContentPost'])) { <div class="container"> <div class="row"> <div class="col-md-4 logo"> - <img src="<?php echo Module::getModuleUrl('cesnet/res/img/footer_logo.png') ?>" > + <img src="<?php echo Module::getModuleUrl('cesnet/res/img/footer_logo.png'); ?>" > </div> <div class="col-md-8"> <div class="row"> diff --git a/themes/einfra/default/includes/header.php b/themes/einfra/default/includes/header.php index 5231b308382226fa79bbef02e711f32a767cb780..d4ca36ac060bdfb8efd90089f713d65561109f45 100644 --- a/themes/einfra/default/includes/header.php +++ b/themes/einfra/default/includes/header.php @@ -3,7 +3,7 @@ use SimpleSAML\Module; use SimpleSAML\Utils\HTTP; -/** +/* * Support the htmlinject hook, which allows modules to change header, pre and post body on all pages. */ $this->data['htmlinject'] = [ @@ -30,7 +30,7 @@ if (array_key_exists('pageid', $this->data)) { } // - o - o - o - o - o - o - o - o - o - o - o - o - -/** +/* * Do not allow to frame SimpleSAMLphp pages from another location. This prevents clickjacking attacks in modern * browsers. * @@ -66,7 +66,7 @@ header('X-Frame-Options: SAMEORIGIN'); $version = $jquery['version']; } - if ($version === '1.8') { + if ('1.8' === $version) { if (isset($jquery['core']) && $jquery['core']) { echo '<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery-1.8.js"></script>' . "\n" @@ -97,7 +97,6 @@ header('X-Frame-Options: SAMEORIGIN'); } } - if ($this->isLanguageRTL()) { ?> <link rel="stylesheet" type="text/css" @@ -133,7 +132,7 @@ if (isset($this->data['onLoad'])) { $onLoad .= $this->data['onLoad']; } -if ($onLoad !== '') { +if ('' !== $onLoad) { $onLoad = ' onload="' . $onLoad . '"'; } @@ -147,7 +146,7 @@ if ($onLoad !== '') { <?php $includeLanguageBar = true; - if (isset($this->data['hideLanguageBar']) && $this->data['hideLanguageBar'] === true) { + if (isset($this->data['hideLanguageBar']) && true === $this->data['hideLanguageBar']) { $includeLanguageBar = false; } diff --git a/themes/einfra/perun/disco-tpl.php b/themes/einfra/perun/disco-tpl.php index 3fba63b9e1e734b1af772f98ef30bc74177fe789..fee9ce5cbae5ee87caa8c3698f30900fcab57155 100644 --- a/themes/einfra/perun/disco-tpl.php +++ b/themes/einfra/perun/disco-tpl.php @@ -10,13 +10,12 @@ use SimpleSAML\Module\perun\model\WarningConfiguration; use SimpleSAML\Utils\HTTP; /** - * This is simple example of template for perun Discovery service + * This is simple example of template for perun Discovery service. * * Allow type hinting in IDE * * @var DiscoTemplate $this */ - $canContinue = false; if (isset($_POST['continue'])) { @@ -63,19 +62,19 @@ $this->data['jquery'] = [ ]; $this->includeAtTemplateBase('includes/header.php'); -if ($authContextClassRef !== null) { +if (null !== $authContextClassRef) { foreach ($authContextClassRef as $value) { - if (substr($value, 0, strlen(URN_CESNET_PROXYIDP_FILTER)) === URN_CESNET_PROXYIDP_FILTER) { + if (URN_CESNET_PROXYIDP_FILTER === substr($value, 0, strlen(URN_CESNET_PROXYIDP_FILTER))) { $filter = substr($value, strlen(URN_CESNET_PROXYIDP_FILTER), strlen($value)); - } elseif (substr($value, 0, strlen(URN_CESNET_PROXYIDP_EFILTER)) === URN_CESNET_PROXYIDP_EFILTER) { + } elseif (URN_CESNET_PROXYIDP_EFILTER === substr($value, 0, strlen(URN_CESNET_PROXYIDP_EFILTER))) { $efilter = substr($value, strlen(URN_CESNET_PROXYIDP_EFILTER), strlen($value)); - } elseif (substr($value, 0, strlen(URN_CESNET_PROXYIDP_IDPENTITYID)) === URN_CESNET_PROXYIDP_IDPENTITYID) { + } elseif (URN_CESNET_PROXYIDP_IDPENTITYID === substr($value, 0, strlen(URN_CESNET_PROXYIDP_IDPENTITYID))) { $idpEntityId = substr($value, strlen(URN_CESNET_PROXYIDP_IDPENTITYID), strlen($value)); } } } -if ($idpEntityId !== null) { +if (null !== $idpEntityId) { $url = $this->getContinueUrl($idpEntityId); HTTP::redirectTrustedURL($url); @@ -84,11 +83,11 @@ if ($idpEntityId !== null) { $url = $this->getContinueUrlWithoutIdPEntityId(); if ($warningAttributes->isEnabled()) { - if ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_INFO) { + if (WarningConfiguration::WARNING_TYPE_INFO === $warningAttributes->getType()) { echo '<div class="alert alert-info">'; - } elseif ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_WARNING) { + } elseif (WarningConfiguration::WARNING_TYPE_WARNING === $warningAttributes->getType()) { echo '<div class="alert alert-warning">'; - } elseif ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_ERROR) { + } elseif (WarningConfiguration::WARNING_TYPE_ERROR === $warningAttributes->getType()) { echo '<div class="alert alert-danger">'; } echo '<h4> <strong>' . $warningAttributes->getTitle() . '</strong> </h4>'; @@ -116,29 +115,33 @@ if ($idpEntityId !== null) { true ) )) { - if ($efilter !== null) { + if (null !== $efilter) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&efilter=' . $efilter); exit; - } elseif ($filter !== null) { + } + if (null !== $filter) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $filter); exit; - } elseif (isset($this->data['originalsp']['efilter'])) { + } + if (isset($this->data['originalsp']['efilter'])) { $efilter = $this->data['originalsp']['efilter']; header('Location: https://ds.eduid.cz/wayf.php' . $url . '&efilter=' . $efilter); exit; - } elseif (isset($this->data['originalsp']['filter'])) { + } + if (isset($this->data['originalsp']['filter'])) { $filter = $this->data['originalsp']['filter']; header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $filter); exit; - } elseif ($defaultEFilter !== null) { + } + if (null !== $defaultEFilter) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&efilter=' . $defaultEFilter); exit; - } elseif ($defaultFilter !== null) { + } + if (null !== $defaultFilter) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $defaultFilter); exit; } throw new Exception('cesnet:disco-tpl: Filter did not set. '); } - $this->includeAtTemplateBase('includes/footer.php'); diff --git a/themes/einfra_idp/core/loginuserpass.php b/themes/einfra_idp/core/loginuserpass.php index 8b8446b78c1e689b9b1a92b09baed2986ac03ac7..0b9dd3c59f0aa7d0d024fdcb45e9831e88b55150 100644 --- a/themes/einfra_idp/core/loginuserpass.php +++ b/themes/einfra_idp/core/loginuserpass.php @@ -10,7 +10,7 @@ if (strlen($this->data['username']) > 0) { $this->includeAtTemplateBase('includes/header.php'); -if ($this->data['errorcode'] !== null) { +if (null !== $this->data['errorcode']) { ?> <div class="alert alert-danger"> <span class="glyphicon glyphicon-exclamation-sign" diff --git a/themes/einfra_idp/default/includes/footer.php b/themes/einfra_idp/default/includes/footer.php index 5fe120f7131883de791e574e5ec4b59717ec5a91..0ef1ba1c910af1781f2892e91fa2e5f5223151a4 100644 --- a/themes/einfra_idp/default/includes/footer.php +++ b/themes/einfra_idp/default/includes/footer.php @@ -19,7 +19,7 @@ if (! empty($this->data['htmlinject']['htmlContentPost'])) { <div class="container"> <div class="row"> <div class="col-md-4 logo"> - <img src="<?php echo Module::getModuleUrl('cesnet/res/img/footer_logo.png') ?>" > + <img src="<?php echo Module::getModuleUrl('cesnet/res/img/footer_logo.png'); ?>" > </div> <div class="col-md-8"> <div class="row"> diff --git a/themes/einfra_idp/default/includes/header.php b/themes/einfra_idp/default/includes/header.php index 31925a39722e13ca1046da8d246393f0ea6d388a..d70b05ca3f3cafbdc5445392597302d67d24b09f 100644 --- a/themes/einfra_idp/default/includes/header.php +++ b/themes/einfra_idp/default/includes/header.php @@ -3,7 +3,7 @@ use SimpleSAML\Module; use SimpleSAML\Utils\HTTP; -/** +/* * Support the htmlinject hook, which allows modules to change header, pre and post body on all pages. */ $this->data['htmlinject'] = [ @@ -30,7 +30,7 @@ if (array_key_exists('pageid', $this->data)) { } // - o - o - o - o - o - o - o - o - o - o - o - o - -/** +/* * Do not allow to frame SimpleSAMLphp pages from another location. This prevents clickjacking attacks in modern * browsers. * @@ -66,7 +66,7 @@ header('X-Frame-Options: SAMEORIGIN'); $version = $jquery['version']; } - if ($version === '1.8') { + if ('1.8' === $version) { if (isset($jquery['core']) && $jquery['core']) { echo '<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery-1.8.js"></script>' . "\n" @@ -97,7 +97,6 @@ header('X-Frame-Options: SAMEORIGIN'); } } - if ($this->isLanguageRTL()) { ?> <link rel="stylesheet" type="text/css" @@ -133,7 +132,7 @@ if (isset($this->data['onLoad'])) { $onLoad .= $this->data['onLoad']; } -if ($onLoad !== '') { +if ('' !== $onLoad) { $onLoad = ' onload="' . $onLoad . '"'; } @@ -147,7 +146,7 @@ if ($onLoad !== '') { <?php $includeLanguageBar = true; - if (isset($this->data['hideLanguageBar']) && $this->data['hideLanguageBar'] === true) { + if (isset($this->data['hideLanguageBar']) && true === $this->data['hideLanguageBar']) { $includeLanguageBar = false; } diff --git a/themes/einfra_idp/perun/disco-tpl.php b/themes/einfra_idp/perun/disco-tpl.php index 3fba63b9e1e734b1af772f98ef30bc74177fe789..fee9ce5cbae5ee87caa8c3698f30900fcab57155 100644 --- a/themes/einfra_idp/perun/disco-tpl.php +++ b/themes/einfra_idp/perun/disco-tpl.php @@ -10,13 +10,12 @@ use SimpleSAML\Module\perun\model\WarningConfiguration; use SimpleSAML\Utils\HTTP; /** - * This is simple example of template for perun Discovery service + * This is simple example of template for perun Discovery service. * * Allow type hinting in IDE * * @var DiscoTemplate $this */ - $canContinue = false; if (isset($_POST['continue'])) { @@ -63,19 +62,19 @@ $this->data['jquery'] = [ ]; $this->includeAtTemplateBase('includes/header.php'); -if ($authContextClassRef !== null) { +if (null !== $authContextClassRef) { foreach ($authContextClassRef as $value) { - if (substr($value, 0, strlen(URN_CESNET_PROXYIDP_FILTER)) === URN_CESNET_PROXYIDP_FILTER) { + if (URN_CESNET_PROXYIDP_FILTER === substr($value, 0, strlen(URN_CESNET_PROXYIDP_FILTER))) { $filter = substr($value, strlen(URN_CESNET_PROXYIDP_FILTER), strlen($value)); - } elseif (substr($value, 0, strlen(URN_CESNET_PROXYIDP_EFILTER)) === URN_CESNET_PROXYIDP_EFILTER) { + } elseif (URN_CESNET_PROXYIDP_EFILTER === substr($value, 0, strlen(URN_CESNET_PROXYIDP_EFILTER))) { $efilter = substr($value, strlen(URN_CESNET_PROXYIDP_EFILTER), strlen($value)); - } elseif (substr($value, 0, strlen(URN_CESNET_PROXYIDP_IDPENTITYID)) === URN_CESNET_PROXYIDP_IDPENTITYID) { + } elseif (URN_CESNET_PROXYIDP_IDPENTITYID === substr($value, 0, strlen(URN_CESNET_PROXYIDP_IDPENTITYID))) { $idpEntityId = substr($value, strlen(URN_CESNET_PROXYIDP_IDPENTITYID), strlen($value)); } } } -if ($idpEntityId !== null) { +if (null !== $idpEntityId) { $url = $this->getContinueUrl($idpEntityId); HTTP::redirectTrustedURL($url); @@ -84,11 +83,11 @@ if ($idpEntityId !== null) { $url = $this->getContinueUrlWithoutIdPEntityId(); if ($warningAttributes->isEnabled()) { - if ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_INFO) { + if (WarningConfiguration::WARNING_TYPE_INFO === $warningAttributes->getType()) { echo '<div class="alert alert-info">'; - } elseif ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_WARNING) { + } elseif (WarningConfiguration::WARNING_TYPE_WARNING === $warningAttributes->getType()) { echo '<div class="alert alert-warning">'; - } elseif ($warningAttributes->getType() === WarningConfiguration::WARNING_TYPE_ERROR) { + } elseif (WarningConfiguration::WARNING_TYPE_ERROR === $warningAttributes->getType()) { echo '<div class="alert alert-danger">'; } echo '<h4> <strong>' . $warningAttributes->getTitle() . '</strong> </h4>'; @@ -116,29 +115,33 @@ if ($idpEntityId !== null) { true ) )) { - if ($efilter !== null) { + if (null !== $efilter) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&efilter=' . $efilter); exit; - } elseif ($filter !== null) { + } + if (null !== $filter) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $filter); exit; - } elseif (isset($this->data['originalsp']['efilter'])) { + } + if (isset($this->data['originalsp']['efilter'])) { $efilter = $this->data['originalsp']['efilter']; header('Location: https://ds.eduid.cz/wayf.php' . $url . '&efilter=' . $efilter); exit; - } elseif (isset($this->data['originalsp']['filter'])) { + } + if (isset($this->data['originalsp']['filter'])) { $filter = $this->data['originalsp']['filter']; header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $filter); exit; - } elseif ($defaultEFilter !== null) { + } + if (null !== $defaultEFilter) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&efilter=' . $defaultEFilter); exit; - } elseif ($defaultFilter !== null) { + } + if (null !== $defaultFilter) { header('Location: https://ds.eduid.cz/wayf.php' . $url . '&filter=' . $defaultFilter); exit; } throw new Exception('cesnet:disco-tpl: Filter did not set. '); } - $this->includeAtTemplateBase('includes/footer.php'); diff --git a/www/updateIsCesnetEligible.php b/www/updateIsCesnetEligible.php index cc1a3ed957e78bfa62ea1b6406e2475fae47673e..8f82917d768f1b1286dd8770392a996f1d3843a4 100644 --- a/www/updateIsCesnetEligible.php +++ b/www/updateIsCesnetEligible.php @@ -3,7 +3,7 @@ declare(strict_types=1); /** - * Script for updating IsCesnetEligible in Perun asynchronously + * Script for updating IsCesnetEligible in Perun asynchronously. */ use SimpleSAML\Error\Exception;