示例#1
0
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->getTargetUser(null);
     $this->group = $this->getTargetGroup(null);
     return true;
 }
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     $this->target = $this->getTargetProfile(null);
     $this->group = $this->getTargetGroup(null);
     return true;
 }
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     $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();
     // only keep id, name, nickname and avatar URL
     foreach ($this->profiles as $p) {
         try {
             $avatar = Avatar::byProfile($p, AVATAR_STREAM_SIZE);
             $avatar = $avatar->url;
         } 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;
     }
     return true;
 }
示例#4
0
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->cursor = (int) $this->arg('cursor', -1);
     $this->user = $this->getTargetUser($this->arg('user'));
     $this->getLists();
     return true;
 }
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->getTargetUser($this->arg('id'));
     if (empty($this->user)) {
         // TRANS: Client error displayed when making an Atom API request for an unknown user.
         $this->clientError(_('No such user.'), 404);
     }
     return true;
 }
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     $this->list = $this->getTargetList($this->arg('nickname'), $this->arg('id'));
     if (!$this->list instanceof Profile_list) {
         // TRANS: Client error displayed when requesting a non existing list
         $this->clientError(_('List not found.'), 404);
     }
     $this->notices = $this->getNotices();
     return true;
 }
示例#7
0
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->getTargetUser(null);
     if (empty($this->user)) {
         $this->clientError(_('No such user.'), 404, $this->format);
         return false;
     }
     $this->groups = $this->getGroups();
     return true;
 }
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->getTargetUser($this->arg('id'));
     if (empty($this->user)) {
         // TRANS: Client error displayed when requesting most recent favourite notices by a user for a non-existing user.
         $this->clientError(_('No such user.'), 404, $this->format);
     }
     $this->notices = $this->getNotices();
     return true;
 }
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     $this->target = $this->getTargetProfile($this->arg('id'));
     if (!$this->target instanceof Profile) {
         // TRANS: Client error displayed when requesting most recent dents by user and friends for a non-existing user.
         $this->clientError(_('No such user.'), 404);
     }
     $this->notices = $this->getNotices();
     return true;
 }
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->getTargetUser($this->arg('id'));
     if (empty($this->user)) {
         $this->clientError(_('No such user.'), 404, $this->format);
         return;
     }
     $this->notices = $this->getNotices();
     return true;
 }
示例#11
0
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     //TODO: Make sure this doesn't leak unwantedly for federated users
     $this->target = $this->getTargetProfile(null);
     if (!$this->target instanceof Profile) {
         // TRANS: Client error displayed when user not found for an action.
         $this->clientError(_('No such user.'), 404);
     }
     $this->groups = $this->getGroups();
     return true;
 }
示例#12
0
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->getTargetUser(null);
     if (empty($this->user)) {
         // TRANS: Client error displayed when user not found for an action.
         $this->clientError(_('No such user.'), 404, $this->format);
         return false;
     }
     $this->groups = $this->getGroups();
     return true;
 }
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     $this->cursor = (int) $this->arg('cursor', -1);
     $user = $this->getTargetUser($this->arg('user'));
     if (!$user instanceof User) {
         // TRANS: Client error displayed trying to perform an action related to a non-existing user.
         $this->clientError(_('No such user.'), 404);
     }
     $this->target = $user->getProfile();
     $this->getLists();
     return true;
 }
示例#14
0
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     // If called as a social graph method, show 5000 per page, otherwise 100
     $this->count = (int) $this->arg('count', 100);
     $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();
     return true;
 }
示例#15
0
 /**
  * Prepare for running the action
  * Take arguments for running:s
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->cursor = (int) $this->arg('cursor', -1);
     $this->user = $this->getTargetUser($this->arg('user'));
     if (empty($this->user)) {
         // TRANS: Client error displayed trying to perform an action related to a non-existing user.
         $this->clientError(_('No such user.'), 404, $this->format);
         return;
     }
     $this->getLists();
     return true;
 }
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->getTargetUser($this->arg('id'));
     $this->include_in_reply_to_status = $this->arg('include_in_reply_to_status');
     if (empty($this->user)) {
         // TRANS: Client error displayed when requesting most recent mentions for a non-existing user.
         $this->clientError(_('No such user.'), 404, $this->format);
         return;
     }
     $this->notices = $this->getNotices();
     return true;
 }
示例#17
0
 /**
  * Set the flags for handling the request. Show list if this is a GET
  * request, update it if it is POST, delete list if method is DELETE
  * or if method is POST and an argument _method is set to DELETE. Act
  * like we don't know if the current user has no access to the list.
  *
  * Takes parameters:
  *     - user: the user id or nickname
  *     - id:   the id of the tag or the tag itself
  *
  * @return boolean success flag
  */
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     $this->delete = $_SERVER['REQUEST_METHOD'] == 'DELETE' || $this->trimmed('_method') == 'DELETE' && $_SERVER['REQUEST_METHOD'] == 'POST';
     // update list if method is POST or PUT and $this->delete is not true
     $this->update = !$this->delete && in_array($_SERVER['REQUEST_METHOD'], array('POST', 'PUT'));
     $this->user = $this->getTargetUser($this->arg('user'));
     $this->list = $this->getTargetList($this->arg('user'), $this->arg('id'));
     if (empty($this->list)) {
         // TRANS: Client error displayed when referring to a non-existing list.
         $this->clientError(_('List not found.'), 404);
     }
     return true;
 }
