Пример #1
0
 /**
  * Prepare the object
  *
  * Check the input values and initialize the object.
  * Shows an error page on bad input.
  *
  * @param array $args $_REQUEST data
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     $nickname = common_canonical_nickname($this->arg('nickname'));
     $this->user = User::staticGet('nickname', $nickname);
     if (!$this->user) {
         // TRANS: Client error displayed when trying to reply to a non-exsting user.
         $this->clientError(_('No such user.'));
         return false;
     }
     $profile = $this->user->getProfile();
     if (!$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;
     common_set_returnto($this->selfUrl());
     $stream = new ReplyNoticeStream($this->user->id, 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.'), $code = 404);
     }
     return true;
 }
 /**
  * Get notices
  *
  * @return array notices
  */
 function getNotices()
 {
     $notices = array();
     $stream = new ReplyNoticeStream($this->target->id, $this->scoped);
     $notice = $stream->getNotices(($this->page - 1) * $this->count, $this->count, $this->since_id, $this->max_id);
     while ($notice->fetch()) {
         $notices[] = clone $notice;
     }
     return $notices;
 }
Пример #3
0
 /**
  * Get notices
  *
  * @return array notices
  */
 function getNotices()
 {
     $notices = array();
     if (empty($this->auth_user)) {
         $profile = null;
     } else {
         $profile = $this->auth_user->getProfile();
     }
     $stream = new ReplyNoticeStream($this->user->id, $profile);
     $notice = $stream->getNotices(($this->page - 1) * $this->count, $this->count, $this->since_id, $this->max_id);
     while ($notice->fetch()) {
         $notices[] = clone $notice;
     }
     return $notices;
 }
Пример #4
0
 function stream($user_id, $offset = 0, $limit = NOTICES_PER_PAGE, $since_id = 0, $max_id = 0)
 {
     $stream = new ReplyNoticeStream($user_id);
     return $stream->getNotices($offset, $limit, $since_id, $max_id);
 }
 /**
  * Get notices
  *
  * @return array notices
  */
 function getNotices()
 {
     $notices = array();
     if (empty($this->auth_user)) {
         $profile = null;
     } else {
         $profile = $this->auth_user->getProfile();
     }
     $stream = new ReplyNoticeStream($this->user->id, $profile);
     $notice = $stream->getNotices(($this->page - 1) * $this->count, $this->count, $this->since_id, $this->max_id);
     while ($notice->fetch()) {
         $notices[] = clone $notice;
     }
     if ($this->include_in_reply_to_status) {
         $replyNoticeIds = array();
         foreach ($notices as $notice) {
             $reply_toId = $notice->reply_to;
             if (!empty($reply_toId)) {
                 $replyNoticeIds[] = $notice->reply_to;
             }
         }
         $replyNotice = Notice::multiGet('id', $replyNoticeIds);
         while ($replyNotice->fetch()) {
             $replyNoticeArray[] = clone $replyNotice;
         }
         $this->replyNotices = new ArrayWrapper($replyNoticeArray);
     }
     return $notices;
 }