]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apigroupmembership.php
Merge branch 'testing' of gitorious.org:statusnet/mainline into 0.9.x
[quix0rs-gnu-social.git] / actions / apigroupmembership.php
index 0bc846d60450e9c2598c40797616ebeb2aeea3d2..ffd5c7c7d572ca0226ee9723026362475f839d80 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    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,19 +35,22 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
-require_once INSTALLDIR . '/lib/api.php';
+require_once INSTALLDIR . '/lib/apiprivateauth.php';
 
 /**
- * List 20 newest members of the group specified by name or ID. 
+ * List 20 newest members of the group specified by name or ID.
  *
  * @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/
  */
 
-class ApiGroupMembershipAction extends ApiAction
+class ApiGroupMembershipAction extends ApiPrivateAuthAction
 {
     var $group    = null;
     var $profiles = null;
@@ -81,18 +88,23 @@ class ApiGroupMembershipAction extends ApiAction
     {
         parent::handle($args);
 
+        if (empty($this->group)) {
+            $this->clientError(_('Group not found.'), 404, $this->format);
+            return false;
+        }
+
         // XXX: RSS and Atom
 
         switch($this->format) {
         case 'xml':
-            $this->show_twitter_xml_users($this->profiles);
+            $this->showTwitterXmlUsers($this->profiles);
             break;
         case 'json':
-            $this->show_json_users($this->profiles);
+            $this->showJsonUsers($this->profiles);
             break;
         default:
             $this->clientError(
-                _('API method not found!'),
+                _('API method not found.'),
                 404,
                 $this->format
             );
@@ -103,7 +115,7 @@ class ApiGroupMembershipAction extends ApiAction
     /**
      * Fetch the members of a group
      *
-     * @return array $profiles list of profiles 
+     * @return array $profiles list of profiles
      */
 
     function getProfiles()
@@ -112,10 +124,9 @@ class ApiGroupMembershipAction extends ApiAction
 
         $profile = $this->group->getMembers(
             ($this->page - 1) * $this->count,
-            $this->count, 
-            $this->since_id, 
-            $this->max_id, 
-            $this->since
+            $this->count,
+            $this->since_id,
+            $this->max_id
         );
 
         while ($profile->fetch()) {
@@ -157,7 +168,7 @@ class ApiGroupMembershipAction extends ApiAction
      * An entity tag for this list of groups
      *
      * Returns an Etag based on the action name, language
-     * the group id, and timestamps of the first and last 
+     * the group id, and timestamps of the first and last
      * user who has joined the group
      *
      * @return string etag