WordPress Social Login - Version 2.1.6

Version Description

Download this release

Release Info

Developer miled
Plugin Icon 128x128 WordPress Social Login
Version 2.1.6
Comparing to
See all releases

Version 2.1.6

Files changed (228) hide show
  1. assets/css/style.css +15 -0
  2. assets/img/16x16/500px.png +0 -0
  3. assets/img/16x16/aol.png +0 -0
  4. assets/img/16x16/blogger.png +0 -0
  5. assets/img/16x16/dribbble.png +0 -0
  6. assets/img/16x16/facebook.png +0 -0
  7. assets/img/16x16/flickr-2.png +0 -0
  8. assets/img/16x16/flickr.png +0 -0
  9. assets/img/16x16/foursquare.png +0 -0
  10. assets/img/16x16/github.png +0 -0
  11. assets/img/16x16/goodreads.png +0 -0
  12. assets/img/16x16/google.png +0 -0
  13. assets/img/16x16/gowalla.png +0 -0
  14. assets/img/16x16/hyves.png +0 -0
  15. assets/img/16x16/identica.png +0 -0
  16. assets/img/16x16/instagram.png +0 -0
  17. assets/img/16x16/lastfm.png +0 -0
  18. assets/img/16x16/linkedin.png +0 -0
  19. assets/img/16x16/live.png +0 -0
  20. assets/img/16x16/livejournal.png +0 -0
  21. assets/img/16x16/mailru.png +0 -0
  22. assets/img/16x16/mixi.png +0 -0
  23. assets/img/16x16/mixx.png +0 -0
  24. assets/img/16x16/myspace.png +0 -0
  25. assets/img/16x16/odnoklassniki.png +0 -0
  26. assets/img/16x16/openid-2.png +0 -0
  27. assets/img/16x16/orkut.png +0 -0
  28. assets/img/16x16/paypal.png +0 -0
  29. assets/img/16x16/skyrock.png +0 -0
  30. assets/img/16x16/stackoverflow.png +0 -0
  31. assets/img/16x16/steam.png +0 -0
  32. assets/img/16x16/tumblr.png +0 -0
  33. assets/img/16x16/twitchtv.png +0 -0
  34. assets/img/16x16/twitter.png +0 -0
  35. assets/img/16x16/vimeo.png +0 -0
  36. assets/img/16x16/vkontakte.png +0 -0
  37. assets/img/16x16/windows.png +0 -0
  38. assets/img/16x16/wordpress.png +0 -0
  39. assets/img/16x16/yahoo.png +0 -0
  40. assets/img/16x16/yandex.png +0 -0
  41. assets/img/32x32/icondock/500px.png +0 -0
  42. assets/img/32x32/icondock/aol.png +0 -0
  43. assets/img/32x32/icondock/blogger.png +0 -0
  44. assets/img/32x32/icondock/facebook.png +0 -0
  45. assets/img/32x32/icondock/flickr.png +0 -0
  46. assets/img/32x32/icondock/foursquare.png +0 -0
  47. assets/img/32x32/icondock/github.png +0 -0
  48. assets/img/32x32/icondock/goodreads.png +0 -0
  49. assets/img/32x32/icondock/google.png +0 -0
  50. assets/img/32x32/icondock/gowalla.png +0 -0
  51. assets/img/32x32/icondock/hyves.png +0 -0
  52. assets/img/32x32/icondock/identica.png +0 -0
  53. assets/img/32x32/icondock/info.txt +6 -0
  54. assets/img/32x32/icondock/instagram.png +0 -0
  55. assets/img/32x32/icondock/lastfm.png +0 -0
  56. assets/img/32x32/icondock/linkedin.png +0 -0
  57. assets/img/32x32/icondock/live.png +0 -0
  58. assets/img/32x32/icondock/livejournal.png +0 -0
  59. assets/img/32x32/icondock/mailru.png +0 -0
  60. assets/img/32x32/icondock/mixi.png +0 -0
  61. assets/img/32x32/icondock/msn.png +0 -0
  62. assets/img/32x32/icondock/myspace.png +0 -0
  63. assets/img/32x32/icondock/odnoklassniki.png +0 -0
  64. assets/img/32x32/icondock/skyrock.png +0 -0
  65. assets/img/32x32/icondock/stackoverflow.png +0 -0
  66. assets/img/32x32/icondock/steam.png +0 -0
  67. assets/img/32x32/icondock/tumblr.png +0 -0
  68. assets/img/32x32/icondock/twitchtv.png +0 -0
  69. assets/img/32x32/icondock/twitter.png +0 -0
  70. assets/img/32x32/icondock/vimeo.png +0 -0
  71. assets/img/32x32/icondock/vkontakte.png +0 -0
  72. assets/img/32x32/icondock/wordpress.png +0 -0
  73. assets/img/32x32/icondock/yahoo.png +0 -0
  74. assets/img/32x32/icondock/yandex.png +0 -0
  75. assets/img/32x32/wpzoom/500px.png +0 -0
  76. assets/img/32x32/wpzoom/aol.png +0 -0
  77. assets/img/32x32/wpzoom/blogger.png +0 -0
  78. assets/img/32x32/wpzoom/facebook.png +0 -0
  79. assets/img/32x32/wpzoom/flickr.png +0 -0
  80. assets/img/32x32/wpzoom/foursquare.png +0 -0
  81. assets/img/32x32/wpzoom/github.png +0 -0
  82. assets/img/32x32/wpzoom/goodreads.png +0 -0
  83. assets/img/32x32/wpzoom/google.png +0 -0
  84. assets/img/32x32/wpzoom/gowalla.png +0 -0
  85. assets/img/32x32/wpzoom/hyves.png +0 -0
  86. assets/img/32x32/wpzoom/identica.png +0 -0
  87. assets/img/32x32/wpzoom/instagram.png +0 -0
  88. assets/img/32x32/wpzoom/lastfm.png +0 -0
  89. assets/img/32x32/wpzoom/license.txt +5 -0
  90. assets/img/32x32/wpzoom/linkedin.png +0 -0
  91. assets/img/32x32/wpzoom/live.png +0 -0
  92. assets/img/32x32/wpzoom/livejournal.png +0 -0
  93. assets/img/32x32/wpzoom/mailru.png +0 -0
  94. assets/img/32x32/wpzoom/mixi.png +0 -0
  95. assets/img/32x32/wpzoom/myspace.png +0 -0
  96. assets/img/32x32/wpzoom/odnoklassniki.png +0 -0
  97. assets/img/32x32/wpzoom/openid-2.png +0 -0
  98. assets/img/32x32/wpzoom/skyrock.png +0 -0
  99. assets/img/32x32/wpzoom/stackoverflow.png +0 -0
  100. assets/img/32x32/wpzoom/steam.png +0 -0
  101. assets/img/32x32/wpzoom/tumblr.png +0 -0
  102. assets/img/32x32/wpzoom/twitchtv.png +0 -0
  103. assets/img/32x32/wpzoom/twitter.png +0 -0
  104. assets/img/32x32/wpzoom/vimeo.png +0 -0
  105. assets/img/32x32/wpzoom/vkontakte.png +0 -0
  106. assets/img/32x32/wpzoom/wordpress.png +0 -0
  107. assets/img/32x32/wpzoom/yahoo.png +0 -0
  108. assets/img/32x32/wpzoom/yandex.png +0 -0
  109. assets/img/alert.png +0 -0
  110. assets/img/flags.png +0 -0
  111. assets/img/loading.gif +0 -0
  112. assets/js/connect.js +49 -0
  113. hybridauth/Hybrid/Auth.php +406 -0
  114. hybridauth/Hybrid/Endpoint.php +217 -0
  115. hybridauth/Hybrid/Error.php +84 -0
  116. hybridauth/Hybrid/Logger.php +68 -0
  117. hybridauth/Hybrid/Provider_Adapter.php +283 -0
  118. hybridauth/Hybrid/Provider_Model.php +231 -0
  119. hybridauth/Hybrid/Provider_Model_OAuth1.php +161 -0
  120. hybridauth/Hybrid/Provider_Model_OAuth2.php +176 -0
  121. hybridauth/Hybrid/Provider_Model_OpenID.php +172 -0
  122. hybridauth/Hybrid/Providers/AOL.php +16 -0
  123. hybridauth/Hybrid/Providers/Facebook.php +269 -0
  124. hybridauth/Hybrid/Providers/Foursquare.php +56 -0
  125. hybridauth/Hybrid/Providers/GitHub.php +56 -0
  126. hybridauth/Hybrid/Providers/Goodreads.php +115 -0
  127. hybridauth/Hybrid/Providers/Google.php +119 -0
  128. hybridauth/Hybrid/Providers/Gowalla.php +102 -0
  129. hybridauth/Hybrid/Providers/Identica.php +165 -0
  130. hybridauth/Hybrid/Providers/Instagram.php +48 -0
  131. hybridauth/Hybrid/Providers/LastFM.php +111 -0
  132. hybridauth/Hybrid/Providers/LinkedIn.php +252 -0
  133. hybridauth/Hybrid/Providers/Live.php +106 -0
  134. hybridauth/Hybrid/Providers/Mailru.php +63 -0
  135. hybridauth/Hybrid/Providers/Mixi.php +6 -0
  136. hybridauth/Hybrid/Providers/MySpace.php +164 -0
  137. hybridauth/Hybrid/Providers/Odnoklassniki.php +174 -0
  138. hybridauth/Hybrid/Providers/OpenID.php +15 -0
  139. hybridauth/Hybrid/Providers/Skyrock.php +198 -0
  140. hybridauth/Hybrid/Providers/Stackoverflow.php +5 -0
  141. hybridauth/Hybrid/Providers/Steam.php +59 -0
  142. hybridauth/Hybrid/Providers/Tumblr.php +79 -0
  143. hybridauth/Hybrid/Providers/TwitchTV.php +73 -0
  144. hybridauth/Hybrid/Providers/Twitter.php +165 -0
  145. hybridauth/Hybrid/Providers/Vkontakte.php +115 -0
  146. hybridauth/Hybrid/Providers/Yahoo.php +31 -0
  147. hybridauth/Hybrid/Providers/Yandex.php +61 -0
  148. hybridauth/Hybrid/Providers/px500.php +100 -0
  149. hybridauth/Hybrid/Storage.php +97 -0
  150. hybridauth/Hybrid/User.php +31 -0
  151. hybridauth/Hybrid/User_Activity.php +39 -0
  152. hybridauth/Hybrid/User_Contact.php +37 -0
  153. hybridauth/Hybrid/User_Profile.php +84 -0
  154. hybridauth/Hybrid/index.html +10 -0
  155. hybridauth/Hybrid/resources/index.html +10 -0
  156. hybridauth/Hybrid/resources/openid_policy.html +10 -0
  157. hybridauth/Hybrid/resources/openid_realm.html +13 -0
  158. hybridauth/Hybrid/resources/openid_xrds.xml +12 -0
  159. hybridauth/Hybrid/thirdparty/Facebook/base_facebook.php +1436 -0
  160. hybridauth/Hybrid/thirdparty/Facebook/facebook.php +160 -0
  161. hybridauth/Hybrid/thirdparty/Facebook/fb_ca_chain_bundle.crt +3920 -0
  162. hybridauth/Hybrid/thirdparty/LastFM/LastFM.php +381 -0
  163. hybridauth/Hybrid/thirdparty/LinkedIn/LinkedIn.php +2639 -0
  164. hybridauth/Hybrid/thirdparty/OAuth/OAuth.php +897 -0
  165. hybridauth/Hybrid/thirdparty/OAuth/OAuth1Client.php +229 -0
  166. hybridauth/Hybrid/thirdparty/OAuth/OAuth2Client.php +245 -0
  167. hybridauth/Hybrid/thirdparty/OpenID/LightOpenID.php +834 -0
  168. hybridauth/Hybrid/thirdparty/index.html +10 -0
  169. hybridauth/index.php +15 -0
  170. hybridauth/readme.txt +12 -0
  171. includes/admin/components/advanced/index.php +111 -0
  172. includes/admin/components/bouncer/index.php +56 -0
  173. includes/admin/components/bouncer/wsl.components.bouncer.setup.php +283 -0
  174. includes/admin/components/bouncer/wsl.components.bouncer.sidebar.php +70 -0
  175. includes/admin/components/components/index.php +36 -0
  176. includes/admin/components/components/wsl.components.help.gallery.php +83 -0
  177. includes/admin/components/components/wsl.components.help.setup.php +92 -0
  178. includes/admin/components/contacts/index.php +220 -0
  179. includes/admin/components/diagnostics/index.php +75 -0
  180. includes/admin/components/help/index.php +105 -0
  181. includes/admin/components/login-widget/index.php +56 -0
  182. includes/admin/components/login-widget/wsl.components.loginwidget.setup.php +153 -0
  183. includes/admin/components/login-widget/wsl.components.loginwidget.sidebar.php +82 -0
  184. includes/admin/components/networks/index.php +65 -0
  185. includes/admin/components/networks/wsl.components.networks.addmore.php +69 -0
  186. includes/admin/components/networks/wsl.components.networks.basicinsights.php +154 -0
  187. includes/admin/components/networks/wsl.components.networks.setup.php +277 -0
  188. includes/admin/components/networks/wsl.components.networks.whyhello.php +52 -0
  189. includes/admin/components/users/index.php +41 -0
  190. includes/admin/components/users/wsl.components.users.list.php +137 -0
  191. includes/admin/components/users/wsl.components.users.profile.php +77 -0
  192. includes/admin/wsl.admin.ui.php +775 -0
  193. includes/services/wsl.authentication.php +989 -0
  194. includes/services/wsl.mail.notification.php +44 -0
  195. includes/services/wsl.user.avatar.php +77 -0
  196. includes/services/wsl.user.data.php +257 -0
  197. includes/settings/wsl.compatibilities.php +202 -0
  198. includes/settings/wsl.database.php +102 -0
  199. includes/settings/wsl.initialization.php +405 -0
  200. includes/settings/wsl.providers.php +245 -0
  201. includes/widgets/wsl.auth.widget.php +456 -0
  202. includes/widgets/wsl.complete.registration.php +161 -0
  203. includes/widgets/wsl.notices.php +67 -0
  204. languages/wordpress-social-login-ar.mo +0 -0
  205. languages/wordpress-social-login-ar.po +1446 -0
  206. languages/wordpress-social-login-de_DE.mo +0 -0
  207. languages/wordpress-social-login-de_DE.po +1449 -0
  208. languages/wordpress-social-login-es_ES.mo +0 -0
  209. languages/wordpress-social-login-es_ES.po +1446 -0
  210. languages/wordpress-social-login-fr_FR.mo +0 -0
  211. languages/wordpress-social-login-fr_FR.po +1446 -0
  212. languages/wordpress-social-login-he_IL.mo +0 -0
  213. languages/wordpress-social-login-he_IL.po +1446 -0
  214. languages/wordpress-social-login-ja.mo +0 -0
  215. languages/wordpress-social-login-ja.po +1446 -0
  216. languages/wordpress-social-login-ru_RU.mo +0 -0
  217. languages/wordpress-social-login-ru_RU.po +1446 -0
  218. languages/wordpress-social-login-zh_CN.mo +0 -0
  219. languages/wordpress-social-login-zh_CN.po +1446 -0
  220. readme.txt +105 -0
  221. screenshot-1.png +0 -0
  222. screenshot-2.png +0 -0
  223. screenshot-3.png +0 -0
  224. screenshot-4.png +0 -0
  225. services/diagnostics.php +168 -0
  226. services/index.php +2 -0
  227. services/siteinfo.php +135 -0
  228. wp-social-login.php +245 -0
