diff --git a/composer.lock b/composer.lock index b05595e4c..3b854383a 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "hybridauth/hybridauth", - "version": "v3.1.1", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/hybridauth/hybridauth.git", - "reference": "020be6991e7ae9f1ffaabae6586245d2a9626273" + "reference": "2edf92f07b94fcc9e17ea14e2a1644b83981af7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hybridauth/hybridauth/zipball/020be6991e7ae9f1ffaabae6586245d2a9626273", - "reference": "020be6991e7ae9f1ffaabae6586245d2a9626273", + "url": "https://api.github.com/repos/hybridauth/hybridauth/zipball/2edf92f07b94fcc9e17ea14e2a1644b83981af7d", + "reference": "2edf92f07b94fcc9e17ea14e2a1644b83981af7d", "shasum": "" }, "require": { @@ -25,14 +25,9 @@ }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "~4.8.35" + "phpunit/phpunit": "^4.8.35 || ^6.5 || ^8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, "autoload": { "psr-4": { "Hybridauth\\": "src/" @@ -61,7 +56,7 @@ "social", "twitter" ], - "time": "2019-12-27T09:26:40+00:00" + "time": "2020-03-04T14:32:04+00:00" }, { "name": "ifsnop/mysqldump-php", diff --git a/e107_handlers/vendor/composer/installed.json b/e107_handlers/vendor/composer/installed.json index cc762051e..4900fb761 100644 --- a/e107_handlers/vendor/composer/installed.json +++ b/e107_handlers/vendor/composer/installed.json @@ -1,17 +1,17 @@ [ { "name": "hybridauth/hybridauth", - "version": "v3.1.1", - "version_normalized": "3.1.1.0", + "version": "3.2.0", + "version_normalized": "3.2.0.0", "source": { "type": "git", "url": "https://github.com/hybridauth/hybridauth.git", - "reference": "020be6991e7ae9f1ffaabae6586245d2a9626273" + "reference": "2edf92f07b94fcc9e17ea14e2a1644b83981af7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hybridauth/hybridauth/zipball/020be6991e7ae9f1ffaabae6586245d2a9626273", - "reference": "020be6991e7ae9f1ffaabae6586245d2a9626273", + "url": "https://api.github.com/repos/hybridauth/hybridauth/zipball/2edf92f07b94fcc9e17ea14e2a1644b83981af7d", + "reference": "2edf92f07b94fcc9e17ea14e2a1644b83981af7d", "shasum": "" }, "require": { @@ -19,15 +19,10 @@ }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "~4.8.35" + "phpunit/phpunit": "^4.8.35 || ^6.5 || ^8" }, - "time": "2019-12-27T09:26:40+00:00", + "time": "2020-03-04T14:32:04+00:00", "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, "installation-source": "dist", "autoload": { "psr-4": { diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/AbstractAdapter.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/AbstractAdapter.php index 3f209e21a..9ee76a76a 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/AbstractAdapter.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/AbstractAdapter.php @@ -100,14 +100,14 @@ abstract class AbstractAdapter implements AdapterInterface $this->config = new Data\Collection($config); - $this->configure(); - $this->setHttpClient($httpClient); $this->setStorage($storage); $this->setLogger($logger); + $this->configure(); + $this->logger->debug(sprintf('Initialize %s, config: ', get_class($this)), $config); $this->initialize(); diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Data/Collection.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Data/Collection.php index 5fc90f158..cbcd21cb9 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Data/Collection.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Data/Collection.php @@ -135,8 +135,8 @@ final class Collection { $properties = []; - foreach ($this->collection as $property) { - $properties[] = $property; + foreach ($this->collection as $key => $value) { + $properties[] = $key; } return $properties; @@ -151,8 +151,8 @@ final class Collection { $values = []; - foreach ($this->collection as $property) { - $values[] = $this->get($property); + foreach ($this->collection as $value) { + $values[] = $value; } return $values; diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Exception/Exception.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Exception/Exception.php index 16d2d7056..2745ecc00 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Exception/Exception.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Exception/Exception.php @@ -48,6 +48,7 @@ class Exception extends \Exception implements ExceptionInterface $obj_dump = print_r($object, true); + // phpcs:ignore $html .= sprintf('' . get_class($object) . ' extends ' . get_parent_class($object) . '
%s
', $obj_dump); } @@ -57,6 +58,7 @@ class Exception extends \Exception implements ExceptionInterface $html .= sprintf('
%s
', $session_dump); + // phpcs:ignore echo sprintf("%s%s", $title, $html); } } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Curl.php b/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Curl.php index d7e7fc396..75d30536d 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Curl.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Curl.php @@ -31,6 +31,7 @@ class Curl implements HttpClientInterface CURLOPT_MAXREDIRS => 5, CURLINFO_HEADER_OUT => true, CURLOPT_ENCODING => 'identity', + // phpcs:ignore CURLOPT_USERAGENT => 'HybridAuth, PHP Social Authentication Library (https://github.com/hybridauth/hybridauth)', ]; @@ -160,9 +161,11 @@ class Curl implements HttpClientInterface $this->responseClientInfo = curl_getinfo($curl); if ($this->logger) { + // phpcs:ignore $this->logger->debug(sprintf('%s::request( %s, %s ), response:', get_class($this), $uri, $method), $this->getResponse()); if (false === $response) { + // phpcs:ignore $this->logger->error(sprintf('%s::request( %s, %s ), error:', get_class($this), $uri, $method), [$this->responseClientError]); } } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Guzzle.php b/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Guzzle.php index f623c7450..9d77dc7cf 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Guzzle.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Guzzle.php @@ -177,9 +177,11 @@ class Guzzle implements HttpClientInterface } if ($this->logger) { + // phpcs:ignore $this->logger->debug(sprintf('%s::request( %s, %s ), response:', get_class($this), $uri, $method), $this->getResponse()); if ($this->responseClientError) { + // phpcs:ignore $this->logger->error(sprintf('%s::request( %s, %s ), error:', get_class($this), $uri, $method), [$this->responseClientError]); } } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Util.php b/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Util.php index 82b1b9bdd..e83c07842 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Util.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Util.php @@ -88,12 +88,8 @@ class Util $protocol = 'http://'; - if ( - ( - $collection->get('HTTPS') && $collection->get('HTTPS') !== 'off' - ) || - $collection->get('HTTP_X_FORWARDED_PROTO') === 'https' - ) { + if (($collection->get('HTTPS') && $collection->get('HTTPS') !== 'off') || + $collection->get('HTTP_X_FORWARDED_PROTO') === 'https') { $protocol = 'https://'; } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Hybridauth.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Hybridauth.php index ea14a00c9..799a2213a 100755 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Hybridauth.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Hybridauth.php @@ -166,6 +166,10 @@ class Hybridauth } $config = $providersConfig[$name]; + $config += [ + 'debug_mode' => $this->config['debug_mode'], + 'debug_file' => $this->config['debug_file'], + ]; if (! isset($config['callback']) && isset($this->config['callback'])) { $config['callback'] = $this->config['callback']; diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/AOLOpenID.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/AOLOpenID.php index bbf931cfc..e7ee0bfbe 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/AOLOpenID.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/AOLOpenID.php @@ -7,12 +7,12 @@ namespace Hybridauth\Provider; -use Hybridauth\Adapter\OpenID as OpenIDAdapter; +use Hybridauth\Adapter\OpenID; /** * AOL OpenID provider adapter. */ -class AOLOpenID extends OpenIDAdapter +class AOLOpenID extends OpenID { /** * {@inheritdoc} diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/BitBucket.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/BitBucket.php index 0cc19a941..1c9241c64 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/BitBucket.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/BitBucket.php @@ -67,10 +67,9 @@ class BitBucket extends OAuth2 if (empty($userProfile->email) && strpos($this->scope, 'email') !== false) { try { + // user email is not mandatory so keep it quite $userProfile = $this->requestUserEmail($userProfile); - } - // user email is not mandatory so keep it quite - catch (\Exception $e) { + } catch (\Exception $e) { } } @@ -83,6 +82,8 @@ class BitBucket extends OAuth2 * @param $userProfile * * @return User\Profile + * + * @throws \Exception */ protected function requestUserEmail($userProfile) { diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Discord.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Discord.php index 28177a083..120f59c5c 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Discord.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Discord.php @@ -17,44 +17,58 @@ use Hybridauth\User; */ class Discord extends OAuth2 { + /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public $scope = 'identify email'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiBaseUrl = 'https://discordapp.com/api/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $authorizeUrl = 'https://discordapp.com/api/oauth2/authorize'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $accessTokenUrl = 'https://discordapp.com/api/oauth2/token'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiDocumentation = 'https://discordapp.com/developers/docs/topics/oauth2'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ + protected function initialize() + { + parent::initialize(); + + $this->tokenRefreshParameters += [ + 'client_id' => $this->clientId, + 'client_secret' => $this->clientSecret, + ]; + } + + /** + * {@inheritdoc} + */ public function getUserProfile() { $response = $this->apiRequest('users/@me'); $data = new Data\Collection($response); - if (! $data->exists('id')) { + if (!$data->exists('id')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } - + // Makes display name more unique. $displayName = $data->get('username') ?: $data->get('login'); if ($discriminator = $data->get('discriminator')) { @@ -63,16 +77,17 @@ class Discord extends OAuth2 $userProfile = new User\Profile(); - $userProfile->identifier = $data->get('id'); + $userProfile->identifier = $data->get('id'); $userProfile->displayName = $displayName; - $userProfile->email = $data->get('email'); + $userProfile->email = $data->get('email'); if ($data->get('verified')) { $userProfile->emailVerified = $data->get('email'); } if ($data->get('avatar')) { - $userProfile->photoURL = 'https://cdn.discordapp.com/avatars/' . $data->get('id') . '/' . $data->get('avatar') . '.png'; + $userProfile->photoURL = 'https://cdn.discordapp.com/avatars/'; + $userProfile->photoURL .= $data->get('id') . '/' . $data->get('avatar') . '.png'; } return $userProfile; diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Facebook.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Facebook.php index 04613838b..159ffedf0 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Facebook.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Facebook.php @@ -88,7 +88,21 @@ class Facebook extends OAuth2 */ public function getUserProfile() { - $response = $this->apiRequest('me?fields=id,name,first_name,last_name,link,website,gender,locale,about,email,hometown,verified,birthday'); + $fields = [ + 'id', + 'name', + 'first_name', + 'last_name', + 'link', + 'website', + 'gender', + 'locale', + 'about', + 'email', + 'hometown', + 'birthday', + ]; + $response = $this->apiRequest('me?fields=' . implode(',', $fields)); $data = new Data\Collection($response); @@ -118,11 +132,9 @@ class Facebook extends OAuth2 $photoSize = $this->config->get('photo_size') ?: '150'; - $userProfile->photoURL = $this->apiBaseUrl . $userProfile->identifier . '/picture?width=' . $photoSize . '&height=' . $photoSize; + $userProfile->photoURL = $this->apiBaseUrl . $userProfile->identifier; + $userProfile->photoURL .= '/picture?width=' . $photoSize . '&height=' . $photoSize; - // Don't use $data->get('verified') here, as Facebook will only return an email if it is validated first: - // https://developers.facebook.com/docs/graph-api/reference/v2.0/user - // "The User's primary email address listed on their profile. This field will not be returned if no valid email address is available." $userProfile->emailVerified = $userProfile->email; $userProfile = $this->fetchUserRegion($userProfile); @@ -236,22 +248,6 @@ class Facebook extends OAuth2 return $userContact; } - /** - * {@inheritdoc} - * - * @deprecated since August 1, 2018. Scheduled for removal before Hybridauth 3.0.0. - * See https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#login-4-24 for more info. - */ - public function setUserStatus($status, $pageId = 'me') - { - @trigger_error('The ' . __METHOD__ . ' method is deprecated since August 1, 2018 and will be removed in Hybridauth 3.0.0.', E_USER_DEPRECATED); - $status = is_string($status) ? ['message' => $status] : $status; - - $response = $this->apiRequest("{$pageId}/feed", 'POST', $status); - - return $response; - } - /** * {@inheritdoc} */ @@ -261,7 +257,7 @@ class Facebook extends OAuth2 // Post on user wall. if ($pageId === 'me') { - return $this->setUserStatus($status, $pageId); + return $this->setUserStatus($status); } // Retrieve writable user pages and filter by given one. @@ -364,7 +360,8 @@ class Facebook extends OAuth2 $userActivity->user->profileURL = $this->getProfileUrl($userActivity->user->identifier); - $userActivity->user->photoURL = $this->apiBaseUrl . $userActivity->user->identifier . '/picture?width=150&height=150'; + $userActivity->user->photoURL = $this->apiBaseUrl . $userActivity->user->identifier; + $userActivity->user->photoURL .= '/picture?width=150&height=150'; } return $userActivity; diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Foursquare.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Foursquare.php index ccf16a0ef..80d7c4ee2 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Foursquare.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Foursquare.php @@ -51,7 +51,10 @@ class Foursquare extends OAuth2 $apiVersion = $this->config->get('api_version') ?: '20140201'; - $this->apiRequestParameters = [ 'v' => $apiVersion ]; + $this->apiRequestParameters = [ + 'oauth_token' => $this->getStoredData('access_token'), + 'v' => $apiVersion, + ]; } /** @@ -84,7 +87,8 @@ class Foursquare extends OAuth2 if ($data->exists('photo')) { $photoSize = $this->config->get('photo_size') ?: '150x150'; - $userProfile->photoURL = $data->filter('photo')->get('prefix') . $photoSize . $data->filter('photo')->get('suffix'); + $userProfile->photoURL = $data->filter('photo')->get('prefix'); + $userProfile->photoURL .= $photoSize . $data->filter('photo')->get('suffix'); } return $userProfile; @@ -125,10 +129,11 @@ class Foursquare extends OAuth2 $userContact = new User\Contact(); - $userContact->identifier = $item->get('id'); - $userContact->photoURL = $item->filter('photo')->get('prefix') . $photoSize . $item->filter('photo')->get('suffix'); + $userContact->identifier = $item->get('id'); + $userContact->photoURL = $item->filter('photo')->get('prefix'); + $userContact->photoURL .= $photoSize . $item->filter('photo')->get('suffix'); $userContact->displayName = trim($item->get('firstName') . ' ' . $item->get('lastName')); - $userContact->email = $item->filter('contact')->get('email'); + $userContact->email = $item->filter('contact')->get('email'); return $userContact; } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/GitHub.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/GitHub.php index 95364aa35..1a20b8f78 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/GitHub.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/GitHub.php @@ -17,63 +17,63 @@ use Hybridauth\User; */ class GitHub extends OAuth2 { + /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public $scope = 'user:email'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiBaseUrl = 'https://api.github.com/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $authorizeUrl = 'https://github.com/login/oauth/authorize'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $accessTokenUrl = 'https://github.com/login/oauth/access_token'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiDocumentation = 'https://developer.github.com/v3/oauth/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getUserProfile() { $response = $this->apiRequest('user'); $data = new Data\Collection($response); - if (! $data->exists('id')) { + if (!$data->exists('id')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $userProfile = new User\Profile(); - $userProfile->identifier = $data->get('id'); + $userProfile->identifier = $data->get('id'); $userProfile->displayName = $data->get('name'); $userProfile->description = $data->get('bio'); - $userProfile->photoURL = $data->get('avatar_url'); - $userProfile->profileURL = $data->get('html_url'); - $userProfile->email = $data->get('email'); - $userProfile->webSiteURL = $data->get('blog'); - $userProfile->region = $data->get('location'); + $userProfile->photoURL = $data->get('avatar_url'); + $userProfile->profileURL = $data->get('html_url'); + $userProfile->email = $data->get('email'); + $userProfile->webSiteURL = $data->get('blog'); + $userProfile->region = $data->get('location'); $userProfile->displayName = $userProfile->displayName ?: $data->get('login'); if (empty($userProfile->email) && strpos($this->scope, 'user:email') !== false) { try { + // user email is not mandatory so keep it quite. $userProfile = $this->requestUserEmail($userProfile); - } - // user email is not mandatory so keep it quite - catch (\Exception $e) { + } catch (\Exception $e) { } } @@ -87,16 +87,18 @@ class GitHub extends OAuth2 * @param User\Profile $userProfile * * @return User\Profile + * + * @throws \Exception */ protected function requestUserEmail(User\Profile $userProfile) { $response = $this->apiRequest('user/emails'); foreach ($response as $idx => $item) { - if (! empty($item->primary) && $item->primary == 1) { + if (!empty($item->primary) && $item->primary == 1) { $userProfile->email = $item->email; - if (! empty($item->verified) && $item->verified == 1) { + if (!empty($item->verified) && $item->verified == 1) { $userProfile->emailVerified = $userProfile->email; } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Google.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Google.php index c7fe86489..203fe0a47 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Google.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Google.php @@ -116,7 +116,7 @@ class Google extends OAuth2 $userProfile->language = $data->get('locale'); $userProfile->email = $data->get('email'); - $userProfile->emailVerified = ($data->get('email_verified') === true || $data->get('email_verified') === 1) ? $userProfile->email : ''; + $userProfile->emailVerified = $data->get('email_verified') ? $userProfile->email : ''; if ($this->config->get('photo_size')) { $userProfile->photoURL .= '?sz=' . $this->config->get('photo_size'); @@ -136,6 +136,8 @@ class Google extends OAuth2 if (false !== strpos($this->scope, '/m8/feeds/') || false !== strpos($this->scope, '/auth/contacts.readonly')) { return $this->getGmailContacts($parameters); } + + return []; } /** @@ -144,6 +146,8 @@ class Google extends OAuth2 * @param array $parameters * * @return array + * + * @throws \Exception */ protected function getGmailContacts($parameters = []) { diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/LinkedIn.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/LinkedIn.php index 921acad48..a873b1855 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/LinkedIn.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/LinkedIn.php @@ -40,7 +40,7 @@ class LinkedIn extends OAuth2 /** * {@inheritdoc} */ - protected $apiDocumentation = 'https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow'; + protected $apiDocumentation = 'https://docs.microsoft.com/en-us/linkedin/shared/authentication/authentication'; /** * {@inheritdoc} @@ -76,12 +76,16 @@ class LinkedIn extends OAuth2 ->get($this->getPreferredLocale($data, 'lastName')); $userProfile->identifier = $data->get('id'); - $userProfile->photoURL = $this->getUserPhotoUrl($data->filter('profilePicture')->filter('displayImage~')->get('elements')); $userProfile->email = $this->getUserEmail(); $userProfile->emailVerified = $userProfile->email; - $userProfile->displayName = trim($userProfile->firstName . ' ' . $userProfile->lastName); + $photo_elements = $data + ->filter('profilePicture') + ->filter('displayImage~') + ->get('elements'); + $userProfile->photoURL = $this->getUserPhotoUrl($photo_elements); + return $userProfile; } @@ -106,7 +110,7 @@ class LinkedIn extends OAuth2 } } - return NULL; + return null; } /** @@ -114,6 +118,8 @@ class LinkedIn extends OAuth2 * * @return string * The user email address. + * + * @throws \Exception */ public function getUserEmail() { @@ -128,7 +134,7 @@ class LinkedIn extends OAuth2 } } - return NULL; + return null; } /** @@ -179,7 +185,8 @@ class LinkedIn extends OAuth2 * @return string * A field locale. */ - protected function getPreferredLocale($data, $field_name) { + protected function getPreferredLocale($data, $field_name) + { $locale = $data->filter($field_name)->filter('preferredLocale'); if ($locale) { return $locale->get('language') . '_' . $locale->get('country'); diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Mailru.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Mailru.php index dae5a537a..190e93153 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Mailru.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Mailru.php @@ -58,7 +58,13 @@ class Mailru extends OAuth2 */ public function getUserProfile() { - $sign = md5('app_id=' . $this->clientId . 'method=users.getInfosecure=1session_key=' . $this->getStoredData('access_token') . $this->clientSecret); + $params = [ + 'app_id' => $this->clientId, + 'method' => 'users.getInfo', + 'secure' => 1, + 'session_key' => $this->getStoredData('access_token'), + ]; + $sign = md5(http_build_query($params, null, '') . $this->clientSecret); $param = [ 'app_id' => $this->clientId, @@ -72,7 +78,7 @@ class Mailru extends OAuth2 $data = new Collection($response[0]); - if (! $data->exists('uid')) { + if (!$data->exists('uid')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Odnoklassniki.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Odnoklassniki.php index 323dc2b88..9597b4e7a 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Odnoklassniki.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Odnoklassniki.php @@ -11,6 +11,7 @@ use Hybridauth\Adapter\OAuth2; use Hybridauth\Data; use Hybridauth\Exception\UnexpectedApiResponseException; use Hybridauth\User; + /** * Odnoklassniki OAuth2 provider adapter. * diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/OpenID.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/OpenID.php index aef704ace..884c31949 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/OpenID.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/OpenID.php @@ -7,7 +7,7 @@ namespace Hybridauth\Provider; -use Hybridauth\Adapter\OpenID as OpenIDAdapter; +use Hybridauth\Adapter; /** * Generic OpenID providers adapter. @@ -40,6 +40,6 @@ use Hybridauth\Adapter\OpenID as OpenIDAdapter; * echo $e->getMessage() ; * } */ -class OpenID extends OpenIDAdapter +class OpenID extends Adapter\OpenID { } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/PaypalOpenID.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/PaypalOpenID.php index fc7720335..9e6b7a1a7 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/PaypalOpenID.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/PaypalOpenID.php @@ -7,13 +7,13 @@ namespace Hybridauth\Provider; -use Hybridauth\Adapter\OpenID as OpenIDAdapter; +use Hybridauth\Adapter\OpenID; use Hybridauth\HttpClient; /** * PayPal OpenID provider adapter. */ -class PaypalOpenID extends OpenIDAdapter +class PaypalOpenID extends OpenID { /** * {@inheritdoc} diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Spotify.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Spotify.php index a1bd15e85..8cf3db507 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Spotify.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Spotify.php @@ -86,5 +86,4 @@ class Spotify extends OAuth2 return $userProfile; } - } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/StackExchangeOpenID.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/StackExchangeOpenID.php index 9c40f7772..befb32dfa 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/StackExchangeOpenID.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/StackExchangeOpenID.php @@ -7,12 +7,12 @@ namespace Hybridauth\Provider; -use Hybridauth\Adapter\OpenID as OpenIDAdapter; +use Hybridauth\Adapter\OpenID; /** * StackExchange OpenID provider adapter. */ -class StackExchangeOpenID extends OpenIDAdapter +class StackExchangeOpenID extends OpenID { /** * {@inheritdoc} diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Steam.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Steam.php index 69b3793df..d9ddfd4a4 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Steam.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Steam.php @@ -7,7 +7,7 @@ namespace Hybridauth\Provider; -use Hybridauth\Adapter\OpenID as OpenIDAdapter; +use Hybridauth\Adapter\OpenID; use Hybridauth\Exception\UnexpectedApiResponseException; use Hybridauth\Data; use Hybridauth\User; @@ -28,7 +28,7 @@ use Hybridauth\User; * $userProfile = $adapter->getUserProfile(); */ -class Steam extends OpenIDAdapter +class Steam extends OpenID { /** * {@inheritdoc} @@ -44,9 +44,12 @@ class Steam extends OpenIDAdapter $userProfile = $this->storage->get($this->providerId . '.user'); - $userProfile->identifier = str_ireplace(array('http://steamcommunity.com/openid/id/', 'https://steamcommunity.com/openid/id/'), '', $userProfile->identifier); + $userProfile->identifier = str_ireplace([ + 'http://steamcommunity.com/openid/id/', + 'https://steamcommunity.com/openid/id/', + ], '', $userProfile->identifier); - if (! $userProfile->identifier) { + if (!$userProfile->identifier) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } @@ -56,9 +59,8 @@ class Steam extends OpenIDAdapter // if api key is provided, we attempt to use steam web api if ($apiKey) { $result = $this->getUserProfileWebAPI($apiKey, $userProfile->identifier); - } - // otherwise we fallback to community data - else { + } else { + // otherwise we fallback to community data $result = $this->getUserProfileLegacyAPI($userProfile->identifier); } @@ -66,9 +68,7 @@ class Steam extends OpenIDAdapter foreach ($result as $k => $v) { $userProfile->$k = $v ?: $userProfile->$k; } - } - // these data are not mandatory, so keep it quite - catch (\Exception $e) { + } catch (\Exception $e) { } // store user profile @@ -85,7 +85,8 @@ class Steam extends OpenIDAdapter */ public function getUserProfileWebAPI($apiKey, $steam64) { - $apiUrl = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' . $apiKey . '&steamids=' . $steam64; + $q = http_build_query(['key' => $apiKey, 'steamid' => $steam64]); + $apiUrl = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?' . $q; $response = $this->httpClient->request($apiUrl); diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Telegram.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Telegram.php index 727b016e9..cf2dc30a3 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Telegram.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Telegram.php @@ -7,7 +7,6 @@ use Hybridauth\Data\Collection; use Hybridauth\User\Profile; use Hybridauth\Adapter\AbstractAdapter; use Hybridauth\Adapter\AdapterInterface; - use Hybridauth\Exception\InvalidApplicationCredentialsException; use Hybridauth\Exception\InvalidAuthorizationCodeException; use Hybridauth\Exception\UnexpectedApiResponseException; @@ -30,28 +29,28 @@ use Hybridauth\Exception\UnexpectedApiResponseException; * $userProfile = $adapter->getUserProfile(); * } * catch(\Exception $e) { - * print $e->getMessage() ; + * print $e->getMessage(); * } */ class Telegram extends AbstractAdapter implements AdapterInterface { - + protected $botId = ''; - + protected $botSecret = ''; - + protected $callbackUrl = ''; - + /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function configure() { $this->botId = $this->config->filter('keys')->get('id'); $this->botSecret = $this->config->filter('keys')->get('secret'); $this->callbackUrl = $this->config->get('callback'); - if (! $this->botId || !$this->botSecret) { + if (!$this->botId || !$this->botSecret) { throw new InvalidApplicationCredentialsException( 'Your application id is required in order to connect to ' . $this->providerId ); @@ -59,13 +58,15 @@ class Telegram extends AbstractAdapter implements AdapterInterface } /** - * {@inheritdoc} - */ - protected function initialize() {} + * {@inheritdoc} + */ + protected function initialize() + { + } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function authenticate() { $this->logger->info(sprintf('%s::authenticate()', get_class($this))); @@ -77,10 +78,10 @@ class Telegram extends AbstractAdapter implements AdapterInterface } return null; } - + /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getUserProfile() { $data = new Collection($this->parseAuthData()); @@ -99,64 +100,64 @@ class Telegram extends AbstractAdapter implements AdapterInterface return $userProfile; } - + /** - * See: https://telegram.im/widget-login.php - * See: https://gist.github.com/anonymous/6516521b1fb3b464534fbc30ea3573c2 - */ + * See: https://telegram.im/widget-login.php + * See: https://gist.github.com/anonymous/6516521b1fb3b464534fbc30ea3573c2 + */ protected function authenticateCheckError() { $auth_data = $this->parseAuthData(); - + $check_hash = $auth_data['hash']; unset($auth_data['hash']); $data_check_arr = []; - + foreach ($auth_data as $key => $value) { - $data_check_arr[] = $key . '=' . $value; + if (!empty($value)) { + $data_check_arr[] = $key . '=' . $value; + } } sort($data_check_arr); - + $data_check_string = implode("\n", $data_check_arr); $secret_key = hash('sha256', $this->botSecret, true); $hash = hash_hmac('sha256', $data_check_string, $secret_key); - + if (strcmp($hash, $check_hash) !== 0) { throw new InvalidAuthorizationCodeException( sprintf('Provider returned an error: %s', 'Data is NOT from Telegram') ); } - + if ((time() - $auth_data['auth_date']) > 86400) { throw new InvalidAuthorizationCodeException( sprintf('Provider returned an error: %s', 'Data is outdated') ); } } - + /** - * See: https://telegram.im/widget-login.php - */ + * See: https://telegram.im/widget-login.php + */ protected function authenticateBegin() { - $this->logger->debug( - sprintf('%s::authenticateBegin(), redirecting user to:', get_class($this)) - ); - - exit( -<<logger->debug(sprintf('%s::authenticateBegin(), redirecting user to:', get_class($this))); + + exit( + << - HTML ); } - + protected function authenticateFinish() { $this->logger->debug( @@ -165,7 +166,7 @@ HTML ); $this->initialize(); } - + protected function parseAuthData() { return [ @@ -178,5 +179,4 @@ HTML 'hash' => filter_input(INPUT_GET, 'hash'), ]; } - } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/TwitchTV.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/TwitchTV.php index fd2034490..bdfec3b87 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/TwitchTV.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/TwitchTV.php @@ -55,7 +55,7 @@ class TwitchTV extends OAuth2 throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } - $users = $data->filter('data')->properties(); + $users = $data->filter('data')->values(); $user = new Data\Collection($users[0]); $userProfile = new User\Profile(); diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Vkontakte.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Vkontakte.php index 36a843069..cfc31bd4e 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Vkontakte.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Vkontakte.php @@ -11,6 +11,8 @@ use Hybridauth\Adapter\OAuth2; use Hybridauth\Exception\UnexpectedApiResponseException; use Hybridauth\Data\Collection; use Hybridauth\User\Profile; +use Hybridauth\Data; +use Hybridauth\User; /** * Vkontakte provider adapter. @@ -37,6 +39,11 @@ use Hybridauth\User\Profile; */ class Vkontakte extends OAuth2 { + + const API_VERSION = '5.95'; + + const URL = 'https://vk.com/'; + /** * {@inheritdoc} */ @@ -57,18 +64,18 @@ class Vkontakte extends OAuth2 */ protected $scope = 'email,offline'; - /** - * {@inheritdoc} - */ - public function hasAccessTokenExpired() - { - // As we using offline scope, $expired will be false. - $expired = $this->getStoredData('expires_in') - ? $this->getStoredData('expires_at') <= time() - : false; + /** + * {@inheritdoc} + */ + public function hasAccessTokenExpired() + { + // As we using offline scope, $expired will be false. + $expired = $this->getStoredData('expires_in') + ? $this->getStoredData('expires_at') <= time() + : false; - return $expired; - } + return $expired; + } /** * {@inheritdoc} @@ -92,7 +99,7 @@ class Vkontakte extends OAuth2 'user_ids' => $this->getStoredData('user_id'), // Required fields: id,first_name,last_name 'fields' => 'screen_name,sex,has_photo,' . $photoField, - 'v' => '5.95', + 'v' => static::API_VERSION, $this->accessTokenName => $this->getStoredData($this->accessTokenName), ]; @@ -117,7 +124,7 @@ class Vkontakte extends OAuth2 $userProfile->displayName = $data->get('screen_name'); $userProfile->photoURL = $data->get('has_photo') === 1 ? $data->get($photoField) : ''; - $screen_name = 'https://vk.com/' . ($data->get('screen_name') ?: 'id' . $data->get('id')); + $screen_name = static::URL . ($data->get('screen_name') ?: 'id' . $data->get('id')); $userProfile->profileURL = $screen_name; switch ($data->get('sex')) { @@ -133,4 +140,52 @@ class Vkontakte extends OAuth2 return $userProfile; } + /** + * {@inheritdoc} + */ + public function getUserContacts() + { + $contacts = []; + + $parameters = [ + 'user_id' => $this->getStoredData('user_id'), + 'fields' => 'uid,name,photo_200_orig', + 'v' => static::API_VERSION, + $this->accessTokenName => $this->getStoredData($this->accessTokenName), + ]; + + $response = $this->apiRequest('friends.get', 'GET', $parameters); + + $data = new Data\Collection($response); + if (!$data->exists('response')) { + throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); + } + if (!$data->filter('response')->filter('items')->isEmpty()) { + foreach ($data->filter('response')->filter('items')->toArray() as $item) { + $contacts[] = $this->fetchUserContact($item); + } + } + + return $contacts; + } + + /** + * Parse the user contact. + * + * @param array $item + * + * @return \Hybridauth\User\Contact + */ + protected function fetchUserContact($item) + { + $userContact = new User\Contact(); + $data = new Data\Collection($item); + + $userContact->identifier = $data->get('id'); + $userContact->displayName = sprintf('%s %s', $data->get('first_name'), $data->get('last_name')); + $userContact->profileURL = static::URL . ($data->get('screen_name') ?: 'id' . $data->get('id')); + $userContact->photoURL = $data->get('photo_200_orig'); + + return $userContact; + } } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/WeChat.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/WeChat.php index 5f374e02c..10bff2bcc 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/WeChat.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/WeChat.php @@ -109,5 +109,4 @@ class WeChat extends OAuth2 return $userProfile; } - } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/WeChatChina.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/WeChatChina.php index fefd019a7..ba3b4b8a4 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/WeChatChina.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/WeChatChina.php @@ -7,12 +7,6 @@ namespace Hybridauth\Provider; -use Hybridauth\Adapter\OAuth2; -use Hybridauth\Provider\WeChat; -use Hybridauth\Exception\UnexpectedApiResponseException; -use Hybridauth\Data; -use Hybridauth\User; - /** * WeChat China OAuth2 provider adapter. */ @@ -38,5 +32,4 @@ class WeChatChina extends WeChat * {@ịnheritdoc} */ protected $accessTokenInfoUrl = 'https://api.weixin.qq.com/sns/auth'; - } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/YahooOpenID.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/YahooOpenID.php index dfda4983e..4b36f7dc2 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/YahooOpenID.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/YahooOpenID.php @@ -7,12 +7,12 @@ namespace Hybridauth\Provider; -use Hybridauth\Adapter\OpenID as OpenIDAdapter; +use Hybridauth\Adapter\OpenID; /** * Yahoo OpenID provider adapter. */ -class YahooOpenID extends OpenIDAdapter +class YahooOpenID extends OpenID { /** * {@inheritdoc} diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Yandex.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Yandex.php index 8563992d1..dacb49840 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Yandex.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Yandex.php @@ -13,7 +13,6 @@ use Hybridauth\Exception\UnexpectedApiResponseException; use Hybridauth\Data\Collection; use Hybridauth\User\Profile; - /** * Yandex provider adapter. * @@ -67,7 +66,7 @@ class Yandex extends OAuth2 $response = $this->apiRequest($this->apiBaseUrl . "?format=json"); if (!isset($response->id)) { - throw new UnexpectedApiResponseException("User profile request failed! {$this->providerId} returned an invalid response.", 6); + throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $data = new Collection($response); diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Storage/Session.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Storage/Session.php index 80d57a09d..1ec08f54c 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Storage/Session.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Storage/Session.php @@ -40,6 +40,7 @@ class Session implements StorageInterface } if (headers_sent()) { + // phpcs:ignore throw new RuntimeException('HTTP headers already sent to browser and Hybridauth won\'t be able to start/resume PHP session. To resolve this, session_start() must be called before outputing any data.'); } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Thirdparty/OAuth/OAuthSignatureMethod.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Thirdparty/OAuth/OAuthSignatureMethod.php index a03bc3a3a..810be0119 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Thirdparty/OAuth/OAuthSignatureMethod.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Thirdparty/OAuth/OAuthSignatureMethod.php @@ -59,7 +59,7 @@ abstract class OAuthSignatureMethod // Avoid a timing leak with a (hopefully) time insensitive compare $result = 0; for ($i = 0; $i < strlen($signature); $i ++) { - $result |= ord($built {$i}) ^ ord($signature {$i}); + $result |= ord($built[$i]) ^ ord($signature[$i]); } return $result == 0; diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Thirdparty/OpenID/LightOpenID.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Thirdparty/OpenID/LightOpenID.php index 7120bf259..7b2d8bde7 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Thirdparty/OpenID/LightOpenID.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Thirdparty/OpenID/LightOpenID.php @@ -23,7 +23,7 @@ class ErrorException extends Exception implements ExceptionInterface /** * This class provides a simple interface for OpenID 1.1/2.0 authentication. - * + * * It requires PHP >= 5.1.2 with cURL or HTTP/HTTPS stream wrappers enabled. * * @version v1.3.1 (2016-03-04) @@ -188,7 +188,7 @@ class LightOpenID if (!is_array($proxy)) { $proxy = parse_url($proxy); } - + // Check if $proxy is valid after the parsing. if ($proxy && !empty($proxy['host'])) { // Make sure that a valid port number is specified. @@ -196,12 +196,12 @@ class LightOpenID if (!is_int($proxy['port'])) { $proxy['port'] = is_numeric($proxy['port']) ? intval($proxy['port']) : 0; } - + if ($proxy['port'] <= 0) { throw new ErrorException('The specified proxy port number is invalid.'); } } - + $this->proxy = $proxy; } } @@ -234,16 +234,16 @@ class LightOpenID protected function set_realm($uri) { $realm = ''; - + # Set a protocol, if not specified. $realm .= (($offset = strpos($uri, '://')) === false) ? $this->get_realm_protocol() : ''; - + # Set the offset properly. $offset = (($offset !== false) ? $offset + 3 : 0); - + # Get only the root, without the path. $realm .= (($end = strpos($uri, '/', $offset)) === false) ? $uri : substr($uri, 0, $end); - + $this->trustRoot = $realm; } @@ -261,7 +261,7 @@ class LightOpenID } else { $use_secure_protocol = false; } - + return $use_secure_protocol ? 'https://' : 'http://'; } @@ -283,23 +283,23 @@ class LightOpenID curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - + if ($method == 'POST') { curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/x-www-form-urlencoded')); } else { curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/xrds+xml, */*')); } - + curl_setopt($curl, CURLOPT_TIMEOUT, $this->curl_time_out); // defaults to infinite curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $this->curl_connect_time_out); // defaults to 300s - + if (!empty($this->proxy)) { curl_setopt($curl, CURLOPT_PROXY, $this->proxy['host']); - + if (!empty($this->proxy['port'])) { curl_setopt($curl, CURLOPT_PROXYPORT, $this->proxy['port']); } - + if (!empty($this->proxy['user'])) { curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->proxy['user'] . ':' . $this->proxy['pass']); } @@ -424,7 +424,7 @@ class LightOpenID if (!$this->hostExists($url)) { throw new ErrorException("Could not connect to $url.", 404); } - + if (empty($this->cnmatch)) { $this->cnmatch = parse_url($url, PHP_URL_HOST); } @@ -469,7 +469,7 @@ class LightOpenID // We want to send a HEAD request, but since get_headers() doesn't // accept $context parameter, we have to change the defaults. $default = stream_context_get_options(stream_context_get_default()); - + // PHP does not reset all options. Instead, it just sets the options // available in the passed array, therefore set the defaults manually. $default += array( @@ -485,7 +485,7 @@ class LightOpenID $default['ssl'] += array( 'CN_match' => '' ); - + $opts = array( 'http' => array( 'method' => 'HEAD', @@ -497,7 +497,7 @@ class LightOpenID 'CN_match' => $this->cnmatch ) ); - + // Enable validation of the SSL certificates. if ($this->verify_peer) { $default['ssl'] += array( @@ -511,15 +511,15 @@ class LightOpenID 'cafile' => $this->cainfo ); } - + // Change the stream context options. stream_context_get_default($opts); - + $headers = get_headers($url . ($params ? '?' . $params : '')); - + // Restore the stream context options. stream_context_get_default($default); - + if (!empty($headers)) { if (intval(substr($headers[0], strlen('HTTP/1.1 '))) == 405) { // The server doesn't support HEAD - emulate it with a GET. @@ -533,7 +533,7 @@ class LightOpenID } else { $headers = array(); } - + return $headers; } @@ -568,24 +568,24 @@ class LightOpenID protected function request($url, $method='GET', $params=array(), $update_claimed_id=false) { $use_curl = false; - + if (function_exists('curl_init')) { if (!$use_curl) { # When allow_url_fopen is disabled, PHP streams will not work. $use_curl = !ini_get('allow_url_fopen'); } - + if (!$use_curl) { # When there is no HTTPS wrapper, PHP streams cannott be used. $use_curl = !in_array('https', stream_get_wrappers()); } - + if (!$use_curl) { # With open_basedir or safe_mode set, cURL can't follow redirects. $use_curl = !(ini_get('safe_mode') || ini_get('open_basedir')); } } - + return $use_curl ? $this->request_curl($url, $method, $params, $update_claimed_id) @@ -598,21 +598,21 @@ class LightOpenID protected function proxy_url() { $result = ''; - + if (!empty($this->proxy)) { $result = $this->proxy['host']; - + if (!empty($this->proxy['port'])) { $result = $result . ':' . $this->proxy['port']; } - + if (!empty($this->proxy['user'])) { $result = $this->proxy['user'] . ':' . $this->proxy['pass'] . '@' . $result; } - + $result = 'http://' . $result; } - + return $result; } @@ -685,7 +685,7 @@ class LightOpenID # A flag to disable yadis discovery in case of failure in headers. $yadis = true; - + # Allows optional regex replacement of the URL, e.g. to use Google Apps # as an OpenID provider without setting up XRDS on the domain hosting. if (!is_null($this->xrds_override_pattern) && !is_null($this->xrds_override_replacement)) { @@ -829,19 +829,19 @@ class LightOpenID # While it is against the spec, allowing this here shouldn't break # compatibility with anything. $allowed_types = array('application/xrds+xml', 'text/xml'); - + # Only allow text/html content type for the Yahoo logins, since # it might cause an endless redirection for the other providers. if ($this->get_provider_name($this->claimed_id) == 'yahoo') { $allowed_types[] = 'text/html'; } - + foreach ($allowed_types as $type) { if (strpos($content_type, $type) !== false) { return true; } } - + return false; } @@ -853,7 +853,7 @@ class LightOpenID protected function get_provider_name($provider_url) { $result = ''; - + if (!empty($provider_url)) { $tokens = array_reverse( explode('.', parse_url($provider_url, PHP_URL_HOST)) @@ -864,7 +864,7 @@ class LightOpenID : (count($tokens) > 2 ? $tokens[2] : '') ); } - + return $result; } @@ -988,15 +988,15 @@ class LightOpenID 'openid.return_to' => $this->returnUrl, 'openid.realm' => $this->trustRoot, ); - + if ($this->ax) { $params += $this->axParams(); } - + if ($this->sreg) { $params += $this->sregParams(); } - + if (!$this->ax && !$this->sreg) { # If OP doesn't advertise either SREG, nor AX, let's send them both # in worst case we don't get anything in return. @@ -1113,36 +1113,36 @@ class LightOpenID protected function getAxAttributes() { $result = array(); - + if ($alias = $this->getNamespaceAlias('http://openid.net/srv/ax/1.0', 'ax')) { $prefix = 'openid_' . $alias; $length = strlen('http://axschema.org/'); - + foreach (explode(',', $this->data['openid_signed']) as $key) { $keyMatch = $alias . '.type.'; - + if (strncmp($key, $keyMatch, strlen($keyMatch)) !== 0) { continue; } - + $key = substr($key, strlen($keyMatch)); $idv = $prefix . '_value_' . $key; $idc = $prefix . '_count_' . $key; $key = substr($this->getItem($prefix . '_type_' . $key), $length); - + if (!empty($key)) { if (($count = intval($this->getItem($idc))) > 0) { $value = array(); - + for ($i = 1; $i <= $count; $i++) { $value[] = $this->getItem($idv . '_' . $i); } - + $value = ($count == 1) ? reset($value) : $value; } else { $value = $this->getItem($idv); } - + if (!is_null($value)) { $result[$key] = $value; } @@ -1152,7 +1152,7 @@ class LightOpenID // No alias for the AX schema has been found, // so there is no AX data in the OP's response. } - + return $result; } @@ -1206,19 +1206,19 @@ class LightOpenID * In order to use the OpenID+OAuth hybrid protocol, you need to add at least one * scope to the $openid->oauth array before you get the call to getAuthUrl(), e.g.: * $openid->oauth[] = 'https://www.googleapis.com/auth/plus.me'; - * - * Furthermore the registered consumer name must fit the OpenID realm. + * + * Furthermore the registered consumer name must fit the OpenID realm. * To register an OpenID consumer at Google use: https://www.google.com/accounts/ManageDomains - * + * * @return string|bool OAuth request token on success, FALSE if no token was provided. */ public function getOAuthRequestToken() { $alias = $this->getNamespaceAlias('http://specs.openid.net/extensions/oauth/1.0'); - + return !empty($alias) ? $this->data['openid_' . $alias . '_request_token'] : false; } - + /** * Gets the alias for the specified namespace, if it's present. * @@ -1229,13 +1229,13 @@ class LightOpenID private function getNamespaceAlias($namespace, $hint = null) { $result = null; - + if (empty($hint) || $this->getItem('openid_ns_' . $hint) != $namespace) { // The common alias is either undefined or points to // some other extension - search for another alias.. $prefix = 'openid_ns_'; $length = strlen($prefix); - + foreach ($this->data as $key => $val) { if (strncmp($key, $prefix, $length) === 0 && $val === $namespace) { $result = trim(substr($key, $length)); @@ -1245,10 +1245,10 @@ class LightOpenID } else { $result = $hint; } - + return $result; } - + /** * Gets an item from the $data array by the specified id. * diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/User/Activity.php b/e107_handlers/vendor/hybridauth/hybridauth/src/User/Activity.php index 731bbbe12..b57467adc 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/User/Activity.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/User/Activity.php @@ -57,15 +57,17 @@ final class Activity } /** - * Prevent the providers adapters from adding new fields. - * - * @var string $name - * @var mixed $value - * - * @throws Exception\UnexpectedValueException - */ + * Prevent the providers adapters from adding new fields. + * + * @var mixed $value + * + * @var string $name + * + * @throws UnexpectedValueException + */ public function __set($name, $value) { + // phpcs:ignore throw new UnexpectedValueException(sprintf('Adding new property "%s\' to %s is not allowed.', $name, __CLASS__)); } } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/tests/Data/CollectionTest.php b/e107_handlers/vendor/hybridauth/hybridauth/tests/Data/CollectionTest.php index 84ede87f3..ef5038181 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/tests/Data/CollectionTest.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/tests/Data/CollectionTest.php @@ -1,4 +1,6 @@ -slug = true; } } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/tests/User/ContactTest.php b/e107_handlers/vendor/hybridauth/hybridauth/tests/User/ContactTest.php index 3ddf44311..f784d0be7 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/tests/User/ContactTest.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/tests/User/ContactTest.php @@ -1,4 +1,6 @@ -slug = true; } } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/tests/User/ProfileTest.php b/e107_handlers/vendor/hybridauth/hybridauth/tests/User/ProfileTest.php index d65b35a2d..9dc29f829 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/tests/User/ProfileTest.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/tests/User/ProfileTest.php @@ -1,4 +1,6 @@ -slug = true; } } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/tests/User/empty b/e107_handlers/vendor/hybridauth/hybridauth/tests/User/empty deleted file mode 100644 index e69de29bb..000000000