Permalink
Browse files

quite a few changes to move to 2.0.9

  • Loading branch information...
1 parent b52838a commit a9d4f53ad2af54accae5c2699b640faab129ff8b hybridauth committed Nov 23, 2011
Showing with 2,909 additions and 3,741 deletions.
  1. +0 −7 README.md
  2. +23 −102 additional-providers/hybridauth-Identica/Providers/Identica.php
  3. +0 −9 additional-providers/hybridauth-Identica/thirdparty/TwitterCompatible/Identica.php
  4. +16 −20 additional-providers/hybridauth-github/Providers/GitHub.php
  5. +3 −7 additional-providers/hybridauth-gowalla/Providers/Gowalla.php
  6. +3 −7 additional-providers/hybridauth-lastfm/Providers/LastFM.php
  7. +4 −10 additional-providers/hybridauth-paypal/Providers/PayPal.php
  8. +39 −94 additional-providers/hybridauth-tumblr/Providers/Tumblr.php
  9. +0 −13 additional-providers/hybridauth-tumblr/thirdparty/TwitterCompatible/Tumblr.php
  10. +3 −7 additional-providers/hybridauth-viadeo/Providers/Viadeo.php
  11. +3 −7 additional-providers/hybridauth-vimeo/Providers/Vimeo.php
  12. BIN examples/embed.gif
  13. +75 −19 examples/facebook_integration/index.php
  14. BIN examples/fb.gif
  15. BIN examples/helloworld.gif
  16. +22 −18 examples/index.html
  17. BIN examples/singup.gif
  18. +1 −1 examples/social_hub/includes/sidebar.php
  19. +1 −2 examples/social_hub/login.php
  20. +1 −11 examples/social_hub/logout_all.php
  21. +1 −1 examples/social_hub/timeline.php
  22. BIN examples/widget.gif
  23. +24 −28 hybridauth/Hybrid/Auth.php
  24. +15 −34 hybridauth/Hybrid/Error.php
  25. +28 −59 hybridauth/Hybrid/Logger.php
  26. +36 −40 hybridauth/Hybrid/Provider_Adapter.php
  27. +21 −25 hybridauth/Hybrid/Provider_Model.php
  28. +8 −12 hybridauth/Hybrid/{Protocols/OAuth1.php → Provider_Model_OAuth1.php}
  29. +4 −8 hybridauth/Hybrid/{Protocols/OAuth2.php → Provider_Model_OAuth2.php}
  30. +7 −11 hybridauth/Hybrid/{Protocols/OpenID.php → Provider_Model_OpenID.php}
  31. +4 −8 hybridauth/Hybrid/Providers/AOL.php
  32. +28 −32 hybridauth/Hybrid/Providers/Facebook.php
  33. +16 −20 hybridauth/Hybrid/Providers/Foursquare.php
  34. +21 −25 hybridauth/Hybrid/Providers/Google.php
  35. +5 −9 hybridauth/Hybrid/Providers/GoogleOpenID.php
  36. +29 −33 hybridauth/Hybrid/Providers/LinkedIn.php
  37. +15 −19 hybridauth/Hybrid/Providers/Live.php
  38. +27 −28 hybridauth/Hybrid/Providers/MySpace.php
  39. +5 −9 hybridauth/Hybrid/Providers/OpenID.php
  40. +27 −37 hybridauth/Hybrid/Providers/Twitter.php
  41. +5 −9 hybridauth/Hybrid/Providers/Yahoo.php
  42. +6 −26 hybridauth/Hybrid/Storage.php
  43. +12 −16 hybridauth/Hybrid/User.php
  44. +0 −51 hybridauth/Hybrid/User/Contact.php
  45. +11 −15 hybridauth/Hybrid/{User/Activity.php → User_Activity.php}
  46. +47 −0 hybridauth/Hybrid/User_Contact.php
  47. +45 −49 hybridauth/Hybrid/{User/Profile.php → User_Profile.php}
  48. +4 −8 hybridauth/Hybrid/resources/config.php.tpl
  49. +2,089 −2,632 hybridauth/Hybrid/thirdparty/LinkedIn/LinkedIn.php
  50. +7 −1 hybridauth/Hybrid/thirdparty/OAuth/OAuth1Client.php
  51. +6 −0 hybridauth/Hybrid/thirdparty/OAuth/OAuth2Client.php
  52. +10 −14 hybridauth/config.php
  53. +144 −139 hybridauth/index.php
  54. +8 −9 hybridauth/install.php
