1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-11 09:04:38 +02:00

HybridAuth downgraded to v2.7.0 until they get their bugs sorted out.

This commit is contained in:
Cameron
2016-12-08 08:10:46 -08:00
parent 41da542395
commit 24d5e6a6c7
8 changed files with 386 additions and 288 deletions

View File

@@ -15,7 +15,7 @@
*/ */
class Hybrid_Auth { class Hybrid_Auth {
public static $version = "2.8.1"; public static $version = "2.7.0";
/** /**
* Configuration array * Configuration array
@@ -352,9 +352,6 @@ class Hybrid_Auth {
* @param string $mode PHP|JS * @param string $mode PHP|JS
*/ */
public static function redirect($url, $mode = "PHP") { public static function redirect($url, $mode = "PHP") {
if(!$mode){
$mode = 'PHP';
}
Hybrid_Logger::info("Enter Hybrid_Auth::redirect( $url, $mode )"); Hybrid_Logger::info("Enter Hybrid_Auth::redirect( $url, $mode )");
// Ensure session is saved before sending response, see https://github.com/symfony/symfony/pull/12341 // Ensure session is saved before sending response, see https://github.com/symfony/symfony/pull/12341

View File

@@ -153,26 +153,11 @@ class Hybrid_Provider_Adapter {
# for default HybridAuth endpoint url hauth_login_start_url # for default HybridAuth endpoint url hauth_login_start_url
# auth.start required the IDp ID # auth.start required the IDp ID
# auth.time optional login request timestamp # auth.time optional login request timestamp
if (!isset($this->params["login_start"]) ) {
$this->params["login_start"] = $HYBRID_AUTH_URL_BASE . ( strpos($HYBRID_AUTH_URL_BASE, '?') ? '&' : '?' ) . "hauth.start={$this->id}&hauth.time={$this->params["hauth_time"]}"; $this->params["login_start"] = $HYBRID_AUTH_URL_BASE . ( strpos($HYBRID_AUTH_URL_BASE, '?') ? '&' : '?' ) . "hauth.start={$this->id}&hauth.time={$this->params["hauth_time"]}";
}
# for default HybridAuth endpoint url hauth_login_done_url # for default HybridAuth endpoint url hauth_login_done_url
# auth.done required the IDp ID # auth.done required the IDp ID
if (!isset($this->params["login_done"]) ) {
$this->params["login_done"] = $HYBRID_AUTH_URL_BASE . ( strpos($HYBRID_AUTH_URL_BASE, '?') ? '&' : '?' ) . "hauth.done={$this->id}"; $this->params["login_done"] = $HYBRID_AUTH_URL_BASE . ( strpos($HYBRID_AUTH_URL_BASE, '?') ? '&' : '?' ) . "hauth.done={$this->id}";
}
# workaround to solve windows live authentication since microsoft disallowed redirect urls to contain any parameters
# http://mywebsite.com/path_to_hybridauth/?hauth.done=Live will not work
if ($this->id=="Live") {
$this->params["login_done"] = $HYBRID_AUTH_URL_BASE."live.php";
}
# Workaround to fix broken callback urls for the Facebook OAuth client
if ($this->adapter->useSafeUrls) {
$this->params['login_done'] = str_replace('hauth.done', 'hauth_done', $this->params['login_done']);
}
if (isset($this->params["hauth_return_to"])) { if (isset($this->params["hauth_return_to"])) {
Hybrid_Auth::storage()->set("hauth_session.{$this->id}.hauth_return_to", $this->params["hauth_return_to"]); Hybrid_Auth::storage()->set("hauth_session.{$this->id}.hauth_return_to", $this->params["hauth_return_to"]);
@@ -239,7 +224,14 @@ class Hybrid_Provider_Adapter {
throw new Exception("Call to undefined function Hybrid_Providers_{$this->id}::$name()."); throw new Exception("Call to undefined function Hybrid_Providers_{$this->id}::$name().");
} }
return call_user_func_array(array($this->adapter, $name), $arguments); $counter = count($arguments);
if ($counter == 1) {
return $this->adapter->$name($arguments[0]);
} elseif ($counter == 2) {
return $this->adapter->$name($arguments[0], $arguments[1]);
} else {
return $this->adapter->$name();
}
} }
/** /**

View File

@@ -64,9 +64,6 @@ abstract class Hybrid_Provider_Model {
*/ */
public $compressed = false; public $compressed = false;
/** @var bool $useSafeUrls Enable this to replace '.' with '_' characters in the callback urls */
public $useSafeUrls = false;
/** /**
* Common providers adapter constructor * Common providers adapter constructor
* *

View File

@@ -1,8 +1,5 @@
<?php <?php
use Facebook\Exceptions\FacebookSDKException;
use Facebook\Facebook as FacebookSDK;
/* ! /* !
* HybridAuth * HybridAuth
* http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth * http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth
@@ -11,29 +8,25 @@ use Facebook\Facebook as FacebookSDK;
/** /**
* Hybrid_Providers_Facebook provider adapter based on OAuth2 protocol * Hybrid_Providers_Facebook provider adapter based on OAuth2 protocol
*
* Hybrid_Providers_Facebook use the Facebook PHP SDK created by Facebook * Hybrid_Providers_Facebook use the Facebook PHP SDK created by Facebook
*
* http://hybridauth.sourceforge.net/userguide/IDProvider_info_Facebook.html * http://hybridauth.sourceforge.net/userguide/IDProvider_info_Facebook.html
*/ */
class Hybrid_Providers_Facebook extends Hybrid_Provider_Model { class Hybrid_Providers_Facebook extends Hybrid_Provider_Model {
/** /**
* Default permissions, and a lot of them. You can change them from the configuration by setting the scope to what you want/need. * default permissions, and a lot of them. You can change them from the configuration by setting the scope to what you want/need
* For a complete list see: https://developers.facebook.com/docs/facebook-login/permissions * {@inheritdoc}
*
* @link https://developers.facebook.com/docs/facebook-login/permissions
* @var array $scope
*/ */
public $scope = ['email', 'user_about_me', 'user_birthday', 'user_hometown', 'user_location', 'user_website', 'publish_actions', 'read_custom_friendlists']; public $scope = "email, user_about_me, user_birthday, user_hometown, user_location, user_website, publish_actions, read_custom_friendlists";
/** /**
* Provider API client * Provider API client
* * @var Facebook
* @var \Facebook\Facebook
*/ */
public $api; public $api;
public $useSafeUrls = true;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@@ -42,37 +35,66 @@ class Hybrid_Providers_Facebook extends Hybrid_Provider_Model {
throw new Exception("Your application id and secret are required in order to connect to {$this->providerId}.", 4); throw new Exception("Your application id and secret are required in order to connect to {$this->providerId}.", 4);
} }
if (isset($this->config['scope'])) { if (!class_exists('FacebookApiException', false)) {
$scope = $this->config['scope']; require_once Hybrid_Auth::$config["path_libraries"] . "Facebook/base_facebook.php";
if (is_string($scope)) { require_once Hybrid_Auth::$config["path_libraries"] . "Facebook/facebook.php";
$scope = explode(",", $scope);
}
$scope = array_map('trim', $scope);
$this->scope = $scope;
} }
$trustForwarded = isset($this->config['trustForwarded']) ? (bool)$this->config['trustForwarded'] : false; if (isset(Hybrid_Auth::$config["proxy"])) {
BaseFacebook::$CURL_OPTS[CURLOPT_PROXY] = Hybrid_Auth::$config["proxy"];
}
$this->api = new FacebookSDK([ $trustForwarded = isset($this->config['trustForwarded']) ? (bool) $this->config['trustForwarded'] : false;
'app_id' => $this->config["keys"]["id"], $this->api = new Facebook(array('appId' => $this->config["keys"]["id"], 'secret' => $this->config["keys"]["secret"], 'trustForwarded' => $trustForwarded));
'app_secret' => $this->config["keys"]["secret"],
'default_graph_version' => 'v2.8', if ($this->token("access_token")) {
'trustForwarded' => $trustForwarded, $this->api->setAccessToken($this->token("access_token"));
]); $this->api->setExtendedAccessToken();
$access_token = $this->api->getAccessToken();
if ($access_token) {
$this->token("access_token", $access_token);
$this->api->setAccessToken($access_token);
}
$this->api->setAccessToken($this->token("access_token"));
}
$this->api->getUser();
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function loginBegin() { function loginBegin() {
$parameters = array("scope" => $this->scope, "redirect_uri" => $this->endpoint, "display" => "page");
$optionals = array("scope", "redirect_uri", "display", "auth_type");
$this->endpoint = $this->params['login_done']; foreach ($optionals as $parameter) {
$helper = $this->api->getRedirectLoginHelper(); if (isset($this->config[$parameter]) && !empty($this->config[$parameter])) {
$parameters[$parameter] = $this->config[$parameter];
// Use re-request, because this will trigger permissions window if not all permissions are granted. //If the auth_type parameter is used, we need to generate a nonce and include it as a parameter
$url = $helper->getReRequestUrl($this->endpoint, $this->scope); if ($parameter == "auth_type") {
$nonce = md5(uniqid(mt_rand(), true));
$parameters['auth_nonce'] = $nonce;
// Redirect to Facebook Hybrid_Auth::storage()->set('fb_auth_nonce', $nonce);
}
}
}
if (isset($this->config['force']) && $this->config['force'] === true) {
$parameters['auth_type'] = 'reauthenticate';
$parameters['auth_nonce'] = md5(uniqid(mt_rand(), true));
Hybrid_Auth::storage()->set('fb_auth_nonce', $parameters['auth_nonce']);
}
// get the login url
$url = $this->api->getLoginUrl($parameters);
// redirect to facebook
Hybrid_Auth::redirect($url); Hybrid_Auth::redirect($url);
} }
@@ -80,47 +102,57 @@ class Hybrid_Providers_Facebook extends Hybrid_Provider_Model {
* {@inheritdoc} * {@inheritdoc}
*/ */
function loginFinish() { function loginFinish() {
// in case we get error_reason=user_denied&error=access_denied
$helper = $this->api->getRedirectLoginHelper(); if (isset($_REQUEST['error']) && $_REQUEST['error'] == "access_denied") {
try { throw new Exception("Authentication failed! The user denied your request.", 5);
$accessToken = $helper->getAccessToken();
} catch (Facebook\Exceptions\FacebookResponseException $e) {
throw new Hybrid_Exception('Facebook Graph returned an error: ' . $e->getMessage());
} catch (Facebook\Exceptions\FacebookSDKException $e) {
throw new Hybrid_Exception('Facebook SDK returned an error: ' . $e->getMessage());
} }
if (!isset($accessToken)) { // in case we are using iOS/Facebook reverse authentication
if ($helper->getError()) { if (isset($_REQUEST['access_token'])) {
throw new Hybrid_Exception(sprintf("Could not authorize user, reason: %s (%d)", $helper->getErrorDescription(), $helper->getErrorCode())); $this->token("access_token", $_REQUEST['access_token']);
} else { $this->api->setAccessToken($this->token("access_token"));
throw new Hybrid_Exception("Could not authorize user. Bad request"); $this->api->setExtendedAccessToken();
$access_token = $this->api->getAccessToken();
if ($access_token) {
$this->token("access_token", $access_token);
$this->api->setAccessToken($access_token);
}
$this->api->setAccessToken($this->token("access_token"));
}
// if auth_type is used, then an auth_nonce is passed back, and we need to check it.
if (isset($_REQUEST['auth_nonce'])) {
$nonce = Hybrid_Auth::storage()->get('fb_auth_nonce');
//Delete the nonce
Hybrid_Auth::storage()->delete('fb_auth_nonce');
if ($_REQUEST['auth_nonce'] != $nonce) {
throw new Exception("Authentication failed! Invalid nonce used for reauthentication.", 5);
} }
} }
try { // try to get the UID of the connected user from fb, should be > 0
// Validate token if (!$this->api->getUser()) {
$oAuth2Client = $this->api->getOAuth2Client(); throw new Exception("Authentication failed! {$this->providerId} returned an invalid user id.", 5);
$tokenMetadata = $oAuth2Client->debugToken($accessToken);
$tokenMetadata->validateAppId($this->config["keys"]["id"]);
$tokenMetadata->validateExpiration();
// Exchanges a short-lived access token for a long-lived one
if (!$accessToken->isLongLived()) {
$accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
}
} catch (FacebookSDKException $e) {
throw new Hybrid_Exception($e->getMessage(), 0, $e);
} }
// set user as logged in
$this->setUserConnected(); $this->setUserConnected();
$this->token("access_token", $accessToken->getValue());
// store facebook access token
$this->token("access_token", $this->api->getAccessToken());
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function logout() { function logout() {
$this->api->destroySession();
parent::logout(); parent::logout();
} }
@@ -128,34 +160,32 @@ class Hybrid_Providers_Facebook extends Hybrid_Provider_Model {
* {@inheritdoc} * {@inheritdoc}
*/ */
function getUserProfile() { function getUserProfile() {
// request user profile from fb api
try { try {
$fields = [ $fields = array(
'id', 'id', 'name', 'first_name', 'last_name', 'link', 'website',
'name', 'gender', 'locale', 'about', 'email', 'hometown', 'location',
'first_name',
'last_name',
'link',
'website',
'gender',
'locale',
'about',
'email',
'hometown',
'location',
'birthday' 'birthday'
]; );
$response = $this->api->get('/me?fields=' . implode(',', $fields), $this->token('access_token'));
$data = $response->getDecodedBody(); $data = $this->api->api('/me?fields=' . implode(',', $fields));
} catch (FacebookSDKException $e) { } catch (FacebookApiException $e) {
throw new Exception("User profile request failed! {$this->providerId} returned an error: {$e->getMessage()}", 6, $e); throw new Exception("User profile request failed! {$this->providerId} returned an error: {$e->getMessage()}", 6, $e);
} }
// Store the user profile. // if the provider identifier is not received, we assume the auth has failed
if (!isset($data["id"])) {
throw new Exception("User profile request failed! {$this->providerId} api returned an invalid response: " . Hybrid_Logger::dumpData( $data ), 6);
}
# store the user profile.
$this->user->profile->identifier = (array_key_exists('id', $data)) ? $data['id'] : ""; $this->user->profile->identifier = (array_key_exists('id', $data)) ? $data['id'] : "";
$this->user->profile->username = (array_key_exists('username', $data)) ? $data['username'] : "";
$this->user->profile->displayName = (array_key_exists('name', $data)) ? $data['name'] : ""; $this->user->profile->displayName = (array_key_exists('name', $data)) ? $data['name'] : "";
$this->user->profile->firstName = (array_key_exists('first_name', $data)) ? $data['first_name'] : ""; $this->user->profile->firstName = (array_key_exists('first_name', $data)) ? $data['first_name'] : "";
$this->user->profile->lastName = (array_key_exists('last_name', $data)) ? $data['last_name'] : ""; $this->user->profile->lastName = (array_key_exists('last_name', $data)) ? $data['last_name'] : "";
$this->user->profile->photoURL = !empty($this->user->profile->identifier) ? "https://graph.facebook.com/" . $this->user->profile->identifier . "/picture?width=150&height=150" : ''; $this->user->profile->photoURL = "https://graph.facebook.com/" . $this->user->profile->identifier . "/picture?width=150&height=150";
$this->user->profile->coverInfoURL = "https://graph.facebook.com/" . $this->user->profile->identifier . "?fields=cover&access_token=" . $this->api->getAccessToken();
$this->user->profile->profileURL = (array_key_exists('link', $data)) ? $data['link'] : ""; $this->user->profile->profileURL = (array_key_exists('link', $data)) ? $data['link'] : "";
$this->user->profile->webSiteURL = (array_key_exists('website', $data)) ? $data['website'] : ""; $this->user->profile->webSiteURL = (array_key_exists('website', $data)) ? $data['website'] : "";
$this->user->profile->gender = (array_key_exists('gender', $data)) ? $data['gender'] : ""; $this->user->profile->gender = (array_key_exists('gender', $data)) ? $data['gender'] : "";
@@ -174,38 +204,51 @@ class Hybrid_Providers_Facebook extends Hybrid_Provider_Model {
} }
if (array_key_exists('birthday', $data)) { if (array_key_exists('birthday', $data)) {
$birtydayPieces = explode('/', $data['birthday']); list($birthday_month, $birthday_day, $birthday_year) = explode("/", $data['birthday']);
if (count($birtydayPieces) == 1) { $this->user->profile->birthDay = (int) $birthday_day;
$this->user->profile->birthYear = (int)$birtydayPieces[0]; $this->user->profile->birthMonth = (int) $birthday_month;
} elseif (count($birtydayPieces) == 2) { $this->user->profile->birthYear = (int) $birthday_year;
$this->user->profile->birthMonth = (int)$birtydayPieces[0];
$this->user->profile->birthDay = (int)$birtydayPieces[1];
} elseif (count($birtydayPieces) == 3) {
$this->user->profile->birthMonth = (int)$birtydayPieces[0];
$this->user->profile->birthDay = (int)$birtydayPieces[1];
$this->user->profile->birthYear = (int)$birtydayPieces[2];
}
} }
return $this->user->profile; return $this->user->profile;
} }
/** /**
* Since the Graph API 2.0, the /friends endpoint only returns friend that also use your Facebook app. * Attempt to retrieve the url to the cover image given the coverInfoURL
*
* @param string $coverInfoURL coverInfoURL variable
* @return string url to the cover image OR blank string
*/
function getCoverURL($coverInfoURL) {
try {
$headers = get_headers($coverInfoURL);
if (substr($headers[0], 9, 3) != "404") {
$coverOBJ = json_decode(file_get_contents($coverInfoURL));
if (array_key_exists('cover', $coverOBJ)) {
return $coverOBJ->cover->source;
}
}
} catch (Exception $e) {
}
return "";
}
/**
* {@inheritdoc} * {@inheritdoc}
*/ */
function getUserContacts() { function getUserContacts() {
$apiCall = '?fields=link,name'; $apiCall = '?fields=link,name';
$returnedContacts = []; $returnedContacts = array();
$pagedList = true; $pagedList = false;
while ($pagedList) { do {
try { try {
$response = $this->api->get('/me/friends' . $apiCall, $this->token('access_token')); $response = $this->api->api('/me/friends' . $apiCall);
$response = $response->getDecodedBody(); } catch (FacebookApiException $e) {
} catch (FacebookSDKException $e) { throw new Exception("User contacts request failed! {$this->providerId} returned an error {$e->getMessage()}", 0, $e);
throw new Hybrid_Exception("User contacts request failed! {$this->providerId} returned an error {$e->getMessage()}", 0, $e);
} }
// Prepare the next call if paging links have been returned // Prepare the next call if paging links have been returned
@@ -219,9 +262,9 @@ class Hybrid_Providers_Facebook extends Hybrid_Provider_Model {
// Add the new page contacts // Add the new page contacts
$returnedContacts = array_merge($returnedContacts, $response['data']); $returnedContacts = array_merge($returnedContacts, $response['data']);
} } while ($pagedList == true);
$contacts = []; $contacts = array();
foreach ($returnedContacts as $item) { foreach ($returnedContacts as $item) {
@@ -238,31 +281,118 @@ class Hybrid_Providers_Facebook extends Hybrid_Provider_Model {
} }
/** /**
* Load the user latest activity, needs 'read_stream' permission * Update user status
* *
* @param string $stream Which activity to fetch: * @param mixed $status An array describing the status, or string
* @param string $pageid (optional) User page id
* @return array
* @throw Exception
*/
function setUserStatus($status, $pageid = null) {
if (!is_array($status)) {
$status = array('message' => $status);
}
if (is_null($pageid)) {
$pageid = 'me';
// if post on page, get access_token page
} else {
$access_token = null;
foreach ($this->getUserPages(true) as $p) {
if (isset($p['id']) && intval($p['id']) == intval($pageid)) {
$access_token = $p['access_token'];
break;
}
}
if (is_null($access_token)) {
throw new Exception("Update user page failed, page not found or not writable!");
}
$status['access_token'] = $access_token;
}
try {
$response = $this->api->api('/' . $pageid . '/feed', 'post', $status);
} catch (FacebookApiException $e) {
throw new Exception("Update user status failed! {$this->providerId} returned an error {$e->getMessage()}", 0, $e);
}
return $response;
}
/**
* {@inheridoc}
*/
function getUserStatus($postid) {
try {
$postinfo = $this->api->api("/" . $postid);
} catch (FacebookApiException $e) {
throw new Exception("Cannot retrieve user status! {$this->providerId} returned an error: {$e->getMessage()}", 0, $e);
}
return $postinfo;
}
/**
* {@inheridoc}
*/
function getUserPages($writableonly = false) {
if (( isset($this->config['scope']) && strpos($this->config['scope'], 'manage_pages') === false ) || (!isset($this->config['scope']) && strpos($this->scope, 'manage_pages') === false ))
throw new Exception("User status requires manage_page permission!");
try {
$pages = $this->api->api("/me/accounts", 'get');
} catch (FacebookApiException $e) {
throw new Exception("Cannot retrieve user pages! {$this->providerId} returned an error: {$e->getMessage()}", 0, $e);
}
if (!isset($pages['data'])) {
return array();
}
if (!$writableonly) {
return $pages['data'];
}
$wrpages = array();
foreach ($pages['data'] as $p) {
if (isset($p['perms']) && in_array('CREATE_CONTENT', $p['perms'])) {
$wrpages[] = $p;
}
}
return $wrpages;
}
/**
* load the user latest activity
* - timeline : all the stream * - timeline : all the stream
* - me : the user activity only * - me : the user activity only
* {@inheritdoc} * {@inheritdoc}
*/ */
function getUserActivity($stream = 'timeline') { function getUserActivity($stream) {
try { try {
if ($stream == "me") { if ($stream == "me") {
$response = $this->api->get('/me/feed', $this->token('access_token')); $response = $this->api->api('/me/feed');
} else { } else {
$response = $this->api->get('/me/home', $this->token('access_token')); $response = $this->api->api('/me/home');
} }
} catch (FacebookSDKException $e) { } catch (FacebookApiException $e) {
throw new Hybrid_Exception("User activity stream request failed! {$this->providerId} returned an error: {$e->getMessage()}", 0, $e); throw new Exception("User activity stream request failed! {$this->providerId} returned an error: {$e->getMessage()}", 0, $e);
} }
if (!$response || !count($response['data'])) { if (!$response || !count($response['data'])) {
return []; return array();
} }
$activities = []; $activities = array();
foreach ($response['data'] as $item) { foreach ($response['data'] as $item) {
if ($stream == "me" && $item["from"]["id"] != $this->api->getUser()) {
continue;
}
$ua = new Hybrid_User_Activity(); $ua = new Hybrid_User_Activity();

View File

@@ -158,16 +158,16 @@ class Hybrid_Providers_Google extends Hybrid_Provider_Model_OAuth2 {
} else { } else {
$this->user->profile->webSiteURL = ''; $this->user->profile->webSiteURL = '';
} }
// google API returns age ranges min and/or max as of https://developers.google.com/+/web/api/rest/latest/people#resource // google API returns age ranges or min. age only (with plus.login scope)
if (property_exists($response, 'ageRange')) { if (property_exists($response, 'ageRange')) {
if (property_exists($response->ageRange, 'min') && property_exists($response->ageRange, 'max')) { if (property_exists($response->ageRange, 'min') && property_exists($response->ageRange, 'max')) {
$this->user->profile->age = $response->ageRange->min . ' - ' . $response->ageRange->max; $this->user->profile->age = $response->ageRange->min . ' - ' . $response->ageRange->max;
} else { } else {
if (property_exists($response->ageRange, 'min')) { if (property_exists($response->ageRange, 'min')) {
$this->user->profile->age = '>= ' . $response->ageRange->min; $this->user->profile->age = '> ' . $response->ageRange->min;
} else { } else {
if (property_exists($response->ageRange, 'max')) { if (property_exists($response->ageRange, 'max')) {
$this->user->profile->age = '<= ' . $response->ageRange->max; $this->user->profile->age = '< ' . $response->ageRange->max;
} else { } else {
$this->user->profile->age = ''; $this->user->profile->age = '';
} }

View File

@@ -30,7 +30,7 @@ class Hybrid_Providers_LinkedIn extends Hybrid_Provider_Model {
} }
if (empty($this->config['fields'])) { if (empty($this->config['fields'])) {
$this->config['fields'] = array( $this->config['fields'] = [
'id', 'id',
'first-name', 'first-name',
'last-name', 'last-name',
@@ -40,8 +40,7 @@ class Hybrid_Providers_LinkedIn extends Hybrid_Provider_Model {
'date-of-birth', 'date-of-birth',
'phone-numbers', 'phone-numbers',
'summary', 'summary',
'positions' ];
);
} }
if (!class_exists('OAuthConsumer', false)) { if (!class_exists('OAuthConsumer', false)) {
@@ -133,11 +132,6 @@ class Hybrid_Providers_LinkedIn extends Hybrid_Provider_Model {
$this->user->profile->email = (string) $data->{'email-address'}; $this->user->profile->email = (string) $data->{'email-address'};
$this->user->profile->emailVerified = (string) $data->{'email-address'}; $this->user->profile->emailVerified = (string) $data->{'email-address'};
if ($data->{'positions'}) {
$this->user->profile->job_title = (string) $data->{'positions'}->{'position'}->{'title'};
$this->user->profile->organization_name = (string) $data->{'positions'}->{'position'}->{'company'}->{'name'};
}
if (isset($data->{'picture-url'})) { if (isset($data->{'picture-url'})) {
$this->user->profile->photoURL = (string) $data->{'picture-url'}; $this->user->profile->photoURL = (string) $data->{'picture-url'};

View File

@@ -131,7 +131,6 @@ class Hybrid_Providers_Twitter extends Hybrid_Provider_Model_OAuth1 {
$this->user->profile->webSiteURL = (property_exists($response, 'url')) ? $response->url : ""; $this->user->profile->webSiteURL = (property_exists($response, 'url')) ? $response->url : "";
$this->user->profile->region = (property_exists($response, 'location')) ? $response->location : ""; $this->user->profile->region = (property_exists($response, 'location')) ? $response->location : "";
if($includeEmail) $this->user->profile->email = (property_exists($response, 'email')) ? $response->email : ""; if($includeEmail) $this->user->profile->email = (property_exists($response, 'email')) ? $response->email : "";
if($includeEmail) $this->user->profile->emailVerified = (property_exists($response, 'email')) ? $response->email : "";
return $this->user->profile; return $this->user->profile;
} }

View File

@@ -149,15 +149,4 @@ class Hybrid_User_Profile {
*/ */
public $zip = null; public $zip = null;
/**
* Job title
* @var string
*/
public $job_title = null;
/**
* Organization name
* @var string
*/
public $organization_name = null;
} }