]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Support undocumented 'id' parameter in /statuses/show API method
authorZach Copley <zach@controlyourself.ca>
Mon, 6 Jul 2009 18:57:21 +0000 (11:57 -0700)
committerZach Copley <zach@controlyourself.ca>
Mon, 6 Jul 2009 18:57:21 +0000 (11:57 -0700)
actions/twitapistatuses.php
lib/router.php

index 555c746cbcae6b041369627a89cc61dc1ef721d6..c9943698dc2bc06510c2d5bafdf506e7e6b6ba43 100644 (file)
@@ -373,9 +373,19 @@ class TwitapistatusesAction extends TwitterapiAction
             return;
         }
 
+        // 'id' is an undocumented parameter in Twitter's API. Several
+        // clients make use of it, so we support it too.
+
+        // show.json?id=12345 takes precedence over /show/12345.json
+
         $this->auth_user = $apidata['user'];
-        $notice_id       = $apidata['api_arg'];
-        $notice          = Notice::staticGet($notice_id);
+        $notice_id       = $this->trimmed('id');
+
+        if (empty($notice_id)) {
+            $notice_id   = $apidata['api_arg'];
+        }
+
+        $notice          = Notice::staticGet((int)$notice_id);
 
         if ($notice) {
             if ($apidata['content-type'] == 'xml') {
@@ -389,7 +399,6 @@ class TwitapistatusesAction extends TwitterapiAction
             $this->clientError(_('No status with that ID found.'),
                 404, $apidata['content-type']);
         }
-
     }
 
     function destroy($args, $apidata)
index 50b733453e1d1266dfc9d7538500169a6dc1dea2..75e72f932295d047bfd0875aab0a91bd5480855a 100644 (file)
@@ -261,7 +261,7 @@ class Router
         $m->connect('api/statuses/:method',
                     array('action' => 'api',
                           'apiaction' => 'statuses'),
-                    array('method' => '(public_timeline|friends_timeline|user_timeline|update|replies|mentions|friends|followers|featured)(\.(atom|rss|xml|json))?'));
+                    array('method' => '(public_timeline|friends_timeline|user_timeline|update|replies|mentions|show|friends|followers|featured)(\.(atom|rss|xml|json))?'));
 
         $m->connect('api/statuses/:method/:argument',
                     array('action' => 'api',