]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Twitter-API: /account/verify_credentials.format now works
authorzach <zach@copley.name>
Fri, 18 Jul 2008 04:03:32 +0000 (00:03 -0400)
committerzach <zach@copley.name>
Fri, 18 Jul 2008 04:03:32 +0000 (00:03 -0400)
darcs-hash:20080718040332-ca946-0c8da4f5e98355ccbb1ee929693fa74bff3c2481.gz

actions/twitapiaccount.php
lib/util.php

index 93e0844c1f821cea7be60c9211b7f2a5cc9de7d7..0198671e77aeeb6bfe51759ac7a5de773514872f 100644 (file)
@@ -24,8 +24,17 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
 class TwitapiaccountAction extends TwitterapiAction {
 
        function verify_credentials($args, $apidata) {
-               parent::handle($args);
-               common_server_error("API method under construction.", $code=501);
+
+               if ($apidata['content-type'] == 'xml') {
+                       header('Content-Type: application/xml; charset=utf-8');         
+                       print '<authorized>true</authorized>';
+               } elseif ($apidata['content-type'] == 'json') {
+                       header('Content-Type: application/json; charset=utf-8');                
+                       print '{"authorized":true}';
+               } else {
+                       common_user_error("API method not found!", $code=404);
+               }
+                       
                exit();
        }
        
index 9f235494bc02dbfb9eb3d0aebf349dd281b4047c..5e3e8c98d0e1b8f1e64538e37f2f84a91a41ffbf 100644 (file)
@@ -227,7 +227,7 @@ function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=
 function common_show_basic_auth_error() {
        header('HTTP/1.1 401 Unauthorized');
        header('Content-type: text/plain');
-       print("Could not authenticate you.\n"); # exactly what Twitter says
+       print("Could not authenticate you."); # exactly what Twitter says - no \n
        exit();
 }