_redirect ($this -> _oConfig -> sDefaultRedirectUrl); if (!$this->_oConfig->sApiID || !$this->_oConfig->sApiSecret || !$this->_oConfig->sApiUrl) { require_once(BX_DIRECTORY_PATH_INC . 'design.inc.php'); bx_import('BxDolLanguages'); $sCode = MsgBox( _t('_bx_dolcon_profile_error_api_keys') ); $this->_oTemplate->getPage(_t('_bx_dolcon'), $sCode); } else { // 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, 'redirect_uri' => $this->_oConfig->sPageHandle, 'scope' => $this->_oConfig->sScope, 'state' => $this->_genToken(), )); $this->_redirect($sUrl); } } function actionHandle() { return $this->_actionHandle(); } protected function _makeFriends($iProfileId) { return parent::__makeFriends($iProfileId); } /** * @param $aProfileInfo - remote profile info * @param $sAlternativeName - suffix to add to NickName to make it unique * @return profile array info, ready for the local database */ protected function _convertRemoteFields($aProfileInfo, $sAlternativeName = '') { $aProfileFields = $aProfileInfo; $sFullname = $aProfileInfo['NickName']; if (!empty($aProfileInfo['FullName'])) $sFullname = $aProfileInfo['FullName']; if (!empty($aProfileInfo['FirstName'])) $sFullname = $aProfileInfo['FirstName'] . (!empty($aProfileInfo['LastName']) ? ' ' . $aProfileInfo['LastName'] : ''); $aProfileFields['name'] = $aProfileInfo['NickName']; $aProfileFields['gender'] = isset($aProfileInfo['Sex']) && ('male' == $aProfileInfo['Sex'] || 'female' == $aProfileInfo['Sex']) ? ('male' == $aProfileInfo['Sex'] ? 1 : 2) : ''; $aProfileFields['birthday'] = isset($aProfileInfo['DateOfBirth']) ? $aProfileInfo['DateOfBirth'] : ''; $aProfileFields['fullname'] = $sFullname; $aProfileFields['picture'] = $aProfileInfo['picture']; $aProfileFields['description'] = $aProfileInfo['DescriptionMe']; $aProfileFields['allow_view_to'] = getParam('bx_dolcon_privacy'); return $aProfileFields; } } /** @} */