]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apigroupmembership.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / actions / apigroupmembership.php
index c97b27fac425cd7e7f383e359d7738cec37a430d..86ae091162fe1781b0a134391b12fef229469455 100644 (file)
@@ -26,6 +26,7 @@
  * @author    Jeffery To <jeffery.to@gmail.com>
  * @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/
  */
@@ -34,8 +35,6 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
-require_once INSTALLDIR . '/lib/apiprivateauth.php';
-
 /**
  * List 20 newest members of the group specified by name or ID.
  *
@@ -48,7 +47,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-
 class ApiGroupMembershipAction extends ApiPrivateAuthAction
 {
     var $group    = null;
@@ -60,14 +58,17 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
      * @param array $args $_REQUEST args
      *
      * @return boolean success flag
-     *
      */
-
-    function prepare($args)
+    protected function prepare(array $args=array())
     {
         parent::prepare($args);
 
         $this->group    = $this->getTargetGroup($this->arg('id'));
+        if (empty($this->group)) {
+            // TRANS: Client error displayed trying to show group membership on a non-existing group.
+            $this->clientError(_('Group not found.'), 404);
+        }
+
         $this->profiles = $this->getProfiles();
 
         return true;
@@ -78,19 +79,11 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
      *
      * Show the members of the group
      *
-     * @param array $args $_REQUEST data (unused)
-     *
      * @return void
      */
-
-    function handle($args)
+    protected function handle()
     {
-        parent::handle($args);
-
-        if (empty($this->group)) {
-            $this->clientError(_('Group not found.'), 404, $this->format);
-            return false;
-        }
+        parent::handle();
 
         // XXX: RSS and Atom
 
@@ -102,12 +95,8 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
             $this->showJsonUsers($this->profiles);
             break;
         default:
-            $this->clientError(
-                _('API method not found.'),
-                404,
-                $this->format
-            );
-            break;
+            // TRANS: Client error displayed when coming across a non-supported API method.
+            $this->clientError(_('API method not found.'), 404);
         }
     }
 
@@ -116,7 +105,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
      *
      * @return array $profiles list of profiles
      */
-
     function getProfiles()
     {
         $profiles = array();
@@ -142,8 +130,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
      *
      * @return boolean true
      */
-
-    function isReadOnly($args)
+    function isReadOnly(array $args=array())
     {
         return true;
     }
@@ -153,7 +140,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
      *
      * @return string datestamp of the lastest profile in the group
      */
-
     function lastModified()
     {
         if (!empty($this->profiles) && (count($this->profiles) > 0)) {
@@ -172,7 +158,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
      *
      * @return string etag
      */
-
     function etag()
     {
         if (!empty($this->profiles) && (count($this->profiles) > 0)) {
@@ -182,6 +167,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
             return '"' . implode(
                 ':',
                 array($this->arg('action'),
+                      common_user_cache_hash($this->auth_user),
                       common_language(),
                       $this->group->id,
                       strtotime($this->profiles[0]->created),
@@ -192,5 +178,4 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
 
         return null;
     }
-
 }