function prepare($args) { parent::prepare($args); $this->nickname = common_canonical_nickname($this->arg('nickname')); $this->user = User::staticGet('nickname', $this->nickname); return true; }
function prepare($args) { parent::prepare($args); $nickname_arg = $this->arg('nickname'); $nickname = common_canonical_nickname($nickname_arg); // Permanent redirect on non-canonical nickname if ($nickname_arg != $nickname) { $args = array('nickname' => $nickname); if ($this->arg('page') && $this->arg('page') != 1) { $args['page'] = $this->arg['page']; } common_redirect(common_local_url('usergroups', $args), 301); return false; } $this->user = User::staticGet('nickname', $nickname); if (!$this->user) { // TRANS: Client error displayed requesting groups for a non-existing user. $this->clientError(_('No such user.'), 404); return false; } $this->profile = $this->user->getProfile(); if (!$this->profile) { // TRANS: Error message displayed when referring to a user without a profile. $this->serverError(_('User has no profile.')); return false; } $this->page = $this->arg('page') ? $this->arg('page') + 0 : 1; return true; }
function prepare($args) { parent::prepare($args); // FIXME very similar code below $nickname_arg = $this->arg('nickname'); $nickname = common_canonical_nickname($nickname_arg); // Permanent redirect on non-canonical nickname if ($nickname_arg != $nickname) { $args = array('nickname' => $nickname); if ($this->arg('page') && $this->arg('page') != 1) { $args['page'] = $this->arg['page']; } common_redirect(common_local_url($this->trimmed('action'), $args), 301); return false; } $this->user = User::staticGet('nickname', $nickname); if (!$this->user) { // TRANS: Client error displayed when trying to perform a gallery action with an unknown user. $this->clientError(_('No such user.'), 404); return false; } $this->profile = $this->user->getProfile(); if (!$this->profile) { // TRANS: Error message displayed when referring to a user without a profile. $this->serverError(_('User has no profile.')); return false; } $this->page = $this->arg('page') ? $this->arg('page') + 0 : 1; $this->tag = $this->trimmed('tag'); $this->q = $this->trimmed('q'); return true; }
function prepare($args) { parent::prepare($args); $this->nickname = common_canonical_nickname($this->arg('nickname')); $this->user = User::staticGet('nickname', $this->nickname); $this->image = Image::staticGet('id', $this->arg('image_id')); $this->portfolio_id = $this->arg('portfolio_id'); return true; }
function prepare($args) { parent::prepare($args); $stream = new ThreadingInboxNoticeStream($this->user, Profile::current()); $this->notice = $stream->getNotices(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); if ($this->page > 1 && $this->notice->N == 0) { // TRANS: Server error when page not found (404). $this->serverError(_('No such page.'), 404); } return true; }
function prepare($args) { parent::prepare($args); $p = Profile::current(); if (empty($this->tag)) { $stream = new ProfileNoticeStream($this->profile, $p); } else { $stream = new TaggedProfileNoticeStream($this->profile, $this->tag, $p); } $this->notice = $stream->getNotices(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); return true; }
protected function prepare(array $args = array()) { parent::prepare($args); // fetch the actual stream stuff $stream = $this->getStream(); $this->notice = $stream->getNotices(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); if ($this->page > 1 && $this->notice->N == 0) { // TRANS: Client error when page not found (404). $this->clientError(_('No such page.'), 404); } return true; }
function prepare($args) { parent::prepare($args); $cur = common_current_user(); if (!empty($cur) && $cur->id == $this->user->id) { $this->notice = $this->user->noticeInbox(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); } else { $this->notice = $this->user->noticesWithFriends(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); } if ($this->page > 1 && $this->notice->N == 0) { $this->serverError(_('您访问的网页不存在'), $code = 404); } return true; }
function prepare($args) { parent::prepare($args); $cur = common_current_user(); if (!empty($cur) && $cur->id == $this->user->id) { $this->notice = $this->user->noticeInbox(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); } else { $this->notice = $this->user->noticesWithFriends(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); } if ($this->page > 1 && $this->notice->N == 0) { // TRANS: Server error when page not found (404) $this->serverError(_('No such page.'), $code = 404); } return true; }
protected function prepare(array $args = array()) { parent::prepare($args); // In case we need more info than ProfileAction->doPreparation() gives us $this->doStreamPreparation(); // fetch the actual stream stuff try { $stream = $this->getStream(); $this->notice = $stream->getNotices(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); } catch (PrivateStreamException $e) { $this->notice = new Notice(); $this->notice->whereAdd('FALSE'); } if ($this->page > 1 && $this->notice->N == 0) { // TRANS: Client error when page not found (404). $this->clientError(_('No such page.'), 404); } return true; }