Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -236,7 +236,7 @@ class _Wordpress extends \IPS\Login\Handler\OAuth2
|
||||
{
|
||||
return $this->_userData( $accessToken )[ 'username' ];
|
||||
}
|
||||
throw new \Exception;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,7 +252,7 @@ class _Wordpress extends \IPS\Login\Handler\OAuth2
|
||||
{
|
||||
return $this->_userData( $accessToken )[ 'display_name' ];
|
||||
}
|
||||
throw new \Exception;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,7 +268,7 @@ class _Wordpress extends \IPS\Login\Handler\OAuth2
|
||||
{
|
||||
return $this->_userData( $accessToken )[ 'email' ];
|
||||
}
|
||||
throw new \Exception;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,10 +287,31 @@ class _Wordpress extends \IPS\Login\Handler\OAuth2
|
||||
{
|
||||
throw new \IPS\Login\Exception( NULL, \IPS\Login\Exception::INTERNAL_ERROR );
|
||||
}
|
||||
|
||||
|
||||
if ( isset( $this->_userData( $link['token_access_token'] )[ 'avatar' ] ) )
|
||||
{
|
||||
return $this->_userData( $link['token_access_token'] )[ 'avatar' ];
|
||||
{
|
||||
$url = preg_replace( '/^.*src=[\'"](.+?)[\'"].*$/i', '$1', $this->_userData( $link['token_access_token'] )[ 'avatar' ] );
|
||||
if ( preg_match( '/^https?:\/\/(?:secure\.|www\.)?gravatar\.com\/avatar\/(.{32})/', $url, $matches ) )
|
||||
{
|
||||
$url = \IPS\Http\Url::external( "https://secure.gravatar.com/avatar/" . $matches[1] )->setQueryString( 'd', '404' );
|
||||
try
|
||||
{
|
||||
$response = $url->request()->head();
|
||||
if ( $response->httpResponseCode == 200 )
|
||||
{
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
return \IPS\Http\Url::external( $url );
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user