Version 5.0.13

This commit is contained in:
Neo committed 2025-12-19 19:04:57 -08:00
1 parent b89858b2ff
commit 5efe744c5f
1407 files changed
+69690 -30177

No files matched your search

+37 -11
View File
@@ -49,6 +49,16 @@ class Facebook extends OAuth2
{
return 'login_handler_Facebook';
}
/**
* Can this handler sync profile photos?
*
* @return bool
*/
public function canSyncProfilePhoto() : bool
{
return true;
}
/**
* ACP Settings Form
@@ -75,6 +85,15 @@ class Facebook extends OAuth2
1 => array( 'login_update_name_changes_inc_optional' ),
)
), NULL, NULL, NULL, 'login_real_name' ),
'real_photo' => new Radio( 'login_real_photo', $this->settings['real_photo'] ?? 1, false, array(
'options' => array(
1 => 'login_real_photo_facebook',
0 => 'login_real_photo_disabled'
),
'toggles' => array(
1 => array( 'login_update_photo_changes_inc_optional' )
)
) )
),
parent::acpForm(),
array()
@@ -310,17 +329,21 @@ class Facebook extends OAuth2
*/
public function userProfilePhoto( Member $member ): ?Url
{
if ( !( $link = $this->_link( $member ) ) or ( $link['token_expires'] and $link['token_expires'] < time() ) )
if ( !( $link = $this->_link( $member ) ) or ( $link['token_expires'] and $link['token_expires'] < time() ) OR empty( $link['token_access_token'] ) )
{
throw new LoginException( "", LoginException::INTERNAL_ERROR );
}
$photoVars = explode( ':', $member->group['g_photo_max_vars'] );
$response = $this->_authorizedRequest( "{$link['token_identifier']}/picture?width={$photoVars[1]}&redirect=false", $link['token_access_token'], NULL, 'get' );
if ( !$response['data']['is_silhouette'] and isset( $response['data']['url'] ) and $response['data']['url'] )
{
return Url::external( $response['data']['url'] );
}
if ( isset( $this->settings['real_photo'] ) and $this->settings['real_photo'] )
{
$photoVars = explode( ':', $member->group['g_photo_max_vars'] );
$response = $this->_authorizedRequest( "{$link['token_identifier']}/picture?width={$photoVars[1]}&redirect=false", $link['token_access_token'], NULL, 'get' );
if ( !$response['data']['is_silhouette'] and isset( $response['data']['url'] ) and $response['data']['url'] )
{
return Url::external( $response['data']['url'] );
}
}
return NULL;
}
@@ -336,7 +359,7 @@ class Facebook extends OAuth2
*/
public function userProfileName( Member $member ): ?string
{
if ( !( $link = $this->_link( $member ) ) or ( $link['token_expires'] and $link['token_expires'] < time() ) )
if ( !( $link = $this->_link( $member ) ) or ( $link['token_expires'] and $link['token_expires'] < time() ) OR empty( $link['token_access_token'] ) )
{
throw new LoginException( "", LoginException::INTERNAL_ERROR );
}
@@ -365,8 +388,11 @@ class Facebook extends OAuth2
{
$return[] = 'name';
}
$return[] = 'photo';
if( isset( $this->settings['update_photo_changes'] ) and $this->settings['update_photo_changes'] == 'optional' and isset( $this->settings['real_photo'] ) and $this->settings['real_photo'] )
{
$return[] = 'photo';
}
return $return;
}