Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Facebook 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
|
||||
*/
|
||||
@@ -83,6 +83,8 @@ class _Facebook extends ProfileSyncAbstract
|
||||
}
|
||||
catch ( \IPS\Http\Request\Exception $e )
|
||||
{
|
||||
\IPS\Log::log( $e, 'facebook' );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -94,12 +96,20 @@ class _Facebook extends ProfileSyncAbstract
|
||||
*/
|
||||
public function cover()
|
||||
{
|
||||
$response = \IPS\Http\Url::external( "https://graph.facebook.com/{$this->member->fb_uid}?access_token={$this->member->fb_token}&fields=cover" )->request()->get()->decodeJson();
|
||||
if ( isset( $response['cover'] ) )
|
||||
try
|
||||
{
|
||||
return \IPS\Http\Url::external( $response['cover']['source'] )->import( 'core_Profile' );
|
||||
$response = \IPS\Http\Url::external( "https://graph.facebook.com/{$this->member->fb_uid}" )->setQueryString( array( 'access_token' => $this->member->fb_token, 'fields' => 'cover' ) )->request()->get()->decodeJson();
|
||||
if ( isset( $response['cover'] ) )
|
||||
{
|
||||
return \IPS\Http\Url::external( $response['cover']['source'] )->import( 'core_Profile' );
|
||||
}
|
||||
}
|
||||
catch ( \IPS\Http\Request\Exception $e )
|
||||
{
|
||||
\IPS\Log::log( $e, 'facebook' );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +121,7 @@ class _Facebook extends ProfileSyncAbstract
|
||||
{
|
||||
try
|
||||
{
|
||||
$response = \IPS\Http\Url::external( "https://graph.facebook.com/{$this->member->fb_uid}?access_token={$this->member->fb_token}" )->request()->get()->decodeJson();
|
||||
$response = \IPS\Http\Url::external( "https://graph.facebook.com/{$this->member->fb_uid}" )->setQueryString( 'access_token', $this->member->fb_token )->request()->get()->decodeJson();
|
||||
if ( isset( $response['name'] ) )
|
||||
{
|
||||
return $response['name'];
|
||||
@@ -119,10 +129,30 @@ class _Facebook extends ProfileSyncAbstract
|
||||
}
|
||||
catch ( \IPS\Http\Request\Exception $e )
|
||||
{
|
||||
\IPS\Log::log( $e, 'facebook' );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Member can import statuses?
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function canImportStatus( \IPS\Member $member )
|
||||
{
|
||||
if ( parent::canImportStatus( $member ) )
|
||||
{
|
||||
$loginHandlers = \IPS\Login::handlers( TRUE );
|
||||
if ( isset( $loginHandlers['Facebook'] ) AND isset( $loginHandlers['Facebook']->settings['allow_status_import'] ) )
|
||||
{
|
||||
return $loginHandlers['Facebook']->settings['allow_status_import'];
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status
|
||||
*
|
||||
@@ -132,34 +162,27 @@ class _Facebook extends ProfileSyncAbstract
|
||||
{
|
||||
try
|
||||
{
|
||||
$response = \IPS\Http\Url::external( "https://graph.facebook.com/{$this->member->fb_uid}/statuses?access_token={$this->member->fb_token}" )->request()->get()->decodeJson();
|
||||
$response = \IPS\Http\Url::external( "https://graph.facebook.com/{$this->member->fb_uid}/feed" )->setQueryString( 'access_token', $this->member->fb_token )->request()->get()->decodeJson();
|
||||
|
||||
if ( !empty( $response['data'] ) )
|
||||
{
|
||||
$statusData = array_shift( $response['data'] );
|
||||
|
||||
if( isset( $statusData['message'] ) )
|
||||
{
|
||||
$status = \IPS\core\Statuses\Status::createItem( $this->member, $this->member->ip_address, new \IPS\DateTime( $statusData['updated_time'] ) );
|
||||
$status->content = nl2br( \IPS\Text\Parser::utf8mb4SafeDecode( $statusData['message'] ), FALSE );
|
||||
$status = \IPS\core\Statuses\Status::createItem( $this->member, $this->member->ip_address, new \IPS\DateTime( $statusData['created_time'] ) );
|
||||
$status->content = $this->_parseStatusText( nl2br( $statusData['message'], FALSE ) );
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( \IPS\Http\Request\Exception $e ) { }
|
||||
catch ( \IPS\Http\Request\Exception $e )
|
||||
{
|
||||
\IPS\Log::log( $e, 'facebook' );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export Status
|
||||
*
|
||||
* @param \IPS\core\Statuses\Status $status The status
|
||||
* @return void
|
||||
*/
|
||||
public function exportStatus( \IPS\core\Statuses\Status $status )
|
||||
{
|
||||
\IPS\Http\Url::external( "https://graph.facebook.com/{$this->member->fb_uid}/feed" )->request()->post( array( 'access_token' => $this->member->fb_token, 'message' => strip_tags( $status->content ) ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Disassociate
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user