exit(1);
}
-require_once INSTALLDIR . '/lib/apibareauth.php';
-
/**
* Returns the most recent notices (default 20) posted by the target user.
* This is the equivalent of 'You and friends' page accessed via Web.
function showTimeline()
{
$profile = $this->user->getProfile();
- $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
$sitename = common_config('site', 'name');
// TRANS: Timeline title for user and friends. %s is a user nickname.
$title = sprintf(_("%s and friends"), $this->user->nickname);
$this->user->nickname, $sitename
);
- $link = common_local_url(
- 'all',
- array('nickname' => $this->user->nickname)
- );
-
+ $logo = $profile->avatarUrl(AVATAR_PROFILE_SIZE);
+ $link = common_local_url('all',
+ array('nickname' => $this->user->nickname));
$self = $this->getSelfUri();
- $logo = (!empty($avatar))
- ? $avatar->displayUrl()
- : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
-
switch($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
$this->showJsonTimeline($this->notices);
break;
case 'as':
- header('Content-Type: application/json; charset=utf-8');
+ header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
$doc = new ActivityStreamJSONDocument($this->auth_user);
$doc->setTitle($title);
$doc->addLink($link, 'alternate', 'text/html');
$this->raw($doc->asString());
break;
default:
- // TRANS: Client error displayed when trying to handle an unknown API method.
+ // TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
{
$notices = array();
- if (!empty($this->auth_user) && $this->auth_user->id == $this->user->id) {
- $notice = $this->user->noticeInbox(
- ($this->page-1) * $this->count,
- $this->count, $this->since_id,
- $this->max_id
- );
- } else {
- $notice = $this->user->noticesWithFriends(
- ($this->page-1) * $this->count,
- $this->count, $this->since_id,
- $this->max_id
- );
+ $profile = null;
+
+ if (isset($this->auth_user)) {
+ $profile = $this->auth_user->getProfile();
}
+ $stream = new InboxNoticeStream($this->user, $profile);
+
+ $notice = $stream->getNotices(($this->page-1) * $this->count,
+ $this->count,
+ $this->since_id,
+ $this->max_id);
+
while ($notice->fetch()) {
$notices[] = clone($notice);
}