示例#18
0
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     $this->target = $this->getTargetProfile($this->arg('id'));
     if (!$this->target instanceof Profile) {
         // TRANS: Client error displayed requesting most recent notices for a non-existing user.
         $this->clientError(_('No such user.'), 404);
     }
     if (!$this->target->isLocal()) {
         $this->serverError(_('Remote user timelines are not available here yet.'), 501);
     }
     $this->notices = $this->getNotices();
     return true;
 }
示例#19
0
 /**
  * Set the flags for handling the request. List lists created by user if this
  * is a GET request, create a new list if it is a POST request.
  *
  * Takes parameters:
  *     - user: the user id or nickname
  * Parameters for POST request
  *     - name: name of the new list (the people tag itself)
  *     - mode: (optional) mode for the new list private/public
  *     - description: (optional) description for the list
  *
  * @return boolean success flag
  */
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     $this->create = $_SERVER['REQUEST_METHOD'] == 'POST';
     if (!$this->create) {
         $this->user = $this->getTargetUser($this->arg('user'));
         if (!$user instanceof User) {
             // TRANS: Client error displayed trying to perform an action related to a non-existing user.
             $this->clientError(_('No such user.'), 404);
         }
         $this->target = $user->getProfile();
         $this->getLists();
     }
     return true;
 }
示例#20
0
 /**
  * Set the flags for handling the request. List lists created by user if this
  * is a GET request, create a new list if it is a POST request.
  *
  * Takes parameters:
  *     - user: the user id or nickname
  * Parameters for POST request
  *     - name: name of the new list (the people tag itself)
  *     - mode: (optional) mode for the new list private/public
  *     - description: (optional) description for the list
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->create = $_SERVER['REQUEST_METHOD'] == 'POST';
     if (!$this->create) {
         $this->user = $this->getTargetUser($this->arg('user'));
         if (empty($this->user)) {
             // TRANS: Client error displayed trying to perform an action related to a non-existing user.
             $this->clientError(_('No such user.'), 404, $this->format);
             return false;
         }
         $this->getLists();
     }
     return true;
 }
 function prepare($args)
 {
     parent::prepare($args);
     $this->target = $this->getTargetProfile($this->arg('id'));
     $this->list = $this->getTargetList($this->arg('user'), $this->arg('list_id'));
     if (empty($this->list)) {
         // TRANS: Client error displayed trying to perform an action related to a non-existing list.
         $this->clientError(_('List not found.'), 404);
     }
     if (!$this->target instanceof Profile) {
         // TRANS: Client error displayed trying to perform an action related to a non-existing user.
         $this->clientError(_('No such user.'), 404);
     }
     return true;
 }
示例#22
0
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->getTargetUser($this->arg('id'));
     $this->list = $this->getTargetList($this->arg('user'), $this->arg('list_id'));
     if (empty($this->list)) {
         // TRANS: Client error displayed trying to perform an action related to a non-existing list.
         $this->clientError(_('List not found.'), 404, $this->format);
         return false;
     }
     if (empty($this->user)) {
         // TRANS: Client error displayed trying to perform an action related to a non-existing user.
         $this->clientError(_('No such user.'), 404, $this->format);
         return false;
     }
     return true;
 }
示例#23
0
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->tag = $this->arg('tag');
     // Note: Twitter no longer supports 'lite'
     $this->lite = $this->arg('lite');
     $this->ids_only = $this->arg('ids_only');
     // If called as a social graph method, show 5000 per page, otherwise 100
     $this->count = isset($this->ids_only) ? 5000 : (int) $this->arg('count', 100);
     $this->user = $this->getTargetUser($this->arg('id'));
     if (empty($this->user)) {
         $this->clientError(_('No such user.'), 404, $this->format);
         return false;
     }
     $this->profiles = $this->getProfiles();
     return true;
 }
 /**
  * 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;
 }
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     $source_id = (int) $this->trimmed('source_id');
     $source_screen_name = $this->trimmed('source_screen_name');
     $target_id = (int) $this->trimmed('target_id');
     $target_screen_name = $this->trimmed('target_screen_name');
     if (!empty($source_id)) {
         $this->source = User::staticGet($source_id);
     } elseif (!empty($source_screen_name)) {
         $this->source = User::staticGet('nickname', $source_screen_name);
     } else {
         $this->source = $this->auth_user;
     }
     if (!empty($target_id)) {
         $this->target = User::staticGet($target_id);
     } elseif (!empty($target_screen_name)) {
         $this->target = User::staticGet('nickname', $target_screen_name);
     }
     return true;
 }
示例#26
0
 protected function prepare(array $args = array())
 {
     // delete list member if method is DELETE or if method is POST and an argument
     // _method is set to DELETE
     $this->delete = $_SERVER['REQUEST_METHOD'] == 'DELETE' || $this->trimmed('_method') == 'DELETE' && $_SERVER['REQUEST_METHOD'] == 'POST';
     // add member if method is POST
     $this->create = !$this->delete && $_SERVER['REQUEST_METHOD'] == 'POST';
     if ($this->arg('id')) {
         $this->target = $this->getTargetProfile($this->arg('id'));
     }
     parent::prepare($args);
     $this->list = $this->getTargetList($this->arg('user'), $this->arg('list_id'));
     if (empty($this->list)) {
         // TRANS: Client error displayed when referring to a non-existing list.
         $this->clientError(_('List not found.'), 404, $this->format);
     }
     if (!$this->create && !$this->delete) {
         $this->getUsers();
     }
     return true;
 }
示例#27
0
 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->getTargetUser($this->arg('id'));
     if (empty($this->user)) {
         // TRANS: Client error displayed when requesting dents of a user and friends for a user that does not exist.
         $this->clientError(_('No such user.'), 404, $this->format);
         return;
     }
     $this->notices = $this->getNotices();
     return true;
 }