|
|
@@ -34,7 +34,7 @@ class BxDolConModule extends BxBaseModConnectModule
|
|
|
}
|
|
|
else {
|
|
|
|
|
|
- // define redirect URL to the remote site
|
|
|
+ // define redirect URL to the remote site
|
|
|
$sUrl = bx_append_url_params($this->_oConfig->sApiUrl . 'auth', array(
|
|
|
'response_type' => 'code',
|
|
|
'client_id' => $this->_oConfig->sApiID,
|
|
|
@@ -51,44 +51,9 @@ class BxDolConModule extends BxBaseModConnectModule
|
|
|
return $this->_actionHandle();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Make friends
|
|
|
- *
|
|
|
- * @param $iProfileId integer
|
|
|
- * @return void
|
|
|
- */
|
|
|
protected function _makeFriends($iProfileId)
|
|
|
{
|
|
|
- if (!$this->_oConfig->bAutoFriends)
|
|
|
- return;
|
|
|
-
|
|
|
- $oConnFrinds = BxDolConnection::getObjectInstance('sys_profiles_friends');
|
|
|
- if (!$oConnFrinds)
|
|
|
- return;
|
|
|
-
|
|
|
- // request info about profile
|
|
|
- if (!($iRemoteProfileId = $this->_oDb->getRemoteProfileId($iProfileId)))
|
|
|
- return;
|
|
|
- $oSession = BxDolSession::getInstance();
|
|
|
- if (!($sAccessToken = $oSession->getValue($this->getName() . '_access_token')))
|
|
|
- return;
|
|
|
- $s = bx_file_get_contents($this->_oConfig->sApiUrl . 'api/friends?id=' . $iRemoteProfileId, array(), 'get', array(
|
|
|
- 'Authorization: Bearer ' . $sAccessToken,
|
|
|
- ));
|
|
|
-
|
|
|
- // handle error
|
|
|
- if (!$s || NULL === ($aResponse = json_decode($s, true)) || !$aResponse || isset($aResponse['error']) || !isset($aResponse['friends'])) {
|
|
|
- $sErrorDescription = isset($aResponse['error_description']) ? $aResponse['error_description'] : _t('_error occured');
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // add friends & followers
|
|
|
- foreach ($aResponse['friends'] as $iRemoteProfileId => $a) {
|
|
|
- if (!($iLocalProfileId = $this->_oDb->getProfileId($iRemoteProfileId)))
|
|
|
- continue;
|
|
|
- $oConnFrinds->actionAdd($iProfileId, $iLocalProfileId);
|
|
|
- $oConnFrinds->actionAdd($iLocalProfileId, $iProfileId);
|
|
|
- }
|
|
|
+ return parent::__makeFriends($iProfileId);
|
|
|
}
|
|
|
|
|
|
/**
|