From 42bbd38417ffbfe5bfee669e0c52b50187a3032a Mon Sep 17 00:00:00 2001 From: zach Date: Fri, 18 Jul 2008 00:03:32 -0400 Subject: [PATCH] Twitter-API: /account/verify_credentials.format now works darcs-hash:20080718040332-ca946-0c8da4f5e98355ccbb1ee929693fa74bff3c2481.gz --- actions/twitapiaccount.php | 13 +++++++++++-- lib/util.php | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/actions/twitapiaccount.php b/actions/twitapiaccount.php index 93e0844c1f..0198671e77 100644 --- a/actions/twitapiaccount.php +++ b/actions/twitapiaccount.php @@ -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 'true'; + } 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(); } diff --git a/lib/util.php b/lib/util.php index 9f235494bc..5e3e8c98d0 100644 --- a/lib/util.php +++ b/lib/util.php @@ -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(); } -- 2.39.5