View
@@ -52,10 +52,3 @@ at [http://hybridauth.sourceforge.net/userguide.html](http://hybridauth.sourcefo
**To get help and support**, join us and participate in the hybriauth discussion group
at [http://hybridauth.sourceforge.net/support.html](http://hybridauth.sourceforge.net/support.html)
-
-## Quick Start
-
-- CHMOD 777 config.php
-- Run install.php.
-- Once configured, delete install.php.
-That's it!
@@ -1,119 +1,40 @@
<?php
-/**
+/*!
* HybridAuth
-*
-* A Social-Sign-On PHP Library for authentication through identity providers like Facebook,
-* Twitter, Google, Yahoo, LinkedIn, MySpace, Windows Live, Tumblr, Friendster, OpenID, PayPal,
-* Vimeo, Foursquare, AOL, Gowalla, and others.
-*
-* Copyright (c) 2009-2011 (http://hybridauth.sourceforge.net)
+* http://hybridauth.sourceforge.net | https://github.com/hybridauth/hybridauth
+* (c) 2009-2011 HybridAuth authors | hybridauth.sourceforge.net/licenses.html
*/
/**
-* Hybrid_Providers_Identica class
+* Hybrid_Providers_Identica
*/
-class Hybrid_Providers_Identica extends Hybrid_Provider_Model
+class Hybrid_Providers_Identica extends Hybrid_Provider_Model_OAuth1
{
- /**
+ /**
* IDp wrappers initializer
*/
function initialize()
{
- if ( ! $this->config["keys"]["key"] || ! $this->config["keys"]["secret"] )
- {
- throw new Exception( "Your application key and secret are required in order to connect to {$this->providerId}.", 4 );
- }
-
- require_once Hybrid_Auth::$config["path_libraries"] . "OAuth/OAuth.php";
- require_once Hybrid_Auth::$config["path_libraries"] . "TwitterCompatible/TwitterCompatibleClient.php";
- require_once Hybrid_Auth::$config["path_libraries"] . "TwitterCompatible/Identica.php";
-
- if( $this->token( "access_token" ) && $this->token( "access_token_secret" ) )
- {
- $this->api = new Identica_Client
- (
- $this->config["keys"]["key"], $this->config["keys"]["secret"],
- $this->token( "access_token" ), $this->token( "access_token_secret" )
- );
- }
- }
-
- /**
- * begin login step
- */
- function loginBegin()
- {
- $this->api = new Identica_Client( $this->config["keys"]["key"], $this->config["keys"]["secret"] );
-
- $tokz = $this->api->getRequestToken( $this->endpoint );
-
- // check the last HTTP status code returned
- if ( $this->api->http_code != 200 )
- {
- throw new Exception( "Authentification failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus(), 5 );
- }
-
- if ( ! isset( $tokz["oauth_token"] ) )
- {
- throw new Exception( "Authentification failed! {$this->providerId} returned an invalid oauth token.", 5 );
- }
-
- $this->token( "request_token" , $tokz["oauth_token"] );
- $this->token( "request_token_secret", $tokz["oauth_token_secret"] );
-
- # redirect user to twitter
- Hybrid_Auth::redirect( $this->api->getAuthorizeURL( $tokz ) );
- }
-
- /**
- * finish login step
- */
- function loginFinish()
- {
- $oauth_token = @ $_REQUEST['oauth_token'];
- $oauth_verifier = @ $_REQUEST['oauth_verifier'];
-
- if ( ! $oauth_token || ! $oauth_verifier )
- {
- throw new Exception( "Authentification failed! {$this->providerId} returned an invalid oauth verifier.", 5 );
- }
-
- $this->api = new Identica_Client(
- $this->config["keys"]["key"], $this->config["keys"]["secret"],
- $this->token( "request_token" ), $this->token( "request_token_secret" )
- );
-
- $tokz = $this->api->getAccessToken( $oauth_verifier );
-
- // check the last HTTP status code returned
- if ( $this->api->http_code != 200 )
- {
- throw new Exception( "Authentification failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus(), 5 );
- }
-
- if ( ! isset( $tokz["oauth_token"] ) )
- {
- throw new Exception( "Authentification failed! {$this->providerId} returned an invalid access token.", 5 );
- }
-
- $this->token( "access_token" , $tokz['oauth_token'] );
- $this->token( "access_token_secret" , $tokz['oauth_token_secret'] );
+ parent::initialize();
- // set user as logged in
- $this->setUserConnected();
+ // provider api end-points
+ $this->api->api_base_url = "https://identi.ca/api/";
+ $this->api->authorize_url = "https://identi.ca/api/oauth/authorize";
+ $this->api->request_token_url = "https://identi.ca/api/oauth/request_token";
+ $this->api->access_token_url = "https://identi.ca/api/oauth/access_token";
}
/**
* load the user profile from the IDp api client
*/
function getUserProfile()
{
- $response = $this->api->get( 'account/verify_credentials' );
+ $response = $this->api->get( 'account/verify_credentials.json' );
// check the last HTTP status code returned
if ( $this->api->http_code != 200 )
{
- throw new Exception( "User profile request failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus(), 6 );
+ throw new Exception( "User profile request failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus( $this->api->http_code ), 6 );
}
if ( ! is_object( $response ) )
@@ -140,12 +61,12 @@ function getUserProfile()
function getUserContacts( $arguments = ARRAY() )
{
$parameters = array( 'cursor' => '-1' );
- $response = $this->api->get( 'friends/ids', $parameters );
+ $response = $this->api->get( 'friends/ids.json', $parameters );
// check the last HTTP status code returned
if ( $this->api->http_code != 200 )
{
- throw new Exception( "User contacts request failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus() );
+ throw new Exception( "User contacts request failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus( $this->api->http_code ) );
}
if( ! $response ){
@@ -157,12 +78,12 @@ function getUserContacts( $arguments = ARRAY() )
// donno if users/lookup is supported by identica.. to do
foreach( $response as $item ){
$parameters = array( 'user_id' => $item );
- $responseud = $this->api->get( 'users/show', $parameters );
+ $responseud = $this->api->get( 'users/show.json', $parameters );
// check the last HTTP status code returned
if ( $this->api->http_code != 200 )
{
- throw new Exception( "User contacts request failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus() );
+ throw new Exception( "User contacts request failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus( $this->api->http_code ) );
}
if( $responseud ){
@@ -189,12 +110,12 @@ function setUserStatus( $arguments = ARRAY() )
$status = $arguments[0]; // status content
$parameters = array( 'status' => $status );
- $response = $this->api->post( 'statuses/update', $parameters );
+ $response = $this->api->post( 'statuses/update.json', $parameters );
// check the last HTTP status code returned
if ( $this->api->http_code != 200 )
{
- throw new Exception( "Update user status update failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus() );
+ throw new Exception( "Update user status update failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus( $this->api->http_code ) );
}
}
@@ -206,16 +127,16 @@ function setUserStatus( $arguments = ARRAY() )
function getUserActivity( $arguments = ARRAY() )
{
if( isset( $arguments[0] ) && $arguments[0] == "me" ){
- $response = $this->api->get( 'statuses/user_timeline' );
+ $response = $this->api->get( 'statuses/user_timeline.json' );
}
else{
- $response = $this->api->get( 'statuses/home_timeline' );
+ $response = $this->api->get( 'statuses/home_timeline.json' );
}
// check the last HTTP status code returned
if ( $this->api->http_code != 200 )
{
- throw new Exception( "User activity stream request failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus() );
+ throw new Exception( "User activity stream request failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus( $this->api->http_code ) );
}
if( ! $response ){
@@ -1,9 +0,0 @@
-<?php
- class Identica_Client extends Twitter_Compatible_Client
- {
- /* Set up the API root URL. */
- public $host = "https://identi.ca/api/";
-
- /* Set API URLS */
- function authenticateURL() { return 'https://identi.ca/api/oauth/authorize'; }
- }
@@ -1,37 +1,33 @@
<?php
-/**
+/*!
* HybridAuth
-*
-* A Social-Sign-On PHP Library for authentication through identity providers like Facebook,
-* Twitter, Google, Yahoo, LinkedIn, MySpace, Windows Live, Tumblr, Friendster, OpenID, PayPal,
-* Vimeo, Foursquare, AOL, Gowalla, and others.
-*
-* Copyright (c) 2009-2011 (http://hybridauth.sourceforge.net)
-*/
+* http://hybridauth.sourceforge.net | https://github.com/hybridauth/hybridauth
+* (c) 2009-2011 HybridAuth authors | hybridauth.sourceforge.net/licenses.html
+*/
/**
* Hybrid_Providers_GitHub
*/
-class Hybrid_Providers_GitHub extends Hybrid_Providers_Protocols_OAuth2
+class Hybrid_Providers_GitHub extends Hybrid_Provider_Model_OAuth2
{
// default permissions
// (no scope) => public read-only access (includes public user profile info, public repo info, and gists).
public $scope = "";
- /**
+ /**
* IDp wrappers initializer
*/
function initialize()
{
parent::initialize();
- // Provider apis end-points
+ // Provider api end-points
$this->api->api_base_url = "https://api.github.com/";
$this->api->authorize_url = "https://github.com/login/oauth/authorize";
$this->api->token_url = "https://github.com/login/oauth/access_token";
}
- /**
+ /**
* load the user profile from the IDp api client
*/
function getUserProfile()
@@ -42,14 +38,14 @@ function getUserProfile()
throw new Exception( "User profile request failed! {$this->providerId} returned an invalide response.", 6 );
}
- $this->user->profile->identifier = @ $data->id;
- $this->user->profile->displayName = @ $data->name;
- $this->user->profile->description = @ $data->bio;
- $this->user->profile->photoURL = @ $data->avatar_url;
- $this->user->profile->profileURL = @ $data->html_url;
- $this->user->profile->email = @ $data->email;
- $this->user->profile->webSiteURL = @ $data->blog;
- $this->user->profile->region = @ $data->location;
+ $this->user->profile->identifier = @ $data->id;
+ $this->user->profile->displayName = @ $data->name;
+ $this->user->profile->description = @ $data->bio;
+ $this->user->profile->photoURL = @ $data->avatar_url;
+ $this->user->profile->profileURL = @ $data->html_url;
+ $this->user->profile->email = @ $data->email;
+ $this->user->profile->webSiteURL = @ $data->blog;
+ $this->user->profile->region = @ $data->location;
if( ! $this->user->profile->displayName ){
$this->user->profile->displayName = @ $data->login;
@@ -1,12 +1,8 @@
<?php
-/**
+/*!
* HybridAuth
-*
-* A Social-Sign-On PHP Library for authentication through identity providers like Facebook,
-* Twitter, Google, Yahoo, LinkedIn, MySpace, Windows Live, Tumblr, Friendster, OpenID, PayPal,
-* Vimeo, Foursquare, AOL, Gowalla, and others.
-*
-* Copyright (c) 2009-2011 (http://hybridauth.sourceforge.net)
+* http://hybridauth.sourceforge.net | https://github.com/hybridauth/hybridauth
+* (c) 2009-2011 HybridAuth authors | hybridauth.sourceforge.net/licenses.html
*/
/**
@@ -1,12 +1,8 @@
<?php
-/**
+/*!
* HybridAuth
-*
-* A Social-Sign-On PHP Library for authentication through identity providers like Facebook,
-* Twitter, Google, Yahoo, LinkedIn, MySpace, Windows Live, Tumblr, Friendster, OpenID, PayPal,
-* Vimeo, Foursquare, AOL, Gowalla, and others.
-*
-* Copyright (c) 2009-2011 (http://hybridauth.sourceforge.net)
+* http://hybridauth.sourceforge.net | https://github.com/hybridauth/hybridauth
+* (c) 2009-2011 HybridAuth authors | hybridauth.sourceforge.net/licenses.html
*/
/**
@@ -1,20 +1,14 @@
<?php
-/**
+/*!
* HybridAuth
-*
-* A Social-Sign-On PHP Library for authentication through identity providers like Facebook,
-* Twitter, Google, Yahoo, LinkedIn, MySpace, Windows Live, Tumblr, Friendster, OpenID, PayPal,
-* Vimeo, Foursquare, AOL, Gowalla, and others.
-*
-* Copyright (c) 2009-2011 (http://hybridauth.sourceforge.net)
+* http://hybridauth.sourceforge.net | https://github.com/hybridauth/hybridauth
+* (c) 2009-2011 HybridAuth authors | hybridauth.sourceforge.net/licenses.html
*/
-require_once Hybrid_Auth::$config["path_providers"] . "/OpenID.php";
-
/**
* Hybrid_Providers_PayPal class
*/
-class Hybrid_Providers_PayPal extends Hybrid_Providers_OpenID
+class Hybrid_Providers_PayPal extends Hybrid_Provider_Model_OpenID
{
var $openidIdentifier = "https://www.paypal.com/webapps/auth/server";
}
Oops, something went wrong.

0 comments on commit a9d4f53

Please sign in to comment.