Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

@@ -2,9 +2,9 @@
/**
* @brief Google Profile Sync
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 13 Jun 2013
* @version SVN_VERSION_NUMBER
*/
@@ -55,14 +55,14 @@ class _Google extends ProfileSyncAbstract
try
{
$loginHandler = \IPS\Login\LoginAbstract::load('google');
$response = \IPS\Http\Url::external( 'https://accounts.google.com/o/oauth2/token' )->request()->post( array(
'client_id' => $loginHandler->settings['client_id'],
'client_secret' => $loginHandler->settings['client_secret'],
'refresh_token' => $this->member->google_token,
'grant_type' => 'refresh_token'
) )->decodeJson();
if ( isset( $response['access_token'] ) )
{
$this->authToken = $response['access_token'];
@@ -73,9 +73,11 @@ class _Google extends ProfileSyncAbstract
{
$this->member->google_token = NULL;
$this->member->save();
\IPS\Log::log( $e, 'google' );
}
}
return $this->user;
}
@@ -97,11 +99,20 @@ class _Google extends ProfileSyncAbstract
*/
public function photo()
{
$user = $this->user();
if ( isset( $user['image'] ) )
try
{
return \IPS\Http\Url::external( preg_replace( '/\?sz=\d+$/', '', $user['image']['url'] ) );
$user = $this->user();
if ( isset( $user['image'] ) )
{
return \IPS\Http\Url::external( preg_replace( '/\?sz=\d+$/', '', $user['image']['url'] ) );
}
}
catch ( \IPS\Http\Request\Exception $e )
{
\IPS\Log::log( $e, 'google' );
}
return NULL;
}
/**
@@ -111,11 +122,19 @@ class _Google extends ProfileSyncAbstract
*/
public function cover()
{
$user = $this->user();
if ( isset( $user['cover'] ) )
try
{
return \IPS\Http\Url::external( $user['cover']['coverPhoto']['url'] )->import( 'core_Profile' );
$user = $this->user();
if ( isset( $user['cover'] ) )
{
return \IPS\Http\Url::external( $user['cover']['coverPhoto']['url'] )->import( 'core_Profile' );
}
}
catch ( \IPS\Http\Request\Exception $e )
{
\IPS\Log::log( $e, 'google' );
}
return NULL;
}
@@ -127,7 +146,11 @@ class _Google extends ProfileSyncAbstract
public function name()
{
$user = $this->user();
return $user['displayName'];
if ( isset( $user['displayName'] ) )
{
return $user['displayName'];
}
}
/**
@@ -137,20 +160,28 @@ class _Google extends ProfileSyncAbstract
*/
public function status()
{
$this->user();
$statuses = $this->get( "people/me/activities/public" );
if ( isset( $statuses['items'] ) )
try
{
foreach ( $statuses['items'] as $status )
$this->user();
$statuses = $this->get( "people/me/activities/public" );
if ( isset( $statuses['items'] ) )
{
if ( $status['object']['content'] )
foreach ( $statuses['items'] as $status )
{
$statusObj = \IPS\core\Statuses\Status::createItem( $this->member, $this->member->ip_address, new \IPS\DateTime( $status['published'] ) );
$statusObj->content = nl2br( \IPS\Text\Parser::utf8mb4SafeDecode( $status['object']['content'] ), FALSE );
return $statusObj;
if ( $status['object']['content'] )
{
$statusObj = \IPS\core\Statuses\Status::createItem( $this->member, $this->member->ip_address, new \IPS\DateTime( $status['published'] ) );
$statusObj->content = $this->_parseStatusText( nl2br( $status['object']['content'], FALSE ) );
return $statusObj;
}
}
}
}
catch ( \IPS\Http\Request\Exception $e )
{
\IPS\Log::log( $e, 'google' );
}
return NULL;
}