diff --git a/includes/DrupalOAuthRequest.inc b/includes/DrupalOAuthRequest.inc index dce9158..0fbf901 100644 --- a/includes/DrupalOAuthRequest.inc +++ b/includes/DrupalOAuthRequest.inc @@ -11,6 +11,7 @@ class DrupalOAuthRequest extends OAuthRequest { * A OAuthRequest generated from the request */ public static function from_request($http_method = NULL, $http_url = NULL, $parameters = NULL) { + global $base_url; // Preparations that has to be made if we're going to detect parameters if ($parameters == NULL) { $qs = $_SERVER['QUERY_STRING']; @@ -26,7 +27,12 @@ class DrupalOAuthRequest extends OAuthRequest { parse_str($_SERVER['QUERY_STRING'], $get); // The q parameter was in the original request, make sure it hasn't been altered if (isset($get['q'])) { - $q = $get['q']; + if (strpos($get['q'], "oauth/") === FALSE) { + $q = $get['q']; + } + else { + $q = FALSE; + } } // The q parameter was set by drupal, unset it else { @@ -44,6 +50,7 @@ class DrupalOAuthRequest extends OAuthRequest { } $_SERVER['QUERY_STRING'] = http_build_query($parsed, '', '&'); } + $http_url = $base_url . request_uri(); $req = parent::from_request($http_method, $http_url, $parameters); // Restore $_SERVER['QUERY_STRING'] if it was touched