From af24da40fd3e4b9067a661952c28b3b5e4413940 Mon Sep 17 00:00:00 2001 From: Jaime Perez Crespo <jaime.perez@uninett.no> Date: Fri, 6 Nov 2015 16:34:34 +0100 Subject: [PATCH] Clean one-liner comments. --- bin/initMDSPdo.php | 4 +- bin/memcacheSync.php | 16 ++-- bin/pwgen.php | 4 +- bin/translation.php | 4 +- config-templates/acl.php | 12 +-- config-templates/ldap.php | 4 +- config-templates/ldapmulti.php | 2 +- lib/SimpleSAML/Auth/Default.php | 2 +- lib/SimpleSAML/Auth/LDAP.php | 76 +++++++++---------- lib/SimpleSAML/Auth/ProcessingChain.php | 18 ++--- lib/SimpleSAML/Auth/Simple.php | 6 +- lib/SimpleSAML/Auth/State.php | 22 +++--- lib/SimpleSAML/Auth/TimeLimitedToken.php | 2 +- lib/SimpleSAML/Bindings/Shib13/Artifact.php | 6 +- lib/SimpleSAML/Bindings/Shib13/HTTPPost.php | 2 +- lib/SimpleSAML/Configuration.php | 4 +- lib/SimpleSAML/Error/Error.php | 2 +- .../Error/UnserializableException.php | 2 +- lib/SimpleSAML/IdP/LogoutTraditional.php | 2 +- lib/SimpleSAML/Logger.php | 2 +- .../Logger/LoggingHandlerSyslog.php | 2 +- lib/SimpleSAML/Memcache.php | 2 +- lib/SimpleSAML/Metadata/SAMLBuilder.php | 4 +- lib/SimpleSAML/Metadata/SAMLParser.php | 2 +- lib/SimpleSAML/Store/SQL.php | 6 +- lib/SimpleSAML/Utilities.php | 10 +-- lib/SimpleSAML/Utils/HTTP.php | 4 +- lib/SimpleSAML/XHTML/Template.php | 64 ++++++++-------- lib/SimpleSAML/XML/Errors.php | 14 ++-- lib/SimpleSAML/XML/Parser.php | 2 +- lib/SimpleSAML/XML/Shib13/AuthnResponse.php | 18 ++--- lib/SimpleSAML/XML/Signer.php | 8 +- lib/SimpleSAML/XML/Validator.php | 52 ++++++------- lib/_autoload.php | 2 +- metadata-templates/saml20-idp-hosted.php | 2 +- metadata-templates/shib13-idp-hosted.php | 2 +- modules/adfs/lib/IdP/ADFS.php | 8 +- modules/adfs/www/idp/prp.php | 4 +- .../lib/Auth/Process/ExpiryWarning.php | 4 +- .../authX509/lib/Auth/Source/X509userCert.php | 4 +- modules/authX509/www/expirywarning.php | 2 +- .../authYubiKey/lib/Auth/Source/YubiKey.php | 4 +- modules/authYubiKey/libextinc/Yubico.php | 4 +- modules/authYubiKey/www/yubikeylogin.php | 2 +- modules/authcrypt/lib/Auth/Source/Hash.php | 4 +- .../authcrypt/lib/Auth/Source/Htpasswd.php | 2 +- .../authfacebook/extlibinc/base_facebook.php | 32 ++++---- .../authfacebook/lib/Auth/Source/Facebook.php | 4 +- modules/authfacebook/lib/Facebook.php | 6 +- modules/authfacebook/www/linkback.php | 2 +- .../authlinkedin/lib/Auth/Source/LinkedIn.php | 6 +- modules/authlinkedin/www/linkback.php | 2 +- .../authmyspace/lib/Auth/Source/MySpace.php | 4 +- modules/authmyspace/www/linkback.php | 2 +- .../authorize/lib/Auth/Process/Authorize.php | 2 +- .../authtwitter/lib/Auth/Source/Twitter.php | 4 +- modules/authtwitter/www/linkback.php | 2 +- .../lib/Auth/Source/LiveID.php | 4 +- modules/authwindowslive/www/linkback.php | 2 +- modules/cas/lib/Auth/Source/CAS.php | 4 +- modules/cas/www/linkback.php | 2 +- modules/casserver/www/serviceValidate.php | 2 +- modules/cdc/lib/Auth/Process/CDC.php | 2 +- modules/cdc/lib/Server.php | 4 +- modules/consent/lib/Consent/Store/Cookie.php | 2 +- .../consent/lib/Consent/Store/Database.php | 2 +- modules/consent/www/getconsent.php | 2 +- .../config-templates/module_consentAdmin.php | 2 +- modules/consentAdmin/www/consentAdmin.php | 4 +- modules/core/lib/ACL.php | 4 +- .../core/lib/Auth/Process/AttributeLimit.php | 4 +- .../core/lib/Auth/Process/AttributeMap.php | 2 +- .../lib/Auth/Process/ExtendIdPSession.php | 4 +- .../core/lib/Auth/Process/GenerateGroups.php | 4 +- .../core/lib/Auth/Process/LanguageAdaptor.php | 4 +- .../core/lib/Auth/Process/ScopeAttribute.php | 2 +- .../lib/Auth/Process/ScopeFromAttribute.php | 4 +- .../Auth/Process/StatisticsWithAttribute.php | 2 +- modules/core/lib/Auth/Process/TargetedID.php | 2 +- .../lib/Auth/Process/WarnShortSSOInterval.php | 4 +- .../core/lib/Auth/Source/AdminPassword.php | 4 +- modules/core/lib/Auth/UserPassBase.php | 4 +- modules/core/lib/Auth/UserPassOrgBase.php | 4 +- modules/core/lib/Stats/Output/File.php | 4 +- .../core/templates/logout-iframe-wrapper.php | 2 +- modules/core/www/authenticate.php | 2 +- modules/core/www/cleardiscochoices.php | 4 +- modules/core/www/frontpage_auth.php | 4 +- modules/core/www/frontpage_config.php | 4 +- modules/core/www/frontpage_federation.php | 4 +- modules/core/www/frontpage_welcome.php | 4 +- modules/core/www/idp/logout-iframe-done.php | 4 +- modules/core/www/idp/logout-iframe.php | 4 +- modules/core/www/loginuserpass.php | 4 +- modules/core/www/loginuserpassorg.php | 4 +- modules/core/www/postredirect.php | 2 +- modules/core/www/short_sso_interval.php | 2 +- modules/cron/www/croninfo.php | 2 +- .../config-templates/module_discopower.php | 4 +- modules/discopower/lib/PowerIdPDisco.php | 2 +- modules/discopower/templates/disco-tpl.php | 2 +- modules/discopower/www/disco.php | 4 +- .../www/attributeserver.php | 4 +- .../lib/Auth/Process/RedirectTest.php | 4 +- .../exampleauth/lib/Auth/Source/External.php | 4 +- .../exampleauth/lib/Auth/Source/Static.php | 4 +- .../exampleauth/lib/Auth/Source/UserPass.php | 4 +- modules/exampleauth/www/authpage.php | 2 +- .../lib/Auth/Process/ExpiryDate.php | 4 +- modules/expirycheck/www/about2expire.php | 2 +- .../Auth/Process/AttributeAddUsersGroups.php | 2 +- modules/ldap/lib/Auth/Source/LDAP.php | 2 +- modules/ldap/lib/Auth/Source/LDAPMulti.php | 4 +- modules/ldap/lib/ConfigHelper.php | 4 +- .../templates/memcachestat.tpl.php | 2 +- modules/memcacheMonitor/www/memcachestat.php | 2 +- modules/metarefresh/bin/metarefresh.php | 4 +- .../config-templates/config-metarefresh.php | 2 +- modules/metarefresh/hooks/hook_cron.php | 2 +- modules/metarefresh/lib/MetaLoader.php | 6 +- .../multiauth/lib/Auth/Source/MultiAuth.php | 4 +- modules/multiauth/www/selectsource.php | 2 +- .../negotiate/lib/Auth/Source/Negotiate.php | 2 +- modules/oauth/bin/demo.php | 4 +- modules/oauth/lib/Consumer.php | 2 +- modules/oauth/libextinc/OAuth.php | 6 +- modules/oauth/www/registry.edit.php | 2 +- modules/oauth/www/registry.php | 2 +- modules/portal/hooks/hook_htmlinject.php | 2 +- .../lib/Auth/Process/Warning.php | 4 +- modules/preprodwarning/www/showwarning.php | 2 +- modules/radius/lib/Auth/Source/Radius.php | 4 +- modules/saml/lib/Auth/Source/SP.php | 4 +- modules/saml/lib/Error.php | 2 +- modules/saml/lib/IdP/SAML1.php | 4 +- modules/saml/lib/IdP/SAML2.php | 6 +- modules/saml/lib/IdP/SQLNameID.php | 2 +- modules/saml/lib/Message.php | 4 +- modules/saml/lib/SP/LogoutStore.php | 4 +- modules/saml/www/idp/certs.php | 4 +- modules/saml/www/sp/discoresp.php | 2 +- modules/saml/www/sp/saml1-acs.php | 4 +- modules/saml/www/sp/saml2-acs.php | 2 +- modules/saml/www/sp/saml2-logout.php | 6 +- modules/sqlauth/lib/Auth/Source/SQL.php | 4 +- modules/statistics/bin/loganalyzer.php | 4 +- modules/statistics/bin/logcleaner.php | 4 +- .../config-templates/module_statistics.php | 4 +- modules/statistics/lib/AccessCheck.php | 2 +- modules/statistics/lib/Aggregator.php | 2 +- modules/statistics/lib/Graph/GoogleCharts.php | 2 +- modules/statistics/lib/LogCleaner.php | 6 +- .../lib/Statistics/Rulesets/BaseRule.php | 2 +- templates/post.php | 4 +- tests/lib/SimpleSAML/DatabaseTest.php | 2 +- .../core/lib/Auth/Process/TargetedIDTest.php | 2 +- www/admin/hostnames.php | 4 +- www/admin/phpinfo.php | 2 +- www/saml2/idp/SingleLogoutService.php | 2 +- www/saml2/idp/metadata.php | 4 +- 160 files changed, 410 insertions(+), 410 deletions(-) diff --git a/bin/initMDSPdo.php b/bin/initMDSPdo.php index f3e685e74..6e5159a63 100755 --- a/bin/initMDSPdo.php +++ b/bin/initMDSPdo.php @@ -1,10 +1,10 @@ #!/usr/bin/env php <?php -/* This is the base directory of the SimpleSAMLphp installation. */ +// This is the base directory of the SimpleSAMLphp installation $baseDir = dirname(dirname(__FILE__)); -/* Add library autoloader and configuration. */ +// Add library autoloader and configuration require_once $baseDir . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . '_autoload.php'; require_once $baseDir . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'; diff --git a/bin/memcacheSync.php b/bin/memcacheSync.php index 01b4e0b3d..2de186ae5 100755 --- a/bin/memcacheSync.php +++ b/bin/memcacheSync.php @@ -2,7 +2,7 @@ <?php -/* Check that the memcache library is enabled. */ +// Check that the memcache library is enabled if(!class_exists('Memcache')) { echo("Error: the memcache library appears to be unavailable.\n"); echo("\n"); @@ -17,21 +17,21 @@ if(!class_exists('Memcache')) { exit(1); } -/* This is the base directory of the SimpleSAMLphp installation. */ +// This is the base directory of the SimpleSAMLphp installation $baseDir = dirname(dirname(__FILE__)); -/* Add library autoloader. */ +// Add library autoloader require_once($baseDir . '/lib/_autoload.php'); -/* Initialize the configuration. */ +// Initialize the configuration $configdir = SimpleSAML\Utils\Config::getConfigDir(); SimpleSAML_Configuration::setConfigDir($configdir); -/* Things we should warn the user about. */ +// Things we should warn the user about $warnServerDown = 0; $warnBigSlab = 0; -/* We use the stats interface to determine which servers exists. */ +// We use the stats interface to determine which servers exists $stats = SimpleSAML_Memcache::getRawStats(); $keys = array(); @@ -105,7 +105,7 @@ function getServerKeys($server) { exit(1); } - /* Read list of slabs. */ + // Read list of slabs $slabs = array(); while( ($line = fgets($socket)) !== FALSE) { $line = rtrim($line); @@ -121,7 +121,7 @@ function getServerKeys($server) { } } - /* Dump keys in slabs. */ + // Dump keys in slabs $keys = array(); foreach($slabs as $slab) { diff --git a/bin/pwgen.php b/bin/pwgen.php index fddca593d..a91df060d 100755 --- a/bin/pwgen.php +++ b/bin/pwgen.php @@ -6,10 +6,10 @@ */ -/* This is the base directory of the SimpleSAMLphp installation. */ +// This is the base directory of the SimpleSAMLphp installation $baseDir = dirname(dirname(__FILE__)); -/* Add library autoloader. */ +// Add library autoloader require_once($baseDir . '/lib/_autoload.php'); diff --git a/bin/translation.php b/bin/translation.php index d07a0c05a..82c60a04b 100755 --- a/bin/translation.php +++ b/bin/translation.php @@ -1,10 +1,10 @@ #!/usr/bin/env php <?php -/* This is the base directory of the SimpleSAMLphp installation. */ +// This is the base directory of the SimpleSAMLphp installation $baseDir = dirname(dirname(__FILE__)); -/* Add library autoloader. */ +// Add library autoloader require_once($baseDir . '/lib/_autoload.php'); if (count($argv) !== 3) { diff --git a/config-templates/acl.php b/config-templates/acl.php index ce901cefe..7dcca1653 100644 --- a/config-templates/acl.php +++ b/config-templates/acl.php @@ -9,34 +9,34 @@ $config = array( 'adminlist' => array( //array('allow', 'equals', 'mail', 'admin1@example.org'), //array('allow', 'has', 'groups', 'admin'), - /* The default action is to deny access. */ + // The default action is to deny access. ), 'example-simple' => array( array('allow', 'equals', 'mail', 'admin1@example.org'), array('allow', 'equals', 'mail', 'admin2@example.org'), - /* The default action is to deny access. */ + // The default action is to deny access. ), 'example-deny-some' => array( array('deny', 'equals', 'mail', 'eviluser@example.org'), - array('allow'), /* Allow everybody else. */ + array('allow'), // Allow everybody else. ), 'example-maildomain' => array( array('allow', 'equals-preg', 'mail', '/@example\.org$/'), - /* The default action is to deny access. */ + // The default action is to deny access. ), 'example-allow-employees' => array( array('allow', 'has', 'eduPersonAffiliation', 'employee'), - /* The default action is to deny access. */ + // The default action is to deny access. ), 'example-allow-employees-not-students' => array( array('deny', 'has', 'eduPersonAffiliation', 'student'), array('allow', 'has', 'eduPersonAffiliation', 'employee'), - /* The default action is to deny access. */ + // The default action is to deny access. ), 'example-deny-student-except-one' => array( diff --git a/config-templates/ldap.php b/config-templates/ldap.php index 5f5b0b9db..799f58428 100644 --- a/config-templates/ldap.php +++ b/config-templates/ldap.php @@ -20,10 +20,10 @@ $config = array ( * Searching the DN of the user. */ - /* Set this to TRUE to enable searching. */ + // Set this to TRUE to enable searching. 'auth.ldap.search.enable' => FALSE, - /* The base DN for the search. */ + // The base DN for the search. 'auth.ldap.search.base' => NULL, /* The attribute(s) to search for. diff --git a/config-templates/ldapmulti.php b/config-templates/ldapmulti.php index e7c8b0cf8..ce16cdee8 100644 --- a/config-templates/ldapmulti.php +++ b/config-templates/ldapmulti.php @@ -9,7 +9,7 @@ $ldapmulti = array ( 'feide.no' => array( 'description' => 'Feide', - /* for a description of options see equivalent options in ldap.php starting with auth.ldap. */ + // for a description of options see equivalent options in ldap.php starting with auth.ldap. 'dnpattern' => 'uid=%username%,dc=feide,dc=no,ou=feide,dc=uninett,dc=no', 'hostname' => 'ldap.uninett.no', 'attributes' => NULL, diff --git a/lib/SimpleSAML/Auth/Default.php b/lib/SimpleSAML/Auth/Default.php index 39950a8e1..3e7814b4d 100644 --- a/lib/SimpleSAML/Auth/Default.php +++ b/lib/SimpleSAML/Auth/Default.php @@ -60,7 +60,7 @@ class SimpleSAML_Auth_Default { $as = SimpleSAML_Auth_Source::getById($authority); if ($as === NULL) { - /* The authority wasn't an authentication source... */ + // The authority wasn't an authentication source... self::logoutCompleted($state); } diff --git a/lib/SimpleSAML/Auth/LDAP.php b/lib/SimpleSAML/Auth/LDAP.php index 87c46afbe..794e84392 100644 --- a/lib/SimpleSAML/Auth/LDAP.php +++ b/lib/SimpleSAML/Auth/LDAP.php @@ -54,10 +54,10 @@ class SimpleSAML_Auth_LDAP { * @param int $port * @param bool $referrals */ - // TODO: Flesh out documentation. + // TODO: Flesh out documentation public function __construct($hostname, $enable_tls = TRUE, $debug = FALSE, $timeout = 0, $port = 389, $referrals = TRUE) { - // Debug. + // Debug SimpleSAML_Logger::debug('Library - LDAP __construct(): Setup LDAP with ' . 'host=\'' . $hostname . '\', tls=' . var_export($enable_tls, true) . @@ -84,18 +84,18 @@ class SimpleSAML_Auth_LDAP { throw $this->makeException('Library - LDAP __construct(): Unable to connect to \'' . $hostname . '\'', ERR_INTERNAL); } - /* Enable LDAP protocol version 3. */ + // Enable LDAP protocol version 3 if (!@ldap_set_option($this->ldap, LDAP_OPT_PROTOCOL_VERSION, 3)) { throw $this->makeException('Library - LDAP __construct(): Failed to set LDAP Protocol version (LDAP_OPT_PROTOCOL_VERSION) to 3', ERR_INTERNAL); } - /* Set referral option */ + // Set referral option if (!@ldap_set_option($this->ldap, LDAP_OPT_REFERRALS, $referrals)) { throw $this->makeException('Library - LDAP __construct(): Failed to set LDAP Referrals (LDAP_OPT_REFERRALS) to '.$referrals, ERR_INTERNAL); } - // Set timeouts, if supported. - // (OpenLDAP 2.x.x or Netscape Directory SDK x.x needed). + // Set timeouts, if supported + // (OpenLDAP 2.x.x or Netscape Directory SDK x.x needed) $this->timeout = $timeout; if ($timeout > 0) { if (!@ldap_set_option($this->ldap, LDAP_OPT_NETWORK_TIMEOUT, $timeout)) { @@ -106,7 +106,7 @@ class SimpleSAML_Auth_LDAP { } } - // Enable TLS, if needed. + // Enable TLS, if needed if (stripos($hostname, "ldaps:") === FALSE and $enable_tls) { if (!@ldap_start_tls($this->ldap)) { throw $this->makeException('Library - LDAP __construct(): Unable to force TLS', ERR_INTERNAL); @@ -126,7 +126,7 @@ class SimpleSAML_Auth_LDAP { private function makeException($description, $type = NULL) { $errNo = 0x00; - // Log LDAP code and description, if possible. + // Log LDAP code and description, if possible if (empty($this->ldap)) { SimpleSAML_Logger::error($description); } else { @@ -136,7 +136,7 @@ class SimpleSAML_Auth_LDAP { // Decide exception type and return if ($type) { if ($errNo !== 0) { - // Only log real LDAP errors; not success. + // Only log real LDAP errors; not success SimpleSAML_Logger::error($description . '; cause: \'' . ldap_error($this->ldap) . '\' (0x' . dechex($errNo) . ')'); } else { SimpleSAML_Logger::error($description); @@ -204,7 +204,7 @@ class SimpleSAML_Auth_LDAP { */ private function search($base, $attribute, $value) { - // Create the search filter. + // Create the search filter $attribute = self::escape_filter_value($attribute, FALSE); $value = self::escape_filter_value($value); $filter = ''; @@ -213,7 +213,7 @@ class SimpleSAML_Auth_LDAP { } $filter = '(|' . $filter . ')'; - // Search using generated filter. + // Search using generated filter SimpleSAML_Logger::debug('Library - LDAP search(): Searching base \'' . $base . '\' for \'' . $filter . '\''); // TODO: Should aliases be dereferenced? $result = @ldap_search($this->ldap, $base, $filter, array(), 0, 0, $this->timeout); @@ -221,7 +221,7 @@ class SimpleSAML_Auth_LDAP { throw $this->makeException('Library - LDAP search(): Failed search on base \'' . $base . '\' for \'' . $filter . '\''); } - // Sanity checks on search results. + // Sanity checks on search results $count = @ldap_count_entries($this->ldap, $result); if ($count === FALSE) { throw $this->makeException('Library - LDAP search(): Failed to get number of entries returned'); @@ -234,7 +234,7 @@ class SimpleSAML_Auth_LDAP { } - // Resolve the DN from the search result. + // Resolve the DN from the search result $entry = @ldap_first_entry($this->ldap, $result); if ($entry === FALSE) { throw $this->makeException('Library - LDAP search(): Unable to retrieve result after searching base \'' . $base . '\' for \'' . $filter . '\''); @@ -273,29 +273,29 @@ class SimpleSAML_Auth_LDAP { */ public function searchfordn($base, $attribute, $value, $allowZeroHits = FALSE) { - // Traverse all search bases, returning DN if found. + // Traverse all search bases, returning DN if found $bases = SimpleSAML\Utils\Arrays::arrayize($base); $result = NULL; foreach ($bases AS $current) { try { - // Single base search. + // Single base search $result = $this->search($current, $attribute, $value); // We don't hawe to look any futher if user is found if (!empty($result)) { return $result; } - // If search failed, attempt the other base DNs. + // If search failed, attempt the other base DNs } catch (SimpleSAML_Error_UserNotFound $e) { // Just continue searching } } - // Decide what to do for zero entries. + // Decide what to do for zero entries SimpleSAML_Logger::debug('Library - LDAP searchfordn(): No entries found'); if ($allowZeroHits) { - // Zero hits allowed. + // Zero hits allowed return NULL; } else { - // Zero hits not allowed. + // Zero hits not allowed throw $this->makeException('Library - LDAP searchfordn(): LDAP search returned zero entries for filter \'(' . $attribute . ' = ' . $value . ')\' on base(s) \'(' . join(' & ', $bases) . ')\'', 2); } @@ -427,7 +427,7 @@ class SimpleSAML_Auth_LDAP { throw $this->makeException($ex_msg); } - // SASL Bind, with error handling. + // SASL Bind, with error handling $authz_id = $sasl_args['authz_id']; $error = @ldap_sasl_bind($this->ldap, $dn, $password, $sasl_args['mech'], @@ -436,13 +436,13 @@ class SimpleSAML_Auth_LDAP { $sasl_args['authz_id'], $sasl_args['props']); } else { - // Simple Bind, with error handling. + // Simple Bind, with error handling $authz_id = $dn; $error = @ldap_bind($this->ldap, $dn, $password); } if ($error === TRUE) { - // Good. + // Good $this->authz_id = $authz_id; SimpleSAML_Logger::debug('Library - LDAP bind(): Bind successful with DN \'' . $dn . '\''); return TRUE; @@ -452,22 +452,22 @@ class SimpleSAML_Auth_LDAP { * LDAP_INVALID_CREDENTIALS * LDAP_INSUFFICIENT_ACCESS */ switch(ldap_errno($this->ldap)) { - case 32: /* LDAP_NO_SUCH_OBJECT */ + case 32: // LDAP_NO_SUCH_OBJECT // no break - case 47: /* LDAP_X_PROXY_AUTHZ_FAILURE */ + case 47: // LDAP_X_PROXY_AUTHZ_FAILURE // no break - case 48: /* LDAP_INAPPROPRIATE_AUTH */ + case 48: // LDAP_INAPPROPRIATE_AUTH // no break - case 49: /* LDAP_INVALID_CREDENTIALS */ + case 49: // LDAP_INVALID_CREDENTIALS // no break - case 50: /* LDAP_INSUFFICIENT_ACCESS */ + case 50: // LDAP_INSUFFICIENT_ACCESS return FALSE; break; default; break; } - // Bad. + // Bad throw $this->makeException('Library - LDAP bind(): Bind failed with DN \'' . $dn . '\''); } @@ -528,7 +528,7 @@ class SimpleSAML_Auth_LDAP { } SimpleSAML_Logger::debug('Library - LDAP getAttributes(): Getting ' . $description . ' from DN \'' . $dn . '\''); - // Attempt to get attributes. + // Attempt to get attributes // TODO: Should aliases be dereferenced? $result = @ldap_read($this->ldap, $dn, 'objectClass=*', $attributes, 0, 0, $this->timeout); if ($result === false) { @@ -543,27 +543,27 @@ class SimpleSAML_Auth_LDAP { throw $this->makeException('Library - LDAP getAttributes(): Could not get attributes of first entry from DN \'' . $dn . '\''); } - // Parsing each found attribute into our result set. + // Parsing each found attribute into our result set $result = array(); // Recycling $result... Possibly bad practice. for ($i = 0; $i < $attributes['count']; $i++) { - // Ignore attributes that exceed the maximum allowed size. + // Ignore attributes that exceed the maximum allowed size $name = $attributes[$i]; $attribute = $attributes[$name]; - // Deciding whether to base64 encode. + // Deciding whether to base64 encode $values = array(); for ($j = 0; $j < $attribute['count']; $j++) { $value = $attribute[$j]; if (!empty($maxsize) && strlen($value) >= $maxsize) { - // Ignoring and warning. + // Ignoring and warning SimpleSAML_Logger::warning('Library - LDAP getAttributes(): Attribute \'' . $name . '\' exceeded maximum allowed size by ' + ($maxsize - strlen($value))); continue; } - // Base64 encode binary attributes. + // Base64 encode binary attributes if (strtolower($name) === 'jpegphoto' || strtolower($name) === 'objectguid') { $values[] = base64_encode($value); } else { @@ -572,12 +572,12 @@ class SimpleSAML_Auth_LDAP { } - // Adding. + // Adding $result[$name] = $values; } - // We're done. + // We're done SimpleSAML_Logger::debug('Library - LDAP getAttributes(): Found attributes \'(' . join(',', array_keys($result)) . ')\''); return $result; } @@ -591,7 +591,7 @@ class SimpleSAML_Auth_LDAP { * @param string $password * @return array|bool */ - // TODO: Documentation; only cleared up exception/log messages. + // TODO: Documentation; only cleared up exception/log messages public function validate($config, $username, $password = null) { /* Escape any characters with a special meaning in LDAP. The following @@ -611,7 +611,7 @@ class SimpleSAML_Auth_LDAP { $dn = $this->searchfordn($config['searchbase'], $config['searchattributes'], $username); } - if ($password !== null) { /* checking users credentials ... assuming below that she may read her own attributes ... */ + if ($password !== null) { // checking users credentials ... assuming below that she may read her own attributes ... if (!$this->bind($dn, $password)) { SimpleSAML_Logger::info('Library - LDAP validate(): Failed to authenticate \''. $username . '\' using DN \'' . $dn . '\''); return FALSE; diff --git a/lib/SimpleSAML/Auth/ProcessingChain.php b/lib/SimpleSAML/Auth/ProcessingChain.php index 86f0afc12..9f9da145f 100644 --- a/lib/SimpleSAML/Auth/ProcessingChain.php +++ b/lib/SimpleSAML/Auth/ProcessingChain.php @@ -91,10 +91,10 @@ class SimpleSAML_Auth_ProcessingChain { foreach ($src as $filter) { $fp = $filter->priority; - /* Find insertion position for filter. */ + // Find insertion position for filter for($i = count($target)-1; $i >= 0; $i--) { if ($target[$i]->priority <= $fp) { - /* The new filter should be inserted after this one. */ + // The new filter should be inserted after this one break; } } @@ -186,7 +186,7 @@ class SimpleSAML_Auth_ProcessingChain { // TODO: remove this in SSP 2.0 if (!array_key_exists('UserID', $state)) { - /* No unique user ID present. Attempt to add one. */ + // No unique user ID present. Attempt to add one. self::addUserID($state); } @@ -196,7 +196,7 @@ class SimpleSAML_Auth_ProcessingChain { } } catch (SimpleSAML_Error_Exception $e) { - /* No need to convert the exception. */ + // No need to convert the exception throw $e; } catch (Exception $e) { /* @@ -206,7 +206,7 @@ class SimpleSAML_Auth_ProcessingChain { throw new SimpleSAML_Error_UnserializableException($e); } - /* Completed. */ + // Completed } @@ -236,7 +236,7 @@ class SimpleSAML_Auth_ProcessingChain { } } - /* Completed. */ + // Completed assert('array_key_exists("ReturnURL", $state) || array_key_exists("ReturnCall", $state)'); assert('!array_key_exists("ReturnURL", $state) || !array_key_exists("ReturnCall", $state)'); @@ -252,7 +252,7 @@ class SimpleSAML_Auth_ProcessingChain { } else { /* Pass the state to the function defined in $state['ReturnCall']. */ - /* We are done with the state array in the session. Delete it. */ + // We are done with the state array in the session. Delete it. SimpleSAML_Auth_State::deleteState($state); $func = $state['ReturnCall']; @@ -286,7 +286,7 @@ class SimpleSAML_Auth_ProcessingChain { // TODO: remove this in SSP 2.0 if (!array_key_exists('UserID', $state)) { - /* No unique user ID present. Attempt to add one. */ + // No unique user ID present. Attempt to add one. self::addUserID($state); } @@ -328,7 +328,7 @@ class SimpleSAML_Auth_ProcessingChain { $attributeName = $state['Source']['userid.attribute']; SimpleSAML_Logger::warning("The 'userid.attribute' option has been deprecated."); } else { - /* Default attribute. */ + // Default attribute $attributeName = 'eduPersonPrincipalName'; } diff --git a/lib/SimpleSAML/Auth/Simple.php b/lib/SimpleSAML/Auth/Simple.php index cd3a71c72..32c5bb9f4 100644 --- a/lib/SimpleSAML/Auth/Simple.php +++ b/lib/SimpleSAML/Auth/Simple.php @@ -76,7 +76,7 @@ class SimpleSAML_Auth_Simple { $session = SimpleSAML_Session::getSessionFromRequest(); if ($session->isValid($this->authSource)) { - /* Already authenticated. */ + // Already authenticated return; } @@ -239,11 +239,11 @@ class SimpleSAML_Auth_Simple { public function getAttributes() { if (!$this->isAuthenticated()) { - /* Not authenticated. */ + // Not authenticated return array(); } - /* Authenticated. */ + // Authenticated $session = SimpleSAML_Session::getSessionFromRequest(); return $session->getAuthData($this->authSource, 'Attributes'); } diff --git a/lib/SimpleSAML/Auth/State.php b/lib/SimpleSAML/Auth/State.php index bf9e597ed..106304695 100644 --- a/lib/SimpleSAML/Auth/State.php +++ b/lib/SimpleSAML/Auth/State.php @@ -149,11 +149,11 @@ class SimpleSAML_Auth_State { $id = $state[self::ID]; if ($rawId || !array_key_exists(self::RESTART, $state)) { - /* Either raw ID or no restart URL. In any case, return the raw ID. */ + // Either raw ID or no restart URL. In any case, return the raw ID. return $id; } - /* We have a restart URL. Return the ID with that URL. */ + // We have a restart URL. Return the ID with that URL. return $id . ':' . $state[self::RESTART]; } @@ -192,10 +192,10 @@ class SimpleSAML_Auth_State { $return = self::getStateId($state, $rawId); $id = $state[self::ID]; - /* Save stage. */ + // Save stage $state[self::STAGE] = $stage; - /* Save state. */ + // Save state $serializedState = serialize($state); $session = SimpleSAML_Session::getSessionFromRequest(); $session->setData('SimpleSAML_Auth_State', $id, $serializedState, self::getStateTimeout()); @@ -254,7 +254,7 @@ class SimpleSAML_Auth_State { $state = $session->getData('SimpleSAML_Auth_State', $sid['id']); if ($state === NULL) { - /* Could not find saved data. */ + // Could not find saved data if ($allowMissing) { return NULL; } @@ -271,7 +271,7 @@ class SimpleSAML_Auth_State { assert('array_key_exists(self::ID, $state)'); assert('array_key_exists(self::STAGE, $state)'); - /* Verify stage. */ + // Verify stage if ($state[self::STAGE] !== $stage) { /* This could be a user trying to bypass security, but most likely it is just * someone using the back-button in the browser. We try to restart the @@ -305,7 +305,7 @@ class SimpleSAML_Auth_State { assert('is_array($state)'); if (!array_key_exists(self::ID, $state)) { - /* This state hasn't been saved. */ + // This state hasn't been saved return; } @@ -327,15 +327,15 @@ class SimpleSAML_Auth_State { if (array_key_exists(self::EXCEPTION_HANDLER_URL, $state)) { - /* Save the exception. */ + // Save the exception $state[self::EXCEPTION_DATA] = $exception; $id = self::saveState($state, self::EXCEPTION_STAGE); - /* Redirect to the exception handler. */ + // Redirect to the exception handler \SimpleSAML\Utils\HTTP::redirectTrustedURL($state[self::EXCEPTION_HANDLER_URL], array(self::EXCEPTION_PARAM => $id)); } elseif (array_key_exists(self::EXCEPTION_HANDLER_FUNC, $state)) { - /* Call the exception handler. */ + // Call the exception handler $func = $state[self::EXCEPTION_HANDLER_FUNC]; assert('is_callable($func)'); @@ -363,7 +363,7 @@ class SimpleSAML_Auth_State { if ($id === NULL) { if (!array_key_exists(self::EXCEPTION_PARAM, $_REQUEST)) { - /* No exception. */ + // No exception return NULL; } $id = $_REQUEST[self::EXCEPTION_PARAM]; diff --git a/lib/SimpleSAML/Auth/TimeLimitedToken.php b/lib/SimpleSAML/Auth/TimeLimitedToken.php index 5a59b7a85..d89bff922 100644 --- a/lib/SimpleSAML/Auth/TimeLimitedToken.php +++ b/lib/SimpleSAML/Auth/TimeLimitedToken.php @@ -47,7 +47,7 @@ class SimpleSAML_Auth_TimeLimitedToken { * Calculates a token value for a given offset */ private function calculate_tokenvalue($offset) { - // A secret salt that should be randomly generated for each installation. + // A secret salt that should be randomly generated for each installation return sha1( $this->calculate_time_slot($offset) . ':' . $this->secretSalt); } diff --git a/lib/SimpleSAML/Bindings/Shib13/Artifact.php b/lib/SimpleSAML/Bindings/Shib13/Artifact.php index d3aa4862d..38fd0641a 100644 --- a/lib/SimpleSAML/Bindings/Shib13/Artifact.php +++ b/lib/SimpleSAML/Bindings/Shib13/Artifact.php @@ -18,7 +18,7 @@ class SimpleSAML_Bindings_Shib13_Artifact { private static function getArtifacts() { assert('array_key_exists("QUERY_STRING", $_SERVER)'); - /* We need to process the query string manually, to capture all SAMLart parameters. */ + // We need to process the query string manually, to capture all SAMLart parameters $artifacts = array(); @@ -161,7 +161,7 @@ class SimpleSAML_Bindings_Shib13_Artifact { ), ); - /* Fetch the artifact. */ + // Fetch the artifact $response = \SimpleSAML\Utils\HTTP::fetch($url, $opts); if ($response === FALSE) { throw new SimpleSAML_Error_Exception('Failed to retrieve assertion from IdP.'); @@ -169,7 +169,7 @@ class SimpleSAML_Bindings_Shib13_Artifact { \SimpleSAML\Utils\XML::debugSAMLMessage($response, 'in'); - /* Find the response in the SOAP message. */ + // Find the response in the SOAP message $response = self::extractResponse($response); return $response; diff --git a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php index 0cd3e1688..c92e0f1bf 100644 --- a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php +++ b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php @@ -97,7 +97,7 @@ class SimpleSAML_Bindings_Shib13_HTTPPost assert('count($statusElements) === 1'); $signer->sign($responseroot, $responseroot, $statusElements[0]); } else { - /* Sign the assertion */ + // Sign the assertion $signer->sign($firstassertionroot, $firstassertionroot); } diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php index 4f9bf36cb..64512ef25 100644 --- a/lib/SimpleSAML/Configuration.php +++ b/lib/SimpleSAML/Configuration.php @@ -526,7 +526,7 @@ class SimpleSAML_Configuration $dir = dirname($dir); - /* Add trailing slash. */ + // Add trailing slash $dir .= '/'; return $dir; @@ -1216,7 +1216,7 @@ class SimpleSAML_Configuration continue; } if (isset($key['X509Certificate'])) { - /* Strip whitespace from key. */ + // Strip whitespace from key $key['X509Certificate'] = preg_replace('/\s+/', '', $key['X509Certificate']); } $ret[] = $key; diff --git a/lib/SimpleSAML/Error/Error.php b/lib/SimpleSAML/Error/Error.php index 7a570a52f..69662ab94 100644 --- a/lib/SimpleSAML/Error/Error.php +++ b/lib/SimpleSAML/Error/Error.php @@ -172,7 +172,7 @@ class SimpleSAML_Error_Error extends SimpleSAML_Error_Exception */ protected function setHTTPCode() { - // Some mostly used HTTP codes. + // Some mostly used HTTP codes $httpCodesMap = array( 400 => 'HTTP/1.0 400 Bad Request', 403 => 'HTTP/1.0 403 Forbidden', diff --git a/lib/SimpleSAML/Error/UnserializableException.php b/lib/SimpleSAML/Error/UnserializableException.php index 97e5c5735..6c55bece1 100644 --- a/lib/SimpleSAML/Error/UnserializableException.php +++ b/lib/SimpleSAML/Error/UnserializableException.php @@ -34,7 +34,7 @@ class SimpleSAML_Error_UnserializableException extends SimpleSAML_Error_Exceptio $code = $original->getCode(); if (!is_int($code)) { - /* PDOException uses a string as the code. Filter it out here. */ + // PDOException uses a string as the code. Filter it out here. $code = -1; } diff --git a/lib/SimpleSAML/IdP/LogoutTraditional.php b/lib/SimpleSAML/IdP/LogoutTraditional.php index d36206739..1160908da 100644 --- a/lib/SimpleSAML/IdP/LogoutTraditional.php +++ b/lib/SimpleSAML/IdP/LogoutTraditional.php @@ -37,7 +37,7 @@ class SimpleSAML_IdP_LogoutTraditional extends SimpleSAML_IdP_LogoutHandler $this->idp->terminateAssociation($id); $state['core:Failed'] = true; - /* Try the next SP. */ + // Try the next SP $this->logoutNextSP($state); assert('FALSE'); } diff --git a/lib/SimpleSAML/Logger.php b/lib/SimpleSAML/Logger.php index 7cfe44278..11d275dd6 100644 --- a/lib/SimpleSAML/Logger.php +++ b/lib/SimpleSAML/Logger.php @@ -320,7 +320,7 @@ class SimpleSAML_Logger } if (self::$loggingHandler === null) { - /* Initialize logging. */ + // Initialize logging self::createLoggingHandler(); if (!empty(self::$earlyLog)) { diff --git a/lib/SimpleSAML/Logger/LoggingHandlerSyslog.php b/lib/SimpleSAML/Logger/LoggingHandlerSyslog.php index 8fbc1d7a1..c0a94ea22 100644 --- a/lib/SimpleSAML/Logger/LoggingHandlerSyslog.php +++ b/lib/SimpleSAML/Logger/LoggingHandlerSyslog.php @@ -26,7 +26,7 @@ class SimpleSAML_Logger_LoggingHandlerSyslog implements SimpleSAML_Logger_Loggin $processname = $config->getString('logging.processname', 'SimpleSAMLphp'); - // Setting facility to LOG_USER (only valid in Windows), enable log level rewrite on windows systems. + // Setting facility to LOG_USER (only valid in Windows), enable log level rewrite on windows systems if (SimpleSAML\Utils\System::getOS() === SimpleSAML\Utils\System::WINDOWS) { $this->isWindows = TRUE; $facility = LOG_USER; diff --git a/lib/SimpleSAML/Memcache.php b/lib/SimpleSAML/Memcache.php index 52000735f..9eb628f18 100644 --- a/lib/SimpleSAML/Memcache.php +++ b/lib/SimpleSAML/Memcache.php @@ -99,7 +99,7 @@ class SimpleSAML_Memcache continue; } - // different data from different servers. We need to update at least one of them to maintain sync. + // different data from different servers. We need to update at least one of them to maintain sync $mustUpdate = true; // update if data in $info is newer than $latestData diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php index 22cc6a99f..59b326404 100644 --- a/lib/SimpleSAML/Metadata/SAMLBuilder.php +++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php @@ -348,7 +348,7 @@ class SimpleSAML_Metadata_SAMLBuilder if ($indexed) { if (!isset($ep['index'])) { - /* Find the maximum index. */ + // Find the maximum index $maxIndex = -1; foreach ($endpoints as $ep) { if (!isset($ep['index'])) { @@ -678,7 +678,7 @@ class SimpleSAML_Metadata_SAMLBuilder assert('is_array($details)'); assert('in_array($type, array("technical", "support", "administrative", "billing", "other"), TRUE)'); - // TODO: remove this check as soon as getContact() is called always before calling this function. + // TODO: remove this check as soon as getContact() is called always before calling this function $details = \SimpleSAML\Utils\Config\Metadata::getContact($details); $e = new SAML2_XML_md_ContactPerson(); diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php index 1002fe2b0..ad725e8b2 100644 --- a/lib/SimpleSAML/Metadata/SAMLParser.php +++ b/lib/SimpleSAML/Metadata/SAMLParser.php @@ -1009,7 +1009,7 @@ class SimpleSAML_Metadata_SAMLParser if ($e instanceof SAML2_XML_mdattr_EntityAttributes && !empty($e->children)) { foreach ($e->children as $attr) { // only saml:Attribute are currently supported here. The specifications also allows - // saml:Assertions, which more complex processing. + // saml:Assertions, which more complex processing if ($attr instanceof SAML2_XML_saml_Attribute) { if (empty($attr->Name) || empty($attr->AttributeValue)) { continue; diff --git a/lib/SimpleSAML/Store/SQL.php b/lib/SimpleSAML/Store/SQL.php index 976a81226..2766892c3 100644 --- a/lib/SimpleSAML/Store/SQL.php +++ b/lib/SimpleSAML/Store/SQL.php @@ -91,7 +91,7 @@ class SimpleSAML_Store_SQL extends SimpleSAML_Store { private function initKVTable() { if ($this->getTableVersion('kvstore') === 1) { - /* Table initialized. */ + // Table initialized return; } @@ -167,7 +167,7 @@ class SimpleSAML_Store_SQL extends SimpleSAML_Store { return; } - /* Default implementation. Try INSERT, and UPDATE if that fails. */ + // Default implementation. Try INSERT, and UPDATE if that fails. $insertQuery = 'INSERT INTO ' . $table . ' ' . $colNames . ' ' . $values; $insertQuery = $this->pdo->prepare($insertQuery); @@ -177,7 +177,7 @@ class SimpleSAML_Store_SQL extends SimpleSAML_Store { } catch (PDOException $e) { $ecode = (string)$e->getCode(); switch ($ecode) { - case '23505': /* PostgreSQL */ + case '23505': // PostgreSQL break; default: SimpleSAML_Logger::error('Error while saving data: ' . $e->getMessage()); diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php index c2816a35f..0aea5f284 100644 --- a/lib/SimpleSAML/Utilities.php +++ b/lib/SimpleSAML/Utilities.php @@ -143,7 +143,7 @@ class SimpleSAML_Utilities if (!empty($start)) { $startTime = SAML2_Utils::xsDateTimeToTimestamp($start); - /* Allow for a 10 minute difference in Time */ + // Allow for a 10 minute difference in Time if (($startTime < 0) || (($startTime - 600) > $currentTime)) { return false; } @@ -230,14 +230,14 @@ class SimpleSAML_Utilities SimpleSAML_Logger::warning('Redirecting to a URL longer than 2048 bytes.'); } - /* Set the location header. */ + // Set the location header header('Location: '.$url, true, $code); - /* Disable caching of this response. */ + // Disable caching of this response header('Pragma: no-cache'); header('Cache-Control: no-cache, must-revalidate'); - /* Show a minimal web page with a clickable link to the URL. */ + // Show a minimal web page with a clickable link to the URL echo '<?xml version="1.0" encoding="UTF-8"?>'."\n"; echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'. ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n"; @@ -257,7 +257,7 @@ class SimpleSAML_Utilities echo '</body>'; echo '</html>'; - /* End script execution. */ + // End script execution exit; } diff --git a/lib/SimpleSAML/Utils/HTTP.php b/lib/SimpleSAML/Utils/HTTP.php index 0c4e5e824..7aaa19779 100644 --- a/lib/SimpleSAML/Utils/HTTP.php +++ b/lib/SimpleSAML/Utils/HTTP.php @@ -400,7 +400,7 @@ class HTTP throw new \SimpleSAML_Error_Exception('Error fetching '.var_export($url, true).':'.$error['message']); } - // data and headers. + // data and headers if ($getHeaders) { if (isset($http_response_header)) { $headers = array(); @@ -830,7 +830,7 @@ class HTTP * * This function supports these forms of relative URLs: * - ^\w+: Absolute URL. E.g. "http://www.example.com:port/path?query#fragment". - * - ^// Same protocol. E.g. "//www.example.com:port/path?query#fragment". + * - ^// Same protocol. E.g. "//www.example.com:port/path?query#fragment" * - ^/ Same protocol and host. E.g. "/path?query#fragment". * - ^? Same protocol, host and path, replace query string & fragment. E.g. "?query#fragment". * - ^# Same protocol, host, path and query, replace fragment. E.g. "#fragment". diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index 4b6488ada..ab20e1169 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -64,7 +64,7 @@ class SimpleSAML_XHTML_Template { } if($defaultDictionary !== NULL && substr($defaultDictionary, -4) === '.php') { - /* For backwards compatibility - print warning. */ + // For backwards compatibility - print warning $backtrace = debug_backtrace(); $where = $backtrace[0]['file'] . ':' . $backtrace[0]['line']; SimpleSAML_Logger::warning('Deprecated use of new SimpleSAML_Template(...) at ' . $where . @@ -124,13 +124,13 @@ class SimpleSAML_XHTML_Template { return $languageCookie; } - /* Check if we can find a good language from the Accept-Language http header. */ + // Check if we can find a good language from the Accept-Language http header $httpLanguage = $this->getHTTPLanguage(); if ($httpLanguage !== NULL) { return $httpLanguage; } - // Language is not set, and we get the default language from the configuration. + // Language is not set, and we get the default language from the configuration return $this->getDefaultLanguage(); } @@ -149,19 +149,19 @@ class SimpleSAML_XHTML_Template { */ $languageMap = self::$defaultLanguageMap; - /* Find the available language with the best score. */ + // Find the available language with the best score $bestLanguage = NULL; $bestScore = -1.0; foreach($languageScore as $language => $score) { - /* Apply the language map to the language code. */ + // Apply the language map to the language code if(array_key_exists($language, $languageMap)) { $language = $languageMap[$language]; } if(!in_array($language, $this->availableLanguages, TRUE)) { - /* Skip this language - we don't have it. */ + // Skip this language - we don't have it continue; } @@ -266,19 +266,19 @@ class SimpleSAML_XHTML_Template { public function getTag($tag) { assert('is_string($tag)'); - /* First check translations loaded by the includeInlineTranslation and includeLanguageFile methods. */ + // First check translations loaded by the includeInlineTranslation and includeLanguageFile methods if(array_key_exists($tag, $this->langtext)) { return $this->langtext[$tag]; } - /* Check whether we should use the default dictionary or a dictionary specified in the tag. */ + // Check whether we should use the default dictionary or a dictionary specified in the tag if(substr($tag, 0, 1) === '{' && preg_match('/^{((?:\w+:)?\w+?):(.*)}$/D', $tag, $matches)) { $dictionary = $matches[1]; $tag = $matches[2]; } else { $dictionary = $this->defaultDictionary; if($dictionary === NULL) { - /* We don't have any dictionary to load the tag from. */ + // We don't have any dictionary to load the tag from return NULL; } } @@ -301,30 +301,30 @@ class SimpleSAML_XHTML_Template { public function getTranslation($translations) { assert('is_array($translations)'); - /* Look up translation of tag in the selected language. */ + // Look up translation of tag in the selected language $selected_language = $this->getLanguage(); if (array_key_exists($selected_language, $translations)) { return $translations[$selected_language]; } - /* Look up translation of tag in the default language. */ + // Look up translation of tag in the default language $default_language = $this->getDefaultLanguage(); if(array_key_exists($default_language, $translations)) { return $translations[$default_language]; } - /* Check for english translation. */ + // Check for english translation if(array_key_exists('en', $translations)) { return $translations['en']; } - /* Pick the first translation available. */ + // Pick the first translation available if(count($translations) > 0) { $languages = array_keys($translations); return $translations[$languages[0]]; } - /* We don't have anything to return. */ + // We don't have anything to return throw new Exception('Nothing to return from translation.'); } @@ -337,11 +337,11 @@ class SimpleSAML_XHTML_Template { */ public function getAttributeTranslation($name) { - /* Normalize attribute name. */ + // Normalize attribute name $normName = strtolower($name); $normName = str_replace(":", "_", $normName); - /* Check for an extra dictionary. */ + // Check for an extra dictionary $extraDict = $this->configuration->getString('attributes.extradictionary', NULL); if ($extraDict !== NULL) { $dict = $this->getDictionary($extraDict); @@ -350,13 +350,13 @@ class SimpleSAML_XHTML_Template { } } - /* Search the default attribute dictionary. */ + // Search the default attribute dictionary $dict = $this->getDictionary('attributes'); if (array_key_exists('attribute_' . $normName, $dict)) { return $this->getTranslation($dict['attribute_' . $normName]); } - /* No translations found. */ + // No translations found return $name; } @@ -384,13 +384,13 @@ class SimpleSAML_XHTML_Template { public function t($tag, $replacements = array(), $fallbackdefault = true, $oldreplacements = array(), $striptags = FALSE) { if(!is_array($replacements)) { - /* Old style call to t(...). Print warning to log. */ + // Old style call to t(...). Print warning to log. $backtrace = debug_backtrace(); $where = $backtrace[0]['file'] . ':' . $backtrace[0]['line']; SimpleSAML_Logger::warning('Deprecated use of SimpleSAML_Template::t(...) at ' . $where . '. Please update the code to use the new style of parameters.'); - /* For backwards compatibility. */ + // For backwards compatibility if(!$replacements && $this->getTag($tag) === NULL) { SimpleSAML_Logger::warning('Code which uses $fallbackdefault === FALSE shouls be' . ' updated to use the getTag-method instead.'); @@ -405,7 +405,7 @@ class SimpleSAML_XHTML_Template { } else { $tagData = $this->getTag($tag); if($tagData === NULL) { - /* Tag not found. */ + // Tag not found SimpleSAML_Logger::info('Template: Looking up [' . $tag . ']: not translated at all.'); return $this->t_not_translated($tag, $fallbackdefault); } @@ -414,7 +414,7 @@ class SimpleSAML_XHTML_Template { $translated = $this->getTranslation($tagData); foreach ($replacements as $k => $v) { - /* try to translate if no replacement is given */ + // try to translate if no replacement is given if ($v == NULL) $v = $this->t($k); $translated = str_replace($k, $v, $translated); } @@ -558,7 +558,7 @@ class SimpleSAML_XHTML_Template { } - // Merge two translation arrays. + // Merge two translation arrays public static function lang_merge($def, $lang) { foreach($def AS $key => $value) { if (array_key_exists($key, $lang)) @@ -615,16 +615,16 @@ class SimpleSAML_XHTML_Template { } - /* First check the current theme. */ + // First check the current theme if ($themeModule !== NULL) { - /* .../module/<themeModule>/themes/<themeName>/<templateModule>/<templateName> */ + // .../module/<themeModule>/themes/<themeName>/<templateModule>/<templateName> $filename = SimpleSAML_Module::getModuleDir($themeModule) . '/themes/' . $themeName . '/' . $templateModule . '/' . $templateName; } elseif ($templateModule !== 'default') { - /* .../module/<templateModule>/templates/<themeName>/<templateName> */ + // .../module/<templateModule>/templates/<themeName>/<templateName> $filename = SimpleSAML_Module::getModuleDir($templateModule) . '/templates/' . $templateName; } else { - /* .../templates/<theme>/<templateName> */ + // .../templates/<theme>/<templateName> $filename = $this->configuration->getPathValue('templatedir', 'templates/') . $templateName; } @@ -633,17 +633,17 @@ class SimpleSAML_XHTML_Template { } - /* Not found in current theme. */ + // Not found in current theme SimpleSAML_Logger::debug($_SERVER['PHP_SELF'].' - Template: Could not find template file [' . $template . '] at [' . $filename . '] - now trying the base template'); - /* Try default theme. */ + // Try default theme if ($templateModule !== 'default') { - /* .../module/<templateModule>/templates/<templateName> */ + // .../module/<templateModule>/templates/<templateName> $filename = SimpleSAML_Module::getModuleDir($templateModule) . '/templates/' . $templateName; } else { - /* .../templates/<templateName> */ + // .../templates/<templateName> $filename = $this->configuration->getPathValue('templatedir', 'templates/') . '/' . $templateName; } @@ -652,7 +652,7 @@ class SimpleSAML_XHTML_Template { } - /* Not found in default template - log error and throw exception. */ + // Not found in default template - log error and throw exception $error = 'Template: Could not find template file [' . $template . '] at [' . $filename . ']'; SimpleSAML_Logger::critical($_SERVER['PHP_SELF'] . ' - ' . $error); diff --git a/lib/SimpleSAML/XML/Errors.php b/lib/SimpleSAML/XML/Errors.php index 0ef552910..c56d95b74 100644 --- a/lib/SimpleSAML/XML/Errors.php +++ b/lib/SimpleSAML/XML/Errors.php @@ -44,13 +44,13 @@ class SimpleSAML_XML_Errors { */ public static function begin() { - /* Check whether the error access functions are present. */ + // Check whether the error access functions are present if(!function_exists('libxml_use_internal_errors')) { return; } if(count(self::$errorStack) === 0) { - /* No error logging is currently in progress. Initialize it. */ + // No error logging is currently in progress. Initialize it. self::$xmlErrorState = libxml_use_internal_errors(TRUE); libxml_clear_errors(); } else { @@ -60,7 +60,7 @@ class SimpleSAML_XML_Errors { self::addErrors(); } - /* Add a new level to the error stack. */ + // Add a new level to the error stack self::$errorStack[] = array(); } @@ -72,20 +72,20 @@ class SimpleSAML_XML_Errors { */ public static function end() { - /* Check whether the error access functions are present. */ + // Check whether the error access functions are present if(!function_exists('libxml_use_internal_errors')) { - /* Pretend that no errors occurred. */ + // Pretend that no errors occurred return array(); } - /* Add any errors which may have occurred. */ + // Add any errors which may have occurred self::addErrors(); $ret = array_pop(self::$errorStack); if(count(self::$errorStack) === 0) { - /* Disable our error logging and restore the previous state. */ + // Disable our error logging and restore the previous state libxml_use_internal_errors(self::$xmlErrorState); } diff --git a/lib/SimpleSAML/XML/Parser.php b/lib/SimpleSAML/XML/Parser.php index db1eb4061..42b4731b9 100644 --- a/lib/SimpleSAML/XML/Parser.php +++ b/lib/SimpleSAML/XML/Parser.php @@ -20,7 +20,7 @@ class SimpleSAML_XML_Parser { public static function fromSimpleXMLElement(SimpleXMLElement $element) { - // Traverse all existing namespaces in element. + // Traverse all existing namespaces in element $namespaces = $element->getNamespaces(); foreach ($namespaces AS $prefix => $ns) { $element[(($prefix === '') ? 'xmlns' : 'xmlns:' . $prefix)] = $ns; diff --git a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php index 4a4346e08..6f6dd8a96 100644 --- a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php +++ b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php @@ -75,17 +75,17 @@ class SimpleSAML_XML_Shib13_AuthnResponse { assert('$this->dom instanceof DOMDocument'); if ($this->messageValidated) { - /* This message was validated externally. */ + // This message was validated externally return TRUE; } - /* Validate the signature. */ + // Validate the signature $this->validator = new SimpleSAML_XML_Validator($this->dom, array('ResponseID', 'AssertionID')); - // Get the issuer of the response. + // Get the issuer of the response $issuer = $this->getIssuer(); - /* Get the metadata of the issuer. */ + // Get the metadata of the issuer $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $md = $metadata->getMetaDataConfig($issuer, 'shib13-idp-remote'); @@ -102,10 +102,10 @@ class SimpleSAML_XML_Shib13_AuthnResponse { } elseif ($md->hasValue('certFingerprint')) { $certFingerprints = $md->getArrayizeString('certFingerprint'); - /* Validate the fingerprint. */ + // Validate the fingerprint $this->validator->validateFingerprint($certFingerprints); } elseif ($md->hasValue('caFile')) { - /* Validate against CA. */ + // Validate against CA $this->validator->validateCA(\SimpleSAML\Utils\Config::getCertPath($md->getString('caFile'))); } else { throw new SimpleSAML_Error_Exception('Missing certificate in Shibboleth 1.3 IdP Remote metadata for identity provider [' . $issuer . '].'); @@ -123,7 +123,7 @@ class SimpleSAML_XML_Shib13_AuthnResponse { private function isNodeValidated($node) { if ($this->messageValidated) { - /* This message was validated externally. */ + // This message was validated externally return TRUE; } @@ -131,7 +131,7 @@ class SimpleSAML_XML_Shib13_AuthnResponse { return FALSE; } - /* Convert the node to a DOM node if it is an element from SimpleXML. */ + // Convert the node to a DOM node if it is an element from SimpleXML if($node instanceof SimpleXMLElement) { $node = dom_import_simplexml($node); } @@ -308,7 +308,7 @@ class SimpleSAML_XML_Shib13_AuthnResponse { $issueInstant = SimpleSAML\Utils\Time::generateTimestamp(); - // 30 seconds timeskew back in time to allow differing clocks. + // 30 seconds timeskew back in time to allow differing clocks $notBefore = SimpleSAML\Utils\Time::generateTimestamp(time() - 30); diff --git a/lib/SimpleSAML/XML/Signer.php b/lib/SimpleSAML/XML/Signer.php index 39cc09bbf..04f176c3d 100644 --- a/lib/SimpleSAML/XML/Signer.php +++ b/lib/SimpleSAML/XML/Signer.php @@ -146,11 +146,11 @@ class SimpleSAML_XML_Signer { assert('is_array($publickey)'); if (!array_key_exists('PEM', $publickey)) { - /* We have a public key with only a fingerprint. */ + // We have a public key with only a fingerprint throw new Exception('Tried to add a certificate fingerprint in a signature.'); } - /* For now, we only assume that the public key is an X509 certificate. */ + // For now, we only assume that the public key is an X509 certificate $this->certificate = $publickey['PEM']; } @@ -254,11 +254,11 @@ class SimpleSAML_XML_Signer { if($this->certificate !== FALSE) { - /* Add the certificate to the signature. */ + // Add the certificate to the signature $objXMLSecDSig->add509Cert($this->certificate, TRUE); } - /* Add extra certificates. */ + // Add extra certificates foreach($this->extraCertificates as $certificate) { $objXMLSecDSig->add509Cert($certificate, TRUE); } diff --git a/lib/SimpleSAML/XML/Validator.php b/lib/SimpleSAML/XML/Validator.php index 05261c206..555578600 100644 --- a/lib/SimpleSAML/XML/Validator.php +++ b/lib/SimpleSAML/XML/Validator.php @@ -50,10 +50,10 @@ class SimpleSAML_XML_Validator { assert('$publickey === FALSE || is_array($publickey)'); } - /* Create an XML security object. */ + // Create an XML security object $objXMLSecDSig = new XMLSecurityDSig(); - /* Add the id attribute if the user passed in an id attribute. */ + // Add the id attribute if the user passed in an id attribute if($idAttribute !== NULL) { if (is_string($idAttribute)) { $objXMLSecDSig->idKeys[] = $idAttribute; @@ -63,33 +63,33 @@ class SimpleSAML_XML_Validator { } } - /* Locate the XMLDSig Signature element to be used. */ + // Locate the XMLDSig Signature element to be used $signatureElement = $objXMLSecDSig->locateSignature($xmlNode); if (!$signatureElement) { throw new Exception('Could not locate XML Signature element.'); } - /* Canonicalize the XMLDSig SignedInfo element in the message. */ + // Canonicalize the XMLDSig SignedInfo element in the message $objXMLSecDSig->canonicalizeSignedInfo(); - /* Validate referenced xml nodes. */ + // Validate referenced xml nodes if (!$objXMLSecDSig->validateReference()) { throw new Exception('XMLsec: digest validation failed'); } - /* Find the key used to sign the document. */ + // Find the key used to sign the document $objKey = $objXMLSecDSig->locateKey(); if (empty($objKey)) { throw new Exception('Error loading key to handle XML signature'); } - /* Load the key data. */ + // Load the key data if ($publickey !== FALSE && array_key_exists('PEM', $publickey)) { - /* We have PEM data for the public key / certificate. */ + // We have PEM data for the public key / certificate $objKey->loadKey($publickey['PEM']); } else { - /* No PEM data. Search for key in signature. */ + // No PEM data. Search for key in signature if (!XMLSecEnc::staticLocateKeyInfo($objKey, $signatureElement)) { throw new Exception('Error finding key data for XML signature validation.'); @@ -104,25 +104,25 @@ class SimpleSAML_XML_Validator { $certificate = $objKey->getX509Certificate(); if ($certificate === NULL) { - /* Wasn't signed with an X509 certificate. */ + // Wasn't signed with an X509 certificate throw new Exception('Message wasn\'t signed with an X509 certificate,' . ' and no public key was provided in the metadata.'); } self::validateCertificateFingerprint($certificate, $publickey['certFingerprint']); - /* Key OK. */ + // Key OK } } - /* Check the signature. */ + // Check the signature if (! $objXMLSecDSig->verify($objKey)) { throw new Exception("Unable to validate Signature"); } - /* Extract the certificate. */ + // Extract the certificate $this->x509Certificate = $objKey->getX509Certificate(); - /* Find the list of validated nodes. */ + // Find the list of validated nodes $this->validNodes = $objXMLSecDSig->getValidatedNodes(); } @@ -156,19 +156,19 @@ class SimpleSAML_XML_Validator { $data = ''; foreach($lines as $line) { - /* Remove '\r' from end of line if present. */ + // Remove '\r' from end of line if present $line = rtrim($line); if($line === '-----BEGIN CERTIFICATE-----') { - /* Delete junk from before the certificate. */ + // Delete junk from before the certificate $data = ''; } elseif($line === '-----END CERTIFICATE-----') { - /* Ignore data after the certificate. */ + // Ignore data after the certificate break; } elseif($line === '-----BEGIN PUBLIC KEY-----') { - /* This isn't an X509 certificate. */ + // This isn't an X509 certificate return NULL; } else { - /* Append the current line to the certificate data. */ + // Append the current line to the certificate data $data .= $line; } } @@ -195,7 +195,7 @@ class SimpleSAML_XML_Validator { $certFingerprint = self::calculateX509Fingerprint($certificate); if ($certFingerprint === NULL) { - /* Couldn't calculate fingerprint from X509 certificate. Should not happen. */ + // Couldn't calculate fingerprint from X509 certificate. Should not happen. throw new Exception('Unable to calculate fingerprint from X509' . ' certificate. Maybe it isn\'t an X509 certificate?'); } @@ -204,13 +204,13 @@ class SimpleSAML_XML_Validator { assert('is_string($fp)'); if ($fp === $certFingerprint) { - /* The fingerprints matched. */ + // The fingerprints matched return; } } - /* None of the fingerprints matched. Throw an exception describing the error. */ + // None of the fingerprints matched. Throw an exception describing the error. throw new Exception('Invalid fingerprint of certificate. Expected one of [' . implode('], [', $fingerprints) . '], but got [' . $certFingerprint . ']'); } @@ -237,11 +237,11 @@ class SimpleSAML_XML_Validator { $fingerprints = array($fingerprints); } - /* Normalize the fingerprints. */ + // Normalize the fingerprints foreach($fingerprints as &$fp) { assert('is_string($fp)'); - /* Make sure that the fingerprint is in the correct format. */ + // Make sure that the fingerprint is in the correct format $fp = strtolower(str_replace(":", "", $fp)); } @@ -305,13 +305,13 @@ class SimpleSAML_XML_Validator { assert('is_string($certificate)'); assert('is_string($caFile)'); - /* Clear openssl errors. */ + // Clear openssl errors while(openssl_error_string() !== FALSE); $res = openssl_x509_checkpurpose($certificate, X509_PURPOSE_ANY, array($caFile)); $errors = ''; - /* Log errors. */ + // Log errors while( ($error = openssl_error_string()) !== FALSE) { $errors .= ' [' . $error . ']'; } diff --git a/lib/_autoload.php b/lib/_autoload.php index 03b5ec180..018468b55 100644 --- a/lib/_autoload.php +++ b/lib/_autoload.php @@ -11,7 +11,7 @@ // SSP is loaded as a separate project if (file_exists(dirname(dirname(__FILE__)).'/vendor/autoload.php')) { require_once dirname(dirname(__FILE__)).'/vendor/autoload.php'; -} else { // SSP is loaded as a library. +} else { // SSP is loaded as a library if (file_exists(dirname(dirname(__FILE__)).'/../../autoload.php')) { require_once dirname(dirname(__FILE__)).'/../../autoload.php'; } else { diff --git a/metadata-templates/saml20-idp-hosted.php b/metadata-templates/saml20-idp-hosted.php index 27f9c4d6a..81a200726 100644 --- a/metadata-templates/saml20-idp-hosted.php +++ b/metadata-templates/saml20-idp-hosted.php @@ -13,7 +13,7 @@ $metadata['__DYNAMIC:1__'] = array( */ 'host' => '__DEFAULT__', - /* X.509 key and certificate. Relative to the cert directory. */ + // X.509 key and certificate. Relative to the cert directory. 'privatekey' => 'server.pem', 'certificate' => 'server.crt', diff --git a/metadata-templates/shib13-idp-hosted.php b/metadata-templates/shib13-idp-hosted.php index c052f11a7..7617fd685 100644 --- a/metadata-templates/shib13-idp-hosted.php +++ b/metadata-templates/shib13-idp-hosted.php @@ -14,7 +14,7 @@ $metadata['__DYNAMIC:1__'] = array( */ 'host' => '__DEFAULT__', - /* X.509 key and certificate. Relative to the cert directory. */ + // X.509 key and certificate. Relative to the cert directory. 'privatekey' => 'server.pem', 'certificate' => 'server.crt', diff --git a/modules/adfs/lib/IdP/ADFS.php b/modules/adfs/lib/IdP/ADFS.php index 8fd9699e8..b33907474 100644 --- a/modules/adfs/lib/IdP/ADFS.php +++ b/modules/adfs/lib/IdP/ADFS.php @@ -172,7 +172,7 @@ class sspmod_adfs_IdP_ADFS { public static function receiveLogoutMessage(SimpleSAML_IdP $idp) { // if a redirect is to occur based on wreply, we will redirect to url as - // this implies an override to normal sp notification. + // this implies an override to normal sp notification if(isset($_GET['wreply']) && !empty($_GET['wreply'])) { $idp->doLogoutRedirect(\SimpleSAML\Utils\HTTP::checkURLAllowed($_GET['wreply'])); assert(FALSE); @@ -183,12 +183,12 @@ class sspmod_adfs_IdP_ADFS { ); $assocId = NULL; // TODO: verify that this is really no problem for: - // a) SSP, because there's no caller SP... - // b) ADFS SP because caller will be called back... + // a) SSP, because there's no caller SP. + // b) ADFS SP because caller will be called back.. $idp->handleLogoutRequest($state, $assocId); } - // accepts an association array, and returns a URL that can be accessed to terminate the association. + // accepts an association array, and returns a URL that can be accessed to terminate the association public static function getLogoutURL(SimpleSAML_IdP $idp, array $association, $relayState) { $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $idpMetadata = $idp->getConfig(); diff --git a/modules/adfs/www/idp/prp.php b/modules/adfs/www/idp/prp.php index 58c922269..9b5f4b82b 100644 --- a/modules/adfs/www/idp/prp.php +++ b/modules/adfs/www/idp/prp.php @@ -21,8 +21,8 @@ if (isset($_GET['wa'])) { assert('FALSE'); } elseif(isset($_GET['assocId'])) { // logout response from ADFS SP - $assocId = $_GET['assocId']; /* Association ID of the SP that sent the logout response. */ - $relayState = $_GET['relayState']; /* Data that was sent in the logout request to the SP. Can be null. */ + $assocId = $_GET['assocId']; // Association ID of the SP that sent the logout response + $relayState = $_GET['relayState']; // Data that was sent in the logout request to the SP. Can be null $logoutError = NULL; /* NULL on success, or an instance of a SimpleSAML_Error_Exception on failure. */ $idp->handleLogoutResponse($assocId, $relayState, $logoutError); } diff --git a/modules/authX509/lib/Auth/Process/ExpiryWarning.php b/modules/authX509/lib/Auth/Process/ExpiryWarning.php index d6c96d2c4..02e89f86f 100644 --- a/modules/authX509/lib/Auth/Process/ExpiryWarning.php +++ b/modules/authX509/lib/Auth/Process/ExpiryWarning.php @@ -57,7 +57,7 @@ class sspmod_authX509_Auth_Process_ExpiryWarning extends SimpleSAML_Auth_Process assert('is_array($state)'); if (isset($state['isPassive']) && $state['isPassive'] === TRUE) { - /* We have a passive request. Skip the warning. */ + // We have a passive request. Skip the warning return; } @@ -76,7 +76,7 @@ class sspmod_authX509_Auth_Process_ExpiryWarning extends SimpleSAML_Auth_Process $now = time(); $daysleft = (int)(($validTo - $now) / (24*60*60)); if ($daysleft > $this->warndaysbefore) { - /* We have a certificate that will be valid for some time. Skip the warning. */ + // We have a certificate that will be valid for some time. Skip the warning return; } diff --git a/modules/authX509/lib/Auth/Source/X509userCert.php b/modules/authX509/lib/Auth/Source/X509userCert.php index 182def23e..fd4895c78 100644 --- a/modules/authX509/lib/Auth/Source/X509userCert.php +++ b/modules/authX509/lib/Auth/Source/X509userCert.php @@ -126,7 +126,7 @@ class sspmod_authX509_Auth_Source_X509userCert extends SimpleSAML_Auth_Source { ($_SERVER['SSL_CLIENT_CERT'] == '')) { $state['authX509.error'] = "NOCERT"; $this->authFailed($state); - assert('FALSE'); /* NOTREACHED */ + assert('FALSE'); // NOTREACHED return; } @@ -137,7 +137,7 @@ class sspmod_authX509_Auth_Source_X509userCert extends SimpleSAML_Auth_Source { $state['authX509.error'] = "INVALIDCERT"; $this->authFailed($state); - assert('FALSE'); /* NOTREACHED */ + assert('FALSE'); // NOTREACHED return; } diff --git a/modules/authX509/www/expirywarning.php b/modules/authX509/www/expirywarning.php index 9a6c6cf6e..68922f576 100644 --- a/modules/authX509/www/expirywarning.php +++ b/modules/authX509/www/expirywarning.php @@ -16,7 +16,7 @@ $state = SimpleSAML_Auth_State::loadState($id, 'warning:expire'); if (array_key_exists('proceed', $_REQUEST)) { - /* The user has pressed the proceed-button. */ + // The user has pressed the proceed-button SimpleSAML_Auth_ProcessingChain::resumeProcessing($state); } diff --git a/modules/authYubiKey/lib/Auth/Source/YubiKey.php b/modules/authYubiKey/lib/Auth/Source/YubiKey.php index f651a61cc..79307f7ea 100644 --- a/modules/authYubiKey/lib/Auth/Source/YubiKey.php +++ b/modules/authYubiKey/lib/Auth/Source/YubiKey.php @@ -73,7 +73,7 @@ class sspmod_authYubiKey_Auth_Source_YubiKey extends SimpleSAML_Auth_Source { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); if (array_key_exists('id', $config)) { @@ -97,7 +97,7 @@ class sspmod_authYubiKey_Auth_Source_YubiKey extends SimpleSAML_Auth_Source { public function authenticate(&$state) { assert('is_array($state)'); - /* We are going to need the authId in order to retrieve this authentication source later. */ + // We are going to need the authId in order to retrieve this authentication source later $state[self::AUTHID] = $this->authId; $id = SimpleSAML_Auth_State::saveState($state, self::STAGEID); diff --git a/modules/authYubiKey/libextinc/Yubico.php b/modules/authYubiKey/libextinc/Yubico.php index 15cd461d3..81d584b8b 100644 --- a/modules/authYubiKey/libextinc/Yubico.php +++ b/modules/authYubiKey/libextinc/Yubico.php @@ -105,7 +105,7 @@ class Auth_Yubico return $this->_response; } - /* TODO? Add functions to get parsed parts of server response? */ + // TODO? Add functions to get parsed parts of server response? /** * Verify Yubico OTP @@ -117,7 +117,7 @@ class Auth_Yubico function verify($token) { $parameters = "id=" . $this->_id . "&otp=" . $token; - /* Generate signature. */ + // Generate signature if($this->_key <> "") { $signature = base64_encode(hash_hmac('sha1', $parameters, $this->_key, true)); $parameters .= '&h=' . $signature; diff --git a/modules/authYubiKey/www/yubikeylogin.php b/modules/authYubiKey/www/yubikeylogin.php index 5dbdb3ef3..010613c25 100644 --- a/modules/authYubiKey/www/yubikeylogin.php +++ b/modules/authYubiKey/www/yubikeylogin.php @@ -21,7 +21,7 @@ if (array_key_exists('otp', $_REQUEST)) { } if (!empty($otp)) { - /* attempt to log in. */ + // attempt to log in $errorCode = sspmod_authYubiKey_Auth_Source_YubiKey::handleLogin($authStateId, $otp); } else { $errorCode = NULL; diff --git a/modules/authcrypt/lib/Auth/Source/Hash.php b/modules/authcrypt/lib/Auth/Source/Hash.php index 20f7e29ad..cee479788 100644 --- a/modules/authcrypt/lib/Auth/Source/Hash.php +++ b/modules/authcrypt/lib/Auth/Source/Hash.php @@ -29,12 +29,12 @@ class sspmod_authcrypt_Auth_Source_Hash extends sspmod_core_Auth_UserPassBase { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); $this->users = array(); - /* Validate and parse our configuration. */ + // Validate and parse our configuration foreach ($config as $userpass => $attributes) { if (!is_string($userpass)) { throw new Exception('Invalid <username>:<passwordhash> for authentication source ' . diff --git a/modules/authcrypt/lib/Auth/Source/Htpasswd.php b/modules/authcrypt/lib/Auth/Source/Htpasswd.php index 83bdad5e0..8fc7d53ad 100644 --- a/modules/authcrypt/lib/Auth/Source/Htpasswd.php +++ b/modules/authcrypt/lib/Auth/Source/Htpasswd.php @@ -27,7 +27,7 @@ class sspmod_authcrypt_Auth_Source_Htpasswd extends sspmod_core_Auth_UserPassBas assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); $this->users = array(); diff --git a/modules/authfacebook/extlibinc/base_facebook.php b/modules/authfacebook/extlibinc/base_facebook.php index 36a1c6f0c..86dae4497 100644 --- a/modules/authfacebook/extlibinc/base_facebook.php +++ b/modules/authfacebook/extlibinc/base_facebook.php @@ -351,7 +351,7 @@ abstract class BaseFacebook public function setExtendedAccessToken() { try { // need to circumvent json_decode by calling _oauthRequest - // directly, since response isn't JSON format. + // directly, since response isn't JSON format $access_token_response = $this->_oauthRequest( $this->getUrl('graph', '/oauth/access_token'), $params = array( @@ -363,8 +363,8 @@ abstract class BaseFacebook ); } catch (FacebookApiException $e) { - // most likely that user very recently revoked authorization. - // In any event, we don't have an access token, so say so. + // most likely that user very recently revoked authorization + // In any event, we don't have an access token, so say so return false; } @@ -403,7 +403,7 @@ abstract class BaseFacebook // first establish access token to be the application // access token, in case we navigate to the /oauth/access_token - // endpoint, where SOME access token is required. + // endpoint, where SOME access token is required $this->setAccessToken($this->getApplicationAccessToken()); $user_access_token = $this->getUserAccessToken(); if ($user_access_token) { @@ -424,9 +424,9 @@ abstract class BaseFacebook * could not be determined. */ protected function getUserAccessToken() { - // first, consider a signed request if it's supplied. + // first, consider a signed request if it's supplied // if there is a signed request, then it alone determines - // the access token. + // the access token $signed_request = $this->getSignedRequest(); if ($signed_request) { // apps.facebook.com hands the access_token in the signed_request @@ -453,7 +453,7 @@ abstract class BaseFacebook } // signed request states there's no access token, so anything - // stored should be cleared. + // stored should be cleared $this->clearAllPersistentData(); return false; // respect the signed request's data, even // if there's an authorization code or something else @@ -468,7 +468,7 @@ abstract class BaseFacebook return $access_token; } - // code was bogus, so everything based on it should be invalidated. + // code was bogus, so everything based on it should be invalidated $this->clearAllPersistentData(); return false; } @@ -507,7 +507,7 @@ abstract class BaseFacebook */ public function getUser() { if ($this->user !== null) { - // we've already determined this and cached the value. + // we've already determined this and cached the value return $this->user; } @@ -524,7 +524,7 @@ abstract class BaseFacebook */ protected function getUserFromAvailableData() { // if a signed request is supplied, then it solely determines - // who the user is. + // who the user is $signed_request = $this->getSignedRequest(); if ($signed_request) { if (array_key_exists('user_id', $signed_request)) { @@ -539,7 +539,7 @@ abstract class BaseFacebook } // if the signed request didn't present a user id, then invalidate - // all entries in any persistent store. + // all entries in any persistent store $this->clearAllPersistentData(); return 0; } @@ -548,7 +548,7 @@ abstract class BaseFacebook $persisted_access_token = $this->getPersistentData('access_token'); // use access_token to fetch user id if we have a user access_token, or if - // the cached access token has changed. + // the cached access token has changed $access_token = $this->getAccessToken(); if ($access_token && $access_token != $this->getApplicationAccessToken() && @@ -646,7 +646,7 @@ abstract class BaseFacebook * * @return mixed The decoded response */ - public function api(/* polymorphic */) { + public function api(// apache + variants specific way of checking for https) { $args = func_get_args(); if (is_array($args[0])) { return $this->_restserver($args[0]); @@ -771,7 +771,7 @@ abstract class BaseFacebook try { // need to circumvent json_decode by calling _oauthRequest - // directly, since response isn't JSON format. + // directly, since response isn't JSON format $access_token_response = $this->_oauthRequest( $this->getUrl('graph', '/oauth/access_token'), @@ -934,7 +934,7 @@ abstract class BaseFacebook $opts[CURLOPT_URL] = $url; // disable the 'Expect: 100-continue' behaviour. This causes CURL to wait - // for 2 seconds if the server does not support this header. + // for 2 seconds if the server does not support this header if (isset($opts[CURLOPT_HTTPHEADER])) { $existing_headers = $opts[CURLOPT_HTTPHEADER]; $existing_headers[] = 'Expect:'; @@ -958,7 +958,7 @@ abstract class BaseFacebook // have IPv6 enabled but not have IPv6 connectivity. If this is // the case, curl will try IPv4 first and if that fails, then it will // fall back to IPv6 and the error EHOSTUNREACH is returned by the - // operating system. + // operating system if ($result === false && empty($opts[CURLOPT_IPRESOLVE])) { $matches = array(); $regex = '/Failed to connect to ([^:].*): Network is unreachable/'; diff --git a/modules/authfacebook/lib/Auth/Source/Facebook.php b/modules/authfacebook/lib/Auth/Source/Facebook.php index 587189056..37b569820 100644 --- a/modules/authfacebook/lib/Auth/Source/Facebook.php +++ b/modules/authfacebook/lib/Auth/Source/Facebook.php @@ -49,7 +49,7 @@ class sspmod_authfacebook_Auth_Source_Facebook extends SimpleSAML_Auth_Source { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); $cfgParse = SimpleSAML_Configuration::loadFromArray($config, 'authsources[' . var_export($this->authId, TRUE) . ']'); @@ -68,7 +68,7 @@ class sspmod_authfacebook_Auth_Source_Facebook extends SimpleSAML_Auth_Source { public function authenticate(&$state) { assert('is_array($state)'); - /* We are going to need the authId in order to retrieve this authentication source later. */ + // We are going to need the authId in order to retrieve this authentication source later $state[self::AUTHID] = $this->authId; $stateID = SimpleSAML_Auth_State::saveState($state, self::STAGE_INIT); diff --git a/modules/authfacebook/lib/Facebook.php b/modules/authfacebook/lib/Facebook.php index 04d47e2bf..d3b329247 100644 --- a/modules/authfacebook/lib/Facebook.php +++ b/modules/authfacebook/lib/Facebook.php @@ -11,13 +11,13 @@ class sspmod_authfacebook_Facebook extends BaseFacebook const FBSS_COOKIE_NAME = 'fbss'; // We can set this to a high number because the main session - // expiration will trump this. + // expiration will trump this const FBSS_COOKIE_EXPIRE = 31556926; // 1 year - // Stores the shared session ID if one is set. + // Stores the shared session ID if one is set protected $sharedSessionID; - /* SimpleSAMLPhp state array */ + // SimpleSAMLphp state array protected $ssp_state; /** diff --git a/modules/authfacebook/www/linkback.php b/modules/authfacebook/www/linkback.php index aed4404c7..6ca8855bc 100644 --- a/modules/authfacebook/www/linkback.php +++ b/modules/authfacebook/www/linkback.php @@ -9,7 +9,7 @@ if (!array_key_exists('AuthState', $_REQUEST) || empty($_REQUEST['AuthState'])) } $state = SimpleSAML_Auth_State::loadState($_REQUEST['AuthState'], sspmod_authfacebook_Auth_Source_Facebook::STAGE_INIT); -/* Find authentication source. */ +// Find authentication source if (!array_key_exists(sspmod_authfacebook_Auth_Source_Facebook::AUTHID, $state)) { throw new SimpleSAML_Error_BadRequest('No data in state for ' . sspmod_authfacebook_Auth_Source_Facebook::AUTHID); } diff --git a/modules/authlinkedin/lib/Auth/Source/LinkedIn.php b/modules/authlinkedin/lib/Auth/Source/LinkedIn.php index 73f4b2e85..3a5dbabb2 100644 --- a/modules/authlinkedin/lib/Auth/Source/LinkedIn.php +++ b/modules/authlinkedin/lib/Auth/Source/LinkedIn.php @@ -34,7 +34,7 @@ class sspmod_authlinkedin_Auth_Source_LinkedIn extends SimpleSAML_Auth_Source { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); if (!array_key_exists('key', $config)) @@ -58,7 +58,7 @@ class sspmod_authlinkedin_Auth_Source_LinkedIn extends SimpleSAML_Auth_Source { public function authenticate(&$state) { assert('is_array($state)'); - /* We are going to need the authId in order to retrieve this authentication source later. */ + // We are going to need the authId in order to retrieve this authentication source later $state[self::AUTHID] = $this->authId; $stateID = SimpleSAML_Auth_State::getStateId($state); @@ -97,7 +97,7 @@ class sspmod_authlinkedin_Auth_Source_LinkedIn extends SimpleSAML_Auth_Source { SimpleSAML_Logger::debug("Got an access token from the OAuth service provider [" . $accessToken->key . "] with the secret [" . $accessToken->secret . "]"); - // TODO: configure attributes (http://developer.linkedin.com/docs/DOC-1061) from config? Limited options via LinkedIn. + // TODO: configure attributes (http://developer.linkedin.com/docs/DOC-1061) from config? Limited options via LinkedIn $userdata = $consumer->getUserInfo('https://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,summary,specialties,picture-url)', $accessToken, array('http' => array('header' => 'x-li-format: json'))); $attributes = array(); diff --git a/modules/authlinkedin/www/linkback.php b/modules/authlinkedin/www/linkback.php index 8a6c6f4fd..85084dffe 100644 --- a/modules/authlinkedin/www/linkback.php +++ b/modules/authlinkedin/www/linkback.php @@ -16,7 +16,7 @@ if (array_key_exists('oauth_verifier', $_REQUEST)) { throw new Exception('OAuth verifier not returned.');; } -/* Find authentication source. */ +// Find authentication source assert('array_key_exists(sspmod_authlinkedin_Auth_Source_LinkedIn::AUTHID, $state)'); $sourceId = $state[sspmod_authlinkedin_Auth_Source_LinkedIn::AUTHID]; diff --git a/modules/authmyspace/lib/Auth/Source/MySpace.php b/modules/authmyspace/lib/Auth/Source/MySpace.php index 1c1624ccb..4e35a9e94 100644 --- a/modules/authmyspace/lib/Auth/Source/MySpace.php +++ b/modules/authmyspace/lib/Auth/Source/MySpace.php @@ -34,7 +34,7 @@ class sspmod_authmyspace_Auth_Source_MySpace extends SimpleSAML_Auth_Source { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); if (!array_key_exists('key', $config)) @@ -57,7 +57,7 @@ class sspmod_authmyspace_Auth_Source_MySpace extends SimpleSAML_Auth_Source { public function authenticate(&$state) { assert('is_array($state)'); - /* We are going to need the authId in order to retrieve this authentication source later. */ + // We are going to need the authId in order to retrieve this authentication source later $state[self::AUTHID] = $this->authId; $consumer = new sspmod_oauth_Consumer($this->key, $this->secret); diff --git a/modules/authmyspace/www/linkback.php b/modules/authmyspace/www/linkback.php index da78d125b..9c530c113 100644 --- a/modules/authmyspace/www/linkback.php +++ b/modules/authmyspace/www/linkback.php @@ -27,7 +27,7 @@ if (array_key_exists('oauth_verifier', $_REQUEST)) { throw new Exception('OAuth verifier not returned.');; } -/* Find authentication source. */ +// Find authentication source assert('array_key_exists(sspmod_authmyspace_Auth_Source_MySpace::AUTHID, $state)'); $sourceId = $state[sspmod_authmyspace_Auth_Source_MySpace::AUTHID]; diff --git a/modules/authorize/lib/Auth/Process/Authorize.php b/modules/authorize/lib/Auth/Process/Authorize.php index 60c37ece4..6b7fc2a25 100644 --- a/modules/authorize/lib/Auth/Process/Authorize.php +++ b/modules/authorize/lib/Auth/Process/Authorize.php @@ -123,7 +123,7 @@ class sspmod_authorize_Auth_Process_Authorize extends SimpleSAML_Auth_Processing * @param array $request */ protected function unauthorized(&$request) { - /* Save state and redirect to 403 page. */ + // Save state and redirect to 403 page $id = SimpleSAML_Auth_State::saveState($request, 'authorize:Authorize'); $url = SimpleSAML_Module::getModuleURL( diff --git a/modules/authtwitter/lib/Auth/Source/Twitter.php b/modules/authtwitter/lib/Auth/Source/Twitter.php index e5cf94387..76287b7bf 100644 --- a/modules/authtwitter/lib/Auth/Source/Twitter.php +++ b/modules/authtwitter/lib/Auth/Source/Twitter.php @@ -35,7 +35,7 @@ class sspmod_authtwitter_Auth_Source_Twitter extends SimpleSAML_Auth_Source { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); $configObject = SimpleSAML_Configuration::loadFromArray($config, 'authsources[' . var_export($this->authId, TRUE) . ']'); @@ -54,7 +54,7 @@ class sspmod_authtwitter_Auth_Source_Twitter extends SimpleSAML_Auth_Source { public function authenticate(&$state) { assert('is_array($state)'); - /* We are going to need the authId in order to retrieve this authentication source later. */ + // We are going to need the authId in order to retrieve this authentication source later $state[self::AUTHID] = $this->authId; $stateID = SimpleSAML_Auth_State::saveState($state, self::STAGE_INIT); diff --git a/modules/authtwitter/www/linkback.php b/modules/authtwitter/www/linkback.php index 5afca477d..2886f8d9a 100644 --- a/modules/authtwitter/www/linkback.php +++ b/modules/authtwitter/www/linkback.php @@ -9,7 +9,7 @@ if (!array_key_exists('AuthState', $_REQUEST) || empty($_REQUEST['AuthState'])) } $state = SimpleSAML_Auth_State::loadState($_REQUEST['AuthState'], sspmod_authtwitter_Auth_Source_Twitter::STAGE_INIT); -/* Find authentication source. */ +// Find authentication source if (!array_key_exists(sspmod_authtwitter_Auth_Source_Twitter::AUTHID, $state)) { throw new SimpleSAML_Error_BadRequest('No data in state for ' . sspmod_authtwitter_Auth_Source_Twitter::AUTHID); } diff --git a/modules/authwindowslive/lib/Auth/Source/LiveID.php b/modules/authwindowslive/lib/Auth/Source/LiveID.php index 177d362d6..68c1a2625 100644 --- a/modules/authwindowslive/lib/Auth/Source/LiveID.php +++ b/modules/authwindowslive/lib/Auth/Source/LiveID.php @@ -32,7 +32,7 @@ class sspmod_authwindowslive_Auth_Source_LiveID extends SimpleSAML_Auth_Source { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); if (!array_key_exists('key', $config)) @@ -55,7 +55,7 @@ class sspmod_authwindowslive_Auth_Source_LiveID extends SimpleSAML_Auth_Source { public function authenticate(&$state) { assert('is_array($state)'); - /* We are going to need the authId in order to retrieve this authentication source later. */ + // We are going to need the authId in order to retrieve this authentication source later $state[self::AUTHID] = $this->authId; $stateID = SimpleSAML_Auth_State::saveState($state, self::STAGE_INIT); diff --git a/modules/authwindowslive/www/linkback.php b/modules/authwindowslive/www/linkback.php index d2d1d077a..fcfd3d66e 100644 --- a/modules/authwindowslive/www/linkback.php +++ b/modules/authwindowslive/www/linkback.php @@ -30,7 +30,7 @@ if (array_key_exists('wrap_verification_code', $_REQUEST)) { throw new Exception('Authentication failed: [' . $_REQUEST['error_code'] . '] ' . $_REQUEST['wrap_error_reason']); } -/* Find authentication source. */ +// Find authentication source assert('array_key_exists(sspmod_authwindowslive_Auth_Source_LiveID::AUTHID, $state)'); $sourceId = $state[sspmod_authwindowslive_Auth_Source_LiveID::AUTHID]; diff --git a/modules/cas/lib/Auth/Source/CAS.php b/modules/cas/lib/Auth/Source/CAS.php index 052886af8..7677bbb21 100644 --- a/modules/cas/lib/Auth/Source/CAS.php +++ b/modules/cas/lib/Auth/Source/CAS.php @@ -51,7 +51,7 @@ class sspmod_cas_Auth_Source_CAS extends SimpleSAML_Auth_Source { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); if (!array_key_exists('cas', $config)){ @@ -196,7 +196,7 @@ class sspmod_cas_Auth_Source_CAS extends SimpleSAML_Auth_Source { public function authenticate(&$state) { assert('is_array($state)'); - /* We are going to need the authId in order to retrieve this authentication source later. */ + // We are going to need the authId in order to retrieve this authentication source later $state[self::AUTHID] = $this->authId; $stateID = SimpleSAML_Auth_State::saveState($state, self::STAGE_INIT); diff --git a/modules/cas/www/linkback.php b/modules/cas/www/linkback.php index 3f87b7b6f..c32ba477c 100644 --- a/modules/cas/www/linkback.php +++ b/modules/cas/www/linkback.php @@ -14,7 +14,7 @@ if (!isset($_GET['ticket'])) { } $state['cas:ticket'] = (string)$_GET['ticket']; -/* Find authentication source. */ +// Find authentication source assert('array_key_exists(sspmod_cas_Auth_Source_CAS::AUTHID, $state)'); $sourceId = $state[sspmod_cas_Auth_Source_CAS::AUTHID]; diff --git a/modules/casserver/www/serviceValidate.php b/modules/casserver/www/serviceValidate.php index 7cdb34595..cf4bd0af2 100644 --- a/modules/casserver/www/serviceValidate.php +++ b/modules/casserver/www/serviceValidate.php @@ -21,7 +21,7 @@ if (array_key_exists('service', $_GET)) { } try { -/* Load SimpleSAMLphp, configuration and metadata */ +// Load SimpleSAMLphp, configuration and metadata $casconfig = SimpleSAML_Configuration::getConfig('module_casserver.php'); $path = $casconfig->resolvePath($casconfig->getValue('ticketcache', 'ticketcache')); diff --git a/modules/cdc/lib/Auth/Process/CDC.php b/modules/cdc/lib/Auth/Process/CDC.php index 99201f6d2..406b03736 100644 --- a/modules/cdc/lib/Auth/Process/CDC.php +++ b/modules/cdc/lib/Auth/Process/CDC.php @@ -56,7 +56,7 @@ class sspmod_cdc_Auth_Process_CDC extends SimpleSAML_Auth_ProcessingFilter { return; } - /* Save state and build request. */ + // Save state and build request $id = SimpleSAML_Auth_State::saveState($state, 'cdc:resume'); $returnTo = SimpleSAML_Module::getModuleURL('cdc/resume.php', array('domain' => $this->domain)); diff --git a/modules/cdc/lib/Server.php b/modules/cdc/lib/Server.php index ec133e1d9..97371ee2e 100644 --- a/modules/cdc/lib/Server.php +++ b/modules/cdc/lib/Server.php @@ -362,7 +362,7 @@ class sspmod_cdc_Server { foreach ($ret as &$idp) { $idp = base64_decode($idp); if ($idp === FALSE) { - /* Not properly base64 encoded. */ + // Not properly base64 encoded SimpleSAML_Logger::warning('CDC - Invalid base64-encoding of CDC entry.'); return array(); } @@ -387,7 +387,7 @@ class sspmod_cdc_Server { $cookie = implode(' ', $list); while (strlen($cookie) > 4000) { - /* The cookie is too long. Remove the oldest elements until it is short enough. */ + // The cookie is too long. Remove the oldest elements until it is short enough $tmp = explode(' ', $cookie, 2); if (count($tmp) === 1) { /* diff --git a/modules/consent/lib/Consent/Store/Cookie.php b/modules/consent/lib/Consent/Store/Cookie.php index 97dfcf699..11aece099 100644 --- a/modules/consent/lib/Consent/Store/Cookie.php +++ b/modules/consent/lib/Consent/Store/Cookie.php @@ -273,7 +273,7 @@ class sspmod_consent_Consent_Store_Cookie extends sspmod_consent_Store ); if (\SimpleSAML\Utils\HTTP::isHTTPS()) { - /* Enable secure cookie for https-requests. */ + // Enable secure cookie for https-requests $params['secure'] = true; } else { $params['secure'] = false; diff --git a/modules/consent/lib/Consent/Store/Database.php b/modules/consent/lib/Consent/Store/Database.php index b6eaabb14..4f24707b7 100644 --- a/modules/consent/lib/Consent/Store/Database.php +++ b/modules/consent/lib/Consent/Store/Database.php @@ -194,7 +194,7 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store assert('is_string($destinationId)'); assert('is_string($attributeSet)'); - /* Check for old consent (with different attribute set). */ + // Check for old consent (with different attribute set) $st = $this->_execute( 'UPDATE ' . $this->_table . ' ' . 'SET consent_date = ' . $this->_dateTime . ', usage_date = ' . $this->_dateTime . ', attribute = ? ' . diff --git a/modules/consent/www/getconsent.php b/modules/consent/www/getconsent.php index d17bd3b87..79fe3ce71 100644 --- a/modules/consent/www/getconsent.php +++ b/modules/consent/www/getconsent.php @@ -61,7 +61,7 @@ if (array_key_exists('yes', $_REQUEST)) { && array_key_exists('saveconsent', $_REQUEST) && $_REQUEST['saveconsent'] === '1' ) { - /* Save consent. */ + // Save consent $store = $state['consent:store']; $userId = $state['consent:store.userId']; $targetedId = $state['consent:store.destination']; diff --git a/modules/consentAdmin/config-templates/module_consentAdmin.php b/modules/consentAdmin/config-templates/module_consentAdmin.php index 041756554..418065c14 100644 --- a/modules/consentAdmin/config-templates/module_consentAdmin.php +++ b/modules/consentAdmin/config-templates/module_consentAdmin.php @@ -19,7 +19,7 @@ $config = array( // Hash attributes including values or not 'attributes.hash' => TRUE, - // Where to direct the user after logout. + // Where to direct the user after logout // REMEMBER to prefix with http:// otherwise the relaystate is only appended // to saml2 logout URL 'returnURL' => 'http://www.wayf.dk', diff --git a/modules/consentAdmin/www/consentAdmin.php b/modules/consentAdmin/www/consentAdmin.php index f277feb3e..717fa3c28 100644 --- a/modules/consentAdmin/www/consentAdmin.php +++ b/modules/consentAdmin/www/consentAdmin.php @@ -61,7 +61,7 @@ function driveProcessingChain( SimpleSAML_Logger::info('consentAdmin: target: '.$targeted_id); SimpleSAML_Logger::info('consentAdmin: attribute: '.$attribute_hash); - /* Return values */ + // Return values return array($targeted_id, $attribute_hash, $attributes); } @@ -80,7 +80,7 @@ if (array_key_exists('logout', $_REQUEST)) { $hashAttributes = $cA_config->getValue('attributes.hash'); -/* Check if valid local session exists */ +// Check if valid local session exists $as->requireAuth(); // Get released attributes diff --git a/modules/core/lib/ACL.php b/modules/core/lib/ACL.php index 8cb444538..fcfa7ecad 100644 --- a/modules/core/lib/ACL.php +++ b/modules/core/lib/ACL.php @@ -99,7 +99,7 @@ class sspmod_core_ACL { $op = array_shift($rule); if ($op === NULL) { - /* An empty rule always matches. */ + // An empty rule always matches return TRUE; } @@ -139,7 +139,7 @@ class sspmod_core_ACL { } } - /* All matches. */ + // All matches return TRUE; } diff --git a/modules/core/lib/Auth/Process/AttributeLimit.php b/modules/core/lib/Auth/Process/AttributeLimit.php index 71b882e22..46d664bc1 100644 --- a/modules/core/lib/Auth/Process/AttributeLimit.php +++ b/modules/core/lib/Auth/Process/AttributeLimit.php @@ -65,11 +65,11 @@ class sspmod_core_Auth_Process_AttributeLimit extends SimpleSAML_Auth_Processing private static function getSPIdPAllowed(array &$request) { if (array_key_exists('attributes', $request['Destination'])) { - /* SP Config. */ + // SP Config return $request['Destination']['attributes']; } if (array_key_exists('attributes', $request['Source'])) { - /* IdP Config. */ + // IdP Config return $request['Source']['attributes']; } return NULL; diff --git a/modules/core/lib/Auth/Process/AttributeMap.php b/modules/core/lib/Auth/Process/AttributeMap.php index 335d73f0d..e4ee73621 100644 --- a/modules/core/lib/Auth/Process/AttributeMap.php +++ b/modules/core/lib/Auth/Process/AttributeMap.php @@ -35,7 +35,7 @@ class sspmod_core_Auth_Process_AttributeMap extends SimpleSAML_Auth_ProcessingFi if($newName === '%duplicate') { $this->duplicate = TRUE; } else { - /* No index given - this is a map file. */ + // No index given - this is a map file $mapFiles[] = $newName; } continue; diff --git a/modules/core/lib/Auth/Process/ExtendIdPSession.php b/modules/core/lib/Auth/Process/ExtendIdPSession.php index 7a6df5777..394574118 100644 --- a/modules/core/lib/Auth/Process/ExtendIdPSession.php +++ b/modules/core/lib/Auth/Process/ExtendIdPSession.php @@ -18,12 +18,12 @@ class sspmod_core_Auth_Process_ExtendIdPSession extends SimpleSAML_Auth_Processi $globalConfig = SimpleSAML_Configuration::getInstance(); $sessionDuration = $globalConfig->getInteger('session.duration', 8*60*60); - /* Extend only if half of session duration already passed */ + // Extend only if half of session duration already passed if ($delta >= ($sessionDuration * 0.5)) { return; } - /* Update authority expire time */ + // Update authority expire time $session = SimpleSAML_Session::getSessionFromRequest(); $session->setAuthorityExpire($state['Authority']); diff --git a/modules/core/lib/Auth/Process/GenerateGroups.php b/modules/core/lib/Auth/Process/GenerateGroups.php index 097481c62..35cbc9f99 100644 --- a/modules/core/lib/Auth/Process/GenerateGroups.php +++ b/modules/core/lib/Auth/Process/GenerateGroups.php @@ -27,7 +27,7 @@ class sspmod_core_Auth_Process_GenerateGroups extends SimpleSAML_Auth_Processing assert('is_array($config)'); if (count($config) === 0) { - /* Use default groups. */ + // Use default groups $this->generateGroupsFrom = array( 'eduPersonAffiliation', 'eduPersonOrgUnitDN', @@ -35,7 +35,7 @@ class sspmod_core_Auth_Process_GenerateGroups extends SimpleSAML_Auth_Processing ); } else { - /* Validate configuration. */ + // Validate configuration foreach ($config as $attributeName) { if (!is_string($attributeName)) { throw new Exception('Invalid attribute name for core:GenerateGroups filter: ' . diff --git a/modules/core/lib/Auth/Process/LanguageAdaptor.php b/modules/core/lib/Auth/Process/LanguageAdaptor.php index cf9b3d25c..347a1fd4a 100644 --- a/modules/core/lib/Auth/Process/LanguageAdaptor.php +++ b/modules/core/lib/Auth/Process/LanguageAdaptor.php @@ -54,10 +54,10 @@ class sspmod_core_Auth_Process_LanguageAdaptor extends SimpleSAML_Auth_Processin if (isset($attrlang) && !isset($lang)) { - /* Language set in attribute but not in cookie - update cookie. */ + // Language set in attribute but not in cookie - update cookie SimpleSAML_XHTML_Template::setLanguageCookie($attrlang); } elseif (!isset($attrlang) && isset($lang)) { - /* Language set in cookie, but not in attribute. Update attribute. */ + // Language set in cookie, but not in attribute. Update attribute $request['Attributes'][$this->langattr] = array($lang); } diff --git a/modules/core/lib/Auth/Process/ScopeAttribute.php b/modules/core/lib/Auth/Process/ScopeAttribute.php index 55052d137..9c8c571ac 100644 --- a/modules/core/lib/Auth/Process/ScopeAttribute.php +++ b/modules/core/lib/Auth/Process/ScopeAttribute.php @@ -83,7 +83,7 @@ class sspmod_core_Auth_Process_ScopeAttribute extends SimpleSAML_Auth_Processing $value = $value . '@' . $scope; if (in_array($value, $attributes[$this->targetAttribute], TRUE)) { - /* Already present. */ + // Already present continue; } diff --git a/modules/core/lib/Auth/Process/ScopeFromAttribute.php b/modules/core/lib/Auth/Process/ScopeFromAttribute.php index 1693130fc..cc0b92c6f 100644 --- a/modules/core/lib/Auth/Process/ScopeFromAttribute.php +++ b/modules/core/lib/Auth/Process/ScopeFromAttribute.php @@ -43,7 +43,7 @@ class sspmod_core_Auth_Process_ScopeFromAttribute extends SimpleSAML_Auth_Proces $config = SimpleSAML_Configuration::loadFromArray($config, 'ScopeFromAttribute'); $this->targetAttribute = $config->getString('targetAttribute'); $this->sourceAttribute = $config->getString('sourceAttribute'); - } /* end constructor */ + } // end constructor /** @@ -61,7 +61,7 @@ class sspmod_core_Auth_Process_ScopeFromAttribute extends SimpleSAML_Auth_Proces return; } - /* will not overwrite existing attribute */ + // will not overwrite existing attribute if (isset($attributes[$this->targetAttribute])) { return; } diff --git a/modules/core/lib/Auth/Process/StatisticsWithAttribute.php b/modules/core/lib/Auth/Process/StatisticsWithAttribute.php index 3151d92e4..32e1bf4a6 100644 --- a/modules/core/lib/Auth/Process/StatisticsWithAttribute.php +++ b/modules/core/lib/Auth/Process/StatisticsWithAttribute.php @@ -75,7 +75,7 @@ class sspmod_core_Auth_Process_StatisticsWithAttribute extends SimpleSAML_Auth_P } if (!array_key_exists('PreviousSSOTimestamp', $state)) { - /* The user hasn't authenticated with this SP earlier in this session. */ + // The user hasn't authenticated with this SP earlier in this session SimpleSAML_Logger::stats($this->typeTag . '-first ' . $dest . ' ' . $source . ' ' . $logAttribute); } diff --git a/modules/core/lib/Auth/Process/TargetedID.php b/modules/core/lib/Auth/Process/TargetedID.php index a42660c18..4c9dea909 100644 --- a/modules/core/lib/Auth/Process/TargetedID.php +++ b/modules/core/lib/Auth/Process/TargetedID.php @@ -123,7 +123,7 @@ class sspmod_core_Auth_Process_TargetedID extends SimpleSAML_Auth_ProcessingFilt $uid = hash('sha1', $uidData); if ($this->generateNameId) { - /* Convert the targeted ID to a SAML 2.0 name identifier element. */ + // Convert the targeted ID to a SAML 2.0 name identifier element $nameId = array( 'Format' => SAML2_Const::NAMEID_PERSISTENT, 'Value' => $uid, diff --git a/modules/core/lib/Auth/Process/WarnShortSSOInterval.php b/modules/core/lib/Auth/Process/WarnShortSSOInterval.php index 8adf492c2..615619e3d 100644 --- a/modules/core/lib/Auth/Process/WarnShortSSOInterval.php +++ b/modules/core/lib/Auth/Process/WarnShortSSOInterval.php @@ -28,7 +28,7 @@ class sspmod_core_Auth_Process_WarnShortSSOInterval extends SimpleSAML_Auth_Proc $timeDelta = time() - $state['PreviousSSOTimestamp']; if ($timeDelta >= 10) { - /* At least 10 seconds since last attempt. */ + // At least 10 seconds since last attempt return; } @@ -43,7 +43,7 @@ class sspmod_core_Auth_Process_WarnShortSSOInterval extends SimpleSAML_Auth_Proc ' seconds since last SSO for this user from the SP ' . var_export($entityId, TRUE)); - /* Save state and redirect. */ + // Save state and redirect $id = SimpleSAML_Auth_State::saveState($state, 'core:short_sso_interval'); $url = SimpleSAML_Module::getModuleURL('core/short_sso_interval.php'); \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('StateId' => $id)); diff --git a/modules/core/lib/Auth/Source/AdminPassword.php b/modules/core/lib/Auth/Source/AdminPassword.php index 9ce8e0dd3..7059ecbb1 100644 --- a/modules/core/lib/Auth/Source/AdminPassword.php +++ b/modules/core/lib/Auth/Source/AdminPassword.php @@ -19,7 +19,7 @@ class sspmod_core_Auth_Source_AdminPassword extends sspmod_core_Auth_UserPassBas assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); $this->setForcedUsername("admin"); @@ -46,7 +46,7 @@ class sspmod_core_Auth_Source_AdminPassword extends sspmod_core_Auth_UserPassBas $config = SimpleSAML_Configuration::getInstance(); $adminPassword = $config->getString('auth.adminpassword', '123'); if ($adminPassword === '123') { - /* We require that the user changes the password. */ + // We require that the user changes the password throw new SimpleSAML_Error_Error('NOTSET'); } diff --git a/modules/core/lib/Auth/UserPassBase.php b/modules/core/lib/Auth/UserPassBase.php index 199430c9e..bc2a865ad 100644 --- a/modules/core/lib/Auth/UserPassBase.php +++ b/modules/core/lib/Auth/UserPassBase.php @@ -89,7 +89,7 @@ abstract class sspmod_core_Auth_UserPassBase extends SimpleSAML_Auth_Source { $this->loginLinks = $config['core:loginpage_links']; } - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); // Get the remember username config options @@ -176,7 +176,7 @@ abstract class sspmod_core_Auth_UserPassBase extends SimpleSAML_Auth_Source { */ $state[self::AUTHID] = $this->authId; - /* What username we should force, if any. */ + // What username we should force, if any if ($this->forcedUsername !== NULL) { /* * This is accessed by the login form, to determine if the user diff --git a/modules/core/lib/Auth/UserPassOrgBase.php b/modules/core/lib/Auth/UserPassOrgBase.php index 4e9defab3..dab93807f 100644 --- a/modules/core/lib/Auth/UserPassOrgBase.php +++ b/modules/core/lib/Auth/UserPassOrgBase.php @@ -71,7 +71,7 @@ abstract class sspmod_core_Auth_UserPassOrgBase extends SimpleSAML_Auth_Source { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); // Get the remember username config options @@ -149,7 +149,7 @@ abstract class sspmod_core_Auth_UserPassOrgBase extends SimpleSAML_Auth_Source { public function authenticate(&$state) { assert('is_array($state)'); - /* We are going to need the authId in order to retrieve this authentication source later. */ + // We are going to need the authId in order to retrieve this authentication source later $state[self::AUTHID] = $this->authId; $id = SimpleSAML_Auth_State::saveState($state, self::STAGEID); diff --git a/modules/core/lib/Stats/Output/File.php b/modules/core/lib/Stats/Output/File.php index 4956c82ef..acd661496 100644 --- a/modules/core/lib/Stats/Output/File.php +++ b/modules/core/lib/Stats/Output/File.php @@ -64,7 +64,7 @@ class sspmod_core_Stats_Output_File extends SimpleSAML_Stats_Output { throw new SimpleSAML_Error_Exception('Error opening log file: ' . var_export($fileName, TRUE)); } - /* Disable output buffering. */ + // Disable output buffering stream_set_write_buffer($this->file, 0); $this->fileDate = $date; @@ -84,7 +84,7 @@ class sspmod_core_Stats_Output_File extends SimpleSAML_Stats_Output { $timestamp = gmdate('Y-m-d\TH:i:s', $time) . sprintf('.%03dZ', $milliseconds); - $outDate = substr($timestamp, 0, 10); /* The date-part of the timstamp. */ + $outDate = substr($timestamp, 0, 10); // The date-part of the timstamp if ($outDate !== $this->fileDate) { $this->openLog($outDate); diff --git a/modules/core/templates/logout-iframe-wrapper.php b/modules/core/templates/logout-iframe-wrapper.php index 97d65f71d..1890ee583 100644 --- a/modules/core/templates/logout-iframe-wrapper.php +++ b/modules/core/templates/logout-iframe-wrapper.php @@ -5,7 +5,7 @@ $SPs = $this->data['SPs']; $iframeURL = 'logout-iframe.php?type=embed&id=' . urlencode($id); -/* Pretty arbitrary height, but should have enough safety margins for most cases. */ +// Pretty arbitrary height, but should have enough safety margins for most cases $iframeHeight = 25 + count($SPs) * 4; $this->data['header'] = $this->t('{logout:progress}'); diff --git a/modules/core/www/authenticate.php b/modules/core/www/authenticate.php index 606095058..3e114e6e9 100644 --- a/modules/core/www/authenticate.php +++ b/modules/core/www/authenticate.php @@ -21,7 +21,7 @@ if(array_key_exists('logout', $_REQUEST)) { } if (array_key_exists(SimpleSAML_Auth_State::EXCEPTION_PARAM, $_REQUEST)) { - /* This is just a simple example of an error. */ + // This is just a simple example of an error $state = SimpleSAML_Auth_State::loadExceptionState(); assert('array_key_exists(SimpleSAML_Auth_State::EXCEPTION_DATA, $state)'); diff --git a/modules/core/www/cleardiscochoices.php b/modules/core/www/cleardiscochoices.php index b3f64187f..a5616d84e 100644 --- a/modules/core/www/cleardiscochoices.php +++ b/modules/core/www/cleardiscochoices.php @@ -6,11 +6,11 @@ require_once('_include.php'); * This page clears the user's IdP discovery choices. */ -/* The base path for cookies. This should be the installation directory for SimpleSAMLphp. */ +// The base path for cookies. This should be the installation directory for SimpleSAMLphp. $config = SimpleSAML_Configuration::getInstance(); $cookiePath = '/' . $config->getBaseUrl(); -/* We delete all cookies which starts with 'idpdisco_' */ +// We delete all cookies which starts with 'idpdisco_' foreach($_COOKIE as $cookieName => $value) { if (substr($cookieName, 0, 9) !== 'idpdisco_') { /* Not a idpdisco cookie. */ diff --git a/modules/core/www/frontpage_auth.php b/modules/core/www/frontpage_auth.php index ae2d683c7..dc47ed233 100644 --- a/modules/core/www/frontpage_auth.php +++ b/modules/core/www/frontpage_auth.php @@ -1,11 +1,11 @@ <?php -/* Load SimpleSAMLphp, configuration */ +// Load SimpleSAMLphp, configuration $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); -/* Check if valid local session exists.. */ +// Check if valid local session exists if ($config->getBoolean('admin.protectindexpage', false)) { SimpleSAML\Utils\Auth::requireAdmin(); } diff --git a/modules/core/www/frontpage_config.php b/modules/core/www/frontpage_config.php index 61b9d1740..e53015d04 100644 --- a/modules/core/www/frontpage_config.php +++ b/modules/core/www/frontpage_config.php @@ -2,11 +2,11 @@ -/* Load SimpleSAMLphp, configuration */ +// Load SimpleSAMLphp, configuration $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); -/* Check if valid local session exists.. */ +// Check if valid local session exists. if ($config->getBoolean('admin.protectindexpage', false)) { SimpleSAML\Utils\Auth::requireAdmin(); } diff --git a/modules/core/www/frontpage_federation.php b/modules/core/www/frontpage_federation.php index 84824cdc9..3834f8001 100644 --- a/modules/core/www/frontpage_federation.php +++ b/modules/core/www/frontpage_federation.php @@ -2,11 +2,11 @@ -/* Load SimpleSAMLphp, configuration */ +// Load SimpleSAMLphp, configuration $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); -/* Check if valid local session exists.. */ +// Check if valid local session exists. if ($config->getBoolean('admin.protectindexpage', false)) { SimpleSAML\Utils\Auth::requireAdmin(); } diff --git a/modules/core/www/frontpage_welcome.php b/modules/core/www/frontpage_welcome.php index e98d3b978..7de50eb69 100644 --- a/modules/core/www/frontpage_welcome.php +++ b/modules/core/www/frontpage_welcome.php @@ -1,11 +1,11 @@ <?php -/* Load SimpleSAMLphp, configuration */ +// Load SimpleSAMLphp, configuration $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); -/* Check if valid local session exists.. */ +// Check if valid local session exists. if ($config->getBoolean('admin.protectindexpage', false)) { SimpleSAML\Utils\Auth::requireAdmin(); } diff --git a/modules/core/www/idp/logout-iframe-done.php b/modules/core/www/idp/logout-iframe-done.php index eeb4f2b0a..f35ae8add 100644 --- a/modules/core/www/idp/logout-iframe-done.php +++ b/modules/core/www/idp/logout-iframe-done.php @@ -13,10 +13,10 @@ if (!isset($_REQUEST['cancel'])) { SimpleSAML_Stats::log('core:idp:logout-iframe:page', array('type' => 'done')); $SPs = $state['core:Logout-IFrame:Associations']; } else { - /* User skipped global logout. */ + // User skipped global logout SimpleSAML_Logger::stats('slo-iframe skip'); SimpleSAML_Stats::log('core:idp:logout-iframe:page', array('type' => 'skip')); - $SPs = array(); /* No SPs should have been logged out. */ + $SPs = array(); // No SPs should have been logged out $state['core:Failed'] = TRUE; /* Mark as partial logout. */ } diff --git a/modules/core/www/idp/logout-iframe.php b/modules/core/www/idp/logout-iframe.php index b181b7f9b..f25b08cc3 100644 --- a/modules/core/www/idp/logout-iframe.php +++ b/modules/core/www/idp/logout-iframe.php @@ -22,7 +22,7 @@ $state = SimpleSAML_Auth_State::loadState($_REQUEST['id'], 'core:Logout-IFrame') $idp = SimpleSAML_IdP::getByState($state); if ($type !== 'init') { - /* Update association state. */ + // Update association state $associations = $idp->getAssociations(); @@ -30,7 +30,7 @@ if ($type !== 'init') { $spId = sha1($assocId); - /* Move SPs from 'onhold' to 'inprogress'. */ + // Move SPs from 'onhold' to 'inprogress' if ($sp['core:Logout-IFrame:State'] === 'onhold') { $sp['core:Logout-IFrame:State'] = 'inprogress'; } diff --git a/modules/core/www/loginuserpass.php b/modules/core/www/loginuserpass.php index ec305a0ab..545032027 100644 --- a/modules/core/www/loginuserpass.php +++ b/modules/core/www/loginuserpass.php @@ -9,7 +9,7 @@ * @package SimpleSAMLphp */ -/* Retrieve the authentication state. */ +// Retrieve the authentication state if (!array_key_exists('AuthState', $_REQUEST)) { throw new SimpleSAML_Error_BadRequest('Missing AuthState parameter.'); } @@ -42,7 +42,7 @@ $errorCode = NULL; $errorParams = NULL; if (!empty($_REQUEST['username']) || !empty($password)) { - /* Either username or password set - attempt to log in. */ + // Either username or password set - attempt to log in if (array_key_exists('forcedUsername', $state)) { $username = $state['forcedUsername']; diff --git a/modules/core/www/loginuserpassorg.php b/modules/core/www/loginuserpassorg.php index e2a3a6539..800a83a60 100644 --- a/modules/core/www/loginuserpassorg.php +++ b/modules/core/www/loginuserpassorg.php @@ -9,7 +9,7 @@ * @package SimpleSAMLphp */ -/* Retrieve the authentication state. */ +// Retrieve the authentication state if (!array_key_exists('AuthState', $_REQUEST)) { throw new SimpleSAML_Error_BadRequest('Missing AuthState parameter.'); } @@ -63,7 +63,7 @@ if ($organizations === NULL || !empty($organization)) { try { sspmod_core_Auth_UserPassOrgBase::handleLogin($authStateId, $username, $password, $organization); } catch (SimpleSAML_Error_Error $e) { - /* Login failed. Extract error code and parameters, to display the error. */ + // Login failed. Extract error code and parameters, to display the error $errorCode = $e->getErrorCode(); $errorParams = $e->getParameters(); } diff --git a/modules/core/www/postredirect.php b/modules/core/www/postredirect.php index d4a16bb2c..ec4cefb7f 100644 --- a/modules/core/www/postredirect.php +++ b/modules/core/www/postredirect.php @@ -34,7 +34,7 @@ if ($session === NULL) { $postData = $session->getData('core_postdatalink', $postId); if ($postData === NULL) { - /* The post data is missing, probably because it timed out. */ + // The post data is missing, probably because it timed out throw new Exception('The POST data we should restore was lost.'); } diff --git a/modules/core/www/short_sso_interval.php b/modules/core/www/short_sso_interval.php index 680818371..12fdb7551 100644 --- a/modules/core/www/short_sso_interval.php +++ b/modules/core/www/short_sso_interval.php @@ -14,7 +14,7 @@ $state = SimpleSAML_Auth_State::loadState($id, 'core:short_sso_interval'); $session = SimpleSAML_Session::getSessionFromRequest(); if (array_key_exists('continue', $_REQUEST)) { - /* The user has pressed the continue/retry-button. */ + // The user has pressed the continue/retry-button SimpleSAML_Auth_ProcessingChain::resumeProcessing($state); } diff --git a/modules/cron/www/croninfo.php b/modules/cron/www/croninfo.php index c90f7edcf..79ad1d0f6 100644 --- a/modules/cron/www/croninfo.php +++ b/modules/cron/www/croninfo.php @@ -7,7 +7,7 @@ require_once('_include.php'); -/* Load SimpleSAMLphp, configuration and metadata */ +// Load SimpleSAMLphp, configuration and metadata $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); diff --git a/modules/discopower/config-templates/module_discopower.php b/modules/discopower/config-templates/module_discopower.php index 4a17e1f7b..5f5507f76 100644 --- a/modules/discopower/config-templates/module_discopower.php +++ b/modules/discopower/config-templates/module_discopower.php @@ -5,7 +5,7 @@ $config = array ( - // Which tab should be set as default. 0 is the first tab. + // Which tab should be set as default. 0 is the first tab 'defaulttab' => 0, /* @@ -39,7 +39,7 @@ $config = array ( * * If this is NULL (the default), the common domain cookie will be deleted when the browser closes. * - * Example: 'cdc.lifetime' => 180*24*60*60, // 180 days. + * Example: 'cdc.lifetime' => 180*24*60*60, // 180 days */ 'cdc.lifetime' => NULL, diff --git a/modules/discopower/lib/PowerIdPDisco.php b/modules/discopower/lib/PowerIdPDisco.php index 18a5b8ee0..15f6a9f91 100644 --- a/modules/discopower/lib/PowerIdPDisco.php +++ b/modules/discopower/lib/PowerIdPDisco.php @@ -320,7 +320,7 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco // the cookie is too long. Remove the oldest elements until it is short enough $tmp = explode(' ', $newCookie, 2); if (count($tmp) === 1) { - // we are left with a single entityID whose base64 representation is too long to fit in a cookie. + // we are left with a single entityID whose base64 representation is too long to fit in a cookie break; } $newCookie = $tmp[1]; diff --git a/modules/discopower/templates/disco-tpl.php b/modules/discopower/templates/disco-tpl.php index 86f7776ca..752badc74 100644 --- a/modules/discopower/templates/disco-tpl.php +++ b/modules/discopower/templates/disco-tpl.php @@ -82,7 +82,7 @@ function showEntry($t, $metadata, $favourite = FALSE) { function getTranslatedName($t, $metadata) { if (isset($metadata['UIInfo']['DisplayName'])) { $displayName = $metadata['UIInfo']['DisplayName']; - assert('is_array($displayName)'); // Should always be an array of language code -> translation. + assert('is_array($displayName)'); // Should always be an array of language code -> translation if (!empty($displayName)) { return $t->getTranslation($displayName); } diff --git a/modules/discopower/www/disco.php b/modules/discopower/www/disco.php index 5e8b82d1e..bfadb7c98 100644 --- a/modules/discopower/www/disco.php +++ b/modules/discopower/www/disco.php @@ -3,13 +3,13 @@ try { $discoHandler = new sspmod_discopower_PowerIdPDisco(array('saml20-idp-remote', 'shib13-idp-remote'), 'poweridpdisco'); } catch (Exception $exception) { - /* An error here should be caused by invalid query parameters. */ + // An error here should be caused by invalid query parameters throw new SimpleSAML_Error_Error('DISCOPARAMS', $exception); } try { $discoHandler->handleRequest(); } catch(Exception $exception) { - /* An error here should be caused by metadata. */ + // An error here should be caused by metadata throw new SimpleSAML_Error_Error('METADATA', $exception); } diff --git a/modules/exampleattributeserver/www/attributeserver.php b/modules/exampleattributeserver/www/attributeserver.php index d56c86973..9b207f5eb 100644 --- a/modules/exampleattributeserver/www/attributeserver.php +++ b/modules/exampleattributeserver/www/attributeserver.php @@ -19,10 +19,10 @@ if ($spEntityId === NULL) { $idpMetadata = $metadata->getMetadataConfig($idpEntityId, 'saml20-idp-hosted'); $spMetadata = $metadata->getMetaDataConfig($spEntityId, 'saml20-sp-remote'); -/* The endpoint we should deliver the message to. */ +// The endpoint we should deliver the message to $endpoint = $spMetadata->getString('testAttributeEndpoint'); -/* The attributes we will return. */ +// The attributes we will return $attributes = array( 'name' => array('value1', 'value2', 'value3'), 'test' => array('test'), diff --git a/modules/exampleauth/lib/Auth/Process/RedirectTest.php b/modules/exampleauth/lib/Auth/Process/RedirectTest.php index 28751cd20..23ad3bee1 100644 --- a/modules/exampleauth/lib/Auth/Process/RedirectTest.php +++ b/modules/exampleauth/lib/Auth/Process/RedirectTest.php @@ -16,10 +16,10 @@ class sspmod_exampleauth_Auth_Process_RedirectTest extends SimpleSAML_Auth_Proce assert('is_array($state)'); assert('array_key_exists("Attributes", $state)'); - /* To check whether the state is saved correctly. */ + // To check whether the state is saved correctly $state['Attributes']['RedirectTest1'] = array('OK'); - /* Save state and redirect. */ + // Save state and redirect $id = SimpleSAML_Auth_State::saveState($state, 'exampleauth:redirectfilter-test'); $url = SimpleSAML_Module::getModuleURL('exampleauth/redirecttest.php'); \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('StateId' => $id)); diff --git a/modules/exampleauth/lib/Auth/Source/External.php b/modules/exampleauth/lib/Auth/Source/External.php index 3df0b939d..ad007473f 100644 --- a/modules/exampleauth/lib/Auth/Source/External.php +++ b/modules/exampleauth/lib/Auth/Source/External.php @@ -32,10 +32,10 @@ class sspmod_exampleauth_Auth_Source_External extends SimpleSAML_Auth_Source { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); - /* Do any other configuration we need here. */ + // Do any other configuration we need here } diff --git a/modules/exampleauth/lib/Auth/Source/Static.php b/modules/exampleauth/lib/Auth/Source/Static.php index f2f9e8a2e..4f7513f73 100644 --- a/modules/exampleauth/lib/Auth/Source/Static.php +++ b/modules/exampleauth/lib/Auth/Source/Static.php @@ -28,11 +28,11 @@ class sspmod_exampleauth_Auth_Source_Static extends SimpleSAML_Auth_Source { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); - /* Parse attributes. */ + // Parse attributes try { $this->attributes = SimpleSAML\Utils\Attributes::normalizeAttributesArray($config); } catch(Exception $e) { diff --git a/modules/exampleauth/lib/Auth/Source/UserPass.php b/modules/exampleauth/lib/Auth/Source/UserPass.php index 5c464d32f..857d8ef2a 100644 --- a/modules/exampleauth/lib/Auth/Source/UserPass.php +++ b/modules/exampleauth/lib/Auth/Source/UserPass.php @@ -29,12 +29,12 @@ class sspmod_exampleauth_Auth_Source_UserPass extends sspmod_core_Auth_UserPassB assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); $this->users = array(); - /* Validate and parse our configuration. */ + // Validate and parse our configuration foreach ($config as $userpass => $attributes) { if (!is_string($userpass)) { throw new Exception('Invalid <username>:<password> for authentication source ' . diff --git a/modules/exampleauth/www/authpage.php b/modules/exampleauth/www/authpage.php index 209a9b83f..73fcb131e 100644 --- a/modules/exampleauth/www/authpage.php +++ b/modules/exampleauth/www/authpage.php @@ -76,7 +76,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $user = $users[$username]; if (!session_id()) { - /* session_start not called before. Do it here. */ + // session_start not called before. Do it here. session_start(); } diff --git a/modules/expirycheck/lib/Auth/Process/ExpiryDate.php b/modules/expirycheck/lib/Auth/Process/ExpiryDate.php index 15db10de7..11a8847de 100644 --- a/modules/expirycheck/lib/Auth/Process/ExpiryDate.php +++ b/modules/expirycheck/lib/Auth/Process/ExpiryDate.php @@ -122,14 +122,14 @@ class sspmod_expirycheck_Auth_Process_ExpiryDate extends SimpleSAML_Auth_Process if (self::shWarning($state, $expireOnDate, $this->warndaysbefore)) { assert('is_array($state)'); if (isset($state['isPassive']) && $state['isPassive'] === TRUE) { - /* We have a passive request. Skip the warning. */ + // We have a passive request. Skip the warning. return; } SimpleSAML_Logger::warning('expirycheck: NetID ' . $netId . ' is about to expire!'); - /* Save state and redirect. */ + // Save state and redirect $state['expireOnDate'] = date($this->date_format, $expireOnDate); $state['netId'] = $netId; $id = SimpleSAML_Auth_State::saveState($state, 'expirywarning:about2expire'); diff --git a/modules/expirycheck/www/about2expire.php b/modules/expirycheck/www/about2expire.php index 441f6f590..9aeeb9fcb 100644 --- a/modules/expirycheck/www/about2expire.php +++ b/modules/expirycheck/www/about2expire.php @@ -15,7 +15,7 @@ $id = $_REQUEST['StateId']; $state = SimpleSAML_Auth_State::loadState($id, 'expirywarning:about2expire'); if (array_key_exists('yes', $_REQUEST)) { - /* The user has pressed the yes-button. */ + // The user has pressed the yes-button SimpleSAML_Auth_ProcessingChain::resumeProcessing($state); } diff --git a/modules/ldap/lib/Auth/Process/AttributeAddUsersGroups.php b/modules/ldap/lib/Auth/Process/AttributeAddUsersGroups.php index bb44ba248..367948bb0 100644 --- a/modules/ldap/lib/Auth/Process/AttributeAddUsersGroups.php +++ b/modules/ldap/lib/Auth/Process/AttributeAddUsersGroups.php @@ -83,7 +83,7 @@ class sspmod_ldap_Auth_Process_AttributeAddUsersGroups extends sspmod_ldap_Auth_ $this->title . 'Checking for groups based on the best method for the LDAP product.' ); - // Based on the directory service, search LDAP for groups. + // Based on the directory service, search LDAP for groups // If any attributes are needed, prepare them before calling search method switch ($this->product) { diff --git a/modules/ldap/lib/Auth/Source/LDAP.php b/modules/ldap/lib/Auth/Source/LDAP.php index 66597c459..83b35faf9 100644 --- a/modules/ldap/lib/Auth/Source/LDAP.php +++ b/modules/ldap/lib/Auth/Source/LDAP.php @@ -28,7 +28,7 @@ class sspmod_ldap_Auth_Source_LDAP extends sspmod_core_Auth_UserPassBase { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); $this->ldapConfig = new sspmod_ldap_ConfigHelper($config, diff --git a/modules/ldap/lib/Auth/Source/LDAPMulti.php b/modules/ldap/lib/Auth/Source/LDAPMulti.php index c30438bbb..8fdbdf9f1 100644 --- a/modules/ldap/lib/Auth/Source/LDAPMulti.php +++ b/modules/ldap/lib/Auth/Source/LDAPMulti.php @@ -38,7 +38,7 @@ class sspmod_ldap_Auth_Source_LDAPMulti extends sspmod_core_Auth_UserPassOrgBase assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); $cfgHelper = SimpleSAML_Configuration::loadFromArray($config, @@ -94,7 +94,7 @@ class sspmod_ldap_Auth_Source_LDAPMulti extends sspmod_core_Auth_UserPassOrgBase assert('is_string($org)'); if (!array_key_exists($org, $this->ldapOrgs)) { - /* The user has selected an organization which doesn't exist anymore. */ + // The user has selected an organization which doesn't exist anymore. SimpleSAML_Logger::warning('Authentication source ' . var_export($this->authId, TRUE) . ': Organization seems to have disappeared while the user logged in.' . ' Organization was ' . var_export($org, TRUE)); diff --git a/modules/ldap/lib/ConfigHelper.php b/modules/ldap/lib/ConfigHelper.php index ed277b9d0..c39d1ddd1 100644 --- a/modules/ldap/lib/ConfigHelper.php +++ b/modules/ldap/lib/ConfigHelper.php @@ -130,7 +130,7 @@ class sspmod_ldap_ConfigHelper { $this->location = $location; - /* Parse configuration. */ + // Parse configuration $config = SimpleSAML_Configuration::loadFromArray($config, $location); $this->hostname = $config->getString('hostname'); @@ -155,7 +155,7 @@ class sspmod_ldap_ConfigHelper { $this->dnPattern = $config->getString('dnpattern'); } - /* Are privs needed to get to the attributes? */ + // Are privs needed to get to the attributes? if ($this->privRead) { $this->privUsername = $config->getString('priv.username'); $this->privPassword = $config->getString('priv.password'); diff --git a/modules/memcacheMonitor/templates/memcachestat.tpl.php b/modules/memcacheMonitor/templates/memcachestat.tpl.php index e763fedf9..dc0a71e26 100644 --- a/modules/memcacheMonitor/templates/memcachestat.tpl.php +++ b/modules/memcacheMonitor/templates/memcachestat.tpl.php @@ -29,7 +29,7 @@ $title = $this->data['title']; $table = $this->data['table']; -/* Identify column headings. */ +// Identify column headings $column_titles = array(); foreach($table as $row_title => $row_data) { foreach($row_data as $ct => $foo) { diff --git a/modules/memcacheMonitor/www/memcachestat.php b/modules/memcacheMonitor/www/memcachestat.php index d925e2cca..d8c7644a4 100644 --- a/modules/memcacheMonitor/www/memcachestat.php +++ b/modules/memcacheMonitor/www/memcachestat.php @@ -74,7 +74,7 @@ function humanreadable($input) { $config = SimpleSAML_Configuration::getInstance(); -/* Make sure that the user has admin access rights. */ +// Make sure that the user has admin access rights SimpleSAML\Utils\Auth::requireAdmin(); diff --git a/modules/metarefresh/bin/metarefresh.php b/modules/metarefresh/bin/metarefresh.php index 707ff05f9..d05531e9e 100755 --- a/modules/metarefresh/bin/metarefresh.php +++ b/modules/metarefresh/bin/metarefresh.php @@ -7,10 +7,10 @@ */ -/* This is the base directory of the SimpleSAMLphp installation. */ +// This is the base directory of the SimpleSAMLphp installation $baseDir = dirname(dirname(dirname(dirname(__FILE__)))); -/* Add library autoloader. */ +// Add library autoloader. require_once($baseDir . '/lib/_autoload.php'); SimpleSAML_Session::useTransientSession(); /* No need to try to create a session here. */ diff --git a/modules/metarefresh/config-templates/config-metarefresh.php b/modules/metarefresh/config-templates/config-metarefresh.php index 377c514d4..0147b1850 100644 --- a/modules/metarefresh/config-templates/config-metarefresh.php +++ b/modules/metarefresh/config-templates/config-metarefresh.php @@ -67,7 +67,7 @@ $config = array( //'types' => array(), ), ), - 'expireAfter' => 60*60*24*4, // Maximum 4 days cache time. + 'expireAfter' => 60*60*24*4, // Maximum 4 days cache time 'outputDir' => 'metadata/metadata-kalmar-consuming/', /* diff --git a/modules/metarefresh/hooks/hook_cron.php b/modules/metarefresh/hooks/hook_cron.php index 9f18ffea4..0d0ef20db 100644 --- a/modules/metarefresh/hooks/hook_cron.php +++ b/modules/metarefresh/hooks/hook_cron.php @@ -19,7 +19,7 @@ function metarefresh_hook_cron(&$croninfo) { $stateFile = $config->getPathValue('datadir', 'data/') . 'metarefresh-state.php'; foreach ($sets AS $setkey => $set) { - // Only process sets where cron matches the current cron tag. + // Only process sets where cron matches the current cron tag $cronTags = $set->getArray('cron'); if (!in_array($croninfo['tag'], $cronTags)) continue; diff --git a/modules/metarefresh/lib/MetaLoader.php b/modules/metarefresh/lib/MetaLoader.php index df88e8e95..e9bfc3a3e 100644 --- a/modules/metarefresh/lib/MetaLoader.php +++ b/modules/metarefresh/lib/MetaLoader.php @@ -99,18 +99,18 @@ class sspmod_metarefresh_MetaLoader { $this->addCachedMetadata($source); return; } elseif(!preg_match('@^HTTP/1\.[01]\s200\s@', $responseHeaders[0])) { - // Other error. + // Other error SimpleSAML_Logger::debug('Error from ' . $source['src'] . ' - attempting to re-use cached metadata'); $this->addCachedMetadata($source); return; } } else { - /* Local file. */ + // Local file. $data = file_get_contents($source['src']); $responseHeaders = NULL; } - /* Everything OK. Proceed. */ + // Everything OK. Proceed. if (isset($source['conditionalGET']) && $source['conditionalGET']) { // Stale or no metadata, so a fresh copy SimpleSAML_Logger::debug('Downloaded fresh copy'); diff --git a/modules/multiauth/lib/Auth/Source/MultiAuth.php b/modules/multiauth/lib/Auth/Source/MultiAuth.php index 4fcfc47ee..6a3c1dfcf 100644 --- a/modules/multiauth/lib/Auth/Source/MultiAuth.php +++ b/modules/multiauth/lib/Auth/Source/MultiAuth.php @@ -45,7 +45,7 @@ class sspmod_multiauth_Auth_Source_MultiAuth extends SimpleSAML_Auth_Source { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); if (!array_key_exists('sources', $config)) { @@ -72,7 +72,7 @@ class sspmod_multiauth_Auth_Source_MultiAuth extends SimpleSAML_Auth_Source { if (array_key_exists('css-class', $info)) { $css_class = $info['css-class']; } else { - /* Use the authtype as the css class */ + // Use the authtype as the css class $authconfig = $authsources->getArray($source, NULL); if (!array_key_exists(0, $authconfig) || !is_string($authconfig[0])) { $css_class = ""; diff --git a/modules/multiauth/www/selectsource.php b/modules/multiauth/www/selectsource.php index da1568cb4..db09029f8 100644 --- a/modules/multiauth/www/selectsource.php +++ b/modules/multiauth/www/selectsource.php @@ -10,7 +10,7 @@ * @package SimpleSAMLphp */ -/* Retrieve the authentication state. */ +// Retrieve the authentication state if (!array_key_exists('AuthState', $_REQUEST)) { throw new SimpleSAML_Error_BadRequest('Missing AuthState parameter.'); } diff --git a/modules/negotiate/lib/Auth/Source/Negotiate.php b/modules/negotiate/lib/Auth/Source/Negotiate.php index 55d3e7413..0103d5439 100644 --- a/modules/negotiate/lib/Auth/Source/Negotiate.php +++ b/modules/negotiate/lib/Auth/Source/Negotiate.php @@ -153,7 +153,7 @@ class sspmod_negotiate_Auth_Source_Negotiate extends SimpleSAML_Auth_Source $lookup = $this->lookupUserData($user); if ($lookup) { $state['Attributes'] = $lookup; - // Override the backend so logout will know what to look for. + // Override the backend so logout will know what to look for $state['LogoutState'] = array( 'negotiate:backend' => null, ); diff --git a/modules/oauth/bin/demo.php b/modules/oauth/bin/demo.php index 01e166f7e..a49521969 100755 --- a/modules/oauth/bin/demo.php +++ b/modules/oauth/bin/demo.php @@ -10,10 +10,10 @@ function _readline($prompt = '') { try { - /* This is the base directory of the SimpleSAMLphp installation. */ + // This is the base directory of the SimpleSAMLphp installation $baseDir = dirname(dirname(dirname(dirname(__FILE__)))); - /* Add library autoloader. */ + // Add library autoloader. require_once($baseDir . '/lib/_autoload.php'); diff --git a/modules/oauth/lib/Consumer.php b/modules/oauth/lib/Consumer.php index 21bc7eb58..f35876782 100644 --- a/modules/oauth/lib/Consumer.php +++ b/modules/oauth/lib/Consumer.php @@ -18,7 +18,7 @@ class sspmod_oauth_Consumer { $this->signer = new OAuthSignatureMethod_HMAC_SHA1(); } - // Used only to load the libextinc library early. + // Used only to load the libextinc library early public static function dummy() {} diff --git a/modules/oauth/libextinc/OAuth.php b/modules/oauth/libextinc/OAuth.php index a4c438f8a..c90e4f914 100644 --- a/modules/oauth/libextinc/OAuth.php +++ b/modules/oauth/libextinc/OAuth.php @@ -1,8 +1,8 @@ <?php // vim: foldmethod=marker -/* Generic exception class - */ +// Generic exception class + class OAuthException extends Exception { // pass } @@ -266,7 +266,7 @@ class OAuthRequest { $http_method = ($http_method) ? $http_method : $_SERVER['REQUEST_METHOD']; // We weren't handed any parameters, so let's find the ones relevant to - // this request. + // this request // If you run XML-RPC or similar you should use this to provide your own // parsed parameter-list if (!$parameters) { diff --git a/modules/oauth/www/registry.edit.php b/modules/oauth/www/registry.edit.php index 93ea85b40..ef8e42ff4 100644 --- a/modules/oauth/www/registry.edit.php +++ b/modules/oauth/www/registry.edit.php @@ -1,6 +1,6 @@ <?php -/* Load SimpleSAMLphp, configuration and metadata */ +// Load SimpleSAMLphp, configuration and metadata $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); $oauthconfig = SimpleSAML_Configuration::getOptionalConfig('module_oauth.php'); diff --git a/modules/oauth/www/registry.php b/modules/oauth/www/registry.php index 14d778eae..b53a76f9e 100644 --- a/modules/oauth/www/registry.php +++ b/modules/oauth/www/registry.php @@ -1,6 +1,6 @@ <?php -/* Load SimpleSAMLphp, configuration and metadata */ +// Load SimpleSAMLphp, configuration and metadata $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); $oauthconfig = SimpleSAML_Configuration::getOptionalConfig('module_oauth.php'); diff --git a/modules/portal/hooks/hook_htmlinject.php b/modules/portal/hooks/hook_htmlinject.php index 597dd4c74..b358ac203 100644 --- a/modules/portal/hooks/hook_htmlinject.php +++ b/modules/portal/hooks/hook_htmlinject.php @@ -29,7 +29,7 @@ function portal_hook_htmlinject(&$hookinfo) { if (!$portal->isPortalized($hookinfo['page'])) return; - // Include jquery UI CSS files in header. + // Include jquery UI CSS files in header $hookinfo['jquery']['css'] = TRUE; // Header diff --git a/modules/preprodwarning/lib/Auth/Process/Warning.php b/modules/preprodwarning/lib/Auth/Process/Warning.php index 161918ba0..89d1fc4ec 100644 --- a/modules/preprodwarning/lib/Auth/Process/Warning.php +++ b/modules/preprodwarning/lib/Auth/Process/Warning.php @@ -21,11 +21,11 @@ class sspmod_preprodwarning_Auth_Process_Warning extends SimpleSAML_Auth_Process assert('is_array($state)'); if (isset($state['isPassive']) && $state['isPassive'] === TRUE) { - /* We have a passive request. Skip the warning. */ + // We have a passive request. Skip the warning return; } - /* Save state and redirect. */ + // Save state and redirect. $id = SimpleSAML_Auth_State::saveState($state, 'warning:request'); $url = SimpleSAML_Module::getModuleURL('preprodwarning/showwarning.php'); \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('StateId' => $id)); diff --git a/modules/preprodwarning/www/showwarning.php b/modules/preprodwarning/www/showwarning.php index 65116b5a6..79d8e1d81 100644 --- a/modules/preprodwarning/www/showwarning.php +++ b/modules/preprodwarning/www/showwarning.php @@ -17,7 +17,7 @@ $state = SimpleSAML_Auth_State::loadState($id, 'warning:request'); if (array_key_exists('yes', $_REQUEST)) { - /* The user has pressed the yes-button. */ + // The user has pressed the yes-button SimpleSAML_Auth_ProcessingChain::resumeProcessing($state); } diff --git a/modules/radius/lib/Auth/Source/Radius.php b/modules/radius/lib/Auth/Source/Radius.php index bcb9a68ed..fbe719126 100644 --- a/modules/radius/lib/Auth/Source/Radius.php +++ b/modules/radius/lib/Auth/Source/Radius.php @@ -68,10 +68,10 @@ class sspmod_radius_Auth_Source_Radius extends sspmod_core_Auth_UserPassBase { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); - /* Parse configuration. */ + // Parse configuration. $config = SimpleSAML_Configuration::loadFromArray($config, 'Authentication source ' . var_export($this->authId, TRUE)); diff --git a/modules/saml/lib/Auth/Source/SP.php b/modules/saml/lib/Auth/Source/SP.php index 1747ffe4b..81fecd3f6 100644 --- a/modules/saml/lib/Auth/Source/SP.php +++ b/modules/saml/lib/Auth/Source/SP.php @@ -44,7 +44,7 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); if (!isset($config['entityID'])) { @@ -115,7 +115,7 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source { $metadataHandler = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); - /* First, look in saml20-idp-remote. */ + // First, look in saml20-idp-remote. try { return $metadataHandler->getMetaDataConfig($entityId, 'saml20-idp-remote'); } catch (Exception $e) { diff --git a/modules/saml/lib/Error.php b/modules/saml/lib/Error.php index e3916ee9c..2b6c9190b 100644 --- a/modules/saml/lib/Error.php +++ b/modules/saml/lib/Error.php @@ -101,7 +101,7 @@ class sspmod_saml_Error extends SimpleSAML_Error_Exception { public static function fromException(Exception $exception) { if ($exception instanceof sspmod_saml_Error) { - /* Return the original exception unchanged. */ + // Return the original exception unchanged return $exception; } elseif ($exception instanceof SimpleSAML_Error_NoPassive) { diff --git a/modules/saml/lib/IdP/SAML1.php b/modules/saml/lib/IdP/SAML1.php index 15fd199e2..2d7c713ae 100644 --- a/modules/saml/lib/IdP/SAML1.php +++ b/modules/saml/lib/IdP/SAML1.php @@ -16,7 +16,7 @@ class sspmod_saml_IdP_SAML1 { assert('isset($state["Attributes"])'); assert('isset($state["SPMetadata"])'); assert('isset($state["saml:shire"])'); - assert('array_key_exists("saml:target", $state)'); // Can be NULL. + assert('array_key_exists("saml:target", $state)'); // Can be NULL $spMetadata = $state["SPMetadata"]; $spEntityId = $spMetadata['entityid']; @@ -46,7 +46,7 @@ class sspmod_saml_IdP_SAML1 { } SimpleSAML_Stats::log('saml:idp:Response', $statsData); - /* Generate and send response. */ + // Generate and send response. $ar = new SimpleSAML_XML_Shib13_AuthnResponse(); $authnResponseXML = $ar->generate($idpMetadata, $spMetadata, $shire, $attributes); diff --git a/modules/saml/lib/IdP/SAML2.php b/modules/saml/lib/IdP/SAML2.php index dfe147feb..a752f025b 100644 --- a/modules/saml/lib/IdP/SAML2.php +++ b/modules/saml/lib/IdP/SAML2.php @@ -16,7 +16,7 @@ class sspmod_saml_IdP_SAML2 { assert('isset($state["Attributes"])'); assert('isset($state["SPMetadata"])'); assert('isset($state["saml:ConsumerURL"])'); - assert('array_key_exists("saml:RequestId", $state)'); // Can be NULL. + assert('array_key_exists("saml:RequestId", $state)'); // Can be NULL assert('array_key_exists("saml:RelayState", $state)'); // Can be NULL. $spMetadata = $state["SPMetadata"]; @@ -41,7 +41,7 @@ class sspmod_saml_IdP_SAML2 { $assertion->setAuthenticatingAuthority($state['saml:AuthenticatingAuthority']); } - /* Create the session association (for logout). */ + // Create the session association (for logout). $association = array( 'id' => 'saml:' . $spEntityId, 'Handler' => 'sspmod_saml_IdP_SAML2', @@ -51,7 +51,7 @@ class sspmod_saml_IdP_SAML2 { 'saml:SessionIndex' => $assertion->getSessionIndex(), ); - /* Maybe encrypt the assertion. */ + // Maybe encrypt the assertion. $assertion = self::encryptAssertion($idpMetadata, $spMetadata, $assertion); /* Create the response. */ diff --git a/modules/saml/lib/IdP/SQLNameID.php b/modules/saml/lib/IdP/SQLNameID.php index 14ceb65df..d2ad849fe 100644 --- a/modules/saml/lib/IdP/SQLNameID.php +++ b/modules/saml/lib/IdP/SQLNameID.php @@ -111,7 +111,7 @@ class sspmod_saml_IdP_SQLNameID { $row = $query->fetch(PDO::FETCH_ASSOC); if ($row === FALSE) { - /* No NameID found. */ + // No NameID found return NULL; } diff --git a/modules/saml/lib/Message.php b/modules/saml/lib/Message.php index 17bb5b382..570498c77 100644 --- a/modules/saml/lib/Message.php +++ b/modules/saml/lib/Message.php @@ -52,12 +52,12 @@ class sspmod_saml_Message { $element->setSignatureKey($privateKey); if ($certArray === NULL) { - /* We don't have a certificate to add. */ + // We don't have a certificate to add return; } if (!array_key_exists('PEM', $certArray)) { - /* We have a public key with only a fingerprint. */ + // We have a public key with only a fingerprint. return; } diff --git a/modules/saml/lib/SP/LogoutStore.php b/modules/saml/lib/SP/LogoutStore.php index 9c8b0d4df..f74821a47 100644 --- a/modules/saml/lib/SP/LogoutStore.php +++ b/modules/saml/lib/SP/LogoutStore.php @@ -107,7 +107,7 @@ class sspmod_saml_SP_LogoutStore { 'now' => gmdate('Y-m-d H:i:s'), ); - /* We request the columns in lowercase in order to be compatible with PostgreSQL. */ + // We request the columns in lowercase in order to be compatible with PostgreSQL $query = 'SELECT _sessionIndex AS _sessionindex, _sessionId AS _sessionid FROM ' . $store->prefix . '_saml_LogoutStore' . ' WHERE _authSource = :_authSource AND _nameId = :_nameId AND _expire >= :now'; $query = $store->pdo->prepare($query); @@ -172,7 +172,7 @@ class sspmod_saml_SP_LogoutStore { $store = SimpleSAML_Store::getInstance(); if ($store === FALSE) { - /* We don't have a datastore. */ + // We don't have a datastore. return; } diff --git a/modules/saml/www/idp/certs.php b/modules/saml/www/idp/certs.php index 780beb5a7..a289d96a2 100644 --- a/modules/saml/www/idp/certs.php +++ b/modules/saml/www/idp/certs.php @@ -1,13 +1,13 @@ <?php -/* Load SimpleSAMLphp, configuration and metadata */ +// Load SimpleSAMLphp, configuration and metadata $config = SimpleSAML_Configuration::getInstance(); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); if (!$config->getBoolean('enable.saml20-idp', false)) throw new SimpleSAML_Error_Error('NOACCESS'); -/* Check if valid local session exists.. */ +// Check if valid local session exists.. if ($config->getBoolean('admin.protectmetadata', false)) { SimpleSAML\Utils\Auth::requireAdmin(); } diff --git a/modules/saml/www/sp/discoresp.php b/modules/saml/www/sp/discoresp.php index a10c5ecd1..078e8add5 100644 --- a/modules/saml/www/sp/discoresp.php +++ b/modules/saml/www/sp/discoresp.php @@ -13,7 +13,7 @@ if (!array_key_exists('idpentityid', $_REQUEST)) { } $state = SimpleSAML_Auth_State::loadState($_REQUEST['AuthID'], 'saml:sp:sso'); -/* Find authentication source. */ +// Find authentication source assert('array_key_exists("saml:sp:AuthId", $state)'); $sourceId = $state['saml:sp:AuthId']; diff --git a/modules/saml/www/sp/saml1-acs.php b/modules/saml/www/sp/saml1-acs.php index bd8d41b93..7aa303bab 100644 --- a/modules/saml/www/sp/saml1-acs.php +++ b/modules/saml/www/sp/saml1-acs.php @@ -26,7 +26,7 @@ SimpleSAML_Logger::debug('Received SAML1 response'); $target = (string)$_REQUEST['TARGET']; if (preg_match('@^https?://@i', $target)) { - /* Unsolicited response. */ + // Unsolicited response $state = array( 'saml:sp:isUnsolicited' => TRUE, 'saml:sp:AuthId' => $sourceId, @@ -35,7 +35,7 @@ if (preg_match('@^https?://@i', $target)) { } else { $state = SimpleSAML_Auth_State::loadState($_REQUEST['TARGET'], 'saml:sp:sso'); - /* Check that the authentication source is correct. */ + // Check that the authentication source is correct. assert('array_key_exists("saml:sp:AuthId", $state)'); if ($state['saml:sp:AuthId'] !== $sourceId) { throw new SimpleSAML_Error_Exception('The authentication source id in the URL does not match the authentication source which sent the request.'); diff --git a/modules/saml/www/sp/saml2-acs.php b/modules/saml/www/sp/saml2-acs.php index 26e8ceb3e..ed261ecf3 100644 --- a/modules/saml/www/sp/saml2-acs.php +++ b/modules/saml/www/sp/saml2-acs.php @@ -16,7 +16,7 @@ try { $b = SAML2_Binding::getCurrentBinding(); } catch (Exception $e) { // TODO: look for a specific exception // This is dirty. Instead of checking the message of the exception, SAML2_Binding::getCurrentBinding() should throw - // an specific exception when the binding is unknown, and we should capture that here. + // an specific exception when the binding is unknown, and we should capture that here if ($e->getMessage() === 'Unable to find the current binding.') { throw new SimpleSAML_Error_Error('ACSPARAMS', $e, 400); } else { diff --git a/modules/saml/www/sp/saml2-logout.php b/modules/saml/www/sp/saml2-logout.php index 637009ac4..9664d01d0 100644 --- a/modules/saml/www/sp/saml2-logout.php +++ b/modules/saml/www/sp/saml2-logout.php @@ -24,7 +24,7 @@ try { $binding = SAML2_Binding::getCurrentBinding(); } catch (Exception $e) { // TODO: look for a specific exception // This is dirty. Instead of checking the message of the exception, SAML2_Binding::getCurrentBinding() should throw - // an specific exception when the binding is unknown, and we should capture that here. + // an specific exception when the binding is unknown, and we should capture that here if ($e->getMessage() === 'Unable to find the current binding.') { throw new SimpleSAML_Error_Error('SLOSERVICEPARAMS', $e, 400); } else { @@ -35,7 +35,7 @@ $message = $binding->receive(); $idpEntityId = $message->getIssuer(); if ($idpEntityId === NULL) { - /* Without an issuer we have no way to respond to the message. */ + // Without an issuer we have no way to respond to the message. throw new SimpleSAML_Error_BadRequest('Received message on logout endpoint without issuer.'); } @@ -56,7 +56,7 @@ if ($message instanceof SAML2_LogoutResponse) { $relayState = $message->getRelayState(); if ($relayState === NULL) { - /* Somehow, our RelayState has been lost. */ + // Somehow, our RelayState has been lost. throw new SimpleSAML_Error_BadRequest('Missing RelayState in logout response.'); } diff --git a/modules/sqlauth/lib/Auth/Source/SQL.php b/modules/sqlauth/lib/Auth/Source/SQL.php index abd9a4155..29cd9d5f1 100644 --- a/modules/sqlauth/lib/Auth/Source/SQL.php +++ b/modules/sqlauth/lib/Auth/Source/SQL.php @@ -47,10 +47,10 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase { assert('is_array($info)'); assert('is_array($config)'); - /* Call the parent constructor first, as required by the interface. */ + // Call the parent constructor first, as required by the interface parent::__construct($info, $config); - /* Make sure that all required parameters are present. */ + // Make sure that all required parameters are present. foreach (array('dsn', 'username', 'password', 'query') as $param) { if (!array_key_exists($param, $config)) { throw new Exception('Missing required attribute \'' . $param . diff --git a/modules/statistics/bin/loganalyzer.php b/modules/statistics/bin/loganalyzer.php index a35348d46..37578856b 100755 --- a/modules/statistics/bin/loganalyzer.php +++ b/modules/statistics/bin/loganalyzer.php @@ -2,10 +2,10 @@ <?php -/* This is the base directory of the SimpleSAMLphp installation. */ +// This is the base directory of the SimpleSAMLphp installation $baseDir = dirname(dirname(dirname(dirname(__FILE__)))); -/* Add library autoloader. */ +// Add library autoloader. require_once($baseDir . '/lib/_autoload.php'); /* Initialize the configuration. */ diff --git a/modules/statistics/bin/logcleaner.php b/modules/statistics/bin/logcleaner.php index ca4acc88b..3ed5e2111 100755 --- a/modules/statistics/bin/logcleaner.php +++ b/modules/statistics/bin/logcleaner.php @@ -2,10 +2,10 @@ <?php -/* This is the base directory of the SimpleSAMLphp installation. */ +// This is the base directory of the SimpleSAMLphp installation $baseDir = dirname(dirname(dirname(dirname(__FILE__)))); -/* Add library autoloader. */ +// Add library autoloader. require_once($baseDir . '/lib/_autoload.php'); /* Initialize the configuration. */ diff --git a/modules/statistics/config-templates/module_statistics.php b/modules/statistics/config-templates/module_statistics.php index 51d3c31cd..99d1de010 100644 --- a/modules/statistics/config-templates/module_statistics.php +++ b/modules/statistics/config-templates/module_statistics.php @@ -5,9 +5,9 @@ $config = array ( - /* Authentication & authorization for statistics. */ + // Authentication & authorization for statistics - /* Whether the statistics require authentication before use. */ + // Whether the statistics require authentication before use. 'protected' => FALSE, /* The authentication source that should be used. */ diff --git a/modules/statistics/lib/AccessCheck.php b/modules/statistics/lib/AccessCheck.php index cd3c5f4b7..b37a61474 100644 --- a/modules/statistics/lib/AccessCheck.php +++ b/modules/statistics/lib/AccessCheck.php @@ -39,7 +39,7 @@ class sspmod_statistics_AccessCheck { SimpleSAML\Utils\Auth::requireAdmin(); } - /* We are using an authsource for login. */ + // We are using an authsource for login. $as = new SimpleSAML_Auth_Simple($authsource); $as->requireAuth(); diff --git a/modules/statistics/lib/Aggregator.php b/modules/statistics/lib/Aggregator.php index 5e2c5073a..18829878c 100644 --- a/modules/statistics/lib/Aggregator.php +++ b/modules/statistics/lib/Aggregator.php @@ -105,7 +105,7 @@ class sspmod_statistics_Aggregator { $logline = fgets($file, 4096); - // Continue if STAT is not found on line. + // Continue if STAT is not found on line if (!preg_match('/STAT/', $logline)) continue; $i++; $lastlogline = $logline; diff --git a/modules/statistics/lib/Graph/GoogleCharts.php b/modules/statistics/lib/Graph/GoogleCharts.php index 250161430..b062fe419 100644 --- a/modules/statistics/lib/Graph/GoogleCharts.php +++ b/modules/statistics/lib/Graph/GoogleCharts.php @@ -99,7 +99,7 @@ class sspmod_statistics_Graph_GoogleCharts { // Dimension of graph. Default is 800x350 'chs=' . $this->x . 'x' . $this->y . - // Dateset values. + // Dateset values '&chd=' . $this->encodedata($datasets) . // Fill area... diff --git a/modules/statistics/lib/LogCleaner.php b/modules/statistics/lib/LogCleaner.php index d95ad4ec7..9b6646495 100644 --- a/modules/statistics/lib/LogCleaner.php +++ b/modules/statistics/lib/LogCleaner.php @@ -62,7 +62,7 @@ class sspmod_statistics_LogCleaner { $logline = fgets($file, 4096); - // Continue if STAT is not found on line. + // Continue if STAT is not found on line if (!preg_match('/STAT/', $logline)) continue; $i++; @@ -119,9 +119,9 @@ class sspmod_statistics_LogCleaner { $file = fopen($this->inputfile, 'r'); - /* Open the output file in a way that guarantees that we will not overwrite a random file. */ + // Open the output file in a way that guarantees that we will not overwrite a random file. if (file_exists($outputfile)) { - /* Delete existing output file. */ + // Delete existing output file. unlink($outputfile); } $outfile = fopen($outputfile, 'x'); /* Create the output file. */ diff --git a/modules/statistics/lib/Statistics/Rulesets/BaseRule.php b/modules/statistics/lib/Statistics/Rulesets/BaseRule.php index 8ddf3ae70..66b8da5f3 100644 --- a/modules/statistics/lib/Statistics/Rulesets/BaseRule.php +++ b/modules/statistics/lib/Statistics/Rulesets/BaseRule.php @@ -68,7 +68,7 @@ class sspmod_statistics_Statistics_Rulesets_BaseRule { $timeresavailable = array_keys($this->available); $timeres = $timeresavailable[0]; - // Then check if the user have provided one that is valid. + // Then check if the user have provided one that is valid if (in_array($preferTimeRes, $timeresavailable)) { $timeres = $preferTimeRes; } diff --git a/templates/post.php b/templates/post.php index 101892917..733fdf0a5 100644 --- a/templates/post.php +++ b/templates/post.php @@ -20,7 +20,7 @@ if (array_key_exists('post', $this->data)) { $post = $this->data['post']; } else { - /* For backwards compatibility. */ + // For backwards compatibility assert('array_key_exists("response", $this->data)'); assert('array_key_exists("RelayStateName", $this->data)'); assert('array_key_exists("RelayState", $this->data)'); @@ -50,7 +50,7 @@ function printItem($name, $value) { return; } - /* This is an array... */ + // This is an array... foreach ($value as $index => $item) { printItem($name . '[' . $index . ']', $item); } diff --git a/tests/lib/SimpleSAML/DatabaseTest.php b/tests/lib/SimpleSAML/DatabaseTest.php index 79fb14948..7ab129fd2 100644 --- a/tests/lib/SimpleSAML/DatabaseTest.php +++ b/tests/lib/SimpleSAML/DatabaseTest.php @@ -62,7 +62,7 @@ class SimpleSAML_DatabaseTest extends PHPUnit_Framework_TestCase $this->config = new SimpleSAML_Configuration($config, "test/SimpleSAML/DatabaseTest.php"); - // Ensure that we have a functional configuration class. + // Ensure that we have a functional configuration class $this->assertInstanceOf('SimpleSAML_Configuration', $this->config); $this->assertEquals($config['database.dsn'], $this->config->getString('database.dsn')); diff --git a/tests/modules/core/lib/Auth/Process/TargetedIDTest.php b/tests/modules/core/lib/Auth/Process/TargetedIDTest.php index d006d9ecc..1e5de9033 100644 --- a/tests/modules/core/lib/Auth/Process/TargetedIDTest.php +++ b/tests/modules/core/lib/Auth/Process/TargetedIDTest.php @@ -20,7 +20,7 @@ class Test_Core_Auth_Process_TargetedID extends PHPUnit_Framework_TestCase } // /** -// * Test the most basic functionality. +// * Test the most basic functionality // */ // public function testBasic() // { diff --git a/www/admin/hostnames.php b/www/admin/hostnames.php index c326e76c5..4baec753b 100644 --- a/www/admin/hostnames.php +++ b/www/admin/hostnames.php @@ -2,11 +2,11 @@ require_once('../_include.php'); -/* Load SimpleSAMLphp, configuration */ +// Load SimpleSAMLphp, configuration $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); -/* Check if valid local session exists.. */ +// Check if valid local session exists.. SimpleSAML\Utils\Auth::requireAdmin(); $attributes = array(); diff --git a/www/admin/phpinfo.php b/www/admin/phpinfo.php index 945172895..2b6b3d7cc 100644 --- a/www/admin/phpinfo.php +++ b/www/admin/phpinfo.php @@ -2,7 +2,7 @@ require_once('../_include.php'); -/* Make sure that the user has admin access rights. */ +// Make sure that the user has admin access rights SimpleSAML\Utils\Auth::requireAdmin(); phpinfo(); diff --git a/www/saml2/idp/SingleLogoutService.php b/www/saml2/idp/SingleLogoutService.php index bf3b97828..3b730b3be 100644 --- a/www/saml2/idp/SingleLogoutService.php +++ b/www/saml2/idp/SingleLogoutService.php @@ -23,7 +23,7 @@ if (isset($_REQUEST['ReturnTo'])) { sspmod_saml_IdP_SAML2::receiveLogoutMessage($idp); } catch (Exception $e) { // TODO: look for a specific exception // This is dirty. Instead of checking the message of the exception, SAML2_Binding::getCurrentBinding() should throw - // an specific exception when the binding is unknown, and we should capture that here. + // an specific exception when the binding is unknown, and we should capture that here if ($e->getMessage() === 'Unable to find the current binding.') { throw new SimpleSAML_Error_Error('SLOSERVICEPARAMS', $e, 400); } else { diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php index fcad630bd..33197996e 100644 --- a/www/saml2/idp/metadata.php +++ b/www/saml2/idp/metadata.php @@ -104,7 +104,7 @@ try { } if ($idpmeta->getBoolean('saml20.sendartifact', false)) { - /* Artifact sending enabled. */ + // Artifact sending enabled $metaArray['ArtifactResolutionService'][] = array( 'index' => 0, 'Location' => \SimpleSAML\Utils\HTTP::getBaseURL().'saml2/idp/ArtifactResolutionService.php', @@ -113,7 +113,7 @@ try { } if ($idpmeta->getBoolean('saml20.hok.assertion', false)) { - /* Prepend HoK SSO Service endpoint. */ + // Prepend HoK SSO Service endpoint. array_unshift($metaArray['SingleSignOnService'], array( 'hoksso:ProtocolBinding' => SAML2_Const::BINDING_HTTP_REDIRECT, 'Binding' => SAML2_Const::BINDING_HOK_SSO, -- GitLab