fix owncloud.log notices
[grauphel.git] / controller / oauthcontroller.php
index d02b7b8..6ab17d2 100644 (file)
@@ -72,7 +72,7 @@ class OauthController extends Controller
         $urlGen = $this->deps->urlGen;
 
         try {
         $urlGen = $this->deps->urlGen;
 
         try {
-            $provider = new \OAuthProvider();
+            $provider = OAuth::getProvider();
             $oauth->registerHandler($provider)
                 ->registerVerificationTokenHandler($provider);
             $provider->checkOAuthRequest(
             $oauth->registerHandler($provider)
                 ->registerVerificationTokenHandler($provider);
             $provider->checkOAuthRequest(
@@ -118,10 +118,16 @@ class OauthController extends Controller
             return $token;
         }
 
             return $token;
         }
 
+        $client = 'unknown';
+        if (isset($_GET['client'])) {
+            $client = $_GET['client'];
+        }
+
         $res = new TemplateResponse('grauphel', 'oauthAuthorize');
         $res->setParams(
             array(
                 'oauth_token' => $token->tokenKey,
         $res = new TemplateResponse('grauphel', 'oauthAuthorize');
         $res->setParams(
             array(
                 'oauth_token' => $token->tokenKey,
+                'client'      => $client,
                 'formaction'  => $this->deps->urlGen->linkToRoute(
                     'grauphel.oauth.confirm'
                 ),
                 'formaction'  => $this->deps->urlGen->linkToRoute(
                     'grauphel.oauth.confirm'
                 ),
@@ -167,7 +173,7 @@ class OauthController extends Controller
         }
 
         //the user is logged in and authorized
         }
 
         //the user is logged in and authorized
-        $provider = new \OAuthProvider();
+        $provider = OAuth::getProvider();
 
         $newToken = new Token('verify');
         $newToken->tokenKey = $token->tokenKey;
 
         $newToken = new Token('verify');
         $newToken->tokenKey = $token->tokenKey;
@@ -230,7 +236,7 @@ class OauthController extends Controller
         $urlGen = $this->deps->urlGen;
 
         try {
         $urlGen = $this->deps->urlGen;
 
         try {
-            $provider = new \OAuthProvider();
+            $provider = OAuth::getProvider();
             $oauth->registerHandler($provider);
             $provider->isRequestTokenEndpoint(true);
             $provider->checkOAuthRequest(
             $oauth->registerHandler($provider);
             $provider->isRequestTokenEndpoint(true);
             $provider->checkOAuthRequest(
@@ -251,7 +257,7 @@ class OauthController extends Controller
                 array(
                     'oauth_token'              => $token->tokenKey,
                     'oauth_token_secret'       => $token->secret,
                 array(
                     'oauth_token'              => $token->tokenKey,
                     'oauth_token_secret'       => $token->secret,
-                    'oauth_callback_confirmed' => 'TRUE'
+                    'oauth_callback_confirmed' => 'true'
                 )
             );
         } catch (OAuthException $e) {
                 )
             );
         } catch (OAuthException $e) {