]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apigroupismember.php
Merge branch 'testing' of gitorious.org:statusnet/mainline into testing
[quix0rs-gnu-social.git] / actions / apigroupismember.php
index facc58174eee3897893dc4c2624e5a24ffa36d74..97f8435614e9da39662c67155f0fd1fba1daf3d6 100644 (file)
@@ -21,6 +21,9 @@
  *
  * @category  API
  * @package   StatusNet
+ * @author    Craig Andrews <candrews@integralblue.com>
+ * @author    Evan Prodromou <evan@status.net>
+ * @author    Jeffery To <jeffery.to@gmail.com>
  * @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
@@ -38,6 +41,9 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
  *
  * @category API
  * @package  StatusNet
+ * @author   Craig Andrews <candrews@integralblue.com>
+ * @author   Evan Prodromou <evan@status.net>
+ * @author   Jeffery To <jeffery.to@gmail.com>
  * @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/
@@ -45,8 +51,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
 
 class ApiGroupIsMemberAction extends ApiBareAuthAction
 {
-    var $format  = null;
-    var $user    = null;
     var $group   = null;
 
     /**
@@ -62,15 +66,8 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction
     {
         parent::prepare($args);
 
-        if ($this->requiresAuth()) {
-            if ($this->checkBasicAuthUser() == false) {
-                return;
-            }
-        }
-
         $this->user   = $this->getTargetUser(null);
         $this->group  = $this->getTargetGroup(null);
-        $this->format = $this->arg('format');
 
         return true;
     }
@@ -90,12 +87,12 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction
         parent::handle($args);
 
         if (empty($this->user)) {
-            $this->clientError(_('No such user!'), 404, $this->format);
+            $this->clientError(_('No such user.'), 404, $this->format);
             return;
         }
 
         if (empty($this->group)) {
-            $this->clientError('Group not found!', 404, $this->format);
+            $this->clientError(_('Group not found!'), 404, $this->format);
             return false;
         }
 
@@ -103,18 +100,18 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction
 
         switch($this->format) {
         case 'xml':
-            $this->init_document('xml');
+            $this->initDocument('xml');
             $this->element('is_member', null, $is_member);
-            $this->end_document('xml');
+            $this->endDocument('xml');
             break;
         case 'json':
-            $this->init_document('json');
-            $this->show_json_objects(array('is_member' => $is_member));
-            $this->end_document('json');
+            $this->initDocument('json');
+            $this->showJsonObjects(array('is_member' => $is_member));
+            $this->endDocument('json');
             break;
         default:
             $this->clientError(
-                _('API method not found!'),
+                _('API method not found.'),
                 400,
                 $this->format
             );
@@ -122,4 +119,19 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction
         }
     }
 
+    /**
+     * Return true if read only.
+     *
+     * MAY override
+     *
+     * @param array $args other arguments
+     *
+     * @return boolean is read only action?
+     */
+
+    function isReadOnly($args)
+    {
+        return true;
+    }
+
 }