/**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     $this->format = 'json';
     $this->count = 5000;
     // max 5000, completely arbitrary...
     $this->target = $this->getTargetProfile($this->arg('id'));
     if (!$this->target instanceof Profile) {
         // TRANS: Client error displayed when requesting a list of followers for a non-existing user.
         $this->clientError(_('No such user.'), 404);
     }
     $this->profiles = $this->getProfiles();
     $this->groups = $this->getGroups();
     $this->blocks = QvitterBlocked::getBlockedIDs($this->target->id, 0, 10000);
     // profiles: only keep id, name, nickname and avatar URL
     foreach ($this->profiles as $p) {
         try {
             $avatar = Avatar::urlByProfile($p, AVATAR_STREAM_SIZE);
         } catch (Exception $e) {
             $avatar = false;
         }
         $this_user = array($p->fullname, $p->nickname, $avatar);
         if (!$p->isLocal()) {
             $this_user[3] = $p->getUrl();
         } else {
             $this_user[3] = false;
         }
         $this->users_stripped[$p->id] = $this_user;
     }
     // groups: only keep id, name, nickname, avatar and local aliases
     foreach ($this->groups as $user_group) {
         $p = $user_group->getProfile();
         $avatar = $user_group->stream_logo;
         $this_group = array($p->fullname, $p->nickname, $avatar);
         if (!$user_group->isLocal()) {
             $this_group[3] = $p->getUrl();
         } else {
             $this_group[3] = false;
         }
         $this->groups_stripped[$user_group->id] = $this_group;
     }
     return true;
 }
 /**
  * Get the user's subscribers (followers) as an array of profiles
  *
  * @return array Profiles
  */
 protected function getProfiles()
 {
     $offset = ($this->page - 1) * $this->count;
     $limit = $this->count + 1;
     $blocks = null;
     $blocks = QvitterBlocked::getBlocked($this->target->id, $offset, $limit);
     $profiles = array();
     while ($blocks->fetch()) {
         $this_profile_block = clone $blocks;
         $profiles[] = $this->getTargetProfile($this_profile_block->blocked);
     }
     return $profiles;
 }