Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

quite a few changes to move to 2.0.9

  • Loading branch information...
commit a9d4f53ad2af54accae5c2699b640faab129ff8b 1 parent b52838a
hybridauth authored
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
7 README.md
@@ -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!
View
125 additional-providers/hybridauth-Identica/Providers/Identica.php
@@ -1,106 +1,27 @@
<?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";
}
/**
@@ -108,12 +29,12 @@ function loginFinish()
*/
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 ){
View
9 additional-providers/hybridauth-Identica/thirdparty/TwitterCompatible/Identica.php
@@ -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'; }
- }
View
36 additional-providers/hybridauth-github/Providers/GitHub.php
@@ -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;
View
10 additional-providers/hybridauth-gowalla/Providers/Gowalla.php
@@ -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
*/
/**
View
10 additional-providers/hybridauth-lastfm/Providers/LastFM.php
@@ -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
*/
/**
View
14 additional-providers/hybridauth-paypal/Providers/PayPal.php
@@ -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";
}
View
133 additional-providers/hybridauth-tumblr/Providers/Tumblr.php
@@ -1,106 +1,27 @@
<?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_Tumblr class
+* Hybrid_Providers_Tumblr
*/
-class Hybrid_Providers_Tumblr extends Hybrid_Provider_Model
+class Hybrid_Providers_Tumblr 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/Tumblr.php";
-
- if( $this->token( "access_token" ) && $this->token( "access_token_secret" ) )
- {
- $this->api = new Tumblr_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 Tumblr_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 );
- }
+ parent::initialize();
- $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 Tumblr_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'] );
-
- // set user as logged in
- $this->setUserConnected();
+ // provider api end-points
+ $this->api->api_base_url = "http://www.tumblr.com/";
+ $this->api->authorize_url = "http://www.tumblr.com/oauth/authorize";
+ $this->api->request_token_url = "http://www.tumblr.com/oauth/request_token";
+ $this->api->access_token_url = "http://www.tumblr.com/oauth/access_token";
}
/**
@@ -113,7 +34,7 @@ function getUserProfile()
// 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 );
}
try{
@@ -134,7 +55,31 @@ function getUserProfile()
return $this->user->profile;
}
-
+
+ /**
+ * load the current logged in user contacts list from the IDp api client
+ */
+ function getUserContacts()
+ {
+ throw new Exception( "Provider does not support this feature.", 8 );
+ }
+
+ /**
+ * return the user activity stream
+ */
+ function getUserActivity( $stream )
+ {
+ throw new Exception( "Provider does not support this feature.", 8 );
+ }
+
+ /**
+ * return the user activity stream
+ */
+ function setUserStatus( $status )
+ {
+ throw new Exception( "Provider does not support this feature.", 8 );
+ }
+
/**
* Utility function, convert xml to array
*/
@@ -153,5 +98,5 @@ public function xml2array($xml) {
}
$arXML['children']=$t;
return($arXML);
- }
+ }
}
View
13 additional-providers/hybridauth-tumblr/thirdparty/TwitterCompatible/Tumblr.php
@@ -1,13 +0,0 @@
-<?php
- // well Tumblr is not that compatible but eh the authentification can be plugged here on 3 LOC
- class Tumblr_Client extends Twitter_Compatible_Client
- {
- /* Set up the API root URL. */
- public $host = "http://www.tumblr.com/";
-
- /* Respons format. */
- public $format = 'xml';
-
- /* Set API URLS */
- function authenticateURL() { return 'http://www.tumblr.com/oauth/authorize'; }
- }
View
10 additional-providers/hybridauth-viadeo/Providers/Viadeo.php
@@ -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
*/
/**
View
10 additional-providers/hybridauth-vimeo/Providers/Vimeo.php
@@ -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
*/
/**
View
BIN  examples/embed.gif
Deleted file not rendered
View
94 examples/facebook_integration/index.php
@@ -1,12 +1,13 @@
<?php
session_start();
+ // include hybridauth lib
$config = dirname(__FILE__) . '/../../hybridauth/config.php';
require_once( "../../hybridauth/Hybrid/Auth.php" );
+ // start login with facebook?
if( isset( $_GET["login"] ) ){
try{
- // hybridauth EP
$hybridauth = new Hybrid_Auth( $config );
$adapter = $hybridauth->authenticate( "facebook" );
@@ -18,38 +19,85 @@
}
}
+ // logged in ?
if( ! isset( $user_profile ) ){
?>
<p>
-A basic example which show how to integrate Facebook Dialogs and stuff on your website side by side whith HybridAuth. Click the Signin link to start.
+A VERY basic example which show how to integrate Facebook Javascript SDK side by side with HybridAuth. Click the Signin link to start.
</p>
- <h2><a href ="index.php?login=1">Signin with facebook</a></h2>
-
- <img src="../fb.gif" style="border:1px solid #ccc;padding:4px;" />
+<h2><a href ="index.php?login=1">Signin with facebook</a></h2>
<?php
}
+
+ // user signed in with facebook
else{
?>
-<h3>Hi <?php echo $user_profile->displayName; ?> </h3>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<link rel="stylesheet" href="../social_hub/public/css.css" type="text/css">
+<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
+<style>
+pre{width:450px;overflow:auto;}
+</style>
+</head>
+<body>
+
+<table width="95%" border="0" cellpadding="2" cellspacing="2">
+<tr>
+<td width="50%" valign="top">
-<input value="Want to share this page on facebook?" style="height:30px;" type="submit" onclick="share_link()" />
-<input value="Want to publish a random story your facebook wall?" style="height:30px;" type="submit" onclick="post_to_wall()" />
-<input value="Want to invite some friends ?" style="height:30px;" type="submit" onclick="invite_friends()" />
+<fieldset>
+<legend>Hybridauth library</legend>
+<b>Hi <?php echo $user_profile->displayName; ?></b>, <br />your profile url is: <?php echo $user_profile->profileURL; ?>
+<hr />
+<b>Hybridauth access tokens for Facebook:</b>
+<pre><?php print_r( $adapter->getAccessToken() ); ?></pre>
+</fieldset>
-<p>
- <hr />
- The invite friends <b>may require some advanced</b> facebook application configuration your side. To know more about FB.ui visit https://developers.facebook.com/docs/reference/javascript/FB.ui/
-</p>
+</td>
+<td width="50%" valign="top">
+
+<fieldset>
+<legend>Facebook JavaScript SDK</legend>
+Your are logged in to this site with facebook and the <a href='https://developers.facebook.com/docs/reference/javascript/'>Javascript SDK</a> should be happy with it.
+<br />
+<br />
+<span id="hellomessage"></span>
+<hr />
+<input value="Click on me to share this page on facebook" style="height:30px;" type="submit" onclick="share_link()" /><br />
+<input value="Click on me to publish a random story your facebook wall" style="height:30px;" type="submit" onclick="post_to_wall()" /><br />
+<input value="Click on me to invite friends" style="height:30px;" type="submit" onclick="invite_friends()" />
+
+<hr />
+<br />
+Note: The invite friends <b>may require some advanced</b> facebook application configuration your side. To know more about FB.ui visit <a href='https://developers.facebook.com/docs/reference/javascript/FB.ui/'>https://developers.facebook.com/docs/reference/javascript/FB.ui/</a>
+
<div id="fb-root"></div>
-<script src="http://connect.facebook.net/en_US/all.js"></script>
+<script src="http://connect.facebook.net/en_US/all.js"></script>
+
<script>
-FB.init({
- appId:'<?php echo $adapter->config["keys"]["id"]; ?>', // or simply set your appid hard coded
- cookie:true,
- status : true,
- xfbml:true
+$(function(){
+ FB.init({
+ appId:'<?php echo $adapter->config["keys"]["id"]; ?>', // or simply set your appid hard coded
+ cookie:true,
+ status : true,
+ xfbml:true
+ });
+
+ FB.api('/me', function(response) {
+ $("#hellomessage").html( "<b>Hi " + response.name + "</b>,<br />your profile url is: " + response.link );
+ });
+
+ FB.getLoginStatus(function(response) {
+ console.log( response );
+ if ( response.session ) {
+ $("#hellomessage").after( "<br /><hr />FB.getLoginStatus() response:<pre>access_token:" + response.session.access_token + "</pre>" );
+ }
+ });
});
// https://developers.facebook.com/docs/reference/dialogs/send/
@@ -86,5 +134,13 @@ function callback(response) {
FB.ui(obj, callback);
}
</script>
+
+
+</fieldset>
+
+</tr>
+</table>
+</body>
+</html>
<?php
}
View
BIN  examples/fb.gif
Deleted file not rendered
View
BIN  examples/helloworld.gif
Deleted file not rendered
View
40 examples/index.html
@@ -1,9 +1,11 @@
<center>
-<table width="80%" border="0" cellspacing="10">
+<table width="70%" border="0" cellspacing="10">
<tr>
<td>
-<h2>Getting Started</h2>
-<p align="justify">To install HybridAuth, you can use the <a href="../hybridauth/install.php">HybridAuth Auto Installer</a></p>
+<h1>HybridAuth Showcases</h1>
+
+<h3>Getting Started</h3>
+<p align="justify">To install HybridAuth, you can use the <a href="../hybridauth/install.php">HybridAuth Auto Installer</a>.</p>
<p align="justify">You can also install HybridAuth manually by refering to <strong>Installation and Configuration</strong> sections at <a href="http://hybridauth.sourceforge.net/userguide.html">http://hybridauth.sourceforge.net/userguide.html</a></p>
@@ -13,17 +15,14 @@
<hr />
</td>
</tr>
-</table>
-</center>
-
-
-
+<tr>
+<td>
+<h3>Available Examples and Demos</h3>
<center>
-<h2><u>HybridAuth Examples and Demos</u></h2>
-<table width="60%" border="0" cellspacing="10">
+<table width="85%" border="0" cellspacing="10">
<tr>
-<td width="280" align="center"><a href="hello_world/index.php"><img src="helloworld.gif" width="250" style="border:1px solid #ccc;padding:4px;" /></a></td>
+<td width="250" align="center"><a href="hello_world/index.php"><img src="http://hybridauth.sourceforge.net/demos/helloworld.gif" width="250" style="border:1px solid #ccc;padding:4px;" /></a></td>
<td align="left" valign="top"><a href="hello_world/index.php"><b>1 - Hello world</b></a>
<p align="justify">
A very simple sign-in script which will try to directly connect the user with Twitter then grab his complete profile and also access the twitter social api.
@@ -33,7 +32,7 @@
</tr>
<tr>
-<td align="center"><a href="widget_authentication/index.php"><img src="widget.gif" width="250" style="border:1px solid #ccc;padding:4px;" /></a></td>
+<td align="center"><a href="widget_authentication/index.php"><img src="http://hybridauth.sourceforge.net/demos/widget.gif" width="250" style="border:1px solid #ccc;padding:4px;" /></a></td>
<td align="left" valign="top"><a href="widget_authentication/index.php"><b>2 - Widget integration</b></a>
<p align="justify">
A simple user friendly sign-in interface (aka: provider selector UI) which you can integrate, customize, redesign and improve (and hopefully you will share some of your work with the comminuty).
@@ -42,7 +41,7 @@
</tr>
<tr>
-<td align="center"><a href="social_hub/index.php"><img src="embed.gif" width="250" style="border:1px solid #ccc;padding:4px;" /></a></td>
+<td align="center"><a href="social_hub/index.php"><img src="http://hybridauth.sourceforge.net/demos/embed.gif" width="250" style="border:1px solid #ccc;padding:4px;" /></a></td>
<td align="left" valign="top"><a href="social_hub/index.php"><b>3 - Tiny Social Hub</b></a>
<p align="justify">
This exapmle show how users can login with providers using HybridAuth. It also show how to grab their profile, update their status or to grab their freinds list from services such as facebook, twitter, myspace.
@@ -50,28 +49,33 @@
</tr>
<tr>
-<td align="center"><a href="signin_signup/index.php"><img src="singup.gif" width="250" style="border:1px solid #ccc;padding:4px;" /></a></td>
-<td align="left" valign="top"><a href="signin_signup/index.php"><b>4 - Sign-in/Sign-up users</b></a>
+<td align="center"><a href="signin_signup/index.php"><img src="http://hybridauth.sourceforge.net/demos/singup.gif" width="250" style="border:1px solid #ccc;padding:4px;" /></a></td>
+<td align="left" valign="top"><a href="signin_signup/index.php"><b>4 - Sign-in/Sign-up Users</b></a>
<p align="justify">
An attempt to put together an answer to how to sign-in/sign-up users using HybridAuth in an existing web application. <p align="justify">
This exapmle provide a simple implementation of the whole sign-in/sign-up process on a MVC environment.</p>
</tr>
<tr>
-<td align="center"><a href="facebook_integration/index.php"><img src="fb.gif" width="250" style="border:1px solid #ccc;padding:4px;" /></a></td>
+<td align="center"><a href="facebook_integration/index.php"><img src="http://hybridauth.sourceforge.net/demos/fb.gif" width="250" style="border:1px solid #ccc;padding:4px;" /></a></td>
<td align="left" valign="top"><a href="facebook_integration/index.php"><b>5 - Basic Facebook integration</b></a>
<p align="justify">
-A basic example which show how to integrate Facebook Dialogs and stuff on your website side by side whith HybridAuth.
+A VERY basic example which show how to integrate Facebook Javascript SDK side by side with HybridAuth.
</p>
</tr>
</table>
+</td>
+</center>
+</tr>
+</table>
+
</center>
<br />
<br />
<hr />
-<p>HybridAuth Open Source Social Sign On Library, 2011.</p>
+<p>HybridAuth Library, 2011. http://hybridauth.sourceforge.net/</p>
<script type="text/javascript">
<script type="text/javascript">
View
BIN  examples/singup.gif
Deleted file not rendered
View
2  examples/social_hub/includes/sidebar.php
@@ -13,7 +13,7 @@
echo '&nbsp;&nbsp;<a href="profile.php?provider=' . $adapter_id . '">Switch to <b>' . $adapter_id . '</b> account</a><br />';
}
?>
- <hr />
+ <br />
&nbsp;&nbsp;<a href="logout_all.php">Logout all connected providers</a>
</fieldset>
<?php
View
3  examples/social_hub/login.php
@@ -89,8 +89,7 @@
&nbsp;&nbsp;<a href="?provider=Live">Sign-in with Windows Live</a><br />
&nbsp;&nbsp;<a href="?provider=LinkedIn">Sign-in with LinkedIn</a><br />
&nbsp;&nbsp;<a href="?provider=Foursquare">Sign-in with Foursquare</a><br />
- &nbsp;&nbsp;<a href="?provider=AOL">Sign-in with AOL</a><br />
- &nbsp;&nbsp;<a href="?provider=GitHub">Sign-in with GitHub</a><br />
+ &nbsp;&nbsp;<a href="?provider=AOL">Sign-in with AOL</a><br />
</fieldset>
</td>
<?php
View
12 examples/social_hub/logout_all.php
@@ -13,17 +13,7 @@
$hybridauth->redirect( "login.php" );
}
catch( Exception $e ){
- // Display the recived error,
- // to know more please refer to Exceptions handling section on the userguide
- switch( $e->getCode() ){
- case 0 : echo "Unspecified error."; break;
- case 1 : echo "Hybriauth configuration error."; break;
- case 2 : echo "Provider not properly configured."; break;
- case 3 : echo "Unknown or disabled provider."; break;
- case 4 : echo "Missing provider application credentials."; break;
- }
-
- echo "<br /><br /><b>Original error message:</b> " . $e->getMessage();
+ echo "<br /><br /><b>Oh well, we got an error :</b> " . $e->getMessage();
echo "<hr /><h3>Trace</h3> <pre>" . $e->getTraceAsString() . "</pre>";
}
View
2  examples/social_hub/timeline.php
@@ -22,7 +22,7 @@
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<link rel="stylesheet" href="public/css.css" type="text/css">
+<link rel="stylesheet" href="public/css.css" type="text/css">
</head>
<body>
<table width="90%" border="0" cellpadding="2" cellspacing="2">
View
BIN  examples/widget.gif
Deleted file not rendered
View
52 hybridauth/Hybrid/Auth.php
@@ -1,13 +1,9 @@
<?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
+*/
// ------------------------------------------------------------------------
// The main file to include in Hybrid_Auth package
@@ -38,6 +34,7 @@ function __construct( $config )
}
}
+ #{{{ well, should we check this each time? ..
// PHP Curl extension [http://www.php.net/manual/en/intro.curl.php]
if ( ! function_exists('curl_init') ) {
throw new Exception('Hybriauth Library needs the CURL PHP extension.');
@@ -52,6 +49,7 @@ function __construct( $config )
if( extension_loaded('oauth') ) {
throw new Exception('Hybriauth Library not compatible with installed PECL OAuth extension. Please disable it.');
}
+ #}}}
Hybrid_Auth::initialize( $config );
}
@@ -87,23 +85,23 @@ public static function initialize( $config )
$config["debug_file"] = null;
}
- # some required includes
+ # some required includes
require_once $config["path_base"] . "Error.php";
require_once $config["path_base"] . "Logger.php";
require_once $config["path_base"] . "Storage.php";
- require_once $config["path_base"] . "Provider_Model.php";
require_once $config["path_base"] . "Provider_Adapter.php";
- require_once $config["path_base"] . "Protocols/OpenID.php";
- require_once $config["path_base"] . "Protocols/OAuth1.php";
- require_once $config["path_base"] . "Protocols/OAuth2.php";
+ require_once $config["path_base"] . "Provider_Model.php";
+ require_once $config["path_base"] . "Provider_Model_OpenID.php";
+ require_once $config["path_base"] . "Provider_Model_OAuth1.php";
+ require_once $config["path_base"] . "Provider_Model_OAuth2.php";
require_once $config["path_base"] . "User.php";
- require_once $config["path_base"] . "User/Profile.php";
- require_once $config["path_base"] . "User/Contact.php";
- require_once $config["path_base"] . "User/Activity.php";
+ require_once $config["path_base"] . "User_Profile.php";
+ require_once $config["path_base"] . "User_Contact.php";
+ require_once $config["path_base"] . "User_Activity.php";
// hash given config
Hybrid_Auth::$config = $config;
@@ -147,7 +145,7 @@ public static function initialize( $config )
}
Hybrid_Logger::info( "Hybrid_Auth initialize: no error found. initialization succeed." );
-
+
// Endof initialize
}
@@ -222,7 +220,7 @@ public static function authenticate( $providerId, $params = NULL )
// --------------------------------------------------------------------
- /**
+ /**
* Return the adapter instance for a given provider
*/
public static function getAdapter( $providerId = NULL )
@@ -234,7 +232,7 @@ public static function getAdapter( $providerId = NULL )
// --------------------------------------------------------------------
- /**
+ /**
* Setup an adapter for a given provider
*/
public static function setup( $providerId, $params = NULL )
@@ -269,7 +267,7 @@ public static function setup( $providerId, $params = NULL )
// --------------------------------------------------------------------
- /**
+ /**
* Check if the current user is connected to a given provider
*/
public static function isConnectedWith( $providerId = NULL )
@@ -280,7 +278,7 @@ public static function isConnectedWith( $providerId = NULL )
// --------------------------------------------------------------------
- /**
+ /**
* Return array listing all authenticated providers
*/
public static function getConnectedProviders()
@@ -298,7 +296,7 @@ public static function getConnectedProviders()
// --------------------------------------------------------------------
- /**
+ /**
* A generic function to logout all connected provider at once
* #3435186, http://sourceforge.net/tracker/?func=detail&atid=1195295&aid=3435186&group_id=281757
*/
@@ -315,19 +313,17 @@ public static function logoutAllProviders()
// --------------------------------------------------------------------
- /**
+ /**
* Utility function, redirect to a given URL with php header or using javascript location.href
*/
public static function redirect( $url, $mode = "PHP", $postdata = ARRAY() )
{
Hybrid_Logger::info( "Enter Hybrid_Auth::redirect( $url, $mode )" );
- if( $mode == "PHP" )
- {
+ if( $mode == "PHP" ){
header( "Location: $url" ) ;
}
- elseif( $mode == "JS" )
- {
+ elseif( $mode == "JS" ){
echo '<html>';
echo '<head>';
echo '<script type="text/javascript">';
@@ -345,7 +341,7 @@ public static function redirect( $url, $mode = "PHP", $postdata = ARRAY() )
// --------------------------------------------------------------------
- /**
+ /**
* Utility function, return the current url. TRUE to get $_SERVER['REQUEST_URI'], FALSE for $_SERVER['PHP_SELF']
*/
public static function getCurrentUrl( $request_uri = true )
View
49 hybridauth/Hybrid/Error.php
@@ -1,20 +1,16 @@
<?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
+*/
/**
* The Hybrid_Error manage and store error for HybridAuth
*/
class Hybrid_Error
{
- /**
+ /**
* store error in HybridAuth cache system
*/
public static function setError( $message, $code = NULL, $trace = NULL, $previous = NULL )
@@ -28,13 +24,13 @@ public static function setError( $message, $code = NULL, $trace = NULL, $previou
Hybrid_Auth::storage()->set( "hauth_session.error.previous", $previous );
}
- /**
+ /**
* store error in HybridAuth cache system
*/
public static function clearError()
{
Hybrid_Logger::info( "Enter Hybrid_Error::clearError()" );
-
+
Hybrid_Auth::storage()->delete( "hauth_session.error.status" );
Hybrid_Auth::storage()->delete( "hauth_session.error.message" );
Hybrid_Auth::storage()->delete( "hauth_session.error.code" );
@@ -42,8 +38,6 @@ public static function clearError()
Hybrid_Auth::storage()->delete( "hauth_session.error.previous" );
}
- // --------------------------------------------------------------------
-
/**
* Checks to see if there is a an error.
*
@@ -54,12 +48,9 @@ public static function clearError()
*/
public static function hasError()
{
- return
- (bool) Hybrid_Auth::storage()->get( "hauth_session.error.status" );
+ return (bool) Hybrid_Auth::storage()->get( "hauth_session.error.status" );
}
- // --------------------------------------------------------------------
-
/**
* a naive error message getter
*
@@ -67,46 +58,36 @@ public static function hasError()
*/
public static function getErrorMessage()
{
- return
- Hybrid_Auth::storage()->get( "hauth_session.error.message" );
+ return Hybrid_Auth::storage()->get( "hauth_session.error.message" );
}
- // --------------------------------------------------------------------
-
- /**
+ /**
* a naive error code getter
*
* @return int error code defined on Hybrid_Auth.
*/
public static function getErrorCode()
{
- return
- Hybrid_Auth::storage()->get( "hauth_session.error.code" );
+ return Hybrid_Auth::storage()->get( "hauth_session.error.code" );
}
- // --------------------------------------------------------------------
-
- /**
+ /**
* a naive error backtrace getter
*
* @return string detailled error backtrace as string.
*/
public static function getErrorTrace()
{
- return
- Hybrid_Auth::storage()->get( "hauth_session.error.trace" );
+ return Hybrid_Auth::storage()->get( "hauth_session.error.trace" );
}
- // --------------------------------------------------------------------
-
- /**
+ /**
* a naive error backtrace getter
*
* @return string detailled error backtrace as string.
*/
public static function getErrorPrevious()
{
- return
- Hybrid_Auth::storage()->get( "hauth_session.error.previous" );
+ return Hybrid_Auth::storage()->get( "hauth_session.error.previous" );
}
}
View
87 hybridauth/Hybrid/Logger.php
@@ -1,13 +1,9 @@
<?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
+*/
/**
* Debugging and Logging class
@@ -27,72 +23,45 @@ function __construct()
}
}
- // --------------------------------------------------------------------
-
- /**
- * Log a message at the debug level.
- *
- * @param $message The message to log.
- */
- public static function debug( $message, $object = NULL )
+ public static function debug( $message, $object = NULL )
{
- if( Hybrid_Auth::$config["debug_mode"] )
- {
- $datetime = new DateTime();
- $datetime = $datetime->format(DATE_ATOM);
-
- file_put_contents
- (
+ if( Hybrid_Auth::$config["debug_mode"] ){
+ $datetime = new DateTime();
+ $datetime = $datetime->format(DATE_ATOM);
+
+ file_put_contents(
Hybrid_Auth::$config["debug_file"],
"DEBUG -- " . $_SERVER['REMOTE_ADDR'] . " -- " . $datetime . " -- " . $message . " -- " . print_r($object, true) . "\n",
FILE_APPEND
);
- }
- }
-
- // --------------------------------------------------------------------
+ }
+ }
- /**
- * Log a message at the info level.
- *
- * @param $message The message to log.
- */
- public static function info( $message )
+ public static function info( $message )
{
- if( Hybrid_Auth::$config["debug_mode"] )
- {
- $datetime = new DateTime();
- $datetime = $datetime->format(DATE_ATOM);
-
- file_put_contents
- (
+ if( Hybrid_Auth::$config["debug_mode"] ){
+ $datetime = new DateTime();
+ $datetime = $datetime->format(DATE_ATOM);
+
+ file_put_contents(
Hybrid_Auth::$config["debug_file"],
"INFO -- " . $_SERVER['REMOTE_ADDR'] . " -- " . $datetime . " -- " . $message . "\n",
FILE_APPEND
);
- }
- }
-
- // --------------------------------------------------------------------
+ }
+ }
- /**
- * Log a message at the error level.
- *
- * @param $message The message to log.
- */
- public static function error($message, $object = NULL)
+ public static function error($message, $object = NULL)
{
- if( Hybrid_Auth::$config["debug_mode"] )
- {
- $datetime = new DateTime();
- $datetime = $datetime->format(DATE_ATOM);
-
- file_put_contents
- (
+ if( Hybrid_Auth::$config["debug_mode"] ){
+ $datetime = new DateTime();
+ $datetime = $datetime->format(DATE_ATOM);
+
+ file_put_contents(
Hybrid_Auth::$config["debug_file"],
"ERROR -- " . $_SERVER['REMOTE_ADDR'] . " -- " . $datetime . " -- " . $message . " -- " . print_r($object, true) . "\n",
FILE_APPEND
);
- }
- }
+ }
+ }
}
View
76 hybridauth/Hybrid/Provider_Adapter.php
@@ -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
*/
/**
@@ -14,37 +10,37 @@
*/
class Hybrid_Provider_Adapter
{
- /**
+ /**
* IDp ID (or unique name)
*/
public $id = NULL ;
- /**
+ /**
* IDp adapter config on hybrid.config.php
*/
public $config = NULL ;
- /**
+ /**
* IDp adapter requireds params
*/
public $params = NULL ;
- /**
+ /**
* IDp adapter path
*/
public $wrapper = NULL ;
- /**
+ /**
* IDp adapter instance
*/
public $adapter = NULL ;
- /**
- * create a new adapter switch IDp name or ID
- *
- * @param string $id The id or name of the IDp
- * @param array $params (optional) required parameters by the adapter
- */
+ /**
+ * create a new adapter switch IDp name or ID
+ *
+ * @param string $id The id or name of the IDp
+ * @param array $params (optional) required parameters by the adapter
+ */
function factory( $id, $params = NULL )
{
Hybrid_Logger::info( "Enter Hybrid_Provider_Adapter::factory( $id )" );
@@ -86,12 +82,12 @@ function factory( $id, $params = NULL )
// --------------------------------------------------------------------
- /**
- * This is the methode that should be specified when a user requests a sign in whith an IDp.
- *
- * Hybrid_Provider_Adapter::login(), prepare the user session and the authentification request
- * for hybrid.endpoint.php
- */
+ /**
+ * This is the methode that should be specified when a user requests a sign in whith an IDp.
+ *
+ * Hybrid_Provider_Adapter::login(), prepare the user session and the authentification request
+ * for hybrid.endpoint.php
+ */
function login()
{
Hybrid_Logger::info( "Enter Hybrid_Provider_Adapter::login( {$this->id} ) " );
@@ -129,9 +125,9 @@ function login()
# auth.done required the IDp ID
$this->params["login_done"] = $HYBRID_AUTH_URL_BASE . ( strpos( $HYBRID_AUTH_URL_BASE, '?' ) ? '&' : '?' ) . "hauth.done={$this->id}";
- 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_endpoint" , $this->params["login_done"] );
- Hybrid_Auth::storage()->set( "hauth_session.{$this->id}.id_provider_params" , $this->params );
+ 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_endpoint" , $this->params["login_done"] );
+ Hybrid_Auth::storage()->set( "hauth_session.{$this->id}.id_provider_params" , $this->params );
// store config to be used by the end point
$_SESSION["HA::CONFIG"] = serialize( Hybrid_Auth::$config );
@@ -144,7 +140,7 @@ function login()
// --------------------------------------------------------------------
- /**
+ /**
* let hybridauth forget all about the user
*/
function logout()
@@ -154,7 +150,7 @@ function logout()
// --------------------------------------------------------------------
- /**
+ /**
* return true if the user is connected to the current provider
*/
public function isUserConnected()
@@ -165,7 +161,7 @@ public function isUserConnected()
// --------------------------------------------------------------------
- /**
+ /**
* handle :
* getUserProfile()
* getUserContacts()
@@ -196,7 +192,7 @@ public function __call( $name, $arguments )
// --------------------------------------------------------------------
- /**
+ /**
* If the user is connected, then return the access_token and access_token_secret
* if the provider api use oauth
*/
@@ -209,18 +205,18 @@ public function getAccessToken()
}
return
- ARRAY(
- "access_token" => $this->adapter->token( "access_token" ) , // OAuth access token
- "access_token_secret" => $this->adapter->token( "access_token_secret" ), // OAuth access token secret
- "refresh_token" => $this->adapter->token( "refresh_token" ) , // OAuth refresh token
- "expires_in" => $this->adapter->token( "expires_in" ) , // OPTIONAL. The duration in seconds of the access token lifetime
- "expires_at" => $this->adapter->token( "expires_at" ) , // OPTIONAL. Timestamp when the access_token expire. if not provided by the social api, then it should be calculated: expires_at = now + expires_in
- );
+ ARRAY(
+ "access_token" => $this->adapter->token( "access_token" ) , // OAuth access token
+ "access_token_secret" => $this->adapter->token( "access_token_secret" ), // OAuth access token secret
+ "refresh_token" => $this->adapter->token( "refresh_token" ) , // OAuth refresh token
+ "expires_in" => $this->adapter->token( "expires_in" ) , // OPTIONAL. The duration in seconds of the access token lifetime
+ "expires_at" => $this->adapter->token( "expires_at" ) , // OPTIONAL. Timestamp when the access_token expire. if not provided by the social api, then it should be calculated: expires_at = now + expires_in
+ );
}
// --------------------------------------------------------------------
- /**
+ /**
* Naive getter of the current connected IDp API client
*/
function api()
@@ -236,7 +232,7 @@ function api()
// --------------------------------------------------------------------
- /**
+ /**
* redirect the user to hauth_return_to (the callback url)
*/
function returnToCallbackUrl()
View
46 hybridauth/Hybrid/Provider_Model.php
@@ -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
*/
/**
@@ -14,7 +10,7 @@
*/
abstract class Hybrid_Provider_Model
{
- /**
+ /**
* the IDp api client (optional)
*/
public $api = NULL;
@@ -24,7 +20,7 @@
*/
public $user = NULL;
- /**
+ /**
* IDp adapter config on hybridauth.php
*/
public $config = NULL;
@@ -34,17 +30,17 @@
*/
public $params = NULL;
- /**
+ /**
* IDp ID (or unique name)
*/
public $providerId = NULL;
- /**
+ /**
* Hybridauth Endpoint URL
*/
public $endpoint = NULL;
- /**
+ /**
* common IDp wrappers constructor
*/
function __construct( $providerId, $config, $params = NULL )
@@ -78,7 +74,7 @@ function __construct( $providerId, $config, $params = NULL )
// --------------------------------------------------------------------
- /**
+ /**
* IDp wrappers initializer
*
* The main job of wrappers initializer is to performs (depend on the IDp api client it self):
@@ -91,14 +87,14 @@ function __construct( $providerId, $config, $params = NULL )
// --------------------------------------------------------------------
- /**
+ /**
* begin login
*/
abstract protected function loginBegin();
// --------------------------------------------------------------------
- /**
+ /**
* finish login
*/
abstract protected function loginFinish();
@@ -119,7 +115,7 @@ function logout()
// --------------------------------------------------------------------
- /**
+ /**
* grab the user profile from the IDp api client
*/
function getUserProfile()
@@ -131,7 +127,7 @@ function getUserProfile()
// --------------------------------------------------------------------
- /**
+ /**
* load the current logged in user contacts list from the IDp api client
*/
function getUserContacts()
@@ -143,7 +139,7 @@ function getUserContacts()
// --------------------------------------------------------------------
- /**
+ /**
* return the user activity stream
*/
function getUserActivity( $stream )
@@ -155,7 +151,7 @@ function getUserActivity( $stream )
// --------------------------------------------------------------------
- /**
+ /**
* return the user activity stream
*/
function setUserStatus( $status )
@@ -167,7 +163,7 @@ function setUserStatus( $status )
// --------------------------------------------------------------------
- /**
+ /**
* return true if the user is connected to the current provider
*/
public function isUserConnected()
@@ -178,7 +174,7 @@ public function isUserConnected()
// --------------------------------------------------------------------
- /**
+ /**
* set user to connected
*/
public function setUserConnected()
@@ -190,7 +186,7 @@ public function setUserConnected()
// --------------------------------------------------------------------
- /**
+ /**
* set user to unconnected
*/
public function setUserUnconnected()
@@ -202,7 +198,7 @@ public function setUserUnconnected()
// --------------------------------------------------------------------
- /**
+ /**
* get or set a token
*/
public function token( $token, $value = NULL )
@@ -217,7 +213,7 @@ public function token( $token, $value = NULL )
// --------------------------------------------------------------------
- /**
+ /**
* delete a stored token
*/
public function deleteToken( $token )
@@ -227,7 +223,7 @@ public function deleteToken( $token )
// --------------------------------------------------------------------
- /**
+ /**
* clear all existen tokens for this provider
*/
public function clearTokens()
View
20 hybridauth/Hybrid/Protocols/OAuth1.php → hybridauth/Hybrid/Provider_Model_OAuth1.php
@@ -1,17 +1,13 @@
<?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
*/
-class Hybrid_Providers_Protocols_OAuth1 extends Hybrid_Provider_Model
+class Hybrid_Provider_Model_OAuth1 extends Hybrid_Provider_Model
{
- /**
+ /**
* try to get the error message from provider api
*/
function errorMessageByStatus() {
@@ -33,7 +29,7 @@ function errorMessageByStatus() {
}
- /**
+ /**
* IDp wrappers initializer
*/
function initialize()
@@ -67,7 +63,7 @@ function initialize()
}
}
- /**
+ /**
* begin login step
*/
function loginBegin()
@@ -90,7 +86,7 @@ function loginBegin()
Hybrid_Auth::redirect( $this->api->authorizeUrl( $tokens ) );
}
- /**
+ /**
* finish login step
*/
function loginFinish()
View
12 hybridauth/Hybrid/Protocols/OAuth2.php → hybridauth/Hybrid/Provider_Model_OAuth2.php
@@ -1,15 +1,11 @@
<?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
*/
-class Hybrid_Providers_Protocols_OAuth2 extends Hybrid_Provider_Model
+class Hybrid_Provider_Model_OAuth2 extends Hybrid_Provider_Model
{
// default permissions
public $scope = "";
View
18 hybridauth/Hybrid/Protocols/OpenID.php → hybridauth/Hybrid/Provider_Model_OpenID.php
@@ -1,19 +1,15 @@
<?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
*/
-class Hybrid_Providers_Protocols_OpenID extends Hybrid_Provider_Model
+class Hybrid_Provider_Model_OpenID extends Hybrid_Provider_Model
{
var $openidIdentifier = "";
- /**
+ /**
* IDp wrappers initializer
*/
function initialize()
@@ -27,7 +23,7 @@ function initialize()
$this->api = new LightOpenID( parse_url( Hybrid_Auth::$config["base_url"], PHP_URL_HOST) );
}
- /**
+ /**
* begin login step
*/
function loginBegin( )
@@ -61,7 +57,7 @@ function loginBegin( )
Hybrid_Auth::redirect( $this->api->authUrl() );
}
- /**
+ /**
* finish login step
*/
function loginFinish( )
View
12 hybridauth/Hybrid/Providers/AOL.php
@@ -1,18 +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
*/
/**
* Hybrid_Providers_AOL
*/
-class Hybrid_Providers_AOL extends Hybrid_Providers_Protocols_OpenID
+class Hybrid_Providers_AOL extends Hybrid_Provider_Model_OpenID
{
var $openidIdentifier = "http://openid.aol.com/";
}
View
60 hybridauth/Hybrid/Providers/Facebook.php
@@ -1,16 +1,12 @@
<?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_Facebook class, wrapper for Facebook Connect
+ * Hybrid_Providers_Facebook
*/
class Hybrid_Providers_Facebook extends Hybrid_Provider_Model
{
@@ -39,7 +35,7 @@ function initialize()
$this->api->getUser();
}
- /**
+ /**
* begin login step
*
* simply call Facebook::require_login().
@@ -77,7 +73,7 @@ function loginFinish()
}
}
- /**
+ /**
* logout
*/
function logout()
@@ -87,7 +83,7 @@ function logout()
parent::logout();
}
- /**
+ /**
* load the user profile from the IDp api client
*/
function getUserProfile()
@@ -106,30 +102,30 @@ function getUserProfile()
}
# store the user profile.
- $this->user->profile->identifier = @ $data['id'];
- $this->user->profile->displayName = @ $data['name'];
- $this->user->profile->firstName = @ $data['first_name'];
- $this->user->profile->lastName = @ $data['last_name'];
- $this->user->profile->photoURL = "https://graph.facebook.com/" . $this->user->profile->identifier . "/picture?type=square";
- $this->user->profile->profileURL = @ $data['link'];
- $this->user->profile->webSiteURL = @ $data['website'];
- $this->user->profile->gender = @ $data['gender'];
- $this->user->profile->description = @ $data['bio'];
- $this->user->profile->email = @ $data['email'];
- $this->user->profile->region = @ $data['hometown']["name"];
+ $this->user->profile->identifier = @ $data['id'];
+ $this->user->profile->displayName = @ $data['name'];
+ $this->user->profile->firstName = @ $data['first_name'];
+ $this->user->profile->lastName = @ $data['last_name'];
+ $this->user->profile->photoURL = "https://graph.facebook.com/" . $this->user->profile->identifier . "/picture?type=square";
+ $this->user->profile->profileURL = @ $data['link'];
+ $this->user->profile->webSiteURL = @ $data['website'];
+ $this->user->profile->gender = @ $data['gender'];
+ $this->user->profile->description = @ $data['bio'];
+ $this->user->profile->email =