Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Version 0.8.1
- prioritize `$tmhOAuth->config['token']` and `$tmhOAuth->config['secret']` over `$tmhOAuth->config['user_token']` and `$tmhOAuth->config['oauth_secret']`
- consider `$tmhOAuth->config['use_ssl']` as well when setting +SSL in the useragent
- update readme and composer description
  • Loading branch information
themattharris committed Jun 15, 2013
1 parent b9a6007 commit 02dd58b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
3 changes: 1 addition & 2 deletions README.md
@@ -1,7 +1,6 @@
# tmhOAuth

An OAuth 1.0A library written in PHP by @themattharris, specifically for use
with the Twitter API.
An OAuth library written in PHP by @themattharris.

**Disclaimer**: This project is a work in progress. Please use the issue tracker
to report any enhancements or issues you encounter.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
@@ -1,6 +1,6 @@
{
"name": "themattharris/tmhoauth",
"description": "An OAuth 1.0A library written in PHP by @themattharris, specifically for use with the Twitter API",
"description": "An OAuth library written in PHP by @themattharris",
"license": "Apache-2.0",
"authors": [
{
Expand Down
21 changes: 11 additions & 10 deletions tmhOAuth.php
Expand Up @@ -4,15 +4,15 @@
*
* An OAuth library written in PHP.
* The library supports file uploading using multipart/form as well as general
* REST requests. OAuth authentication is sent using the an Authorization Header.
* REST requests. OAuth authentication is sent using an Authorization Header.
*
* @author themattharris
* @version 0.8.0
* @version 0.8.1
*
* 13 June 2013
* 15 June 2013
*/
class tmhOAuth {
const VERSION = '0.8.0';
const VERSION = '0.8.1';

var $response = array();

Expand Down Expand Up @@ -58,13 +58,14 @@ public function reconfigure($config=array()) {
'curl_ssl_verifyhost' => 2,
// for security this should always be set to true.
'curl_ssl_verifypeer' => true,
// for security this should always be set to true.
'use_ssl' => true,

// you can get the latest cacert.pem from here http://curl.haxx.se/ca/cacert.pem
// if you're getting HTTP 0 responses, check cacert.pem exists and is readable
// without it curl won't be able to create an SSL connection
'curl_cainfo' => __DIR__ . DIRECTORY_SEPARATOR . 'cacert.pem',
'curl_capath' => __DIR__,
'use_ssl' => true, // you really don't want to turn this off

'curl_followlocation' => false, // whether to follow redirects or not

Expand Down Expand Up @@ -111,7 +112,7 @@ private function set_user_agent() {
if (!empty($this->config['user_agent']))
return;

$ssl = ($this->config['curl_ssl_verifyhost'] && $this->config['curl_ssl_verifypeer']) ? '+' : '-';
$ssl = ($this->config['curl_ssl_verifyhost'] && $this->config['curl_ssl_verifypeer'] && $this->config['use_ssl']) ? '+' : '-';
$ua = 'tmhOAuth ' . self::VERSION . $ssl . 'SSL - //github.com/themattharris/tmhOAuth';
$this->config['user_agent'] = $ua;
}
Expand Down Expand Up @@ -214,16 +215,16 @@ private function prepare_oauth1_params() {

private function token() {
if ( $this->request_settings['with_user'] ) {
if (isset($this->config['user_token'])) return $this->config['user_token'];
elseif (isset($this->config['token'])) return $this->config['token'];
if (isset($this->config['token'])) return $this->config['token'];
elseif (isset($this->config['user_token'])) return $this->config['user_token'];
}
return '';
}

private function secret() {
if ( $this->request_settings['with_user'] ) {
if (isset($this->config['user_secret'])) return $this->config['user_secret'];
elseif (isset($this->config['secret'])) return $this->config['secret'];
if (isset($this->config['secret'])) return $this->config['secret'];
elseif (isset($this->config['user_secret'])) return $this->config['user_secret'];
}
return '';
}
Expand Down

0 comments on commit 02dd58b

Please sign in to comment.