[geeklog-hg] geeklog: Updated oauth-api class to 1.0.39 and httpclient class ...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Tue Jan 6 21:40:25 EST 2015
changeset 9571:9105e36ac14f
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/9105e36ac14f
user: Tom
date: Tue Jan 06 21:39:57 2015 -0500
description:
Updated oauth-api class to 1.0.39 and httpclient class to 1.0.2
diffstat:
system/classes/http/http.php | 39 +-
system/classes/oauth/oauth_client.php | 1199 +++++++++++++++++++++-----------
system/classes/oauthhelper.class.php | 9 +-
3 files changed, 833 insertions(+), 414 deletions(-)
diffs (truncated from 1701 to 300 lines):
diff -r 80084603fd0b -r 9105e36ac14f system/classes/http/http.php
--- a/system/classes/http/http.php Sun Jan 04 00:39:32 2015 +0900
+++ b/system/classes/http/http.php Tue Jan 06 21:39:57 2015 -0500
@@ -2,7 +2,7 @@
/*
* http.php
*
- * @(#) $Header: /opt2/ena/metal/http/http.php,v 1.90 2013/02/20 11:45:28 mlemos Exp $
+ * @(#) $Header: /opt2/ena/metal/http/http.php,v 1.92 2014/08/14 23:17:34 mlemos Exp $
*
*/
@@ -27,7 +27,7 @@
var $protocol="http";
var $request_method="GET";
- var $user_agent='httpclient (http://www.phpclasses.org/httpclient $Revision: 1.90 $)';
+ var $user_agent='httpclient (http://www.phpclasses.org/httpclient $Revision: 1.92 $)';
var $accept='';
var $authentication_mechanism="";
var $user;
@@ -1546,6 +1546,11 @@
return($this->SetError("it was received an unexpected HTTP response status", HTTP_CLIENT_ERROR_PROTOCOL_FAILURE));
$this->response_status=$matches[1];
$this->response_message=$matches[2];
+ if($this->response_status == 204)
+ {
+ $this->content_length = 0;
+ $this->content_length_set = 1;
+ }
}
if($line=="")
{
@@ -1993,6 +1998,36 @@
}
}
+ Function ReadWholeReplyIntoTemporaryFile(&$file)
+ {
+ if(!($file = tmpfile()))
+ return $this->SetPHPError('could not create the temporary file to save the response', $php_errormsg, HTTP_CLIENT_ERROR_CANNOT_ACCESS_LOCAL_FILE);
+ for(;;)
+ {
+ if(strlen($error = $this->ReadReplyBody($block, $this->file_buffer_length)))
+ {
+ fclose($file);
+ return($error);
+ }
+ if(strlen($block) == 0)
+ {
+ if(@fseek($file, 0) != 0)
+ {
+ $error = $this->SetPHPError('could not seek to the beginning of temporary file with the response', $php_errormsg, HTTP_CLIENT_ERROR_CANNOT_ACCESS_LOCAL_FILE);
+ fclose($file);
+ return $error;
+ }
+ return('');
+ }
+ if(!@fwrite($file, $block))
+ {
+ $error = $this->SetPHPError('could not write to the temporary file to save the response', $php_errormsg, HTTP_CLIENT_ERROR_CANNOT_ACCESS_LOCAL_FILE);
+ fclose($file);
+ return $error;
+ }
+ }
+ }
+
Function SaveCookies(&$cookies, $domain='', $secure_only=0, $persistent_only=0)
{
$now=gmdate("Y-m-d H-i-s");
diff -r 80084603fd0b -r 9105e36ac14f system/classes/oauth/oauth_client.php
--- a/system/classes/oauth/oauth_client.php Sun Jan 04 00:39:32 2015 +0900
+++ b/system/classes/oauth/oauth_client.php Tue Jan 06 21:39:57 2015 -0500
@@ -2,7 +2,7 @@
/*
* oauth_client.php
*
- * @(#) $Id: oauth_client.php,v 1.72 2013/07/31 11:51:03 mlemos Exp $
+ * @(#) $Id: oauth_client.php,v 1.125 2014/12/23 03:51:59 mlemos Exp $
*
*/
@@ -12,7 +12,7 @@
<package>net.manuellemos.oauth</package>
- <version>@(#) $Id: oauth_client.php,v 1.72 2013/07/31 11:51:03 mlemos Exp $</version>
+ <version>@(#) $Id: oauth_client.php,v 1.125 2014/12/23 03:51:59 mlemos Exp $</version>
<copyright>Copyright © (C) Manuel Lemos 2012</copyright>
<title>OAuth client</title>
<author>Manuel Lemos</author>
@@ -48,6 +48,7 @@
<variablelink>authorization_header</variablelink>,
<variablelink>request_token_url</variablelink>,
<variablelink>dialog_url</variablelink>,
+ <variablelink>pin_dialog_url</variablelink>,
<variablelink>offline_dialog_url</variablelink>,
<variablelink>append_state_to_redirect_uri</variablelink> and
<variablelink>access_token_url</variablelink>.<paragraphbreak />
@@ -225,10 +226,19 @@
several configuration variables just by setting this server
variable.<paragraphbreak />
Currently it supports the following servers:
+ <stringvalue>37Signals</stringvalue>,
+ <stringvalue>Amazon</stringvalue>,
<stringvalue>Bitbucket</stringvalue>,
+ <stringvalue>Bitly</stringvalue>,
<stringvalue>Box</stringvalue>,
+ <stringvalue>Buffer</stringvalue>,
+ <stringvalue>Copy</stringvalue>,
+ <stringvalue>Dailymotion</stringvalue>,
+ <stringvalue>Discogs</stringvalue>,
<stringvalue>Disqus</stringvalue>,
- <stringvalue>Dropbox</stringvalue>,
+ <stringvalue>Dropbox</stringvalue> (Dropbox with OAuth 1.0),
+ <stringvalue>Dropbox2</stringvalue> (Dropbox with OAuth 2.0),
+ <stringvalue>Etsy</stringvalue>,
<stringvalue>Eventful</stringvalue>,
<stringvalue>Facebook</stringvalue>,
<stringvalue>Fitbit</stringvalue>,
@@ -236,17 +246,39 @@
<stringvalue>Foursquare</stringvalue>,
<stringvalue>github</stringvalue>,
<stringvalue>Google</stringvalue>,
+ <stringvalue>Google1</stringvalue> (Google with OAuth 1.0),
+ <stringvalue>imgur</stringvalue>,
+ <stringvalue>Intuit</stringvalue>,
<stringvalue>Instagram</stringvalue>,
+ <stringvalue>Jawbone</stringvalue>,
<stringvalue>LinkedIn</stringvalue>,
+ <stringvalue>LinkedIn2</stringvalue> (LinkedIn with OAuth 2.0),
+ <stringvalue>mail.ru</stringvalue>,
+ <stringvalue>MailChimp</stringvalue>,
+ <stringvalue>Mavenlink</stringvalue>,
+ <stringvalue>Meetup</stringvalue>,
<stringvalue>Microsoft</stringvalue>,
+ <stringvalue>oDesk</stringvalue>,
+ <stringvalue>Paypal</stringvalue>,
+ <stringvalue>PaypalApplication</stringvalue>,
+ <stringvalue>Rdio</stringvalue>,
+ <stringvalue>Reddit</stringvalue>,
+ <stringvalue>RunKeeper</stringvalue>,
<stringvalue>Salesforce</stringvalue>,
<stringvalue>Scoop.it</stringvalue>,
<stringvalue>StockTwits</stringvalue>,
<stringvalue>SurveyMonkey</stringvalue>,
+ <stringvalue>TeamViewer</stringvalue>,
<stringvalue>Tumblr</stringvalue>,
<stringvalue>Twitter</stringvalue>,
- <stringvalue>XING</stringvalue> and
- <stringvalue>Yahoo</stringvalue>. Please contact the author if you
+ <stringvalue>Vimeo</stringvalue>,
+ <stringvalue>VK</stringvalue>,
+ <stringvalue>Withings</stringvalue>,
+ <stringvalue>Wordpress</stringvalue>,
+ <stringvalue>Xero</stringvalue>,
+ <stringvalue>XING</stringvalue>,
+ <stringvalue>Yahoo</stringvalue> and
+ <stringvalue>Yandex</stringvalue>. Please contact the author if you
would like to ask to add built-in support for other types of OAuth
servers.<paragraphbreak />
If you want to access other types of OAuth servers that are not
@@ -261,6 +293,24 @@
/*
{metadocument}
<variable>
+ <name>configuration_file</name>
+ <type>STRING</type>
+ <value>oauth_configuration.json</value>
+ <documentation>
+ <purpose>Specify the path of the configuration file that defines the
+ properties of additional OAuth server types.</purpose>
+ <usage>Change the path in this variable if you are accessing a type
+ of server without support built-in the class and you need to put
+ the configuration file path in a different directory.</usage>
+ </documentation>
+ </variable>
+{/metadocument}
+*/
+ var $configuration_file = 'oauth_configuration.json';
+
+/*
+{metadocument}
+ <variable>
<name>request_token_url</name>
<type>STRING</type>
<value></value>
@@ -294,6 +344,9 @@
can grant access to your application.</purpose>
<usage>Set this variable to the OAuth request token URL when you are
not accessing one of the built-in supported OAuth servers.<paragraphbreak />
+ For OAuth 1.0a servers that return the login dialog URL
+ automatically, set this variable to
+ <stringvalue>automatic</stringvalue><paragraphbreak />
For certain servers, the dialog URL can have certain marks that
will act as template placeholders which will be replaced with
values defined before redirecting the users browser. Currently it
@@ -315,6 +368,25 @@
/*
{metadocument}
<variable>
+ <name>pin_dialog_url</name>
+ <type>STRING</type>
+ <value></value>
+ <documentation>
+ <purpose>URL of the OAuth server to redirect the browser so the user
+ can grant access to your application.</purpose>
+ <usage>Set this variable when using the pin based authorization and
+ the format of the of the authorization dialog page URL is
+ different than the one set to the
+ <variablelink>dialog_url</variablelink> variable.</usage>
+ </documentation>
+ </variable>
+{/metadocument}
+*/
+ var $pin_dialog_url = '';
+
+/*
+{metadocument}
+ <variable>
<name>offline_dialog_url</name>
<type>STRING</type>
<value></value>
@@ -336,6 +408,24 @@
/*
{metadocument}
<variable>
+ <name>pin</name>
+ <type>STRING</type>
+ <value></value>
+ <documentation>
+ <purpose>Value of the pin code for pin based authorization.</purpose>
+ <usage>Set this value to the pin informed by the user when
+ implementing the pin based authorization.<paragraphbreak />
+ Make sure the <variablelink>redirect_uri</variablelink> variable
+ is set to <stringvalue>oob</stringvalue>.</usage>
+ </documentation>
+ </variable>
+{/metadocument}
+*/
+ var $pin = '';
+
+/*
+{metadocument}
+ <variable>
<name>append_state_to_redirect_uri</name>
<type>STRING</type>
<value></value>
@@ -470,7 +560,9 @@
<purpose>URL of the current script page that is calling this
class</purpose>
<usage>Set this variable to the current script page URL before
- proceeding the the OAuth authorization process.</usage>
+ proceeding the the OAuth authorization process.<paragraphbreak />
+ For pin based authorization, set this variable to
+ <stringvalue>oob</stringvalue>.</usage>
</documentation>
</variable>
{/metadocument}
@@ -669,6 +761,27 @@
*/
var $default_access_token_type = '';
+
+/*
+{metadocument}
+ <variable>
+ <name>access_token_parameter</name>
+ <type>STRING</type>
+ <value></value>
+ <documentation>
+ <purpose>Name of the access token parameter to be passed in API call
+ requests.</purpose>
+ <usage>Set this variable to a non-empty string to override the
+ default name for the access token parameter which is
+ <stringvalue>oauth_token</stringvalue> of OAuth 1 and
+ <stringvalue>access_token</stringvalue> for OAuth 2.</usage>
+ </documentation>
+ </variable>
+{/metadocument}
+*/
+ var $access_token_parameter = '';
+
+
/*
{metadocument}
<variable>
@@ -688,7 +801,8 @@
{metadocument}
<variable>
<name>store_access_token_response</name>
- <type>ARRAY</type>
+ <type>BOOLEAN</type>
+ <value>0</value>
<documentation>
<purpose>Option to determine if the original response for the access
token request should be stored in the
@@ -706,6 +820,26 @@
/*
{metadocument}
More information about the geeklog-cvs
mailing list