]> git.mxchange.org Git - friendica.git/blobdiff - library/OAuth1.php
Merge pull request #5106 from tobiasd/20180521-en
[friendica.git] / library / OAuth1.php
index 604945265f6f569c9dc3b7fdf24858c59762bfe2..c537f2b252f7db0c8f69967859702bbbb4f30093 100644 (file)
@@ -27,6 +27,10 @@ class OAuthToken {
   public $key;
   public $secret;
 
+  public $expires;
+  public $scope;
+  public $uid;
+
   /**
    * key = the token
    * secret = the token secret
@@ -285,10 +289,10 @@ class OAuthRequest {
       }
 
     }
-    // fix for friendika redirect system
+    // fix for friendica redirect system
     
-    $http_url =  substr($http_url, 0, strpos($http_url,$parameters['q'])+strlen($parameters['q']));
-    unset( $parameters['q'] );
+    $http_url =  substr($http_url, 0, strpos($http_url,$parameters['pagename'])+strlen($parameters['pagename']));
+    unset( $parameters['pagename'] );
     
        //echo "<pre>".__function__."\n"; var_dump($http_method, $http_url, $parameters, $_SERVER['REQUEST_URI']); killme();
     return new OAuthRequest($http_method, $http_url, $parameters);
@@ -417,8 +421,11 @@ class OAuthRequest {
   /**
    * 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);
   }
 
   /**
@@ -552,6 +559,7 @@ class OAuthServer {
   public function verify_request(&$request) {
     $this->get_version($request);
     $consumer = $this->get_consumer($request);
+    //echo __file__.__line__.__function__."<pre>"; var_dump($consumer); die();
     $token = $this->get_token($request, $consumer, "access");
     $this->check_signature($request, $consumer, $token);
     return array($consumer, $token);