From dec2f29c6a77dd97383ebdbabdc0bff8e524bfa4 Mon Sep 17 00:00:00 2001 From: zach Date: Tue, 30 Sep 2008 22:09:59 -0400 Subject: Twitter-compatible API - Added content-type checks to several methods. Calling an API method with a bad content type used to return a blank page. darcs-hash:20081001020959-462f3-83b0241ba7dc99c4e3a52148a46deb8182e005b0.gz --- actions/twitapiusers.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'actions/twitapiusers.php') diff --git a/actions/twitapiusers.php b/actions/twitapiusers.php index cb682695a..b43a64152 100644 --- a/actions/twitapiusers.php +++ b/actions/twitapiusers.php @@ -51,6 +51,11 @@ class TwitapiusersAction extends TwitterapiAction { function show($args, $apidata) { parent::handle($args); + if (!in_array($apidata['content-type'], array('xml', 'json'))) { + common_user_error(_('API method not found!'), $code = 404); + exit; + } + $user = null; $email = $this->arg('email'); @@ -118,9 +123,7 @@ class TwitapiusersAction extends TwitterapiAction { $this->init_document('json'); $this->show_json_objects($twitter_user); $this->end_document('json'); - } else { - common_user_error(_('API method not found!'), $code = 404); - } + } exit(); } -- cgit v1.2.3-54-g00ecf