assets/css/style.css ADDED
@@ -0,0 +1,15 @@
1
+ #wp-social-login-connect-with{
2
+ font-weight: bold;
3
+ }
4
+
5
+ #wp-social-login-connect-options{
6
+ padding:10px;
7
+ }
8
+
9
+ #wp-social-login-connect-options a{
10
+ text-decoration: none;
11
+ }
12
+
13
+ #wp-social-login-connect-options img{
14
+ border:0 none;
15
+ }
assets/img/16x16/500px.png ADDED
Binary file
assets/img/16x16/aol.png ADDED
Binary file
assets/img/16x16/blogger.png ADDED
Binary file
assets/img/16x16/dribbble.png ADDED
Binary file
assets/img/16x16/facebook.png ADDED
Binary file
assets/img/16x16/flickr-2.png ADDED
Binary file
assets/img/16x16/flickr.png ADDED
Binary file
assets/img/16x16/foursquare.png ADDED
Binary file
assets/img/16x16/github.png ADDED
Binary file
assets/img/16x16/goodreads.png ADDED
Binary file
assets/img/16x16/google.png ADDED
Binary file
assets/img/16x16/gowalla.png ADDED
Binary file
assets/img/16x16/hyves.png ADDED
Binary file
assets/img/16x16/identica.png ADDED
Binary file
assets/img/16x16/instagram.png ADDED
Binary file
assets/img/16x16/lastfm.png ADDED
Binary file
assets/img/16x16/linkedin.png ADDED
Binary file
assets/img/16x16/live.png ADDED
Binary file
assets/img/16x16/livejournal.png ADDED
Binary file
assets/img/16x16/mailru.png ADDED
Binary file
assets/img/16x16/mixi.png ADDED
Binary file
assets/img/16x16/mixx.png ADDED
Binary file
assets/img/16x16/myspace.png ADDED
Binary file
assets/img/16x16/odnoklassniki.png ADDED
Binary file
assets/img/16x16/openid-2.png ADDED
Binary file
assets/img/16x16/orkut.png ADDED
Binary file
assets/img/16x16/paypal.png ADDED
Binary file
assets/img/16x16/skyrock.png ADDED
Binary file
assets/img/16x16/stackoverflow.png ADDED
Binary file
assets/img/16x16/steam.png ADDED
Binary file
assets/img/16x16/tumblr.png ADDED
Binary file
assets/img/16x16/twitchtv.png ADDED
Binary file
assets/img/16x16/twitter.png ADDED
Binary file
assets/img/16x16/vimeo.png ADDED
Binary file
assets/img/16x16/vkontakte.png ADDED
Binary file
assets/img/16x16/windows.png ADDED
Binary file
assets/img/16x16/wordpress.png ADDED
Binary file
assets/img/16x16/yahoo.png ADDED
Binary file
assets/img/16x16/yandex.png ADDED
Binary file
assets/img/32x32/icondock/500px.png ADDED
Binary file
assets/img/32x32/icondock/aol.png ADDED
Binary file
assets/img/32x32/icondock/blogger.png ADDED
Binary file
assets/img/32x32/icondock/facebook.png ADDED
Binary file
assets/img/32x32/icondock/flickr.png ADDED
Binary file
assets/img/32x32/icondock/foursquare.png ADDED
Binary file
assets/img/32x32/icondock/github.png ADDED
Binary file
assets/img/32x32/icondock/goodreads.png ADDED
Binary file
assets/img/32x32/icondock/google.png ADDED
Binary file
assets/img/32x32/icondock/gowalla.png ADDED
Binary file
assets/img/32x32/icondock/hyves.png ADDED
Binary file
assets/img/32x32/icondock/identica.png ADDED
Binary file
assets/img/32x32/icondock/info.txt ADDED
@@ -0,0 +1,6 @@
1
+ Vector Social Media Icons
2
+ by IconDock.com & Double-J Design (http://www.doublejdesign.co.uk)
3
+
4
+ URL: http://icondock.com/free/vector-social-media-icons
5
+
6
+ Note: the company logos in the icons are copyright of their respective owners.
assets/img/32x32/icondock/instagram.png ADDED
Binary file
assets/img/32x32/icondock/lastfm.png ADDED
Binary file
assets/img/32x32/icondock/linkedin.png ADDED
Binary file
assets/img/32x32/icondock/live.png ADDED
Binary file
assets/img/32x32/icondock/livejournal.png ADDED
Binary file
assets/img/32x32/icondock/mailru.png ADDED
Binary file
assets/img/32x32/icondock/mixi.png ADDED
Binary file
assets/img/32x32/icondock/msn.png ADDED
Binary file
assets/img/32x32/icondock/myspace.png ADDED
Binary file
assets/img/32x32/icondock/odnoklassniki.png ADDED
Binary file
assets/img/32x32/icondock/skyrock.png ADDED
Binary file
assets/img/32x32/icondock/stackoverflow.png ADDED
Binary file
assets/img/32x32/icondock/steam.png ADDED
Binary file
assets/img/32x32/icondock/tumblr.png ADDED
Binary file
assets/img/32x32/icondock/twitchtv.png ADDED
Binary file
assets/img/32x32/icondock/twitter.png ADDED
Binary file
assets/img/32x32/icondock/vimeo.png ADDED
Binary file
assets/img/32x32/icondock/vkontakte.png ADDED
Binary file
assets/img/32x32/icondock/wordpress.png ADDED
Binary file
assets/img/32x32/icondock/yahoo.png ADDED
Binary file
assets/img/32x32/icondock/yandex.png ADDED
Binary file
assets/img/32x32/wpzoom/500px.png ADDED
Binary file
assets/img/32x32/wpzoom/aol.png ADDED
Binary file
assets/img/32x32/wpzoom/blogger.png ADDED
Binary file
assets/img/32x32/wpzoom/facebook.png ADDED
Binary file
assets/img/32x32/wpzoom/flickr.png ADDED
Binary file
assets/img/32x32/wpzoom/foursquare.png ADDED
Binary file
assets/img/32x32/wpzoom/github.png ADDED
Binary file
assets/img/32x32/wpzoom/goodreads.png ADDED
Binary file
assets/img/32x32/wpzoom/google.png ADDED
Binary file
assets/img/32x32/wpzoom/gowalla.png ADDED
Binary file
assets/img/32x32/wpzoom/hyves.png ADDED
Binary file
assets/img/32x32/wpzoom/identica.png ADDED
Binary file
assets/img/32x32/wpzoom/instagram.png ADDED
Binary file
assets/img/32x32/wpzoom/lastfm.png ADDED
Binary file
assets/img/32x32/wpzoom/license.txt ADDED
@@ -0,0 +1,5 @@
1
+ WPZOOM Social Networking Icon Set by WPZOOM is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License (http://creativecommons.org/licenses/by-sa/3.0/).
2
+
3
+ You are allowed to use these icons anywhere you want, however we’ll highly appreciate if you will link to our website when you share them - http://www.wpzoom.com
4
+
5
+ Designed by David Ferreira.
assets/img/32x32/wpzoom/linkedin.png ADDED
Binary file
assets/img/32x32/wpzoom/live.png ADDED
Binary file
assets/img/32x32/wpzoom/livejournal.png ADDED
Binary file
assets/img/32x32/wpzoom/mailru.png ADDED
Binary file
assets/img/32x32/wpzoom/mixi.png ADDED
Binary file
assets/img/32x32/wpzoom/myspace.png ADDED
Binary file
assets/img/32x32/wpzoom/odnoklassniki.png ADDED
Binary file
assets/img/32x32/wpzoom/openid-2.png ADDED
Binary file
assets/img/32x32/wpzoom/skyrock.png ADDED
Binary file
assets/img/32x32/wpzoom/stackoverflow.png ADDED
Binary file
assets/img/32x32/wpzoom/steam.png ADDED
Binary file
assets/img/32x32/wpzoom/tumblr.png ADDED
Binary file
assets/img/32x32/wpzoom/twitchtv.png ADDED
Binary file
assets/img/32x32/wpzoom/twitter.png ADDED
Binary file
assets/img/32x32/wpzoom/vimeo.png ADDED
Binary file
assets/img/32x32/wpzoom/vkontakte.png ADDED
Binary file
assets/img/32x32/wpzoom/wordpress.png ADDED
Binary file
assets/img/32x32/wpzoom/yahoo.png ADDED
Binary file
assets/img/32x32/wpzoom/yandex.png ADDED
Binary file
assets/img/alert.png ADDED
Binary file
assets/img/flags.png ADDED
Binary file
assets/img/loading.gif ADDED
Binary file
assets/js/connect.js ADDED
@@ -0,0 +1,49 @@
1
+ /* Based on http://wordpress.org/extend/plugins/social-connect/ */
2
+
3
+ (function($){
4
+ $(function(){
5
+ $(".wsl_connect_with_provider").click(function(){
6
+ popupurl = $("#wsl_popup_base_url").val();
7
+ provider = $(this).attr("data-provider");
8
+
9
+ window.open(
10
+ popupurl+"provider="+provider,
11
+ "hybridauth_social_sing_on",
12
+ "location=1,status=0,scrollbars=0,width=1000,height=600"
13
+ );
14
+ });
15
+ });
16
+ })(jQuery);
17
+
18
+ window.wsl_wordpress_social_login = function(config) {
19
+ jQuery('#loginform').unbind('submit.simplemodal-login');
20
+
21
+ var form_id = '#loginform';
22
+
23
+ if(!jQuery('#loginform').length) {
24
+ // if register form exists, just use that
25
+ if( jQuery('#registerform').length ) {
26
+ form_id = '#registerform';
27
+ }
28
+ else {
29
+ // create the login form
30
+ var login_uri = jQuery("#wsl_login_form_uri").val();
31
+
32
+ jQuery('body').append("<form id='loginform' method='post' action='" + login_uri + "'></form>");
33
+ jQuery('#loginform').append("<input type='hidden' id='redirect_to' name='redirect_to' value='" + window.location.href + "'>");
34
+ }
35
+ }
36
+
37
+ jQuery.each(config, function(key, value) {
38
+ jQuery("#" + key).remove();
39
+ jQuery(form_id).append("<input type='hidden' id='" + key + "' name='" + key + "' value='" + value + "'>");
40
+ });
41
+
42
+ if(jQuery("#simplemodal-login-form").length) {
43
+ var current_url = window.location.href;
44
+ jQuery("#redirect_to").remove();
45
+ jQuery(form_id).append("<input type='hidden' id='redirect_to' name='redirect_to' value='" + current_url + "'>");
46
+ }
47
+
48
+ jQuery(form_id).submit();
49
+ }
hybridauth/Hybrid/Auth.php ADDED
@@ -0,0 +1,406 @@
1
+ <?php
2
+ /*!
3
+ * HybridAuth
4
+ * http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth
5
+ * (c) 2009-2012, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html
6
+ */
7
+
8
+ /**
9
+ * Hybrid_Auth class
10
+ *
11
+ * Hybrid_Auth class provide a simple way to authenticate users via OpenID and OAuth.
12
+ *
13
+ * Generally, Hybrid_Auth is the only class you should instanciate and use throughout your application.
14
+ */
15
+ class Hybrid_Auth
16
+ {
17
+ public static $version = "2.1.1-dev";
18
+
19
+ public static $config = array();
20
+
21
+ public static $store = NULL;
22
+
23
+ public static $error = NULL;
24
+
25
+ public static $logger = NULL;
26
+
27
+ // --------------------------------------------------------------------
28
+
29
+ /**
30
+ * Try to start a new session of none then initialize Hybrid_Auth
31
+ *
32
+ * Hybrid_Auth constructor will require either a valid config array or
33
+ * a path for a configuration file as parameter. To know more please
34
+ * refer to the Configuration section:
35
+ * http://hybridauth.sourceforge.net/userguide/Configuration.html
36
+ */
37
+ function __construct( $config )
38
+ {
39
+ Hybrid_Auth::initialize( $config );
40
+ }
41
+
42
+ // --------------------------------------------------------------------
43
+
44
+ /**
45
+ * Try to initialize Hybrid_Auth with given $config hash or file
46
+ */
47
+ public static function initialize( $config )
48
+ {
49
+ if( ! is_array( $config ) && ! file_exists( $config ) ){
50
+ throw new Exception( "Hybriauth config does not exist on the given path.", 1 );
51
+ }
52
+
53
+ if( ! is_array( $config ) ){
54
+ $config = include $config;
55
+ }
56
+
57
+ // build some need'd paths
58
+ $config["path_base"] = realpath( dirname( __FILE__ ) ) . "/";
59
+ $config["path_libraries"] = $config["path_base"] . "thirdparty/";
60
+ $config["path_resources"] = $config["path_base"] . "resources/";
61
+ $config["path_providers"] = $config["path_base"] . "Providers/";
62
+
63
+ // reset debug mode
64
+ if( ! isset( $config["debug_mode"] ) ){
65
+ $config["debug_mode"] = false;
66
+ $config["debug_file"] = null;
67
+ }
68
+
69
+ # load hybridauth required files, a autoload is on the way...
70
+ require_once $config["path_base"] . "Error.php";
71
+ require_once $config["path_base"] . "Logger.php";
72
+
73
+ require_once $config["path_base"] . "Storage.php";
74
+
75
+ require_once $config["path_base"] . "Provider_Adapter.php";
76
+
77
+ require_once $config["path_base"] . "Provider_Model.php";
78
+ require_once $config["path_base"] . "Provider_Model_OpenID.php";
79
+ require_once $config["path_base"] . "Provider_Model_OAuth1.php";
80
+ require_once $config["path_base"] . "Provider_Model_OAuth2.php";
81
+
82
+ require_once $config["path_base"] . "User.php";
83
+ require_once $config["path_base"] . "User_Profile.php";
84
+ require_once $config["path_base"] . "User_Contact.php";
85
+ require_once $config["path_base"] . "User_Activity.php";
86
+
87
+ // hash given config
88
+ Hybrid_Auth::$config = $config;
89
+
90
+ // instace of log mng
91
+ Hybrid_Auth::$logger = new Hybrid_Logger();
92
+
93
+ // instace of errors mng
94
+ Hybrid_Auth::$error = new Hybrid_Error();
95
+
96
+ // start session storage mng
97
+ Hybrid_Auth::$store = new Hybrid_Storage();
98
+
99
+ Hybrid_Logger::info( "Enter Hybrid_Auth::initialize()");
100
+ Hybrid_Logger::info( "Hybrid_Auth::initialize(). PHP version: " . PHP_VERSION );
101
+ Hybrid_Logger::info( "Hybrid_Auth::initialize(). Hybrid_Auth version: " . Hybrid_Auth::$version );
102
+ Hybrid_Logger::info( "Hybrid_Auth::initialize(). Hybrid_Auth called from: " . Hybrid_Auth::getCurrentUrl() );
103
+
104
+ // PHP Curl extension [http://www.php.net/manual/en/intro.curl.php]
105
+ if ( ! function_exists('curl_init') ) {
106
+ Hybrid_Logger::error('Hybridauth Library needs the CURL PHP extension.');
107
+ throw new Exception('Hybridauth Library needs the CURL PHP extension.');
108
+ }
109
+
110
+ // PHP JSON extension [http://php.net/manual/en/book.json.php]
111
+ if ( ! function_exists('json_decode') ) {
112
+ Hybrid_Logger::error('Hybridauth Library needs the JSON PHP extension.');
113
+ throw new Exception('Hybridauth Library needs the JSON PHP extension.');
114
+ }
115
+
116
+ // session.name
117
+ if( session_name() != "PHPSESSID" ){
118
+ Hybrid_Logger::info('PHP session.name diff from default PHPSESSID. http://php.net/manual/en/session.configuration.php#ini.session.name.');
119
+ }
120
+
121
+ // safe_mode is on
122
+ if( ini_get('safe_mode') ){
123
+ Hybrid_Logger::info('PHP safe_mode is on. http://php.net/safe-mode.');
124
+ }
125
+
126
+ // open basedir is on
127
+ if( ini_get('open_basedir') ){
128
+ Hybrid_Logger::info('PHP open_basedir is on. http://php.net/open-basedir.');
129
+ }
130
+
131
+ Hybrid_Logger::debug( "Hybrid_Auth initialize. dump used config: ", serialize( $config ) );
132
+ Hybrid_Logger::debug( "Hybrid_Auth initialize. dump current session: ", Hybrid_Auth::storage()->getSessionData() );
133
+ Hybrid_Logger::info( "Hybrid_Auth initialize: check if any error is stored on the endpoint..." );
134
+
135
+ if( Hybrid_Error::hasError() ){
136
+ $m = Hybrid_Error::getErrorMessage();
137
+ $c = Hybrid_Error::getErrorCode();
138
+ $p = Hybrid_Error::getErrorPrevious();
139
+
140
+ Hybrid_Logger::error( "Hybrid_Auth initialize: A stored Error found, Throw an new Exception and delete it from the store: Error#$c, '$m'" );
141
+
142
+ Hybrid_Error::clearError();
143
+
144
+ // try to provide the previous if any
145
+ // Exception::getPrevious (PHP 5 >= 5.3.0) http://php.net/manual/en/exception.getprevious.php
146
+ if ( version_compare( PHP_VERSION, '5.3.0', '>=' ) && ($p instanceof Exception) ) {
147
+ throw new Exception( $m, $c, $p );
148
+ }
149
+ else{
150
+ throw new Exception( $m, $c );
151
+ }
152
+ }
153
+
154
+ Hybrid_Logger::info( "Hybrid_Auth initialize: no error found. initialization succeed." );
155
+
156
+ // Endof initialize
157
+ }
158
+
159
+ // --------------------------------------------------------------------
160
+
161
+ /**
162
+ * Hybrid storage system accessor
163
+ *
164
+ * Users sessions are stored using HybridAuth storage system ( HybridAuth 2.0 handle PHP Session only) and can be acessed directly by
165
+ * Hybrid_Auth::storage()->get($key) to retrieves the data for the given key, or calling
166
+ * Hybrid_Auth::storage()->set($key, $value) to store the key => $value set.
167
+ */
168
+ public static function storage()
169
+ {
170
+ return Hybrid_Auth::$store;
171
+ }
172
+
173
+ // --------------------------------------------------------------------
174
+
175
+ /**
176
+ * Get hybridauth session data.
177
+ */
178
+ function getSessionData()
179
+ {
180
+ return Hybrid_Auth::storage()->getSessionData();
181
+ }
182
+
183
+ // --------------------------------------------------------------------
184
+
185
+ /**
186
+ * restore hybridauth session data.
187
+ */
188
+ function restoreSessionData( $sessiondata = NULL )
189
+ {
190
+ Hybrid_Auth::storage()->restoreSessionData( $sessiondata );
191
+ }
192
+
193
+ // --------------------------------------------------------------------
194
+
195
+ /**
196
+ * Try to authenticate the user with a given provider.
197
+ *
198
+ * If the user is already connected we just return and instance of provider adapter,
199
+ * ELSE, try to authenticate and authorize the user with the provider.
200
+ *
201
+ * $params is generally an array with required info in order for this provider and HybridAuth to work,
202
+ * like :
203
+ * hauth_return_to: URL to call back after authentication is done
204
+ * openid_identifier: The OpenID identity provider identifier
205
+ * google_service: can be "Users" for Google user accounts service or "Apps" for Google hosted Apps
206
+ */
207
+ public static function authenticate( $providerId, $params = NULL )
208
+ {
209
+ Hybrid_Logger::info( "Enter Hybrid_Auth::authenticate( $providerId )" );
210
+
211
+ // if user not connected to $providerId then try setup a new adapter and start the login process for this provider
212
+ if( ! Hybrid_Auth::storage()->get( "hauth_session.$providerId.is_logged_in" ) ){
213
+ Hybrid_Logger::info( "Hybrid_Auth::authenticate( $providerId ), User not connected to the provider. Try to authenticate.." );
214
+
215
+ $provider_adapter = Hybrid_Auth::setup( $providerId, $params );
216
+
217
+ $provider_adapter->login();
218
+ }
219
+
220
+ // else, then return the adapter instance for the given provider
221
+ else{
222
+ Hybrid_Logger::info( "Hybrid_Auth::authenticate( $providerId ), User is already connected to this provider. Return the adapter instance." );
223
+
224
+ return Hybrid_Auth::getAdapter( $providerId );
225
+ }
226
+ }
227
+
228
+ // --------------------------------------------------------------------
229
+
230
+ /**
231
+ * Return the adapter instance for an authenticated provider
232
+ */
233
+ public static function getAdapter( $providerId = NULL )
234
+ {
235
+ Hybrid_Logger::info( "Enter Hybrid_Auth::getAdapter( $providerId )" );
236
+
237
+ return Hybrid_Auth::setup( $providerId );
238
+ }
239
+
240
+ // --------------------------------------------------------------------
241
+
242
+ /**
243
+ * Setup an adapter for a given provider
244
+ */
245
+ public static function setup( $providerId, $params = NULL )
246
+ {
247
+ Hybrid_Logger::debug( "Enter Hybrid_Auth::setup( $providerId )", $params );
248
+
249
+ if( ! $params ){
250
+ $params = Hybrid_Auth::storage()->get( "hauth_session.$providerId.id_provider_params" );
251
+
252
+ Hybrid_Logger::debug( "Hybrid_Auth::setup( $providerId ), no params given. Trying to get the sotred for this provider.", $params );
253
+ }
254
+
255
+ if( ! $params ){
256
+ $params = ARRAY();
257
+
258
+ Hybrid_Logger::info( "Hybrid_Auth::setup( $providerId ), no stored params found for this provider. Initialize a new one for new session" );
259
+ }
260
+
261
+ if( ! isset( $params["hauth_return_to"] ) ){
262
+ $params["hauth_return_to"] = Hybrid_Auth::getCurrentUrl();
263
+ }
264
+
265
+ Hybrid_Logger::debug( "Hybrid_Auth::setup( $providerId ). HybridAuth Callback URL set to: ", $params["hauth_return_to"] );
266
+
267
+ # instantiate a new IDProvider Adapter
268
+ $provider = new Hybrid_Provider_Adapter();
269
+
270
+ $provider->factory( $providerId, $params );
271
+
272
+ return $provider;
273
+ }
274
+
275
+ // --------------------------------------------------------------------
276
+
277
+ /**
278
+ * Check if the current user is connected to a given provider
279
+ */
280
+ public static function isConnectedWith( $providerId )
281
+ {
282
+ return (bool) Hybrid_Auth::storage()->get( "hauth_session.{$providerId}.is_logged_in" );
283
+ }
284
+
285
+ // --------------------------------------------------------------------
286
+
287
+ /**
288
+ * Return array listing all authenticated providers
289
+ */
290
+ public static function getConnectedProviders()
291
+ {
292
+ $idps = array();
293
+
294
+ foreach( Hybrid_Auth::$config["providers"] as $idpid => $params ){
295
+ if( Hybrid_Auth::isConnectedWith( $idpid ) ){
296
+ $idps[] = $idpid;
297
+ }
298
+ }
299
+
300
+ return $idps;
301
+ }
302
+
303
+ // --------------------------------------------------------------------
304
+
305
+ /**
306
+ * Return array listing all enabled providers as well as a flag if you are connected.
307
+ */
308
+ public static function getProviders()
309
+ {
310
+ $idps = array();
311
+
312
+ foreach( Hybrid_Auth::$config["providers"] as $idpid => $params ){
313
+ if($params['enabled']) {
314
+ $idps[$idpid] = array( 'connected' => false );
315
+
316
+ if( Hybrid_Auth::isConnectedWith( $idpid ) ){
317
+ $idps[$idpid]['connected'] = true;
318
+ }
319
+ }
320
+ }
321
+
322
+ return $idps;
323
+ }
324
+
325
+ // --------------------------------------------------------------------
326
+
327
+ /**
328
+ * A generic function to logout all connected provider at once
329
+ */
330
+ public static function logoutAllProviders()
331
+ {
332
+ $idps = Hybrid_Auth::getConnectedProviders();
333
+
334
+ foreach( $idps as $idp ){
335
+ $adapter = Hybrid_Auth::getAdapter( $idp );
336
+
337
+ $adapter->logout();
338
+ }
339
+ }
340
+
341
+ // --------------------------------------------------------------------
342
+
343
+ /**
344
+ * Utility function, redirect to a given URL with php header or using javascript location.href
345
+ */
346
+ public static function redirect( $url, $mode = "PHP" )
347
+ {
348
+ Hybrid_Logger::info( "Enter Hybrid_Auth::redirect( $url, $mode )" );
349
+
350
+ if( $mode == "PHP" ){
351
+ header( "Location: $url" ) ;
352
+ }
353
+ elseif( $mode == "JS" ){
354
+ echo '<html>';
355
+ echo '<head>';
356
+ echo '<script type="text/javascript">';
357
+ echo 'function redirect(){ window.top.location.href="' . $url . '"; }';
358
+ echo '</script>';
359
+ echo '</head>';
360
+ echo '<body onload="redirect()">';
361
+ echo 'Redirecting, please wait...';
362
+ echo '</body>';
363
+ echo '</html>';
364
+ }
365
+
366
+ die();
367
+ }
368
+
369
+ // --------------------------------------------------------------------
370
+
371
+ /**
372
+ * Utility function, return the current url. TRUE to get $_SERVER['REQUEST_URI'], FALSE for $_SERVER['PHP_SELF']
373
+ */
374
+ public static function getCurrentUrl( $request_uri = true )
375
+ {
376
+ if(
377
+ isset( $_SERVER['HTTPS'] ) && ( $_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1 )
378
+ || isset( $_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'
379
+ ){
380
+ $protocol = 'https://';
381
+ }
382
+ else {
383
+ $protocol = 'http://';
384
+ }
385
+
386
+ $url = $protocol . $_SERVER['HTTP_HOST'];
387
+
388
+ // use port if non default
389
+ if( isset( $_SERVER['SERVER_PORT'] ) && strpos( $url, ':'.$_SERVER['SERVER_PORT'] ) === FALSE ) {
390
+ $url .= ($protocol === 'http://' && $_SERVER['SERVER_PORT'] != 80 && !isset( $_SERVER['HTTP_X_FORWARDED_PROTO']))
391
+ || ($protocol === 'https://' && $_SERVER['SERVER_PORT'] != 443 && !isset( $_SERVER['HTTP_X_FORWARDED_PROTO']))
392
+ ? ':' . $_SERVER['SERVER_PORT']
393
+ : '';
394
+ }
395
+
396
+ if( $request_uri ){
397
+ $url .= $_SERVER['REQUEST_URI'];
398
+ }
399
+ else{
400
+ $url .= $_SERVER['PHP_SELF'];
401
+ }
402
+
403
+ // return current url
404
+ return $url;
405
+ }
406
+ }
hybridauth/Hybrid/Endpoint.php ADDED
@@ -0,0 +1,217 @@
1
+ <?php
2
+ /*!
3
+ * HybridAuth
4
+ * http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth
5
+ * (c) 2009-2012, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html
6
+ */
7
+
8
+ /**
9
+ * Hybrid_Endpoint class
10
+ *
11
+ * Hybrid_Endpoint class provides a simple way to handle the OpenID and OAuth endpoint.
12
+ */
13
+ class Hybrid_Endpoint {
14
+ public static $request = NULL;
15
+ public static $initDone = FALSE;
16
+
17
+ /**
18
+ * Process the current request
19
+ *
20
+ * $request - The current request parameters. Leave as NULL to default to use $_REQUEST.
21
+ */
22
+ public static function process( $request = NULL )
23
+ {
24
+ // Setup request variable
25
+ Hybrid_Endpoint::$request = $request;
26
+
27
+ if ( is_null(Hybrid_Endpoint::$request) ){
28
+ // Fix a strange behavior when some provider call back ha endpoint
29
+ // with /index.php?hauth.done={provider}?{args}...
30
+ // >here we need to recreate the $_REQUEST
31
+ if ( strrpos( $_SERVER["QUERY_STRING"], '?' ) ) {
32
+ $_SERVER["QUERY_STRING"] = str_replace( "?", "&", $_SERVER["QUERY_STRING"] );
33
+
34
+ parse_str( $_SERVER["QUERY_STRING"], $_REQUEST );
35
+ }
36
+
37
+ Hybrid_Endpoint::$request = $_REQUEST;
38
+ }
39
+
40
+ // If openid_policy requested, we return our policy document
41
+ if ( isset( Hybrid_Endpoint::$request["get"] ) && Hybrid_Endpoint::$request["get"] == "openid_policy" ) {
42
+ Hybrid_Endpoint::processOpenidPolicy();
43
+ }
44
+
45
+ // If openid_xrds requested, we return our XRDS document
46
+ if ( isset( Hybrid_Endpoint::$request["get"] ) && Hybrid_Endpoint::$request["get"] == "openid_xrds" ) {
47
+ Hybrid_Endpoint::processOpenidXRDS();
48
+ }
49
+
50
+ // If we get a hauth.start
51
+ if ( isset( Hybrid_Endpoint::$request["hauth_start"] ) && Hybrid_Endpoint::$request["hauth_start"] ) {
52
+ Hybrid_Endpoint::processAuthStart();
53
+ }
54
+ // Else if hauth.done
55
+ elseif ( isset( Hybrid_Endpoint::$request["hauth_done"] ) && Hybrid_Endpoint::$request["hauth_done"] ) {
56
+ Hybrid_Endpoint::processAuthDone();
57
+ }
58
+ // Else we advertise our XRDS document, something supposed to be done from the Realm URL page
59
+ else {
60
+ Hybrid_Endpoint::processOpenidRealm();
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Process OpenID policy request
66
+ */
67
+ public static function processOpenidPolicy()
68
+ {
69
+ $output = file_get_contents( dirname(__FILE__) . "/resources/openid_policy.html" );
70
+ print $output;
71
+ die();
72
+ }
73
+
74
+ /**
75
+ * Process OpenID XRDS request
76
+ */
77
+ public static function processOpenidXRDS()
78
+ {
79
+ header("Content-Type: application/xrds+xml");
80
+
81
+ $output = str_replace
82
+ (
83
+ "{RETURN_TO_URL}",
84
+ str_replace(
85
+ array("<", ">", "\"", "'", "&"), array("&lt;", "&gt;", "&quot;", "&apos;", "&amp;"),
86
+ Hybrid_Auth::getCurrentUrl( false )
87
+ ),
88
+ file_get_contents( dirname(__FILE__) . "/resources/openid_xrds.xml" )
89
+ );
90
+ print $output;
91
+ die();
92
+ }
93
+
94
+ /**
95
+ * Process OpenID realm request
96
+ */
97
+ public static function processOpenidRealm()
98
+ {
99
+ $output = str_replace
100
+ (
101
+ "{X_XRDS_LOCATION}",
102
+ htmlentities( Hybrid_Auth::getCurrentUrl( false ), ENT_QUOTES, 'UTF-8' ) . "?get=openid_xrds&v=" . Hybrid_Auth::$version,
103
+ file_get_contents( dirname(__FILE__) . "/resources/openid_realm.html" )
104
+ );
105
+ print $output;
106
+ die();
107
+ }
108
+
109
+ /**
110
+ * define:endpoint step 3.
111
+ */
112
+ public static function processAuthStart()
113
+ {
114
+ Hybrid_Endpoint::authInit();
115
+
116
+ $provider_id = trim( strip_tags( Hybrid_Endpoint::$request["hauth_start"] ) );
117
+
118
+ # check if page accessed directly
119
+ if( ! Hybrid_Auth::storage()->get( "hauth_session.$provider_id.hauth_endpoint" ) ) {
120
+ Hybrid_Logger::error( "Endpoint: hauth_endpoint parameter is not defined on hauth_start, halt login process!" );
121
+
122
+ header( "HTTP/1.0 404 Not Found" );
123
+ die( "You cannot access this page directly." );
124
+ }
125
+
126
+ # define:hybrid.endpoint.php step 2.
127
+ $hauth = Hybrid_Auth::setup( $provider_id );
128
+
129
+ # if REQUESTed hauth_idprovider is wrong, session not created, etc.
130
+ if( ! $hauth ) {
131
+ Hybrid_Logger::error( "Endpoint: Invalid parameter on hauth_start!" );
132
+
133
+ header( "HTTP/1.0 404 Not Found" );
134
+ die( "Invalid parameter! Please return to the login page and try again." );
135
+ }
136
+
137
+ try {
138
+ Hybrid_Logger::info( "Endpoint: call adapter [{$provider_id}] loginBegin()" );
139
+
140
+ $hauth->adapter->loginBegin();
141
+ }
142
+ catch ( Exception $e ) {
143
+ Hybrid_Logger::error( "Exception:" . $e->getMessage(), $e );
144
+ Hybrid_Error::setError( $e->getMessage(), $e->getCode(), $e->getTraceAsString(), $e );
145
+
146
+ $hauth->returnToCallbackUrl();
147
+ }
148
+
149
+ die();
150
+ }
151
+
152
+ /**
153
+ * define:endpoint step 3.1 and 3.2
154
+ */
155
+ public static function processAuthDone()
156
+ {
157
+ Hybrid_Endpoint::authInit();
158
+
159
+ $provider_id = trim( strip_tags( Hybrid_Endpoint::$request["hauth_done"] ) );
160
+
161
+ $hauth = Hybrid_Auth::setup( $provider_id );
162
+
163
+ if( ! $hauth ) {
164
+ Hybrid_Logger::error( "Endpoint: Invalid parameter on hauth_done!" );
165
+
166
+ $hauth->adapter->setUserUnconnected();
167
+
168
+ header("HTTP/1.0 404 Not Found");
169
+ die( "Invalid parameter! Please return to the login page and try again." );
170
+ }
171
+
172
+ try {
173
+ Hybrid_Logger::info( "Endpoint: call adapter [{$provider_id}] loginFinish() " );
174
+
175
+ $hauth->adapter->loginFinish();
176
+ }
177
+ catch( Exception $e ){
178
+ Hybrid_Logger::error( "Exception:" . $e->getMessage(), $e );
179
+ Hybrid_Error::setError( $e->getMessage(), $e->getCode(), $e->getTraceAsString(), $e );
180
+
181
+ $hauth->adapter->setUserUnconnected();
182
+ }
183
+
184
+ Hybrid_Logger::info( "Endpoint: job done. retrun to callback url." );
185
+
186
+ $hauth->returnToCallbackUrl();
187
+ die();
188
+ }
189
+
190
+ public static function authInit()
191
+ {
192
+ if ( ! Hybrid_Endpoint::$initDone) {
193
+ Hybrid_Endpoint::$initDone = TRUE;
194
+
195
+ # Init Hybrid_Auth
196
+ try {
197
+ require_once realpath( dirname( __FILE__ ) ) . "/Storage.php";
198
+
199
+ $storage = new Hybrid_Storage();
200
+
201
+ // Check if Hybrid_Auth session already exist
202
+ if ( ! $storage->config( "CONFIG" ) ) {
203
+ header( "HTTP/1.0 404 Not Found" );
204
+ die( "You cannot access this page directly." );
205
+ }
206
+
207
+ Hybrid_Auth::initialize( $storage->config( "CONFIG" ) );
208
+ }
209
+ catch ( Exception $e ){
210
+ Hybrid_Logger::error( "Endpoint: Error while trying to init Hybrid_Auth" );
211
+
212
+ header( "HTTP/1.0 404 Not Found" );
213
+ die( "Oophs. Error!" );
214
+ }
215
+ }
216
+ }
217
+ }
hybridauth/Hybrid/Error.php ADDED
@@ -0,0 +1,84 @@
1
+ <?php
2
+ /*!
3
+ * HybridAuth
4
+ * http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth
5
+ * (c) 2009-2012, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html
6
+ */
7
+
8
+ /**
9
+ * Errors manager
10
+ *
11
+ * HybridAuth errors are stored in Hybrid::storage() and not displayed directly to the end user
12
+ */
13
+ class Hybrid_Error
14
+ {
15
+ /**
16
+ * store error in session
17
+ */
18
+ public static function setError( $message, $code = NULL, $trace = NULL, $previous = NULL )
19
+ {
20
+ Hybrid_Logger::info( "Enter Hybrid_Error::setError( $message )" );
21
+
22
+ Hybrid_Auth::storage()->set( "hauth_session.error.status" , 1 );
23
+ Hybrid_Auth::storage()->set( "hauth_session.error.message" , $message );
24
+ Hybrid_Auth::storage()->set( "hauth_session.error.code" , $code );
25
+ Hybrid_Auth::storage()->set( "hauth_session.error.trace" , $trace );
26
+ Hybrid_Auth::storage()->set( "hauth_session.error.previous", $previous );
27
+ }
28
+
29
+ /**
30
+ * clear the last error
31
+ */
32
+ public static function clearError()
33
+ {
34
+ Hybrid_Logger::info( "Enter Hybrid_Error::clearError()" );
35
+
36
+ Hybrid_Auth::storage()->delete( "hauth_session.error.status" );
37
+ Hybrid_Auth::storage()->delete( "hauth_session.error.message" );
38
+ Hybrid_Auth::storage()->delete( "hauth_session.error.code" );
39
+ Hybrid_Auth::storage()->delete( "hauth_session.error.trace" );
40
+ Hybrid_Auth::storage()->delete( "hauth_session.error.previous" );
41
+ }
42
+
43
+ /**
44
+ * Checks to see if there is a an error.
45
+ *
46
+ * @return boolean True if there is an error.
47
+ */
48
+ public static function hasError()
49
+ {
50
+ return (bool) Hybrid_Auth::storage()->get( "hauth_session.error.status" );
51
+ }
52
+
53
+ /**
54
+ * return error message
55
+ */
56
+ public static function getErrorMessage()
57
+ {
58
+ return Hybrid_Auth::storage()->get( "hauth_session.error.message" );
59
+ }
60
+
61
+ /**
62
+ * return error code
63
+ */
64
+ public static function getErrorCode()
65
+ {
66
+ return Hybrid_Auth::storage()->get( "hauth_session.error.code" );
67
+ }
68
+
69
+ /**
70
+ * return string detailled error backtrace as string.
71
+ */
72
+ public static function getErrorTrace()
73
+ {
74
+ return Hybrid_Auth::storage()->get( "hauth_session.error.trace" );
75
+ }
76
+
77
+ /**
78
+ * @return string detailled error backtrace as string.
79
+ */
80
+ public static function getErrorPrevious()
81
+ {
82
+ return Hybrid_Auth::storage()->get( "hauth_session.error.previous" );
83
+ }
84
+ }
hybridauth/Hybrid/Logger.php ADDED
@@ -0,0 +1,68 @@
1
+ <?php
2
+ /*!
3
+ * HybridAuth
4
+ * http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth
5
+ * (c) 2009-2012, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html
6
+ */
7
+
8
+ /**
9
+ * Debugging and Logging manager
10
+ */
11
+ class Hybrid_Logger
12
+ {
13
+ function __construct()
14
+ {
15
+ // if debug mode is set to true, then check for the writable log file
16
+ if ( Hybrid_Auth::$config["debug_mode"] ){
17
+ if ( ! file_exists( Hybrid_Auth::$config["debug_file"] ) ){
18
+ throw new Exception( "'debug_mode' is set to 'true', but the file " . Hybrid_Auth::$config['debug_file'] . " in 'debug_file' does not exit.", 1 );
19
+ }
20
+
21
+ if ( ! is_writable( Hybrid_Auth::$config["debug_file"] ) ){
22
+ throw new Exception( "'debug_mode' is set to 'true', but the given log file path 'debug_file' is not a writable file.", 1 );
23
+ }
24
+ }
25
+ }
26
+
27
+ public static function debug( $message, $object = NULL )
28
+ {
29
+ if( Hybrid_Auth::$config["debug_mode"] ){
30
+ $datetime = new DateTime();
31
+ $datetime = $datetime->format(DATE_ATOM);
32
+
33
+ file_put_contents(
34
+ Hybrid_Auth::$config["debug_file"],
35
+ "DEBUG -- " . $_SERVER['REMOTE_ADDR'] . " -- " . $datetime . " -- " . $message . " -- " . print_r($object, true) . "\n",
36
+ FILE_APPEND
37
+ );
38
+ }
39
+ }
40
+
41
+ public static function info( $message )
42
+ {
43
+ if( Hybrid_Auth::$config["debug_mode"] ){
44
+ $datetime = new DateTime();
45
+ $datetime = $datetime->format(DATE_ATOM);
46
+
47
+ file_put_contents(
48
+ Hybrid_Auth::$config["debug_file"],
49
+ "INFO -- " . $_SERVER['REMOTE_ADDR'] . " -- " . $datetime . " -- " . $message . "\n",
50
+ FILE_APPEND
51
+ );
52
+ }
53
+ }
54
+
55
+ public static function error($message, $object = NULL)
56
+ {
57
+ if( Hybrid_Auth::$config["debug_mode"] ){
58
+ $datetime = new DateTime();
59
+ $datetime = $datetime->format(DATE_ATOM);
60
+
61
+ file_put_contents(
62
+ Hybrid_Auth::$config["debug_file"],
63
+ "ERROR -- " . $_SERVER['REMOTE_ADDR'] . " -- " . $datetime . " -- " . $message . " -- " . print_r($object, true) . "\n",
64
+ FILE_APPEND
65
+ );
66
+ }
67
+ }
68
+ }
hybridauth/Hybrid/Provider_Adapter.php ADDED
@@ -0,0 +1,283 @@
1
+ <?php
2
+ /*!
3
+ * HybridAuth
4
+ * http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth
5
+ * (c) 2009-2012, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html
6
+ */
7
+
8
+ /**
9
+ * Hybrid_Provider_Adapter is the basic class which Hybrid_Auth will use
10
+ * to connect users to a given provider.
11
+ *
12
+ * Basically Hybrid_Provider_Adapterwill create a bridge from your php
13
+ * application to the provider api.
14
+ *
15
+ * Hybrid_Auth will automatically load Hybrid_Provider_Adapter and create
16
+ * an instance of it for each authenticated provider.
17
+ */
18
+ class Hybrid_Provider_Adapter
19
+ {
20
+ /* Provider ID (or unique name) */
21
+ public $id = NULL ;
22
+
23
+ /* Provider adapter specific config */
24
+ public $config = NULL ;
25
+
26
+ /* Provider adapter extra parameters */
27
+ public $params = NULL ;
28
+
29
+ /* Provider adapter wrapper path */
30
+ public $wrapper = NULL ;
31
+
32
+ /* Provider adapter instance */
33
+ public $adapter = NULL ;
34
+
35
+ // --------------------------------------------------------------------
36
+
37
+ /**
38
+ * create a new adapter switch IDp name or ID
39
+ *
40
+ * @param string $id The id or name of the IDp
41
+ * @param array $params (optional) required parameters by the adapter
42
+ */
43
+ function factory( $id, $params = NULL )
44
+ {
45
+ Hybrid_Logger::info( "Enter Hybrid_Provider_Adapter::factory( $id )" );
46
+
47
+ # init the adapter config and params
48
+ $this->id = $id;
49
+ $this->params = $params;
50
+ $this->id = $this->getProviderCiId( $this->id );
51
+ $this->config = $this->getConfigById( $this->id );
52
+
53
+ # check the IDp id
54
+ if( ! $this->id ){
55
+ throw new Exception( "No provider ID specified.", 2 );
56
+ }
57
+
58
+ # check the IDp config
59
+ if( ! $this->config ){
60
+ throw new Exception( "Unknown Provider ID, check your configuration file.", 3 );
61
+ }
62
+
63
+ # check the IDp adapter is enabled
64
+ if( ! $this->config["enabled"] ){
65
+ throw new Exception( "The provider '{$this->id}' is not enabled.", 3 );
66
+ }
67
+
68
+ # include the adapter wrapper
69
+ if( isset( $this->config["wrapper"] ) && is_array( $this->config["wrapper"] ) ){
70
+ require_once $this->config["wrapper"]["path"];
71
+
72
+ if( ! class_exists( $this->config["wrapper"]["class"] ) ){
73
+ throw new Exception( "Unable to load the adapter class.", 3 );
74
+ }
75
+
76
+ $this->wrapper = $this->config["wrapper"]["class"];
77
+ }
78
+ else{
79
+ require_once Hybrid_Auth::$config["path_providers"] . $this->id . ".php" ;
80
+
81
+ $this->wrapper = "Hybrid_Providers_" . $this->id;
82
+ }
83
+
84
+ # create the adapter instance, and pass the current params and config
85
+ $this->adapter = new $this->wrapper( $this->id, $this->config, $this->params );
86
+
87
+ return $this;
88
+ }
89
+
90
+ // --------------------------------------------------------------------
91
+
92
+ /**
93
+ * Hybrid_Provider_Adapter::login(), prepare the user session and the authentication request
94
+ * for index.php
95
+ */
96
+ function login()
97
+ {
98
+ Hybrid_Logger::info( "Enter Hybrid_Provider_Adapter::login( {$this->id} ) " );
99
+
100
+ if( ! $this->adapter ){
101
+ throw new Exception( "Hybrid_Provider_Adapter::login() should not directly used." );
102
+ }
103
+
104
+ // clear all unneeded params
105
+ foreach( Hybrid_Auth::$config["providers"] as $idpid => $params ){
106
+ Hybrid_Auth::storage()->delete( "hauth_session.{$idpid}.hauth_return_to" );
107
+ Hybrid_Auth::storage()->delete( "hauth_session.{$idpid}.hauth_endpoint" );
108
+ Hybrid_Auth::storage()->delete( "hauth_session.{$idpid}.id_provider_params" );
109
+ }
110
+
111
+ // make a fresh start
112
+ $this->logout();
113
+
114
+ # get hybridauth base url
115
+ $HYBRID_AUTH_URL_BASE = Hybrid_Auth::$config["base_url"];
116
+
117
+ # we make use of session_id() as storage hash to identify the current user
118
+ # using session_regenerate_id() will be a problem, but ..
119
+ $this->params["hauth_token"] = session_id();
120
+
121
+ # set request timestamp
122
+ $this->params["hauth_time"] = time();
123
+
124
+ # for default HybridAuth endpoint url hauth_login_start_url
125
+ # auth.start required the IDp ID
126
+ # auth.time optional login request timestamp
127
+ $this->params["login_start"] = $HYBRID_AUTH_URL_BASE . ( strpos( $HYBRID_AUTH_URL_BASE, '?' ) ? '&' : '?' ) . "hauth.start={$this->id}&hauth.time={$this->params["hauth_time"]}";
128
+
129
+ # for default HybridAuth endpoint url hauth_login_done_url
130
+ # auth.done required the IDp ID
131
+ $this->params["login_done"] = $HYBRID_AUTH_URL_BASE . ( strpos( $HYBRID_AUTH_URL_BASE, '?' ) ? '&' : '?' ) . "hauth.done={$this->id}";
132
+
133
+ Hybrid_Auth::storage()->set( "hauth_session.{$this->id}.hauth_return_to" , $this->params["hauth_return_to"] );
134
+ Hybrid_Auth::storage()->set( "hauth_session.{$this->id}.hauth_endpoint" , $this->params["login_done"] );
135
+ Hybrid_Auth::storage()->set( "hauth_session.{$this->id}.id_provider_params" , $this->params );
136
+
137
+ // store config to be used by the end point
138
+ Hybrid_Auth::storage()->config( "CONFIG", Hybrid_Auth::$config );
139
+
140
+ // move on
141
+ Hybrid_Logger::debug( "Hybrid_Provider_Adapter::login( {$this->id} ), redirect the user to login_start URL." );
142
+
143
+ Hybrid_Auth::redirect( $this->params["login_start"] );
144
+ }
145
+
146
+ // --------------------------------------------------------------------
147
+
148
+ /**
149
+ * let hybridauth forget all about the user for the current provider
150
+ */
151
+ function logout()
152
+ {
153
+ $this->adapter->logout();
154
+ }
155
+
156
+ // --------------------------------------------------------------------
157
+
158
+ /**
159
+ * return true if the user is connected to the current provider
160
+ */
161
+ public function isUserConnected()
162
+ {
163
+ return $this->adapter->isUserConnected();
164
+ }
165
+
166
+ // --------------------------------------------------------------------
167
+
168
+ /**
169
+ * handle :
170
+ * getUserProfile()
171
+ * getUserContacts()
172
+ * getUserActivity()
173
+ * setUserStatus()
174
+ */
175
+ public function __call( $name, $arguments )
176
+ {
177
+ Hybrid_Logger::info( "Enter Hybrid_Provider_Adapter::$name(), Provider: {$this->id}" );
178
+
179
+ if ( ! $this->isUserConnected() ){
180
+ throw new Exception( "User not connected to the provider {$this->id}.", 7 );
181
+ }
182
+
183
+ if ( ! method_exists( $this->adapter, $name ) ){
184
+ throw new Exception( "Call to undefined function Hybrid_Providers_{$this->id}::$name()." );
185
+ }
186
+
187
+ if( count( $arguments ) ){
188
+ return $this->adapter->$name( $arguments[0] );
189
+ }
190
+ else{
191
+ return $this->adapter->$name();
192
+ }
193
+ }
194
+
195
+ // --------------------------------------------------------------------
196
+
197
+ /**
198
+ * If the user is connected, then return the access_token and access_token_secret
199
+ * if the provider api use oauth
200
+ */
201
+ public function getAccessToken()
202
+ {
203
+ if( ! $this->adapter->isUserConnected() ){
204
+ Hybrid_Logger::error( "User not connected to the provider." );
205
+
206
+ throw new Exception( "User not connected to the provider.", 7 );
207
+ }
208
+
209
+ return
210
+ ARRAY(
211
+ "access_token" => $this->adapter->token( "access_token" ) , // OAuth access token
212
+ "access_token_secret" => $this->adapter->token( "access_token_secret" ), // OAuth access token secret
213
+ "refresh_token" => $this->adapter->token( "refresh_token" ) , // OAuth refresh token
214
+ "expires_in" => $this->adapter->token( "expires_in" ) , // OPTIONAL. The duration in seconds of the access token lifetime
215
+ "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
216
+ );
217
+ }
218
+
219
+ // --------------------------------------------------------------------
220
+
221
+ /**
222
+ * Naive getter of the current connected IDp API client
223
+ */
224
+ function api()
225
+ {
226
+ if( ! $this->adapter->isUserConnected() ){
227
+ Hybrid_Logger::error( "User not connected to the provider." );
228
+
229
+ throw new Exception( "User not connected to the provider.", 7 );
230
+ }
231
+
232
+ return $this->adapter->api;
233
+ }
234
+
235
+ // --------------------------------------------------------------------
236
+
237
+ /**
238
+ * redirect the user to hauth_return_to (the callback url)
239
+ */
240
+ function returnToCallbackUrl()
241
+ {
242
+ // get the stored callback url
243
+ $callback_url = Hybrid_Auth::storage()->get( "hauth_session.{$this->id}.hauth_return_to" );
244
+
245
+ // remove some unneed'd stored data
246
+ Hybrid_Auth::storage()->delete( "hauth_session.{$this->id}.hauth_return_to" );
247
+ Hybrid_Auth::storage()->delete( "hauth_session.{$this->id}.hauth_endpoint" );
248
+ Hybrid_Auth::storage()->delete( "hauth_session.{$this->id}.id_provider_params" );
249
+
250
+ // back to home
251
+ Hybrid_Auth::redirect( $callback_url );
252
+ }
253
+
254
+ // --------------------------------------------------------------------
255
+
256
+ /**
257
+ * return the provider config by id
258
+ */
259
+ function getConfigById( $id )
260
+ {
261
+ if( isset( Hybrid_Auth::$config["providers"][$id] ) ){
262
+ return Hybrid_Auth::$config["providers"][$id];
263
+ }
264
+
265
+ return NULL;
266
+ }
267
+
268
+ // --------------------------------------------------------------------
269
+
270
+ /**
271
+ * return the provider config by id; insensitive
272
+ */
273
+ function getProviderCiId( $id )
274
+ {
275
+ foreach( Hybrid_Auth::$config["providers"] as $idpid => $params ){
276
+ if( strtolower( $idpid ) == strtolower( $id ) ){
277
+ return $idpid;
278
+ }
279
+ }
280
+
281
+ return NULL;
282
+ }
283
+ }
hybridauth/Hybrid/Provider_Model.php ADDED
@@ -0,0 +1,231 @@
1
+ <?php
2
+ /*!
3
+ * HybridAuth
4
+ * http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth
5
+ * (c) 2009-2012, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html
6
+ */
7
+
8
+ /**
9
+ * Hybrid_Provider_Model provide a common interface for supported IDps on HybridAuth.
10
+ *
11
+ * Basically, each provider adapter has to define at least 4 methods:
12
+ * Hybrid_Providers_{provider_name}::initialize()
13
+ * Hybrid_Providers_{provider_name}::loginBegin()
14
+ * Hybrid_Providers_{provider_name}::loginFinish()
15
+ * Hybrid_Providers_{provider_name}::getUserProfile()
16
+ *
17
+ * HybridAuth also come with three others models
18
+ * Class Hybrid_Provider_Model_OpenID for providers that uses the OpenID 1 and 2 protocol.
19
+ * Class Hybrid_Provider_Model_OAuth1 for providers that uses the OAuth 1 protocol.
20
+ * Class Hybrid_Provider_Model_OAuth2 for providers that uses the OAuth 2 protocol.
21
+ */
22
+ abstract class Hybrid_Provider_Model
23
+ {
24
+ /* IDp ID (or unique name) */
25
+ public $providerId = NULL;
26
+
27
+ /* specific provider adapter config */
28
+ public $config = NULL;
29
+
30
+ /* provider extra parameters */
31
+ public $params = NULL;
32
+
33
+ /* Endpoint URL for that provider */
34
+ public $endpoint = NULL;
35
+
36
+ /* Hybrid_User obj, represents the current loggedin user */
37
+ public $user = NULL;
38
+
39
+ /* the provider api client (optional) */
40
+ public $api = NULL;
41
+
42
+ /**
43
+ * common providers adapter constructor
44
+ */
45
+ function __construct( $providerId, $config, $params = NULL )
46
+ {
47
+ # init the IDp adapter parameters, get them from the cache if possible
48
+ if( ! $params ){
49
+ $this->params = Hybrid_Auth::storage()->get( "hauth_session.$providerId.id_provider_params" );
50
+ }
51
+ else{
52
+ $this->params = $params;
53
+ }
54
+
55
+ // idp id
56
+ $this->providerId = $providerId;
57
+
58
+ // set HybridAuth endpoint for this provider
59
+ $this->endpoint = Hybrid_Auth::storage()->get( "hauth_session.$providerId.hauth_endpoint" );
60
+
61
+ // idp config
62
+ $this->config = $config;
63
+
64
+ // new user instance
65
+ $this->user = new Hybrid_User();
66
+ $this->user->providerId = $providerId;
67
+
68
+ // initialize the current provider adapter
69
+ $this->initialize();
70
+
71
+ Hybrid_Logger::debug( "Hybrid_Provider_Model::__construct( $providerId ) initialized. dump current adapter instance: ", serialize( $this ) );
72
+ }
73
+
74
+ // --------------------------------------------------------------------
75
+
76
+ /**
77
+ * IDp wrappers initializer
78
+ *
79
+ * The main job of wrappers initializer is to performs (depend on the IDp api client it self):
80
+ * - include some libs nedded by this provider,
81
+ * - check IDp key and secret,
82
+ * - set some needed parameters (stored in $this->params) by this IDp api client
83
+ * - create and setup an instance of the IDp api client on $this->api
84
+ */
85
+ abstract protected function initialize();
86
+
87
+ // --------------------------------------------------------------------
88
+
89
+ /**
90
+ * begin login
91
+ */
92
+ abstract protected function loginBegin();
93
+
94
+ // --------------------------------------------------------------------
95
+
96
+ /**
97
+ * finish login
98
+ */
99
+ abstract protected function loginFinish();
100
+
101
+ // --------------------------------------------------------------------
102
+
103
+ /**
104
+ * generic logout, just erase current provider adapter stored data to let Hybrid_Auth all forget about it
105
+ */
106
+ function logout()
107
+ {
108
+ Hybrid_Logger::info( "Enter [{$this->providerId}]::logout()" );
109
+
110
+ $this->clearTokens();
111
+
112
+ return TRUE;
113
+ }
114
+
115
+ // --------------------------------------------------------------------
116
+
117
+ /**
118
+ * grab the user profile from the IDp api client
119
+ */
120
+ function getUserProfile()
121
+ {
122
+ Hybrid_Logger::error( "HybridAuth do not provide users contats list for {$this->providerId} yet." );
123
+
124
+ throw new Exception( "Provider does not support this feature.", 8 );
125
+ }
126
+
127
+ // --------------------------------------------------------------------
128
+
129
+ /**
130
+ * load the current logged in user contacts list from the IDp api client
131
+ */
132
+ function getUserContacts()
133
+ {
134
+ Hybrid_Logger::error( "HybridAuth do not provide users contats list for {$this->providerId} yet." );
135
+
136
+ throw new Exception( "Provider does not support this feature.", 8 );
137
+ }
138
+
139
+ // --------------------------------------------------------------------
140
+
141
+ /**
142
+ * return the user activity stream
143
+ */
144
+ function getUserActivity( $stream )
145
+ {
146
+ Hybrid_Logger::error( "HybridAuth do not provide user's activity stream for {$this->providerId} yet." );
147
+
148
+ throw new Exception( "Provider does not support this feature.", 8 );
149
+ }
150
+
151
+ // --------------------------------------------------------------------
152
+
153
+ /**
154
+ * return the user activity stream
155
+ */
156
+ function setUserStatus( $status )
157
+ {
158
+ Hybrid_Logger::error( "HybridAuth do not provide user's activity stream for {$this->providerId} yet." );
159
+
160
+ throw new Exception( "Provider does not support this feature.", 8 );
161
+ }
162
+
163
+ // --------------------------------------------------------------------
164
+
165
+ /**
166
+ * return true if the user is connected to the current provider
167
+ */
168
+ public function isUserConnected()
169
+ {
170
+ return (bool) Hybrid_Auth::storage()->get( "hauth_session.{$this->providerId}.is_logged_in" );
171
+ }
172
+
173
+ // --------------------------------------------------------------------
174
+
175
+ /**
176
+ * set user to connected
177
+ */
178
+ public function setUserConnected()
179
+ {
180
+ Hybrid_Logger::info( "Enter [{$this->providerId}]::setUserConnected()" );
181
+
182
+ Hybrid_Auth::storage()->set( "hauth_session.{$this->providerId}.is_logged_in", 1 );
183
+ }
184
+
185
+ // --------------------------------------------------------------------
186
+
187
+ /**
188
+ * set user to unconnected
189
+ */
190
+ public function setUserUnconnected()
191
+ {
192
+ Hybrid_Logger::info( "Enter [{$this->providerId}]::setUserUnconnected()" );
193
+
194
+ Hybrid_Auth::storage()->set( "hauth_session.{$this->providerId}.is_logged_in", 0 );
195
+ }
196
+
197
+ // --------------------------------------------------------------------
198
+
199
+ /**
200
+ * get or set a token
201
+ */
202
+ public function token( $token, $value = NULL )
203
+ {
204
+ if( $value === NULL ){
205
+ return Hybrid_Auth::storage()->get( "hauth_session.{$this->providerId}.token.$token" );
206
+ }
207
+ else{
208
+ Hybrid_Auth::storage()->set( "hauth_session.{$this->providerId}.token.$token", $value );
209
+ }
210
+ }
211
+
212
+ // --------------------------------------------------------------------
213
+
214
+ /**
215
+ * delete a stored token
216
+ */
217
+ public function deleteToken( $token )
218
+ {
219
+ Hybrid_Auth::storage()->delete( "hauth_session.{$this->providerId}.token.$token" );
220
+ }
221
+
222
+ // --------------------------------------------------------------------
223
+
224
+ /**
225
+ * clear all existen tokens for this provider
226
+ */
227
+ public function clearTokens()
228
+ {
229
+ Hybrid_Auth::storage()->deleteMatch( "hauth_session.{$this->providerId}." );
230
+ }
231
+ }
hybridauth/Hybrid/Provider_Model_OAuth1.php ADDED
@@ -0,0 +1,161 @@