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/twitapifriendships.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'actions/twitapifriendships.php') diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php index d97b7c08e..f9ff251d6 100644 --- a/actions/twitapifriendships.php +++ b/actions/twitapifriendships.php @@ -152,6 +152,11 @@ class TwitapifriendshipsAction extends TwitterapiAction { function exists($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_a_id = $this->trimmed('user_a'); $user_b_id = $this->trimmed('user_b'); @@ -181,7 +186,6 @@ class TwitapifriendshipsAction extends TwitterapiAction { $this->end_document('json'); break; default: - print $result; // Really? --Zach break; } -- cgit v1.2.3-54-g00ecf