]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apiuserfriends.php
More listitems and lists into separate files + stronger typing
[quix0rs-gnu-social.git] / actions / apiuserfriends.php
index 8a42e36b98ccca3da91b372b831c4baf3f5c5bd2..89a90239a1bbc267a6ac65b9f65f20c1fb4d123e 100644 (file)
  *
  * @category  API
  * @package   StatusNet
+ * @author    Dan Moore <dan@moore.cx>
+ * @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
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET')) {
-    exit(1);
-}
-
-require_once INSTALLDIR.'/lib/apibareauth.php';
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 /**
  * Ouputs the authenticating user's friends (subscriptions), each with
@@ -40,11 +38,12 @@ require_once INSTALLDIR.'/lib/apibareauth.php';
  *
  * @category API
  * @package  StatusNet
+ * @author   Dan Moore <dan@moore.cx>
+ * @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 ApiUserFriendsAction extends ApiSubscriptionsAction
 {
     /**
@@ -52,8 +51,7 @@ class ApiUserFriendsAction extends ApiSubscriptionsAction
      *
      * @return array Profiles
      */
-
-    function getProfiles()
+    protected function getProfiles()
     {
         $offset = ($this->page - 1) * $this->count;
         $limit =  $this->count + 1;
@@ -61,11 +59,11 @@ class ApiUserFriendsAction extends ApiSubscriptionsAction
         $subs = null;
 
         if (isset($this->tag)) {
-            $subs = $this->user->getTaggedSubscriptions(
+            $subs = $this->target->getTaggedSubscriptions(
                 $this->tag, $offset, $limit
             );
         } else {
-            $subs = $this->user->getSubscriptions(
+            $subs = $this->target->getSubscribed(
                 $offset,
                 $limit
             );
@@ -73,13 +71,10 @@ class ApiUserFriendsAction extends ApiSubscriptionsAction
 
         $profiles = array();
 
-        if (!empty($subs)) {
-            while ($subs->fetch()) {
-                $profiles[] = clone($subs);
-            }
+        while ($subs->fetch()) {
+            $profiles[] = clone($subs);
         }
 
         return $profiles;
     }
-
 }