/* Generic exception class
*/
-class OAuthException extends Exception {
- // pass
+if (!class_exists('OAuthException', false)) {
+ class OAuthException extends Exception {
+ // pass
+ }
}
class OAuthConsumer {
public $key;
public $secret;
+ public $expires;
+ public $scope;
+ public $uid;
+
/**
* key = the token
* secret = the token secret
*/
public function check_signature($request, $consumer, $token, $signature) {
$built = $this->build_signature($request, $consumer, $token);
- return $built == $signature;
+ return ($built == $signature);
}
}
$key_parts = OAuthUtil::urlencode_rfc3986($key_parts);
$key = implode('&', $key_parts);
- return base64_encode(hash_hmac('sha1', $base_string, $key, true));
+
+ $r = base64_encode(hash_hmac('sha1', $base_string, $key, true));
+ return $r;
}
}
}
}
-
+ // fix for friendica redirect system
+
+ $http_url = substr($http_url, 0, strpos($http_url,$parameters['pagename'])+strlen($parameters['pagename']));
+ unset( $parameters['pagename'] );
+
return new OAuthRequest($http_method, $http_url, $parameters);
}
/**
* builds the data one would send in a POST request
*/
- public function to_postdata() {
- return OAuthUtil::build_http_query($this->parameters);
+ public function to_postdata($raw = false) {
+ if ($raw)
+ return($this->parameters);
+ else
+ return OAuthUtil::build_http_query($this->parameters);
}
/**
$token,
$signature
);
+
if (!$valid_sig) {
throw new OAuthException("Invalid signature");