function update_location($args, $apidata) {
parent::handle($args);
+ if (!in_array($apidata['content-type'], array('xml', 'json'))) {
+ common_user_error(_('API method not found!'), $code = 404);
+ exit;
+ }
+
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
exit();
exit();
}
- common_debug($this->trimmed('user'));
-
$other = $this->get_user($this->trimmed('user'));
if (!$other) {
function create($args, $apidata) {
parent::handle($args);
+ if (!in_array($apidata['content-type'], array('xml', 'json'))) {
+ common_user_error(_('API method not found!'), $code = 404);
+ exit;
+ }
+
// Check for RESTfulness
if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
// XXX: Twitter just prints the err msg, no XML / JSON.
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');
$this->end_document('json');
break;
default:
- print $result; // Really? --Zach
break;
}
class TwitapihelpAction extends TwitterapiAction {
- function is_readonly() {
+ function is_readonly() {
return true;
}
* Formats: xml, json
*/
function test($args, $apidata) {
- global $xw;
+ parent::handle($args);
+
if ($apidata['content-type'] == 'xml') {
$this->init_document('xml');
common_element('ok', NULL, 'true');
common_server_error(_('API method under construction.'), $code=501);
exit();
}
-
+
}
\ No newline at end of file
parent::handle($args);
+ if (!in_array($apidata['content-type'], array('xml', 'json'))) {
+ common_user_error(_('API method not found!'), $code = 404);
+ exit;
+ }
+
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
exit();
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;
+ }
+
$notice_id = $apidata['api_arg'];
$notice = Notice::staticGet($notice_id);
parent::handle($args);
+ if (!in_array($apidata['content-type'], array('xml', 'json'))) {
+ common_user_error(_('API method not found!'), $code = 404);
+ exit;
+ }
+
// Check for RESTfulness
if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
// XXX: Twitter just prints the err msg, no XML / JSON.
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');
$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();
}