Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+10 -25
View File
@@ -11,7 +11,7 @@
namespace IPS\Login\Handler\OAuth2;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -58,7 +58,7 @@ class _Wordpress extends \IPS\Login\Handler\OAuth2
{
$active = 'accountManagementSettings';
}
if ( !is_string( $v ) and !is_array( $v ) )
if ( !\is_string( $v ) and !\is_array( $v ) )
{
${$active}[ $k ] = $v;
}
@@ -283,35 +283,20 @@ class _Wordpress extends \IPS\Login\Handler\OAuth2
*/
public function userProfilePhoto( \IPS\Member $member )
{
if ( !( $link = $this->_link( $member ) ) )
if ( !( $link = $this->_link( $member ) ) or ( $link['token_expires'] and $link['token_expires'] < time() ) )
{
throw new \IPS\Login\Exception( NULL, \IPS\Login\Exception::INTERNAL_ERROR );
}
if ( isset( $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 ) )
try
{
$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 \IPS\Http\Url::external( $url );
}
catch ( \Exception $e ) { }
}
return NULL;
}
@@ -328,7 +313,7 @@ class _Wordpress extends \IPS\Login\Handler\OAuth2
*/
public function userProfileName( \IPS\Member $member )
{
if ( !( $link = $this->_link( $member ) ) )
if ( !( $link = $this->_link( $member ) ) or ( $link['token_expires'] and $link['token_expires'] < time() ) )
{
throw new \IPS\Login\Exception( NULL, \IPS\Login\Exception::INTERNAL_ERROR );
}
@@ -385,7 +370,7 @@ class _Wordpress extends \IPS\Login\Handler\OAuth2
->decodeJson();
/* As with the Custom handler - if we did not get expected data, try using the query string method. */
if ( !count( $data ) )
if ( !\count( $data ) )
{
$data = \IPS\Http\Url::external( rtrim( $this->settings['wordpress_url'], "/" ) . "/wp-content/plugins/miniorange-oauth-20-server/web/moserver/resource" )
->setQueryString( 'access_token', $accessToken )