]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apistatusnetversion.php
Merge branch '1.0.x' of gitorious.org:statusnet/mainline into 1.0.x
[quix0rs-gnu-social.git] / actions / apistatusnetversion.php
index e6f35e7d29586e513519ea5f3e8edbb6f8ec008d..3a7b150cab4e033d6088d2c2c912bdfae48916c0 100644 (file)
@@ -21,6 +21,7 @@
  *
  * @category  API
  * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
  * @author    Zach Copley <zach@status.net>
  * @copyright 2009 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
@@ -31,7 +32,7 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
-require_once INSTALLDIR . '/lib/api.php';
+require_once INSTALLDIR . '/lib/apiprivateauth.php';
 
 /**
  * Returns a version number for this version of StatusNet, which
@@ -41,15 +42,13 @@ require_once INSTALLDIR . '/lib/api.php';
  *
  * @category API
  * @package  StatusNet
+ * @author   Evan Prodromou <evan@status.net>
  * @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 ApiStatusnetVersionAction extends TwitterApiAction
+class ApiStatusnetVersionAction extends ApiPrivateAuthAction
 {
-    var $format = null;
-
     /**
      * Take arguments for running
      *
@@ -58,11 +57,9 @@ class ApiStatusnetVersionAction extends TwitterApiAction
      * @return boolean success flag
      *
      */
-
     function prepare($args)
     {
         parent::prepare($args);
-        $this->format = $this->arg('format');
         return true;
     }
 
@@ -73,31 +70,43 @@ class ApiStatusnetVersionAction extends TwitterApiAction
      *
      * @return void
      */
-
     function handle($args)
     {
         parent::handle($args);
 
         switch ($this->format) {
         case 'xml':
-            $this->init_document('xml');
+            $this->initDocument('xml');
             $this->element('version', null, STATUSNET_VERSION);
-            $this->end_document('xml');
+            $this->endDocument('xml');
             break;
         case 'json':
-            $this->init_document('json');
+            $this->initDocument('json');
             print '"'.STATUSNET_VERSION.'"';
-            $this->end_document('json');
+            $this->endDocument('json');
             break;
         default:
             $this->clientError(
-                _('API method not found!'), 
-                404, 
+                // TRANS: Client error displayed when coming across a non-supported API method.
+                _('API method not found.'),
+                404,
                 $this->format
             );
             break;
         }
     }
 
+    /**
+     * Return true if read only.
+     *
+     * MAY override
+     *
+     * @param array $args other arguments
+     *
+     * @return boolean is read only action?
+     */
+    function isReadOnly($args)
+    {
+        return true;
+    }
 }
-