]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apistatusesshow.php
Much more reliable Facebook SSO
[quix0rs-gnu-social.git] / actions / apistatusesshow.php
index 55eea2356d143541f9b7cfc968e618adc92c0a6a..a98e45f79ca04776b67a9e8de706dd8b27b04fe7 100644 (file)
  *
  * @category  API
  * @package   StatusNet
+ * @author    Craig Andrews <candrews@integralblue.com>
+ * @author    Evan Prodromou <evan@status.net>
+ * @author    Jeffery To <jeffery.to@gmail.com>
+ * @author    Tom Blankenship <mac65@mac65.com>
+ * @author    Mike Cochrane <mikec@mikenz.geek.nz>
+ * @author    Robin Millette <robin@millette.info>
  * @author    Zach Copley <zach@status.net>
  * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -31,24 +38,27 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
-require_once INSTALLDIR.'/lib/twitterapi.php';
+require_once INSTALLDIR . '/lib/apiprivateauth.php';
 
 /**
  * Returns the notice specified by id as a Twitter-style status and inline user
  *
  * @category API
  * @package  StatusNet
+ * @author   Craig Andrews <candrews@integralblue.com>
+ * @author   Evan Prodromou <evan@status.net>
+ * @author   Jeffery To <jeffery.to@gmail.com>
+ * @author   Tom Blankenship <mac65@mac65.com>
+ * @author   Mike Cochrane <mikec@mikenz.geek.nz>
+ * @author   Robin Millette <robin@millette.info>
  * @author   Zach Copley <zach@status.net>
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-
-class ApiStatusesShowAction extends TwitterapiAction
+class ApiStatusesShowAction extends ApiPrivateAuthAction
 {
-
     var $notice_id = null;
     var $notice    = null;
-    var $format    = null;
 
     /**
      * Take arguments for running
@@ -56,9 +66,7 @@ class ApiStatusesShowAction extends TwitterapiAction
      * @param array $args $_REQUEST args
      *
      * @return boolean success flag
-     *
      */
-
     function prepare($args)
     {
         parent::prepare($args);
@@ -74,7 +82,6 @@ class ApiStatusesShowAction extends TwitterapiAction
             $this->notice_id = (int)$this->arg('id');
         }
 
-        $this->format = $this->arg('format');
         $this->notice = Notice::staticGet((int)$this->notice_id);
 
         return true;
@@ -89,13 +96,13 @@ class ApiStatusesShowAction extends TwitterapiAction
      *
      * @return void
      */
-
     function handle($args)
     {
         parent::handle($args);
 
         if (!in_array($this->format, array('xml', 'json'))) {
-            $this->clientError(_('API method not found!'), $code = 404);
+            // TRANS: Client error displayed when trying to handle an unknown API method.
+            $this->clientError(_('API method not found.'), $code = 404);
             return;
         }
 
@@ -107,17 +114,15 @@ class ApiStatusesShowAction extends TwitterapiAction
      *
      * @return void
      */
-
     function showNotice()
     {
         if (!empty($this->notice)) {
             if ($this->format == 'xml') {
-                $this->show_single_xml_status($this->notice);
+                $this->showSingleXmlStatus($this->notice);
             } elseif ($this->format == 'json') {
                 $this->show_single_json_status($this->notice);
             }
         } else {
-
             // XXX: Twitter just sets a 404 header and doens't bother
             // to return an err msg
 
@@ -125,12 +130,14 @@ class ApiStatusesShowAction extends TwitterapiAction
 
             if (!empty($deleted)) {
                 $this->clientError(
+                    // TRANS: Client error displayed requesting a deleted status.
                     _('Status deleted.'),
                     410,
                     $this->format
                 );
             } else {
                 $this->clientError(
+                    // TRANS: Client error displayed requesting a status with an invalid ID.
                     _('No status with that ID found.'),
                     404,
                     $this->format
@@ -146,7 +153,6 @@ class ApiStatusesShowAction extends TwitterapiAction
      *
      * @return boolean true
      */
-
     function isReadOnly($args)
     {
         return true;
@@ -157,7 +163,6 @@ class ApiStatusesShowAction extends TwitterapiAction
      *
      * @return string datestamp of the latest notice in the stream
      */
-
     function lastModified()
     {
         if (!empty($this->notice)) {
@@ -175,7 +180,6 @@ class ApiStatusesShowAction extends TwitterapiAction
      *
      * @return string etag
      */
-
     function etag()
     {
         if (!empty($this->notice)) {
@@ -183,6 +187,7 @@ class ApiStatusesShowAction extends TwitterapiAction
             return '"' . implode(
                 ':',
                 array($this->arg('action'),
+                      common_user_cache_hash($this->auth_user),
                       common_language(),
                       $this->notice->id,
                       strtotime($this->notice->created))
@@ -192,5 +197,4 @@ class ApiStatusesShowAction extends TwitterapiAction
 
         return null;
     }
-
 }