X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapitimelineuser.php;h=11431a82ca9231658ccf0ea8d82ec693905354e3;hb=e05415f621890bbaf42752577249ecdc22c161fc;hp=3e849cc786c56b69c77b67c5ae6eee3685cdbd8b;hpb=85528ccb1f5840a8c73f6c939f12d98bb3680cde;p=quix0rs-gnu-social.git diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php index 3e849cc786..11431a82ca 100644 --- a/actions/apitimelineuser.php +++ b/actions/apitimelineuser.php @@ -112,21 +112,17 @@ class ApiTimelineUserAction extends ApiBareAuthAction function showTimeline() { $profile = $this->user->getProfile(); - $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); - $sitename = common_config('site', 'name'); - $title = sprintf(_("%s timeline"), $this->user->nickname); - $taguribase = TagURI::base(); - $id = "tag:$taguribase:UserTimeline:" . $this->user->id; - $link = common_local_url( + // We'll use the shared params from the Atom stub + // for other feed types. + $atom = new AtomUserNoticeFeed($this->user); + + $link = common_local_url( 'showstream', array('nickname' => $this->user->nickname) ); - $subtitle = sprintf( - _('Updates from %1$s on %2$s!'), - $this->user->nickname, $sitename - ); - $logo = ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE); + + $self = $this->getSelfUri(); // FriendFeed's SUP protocol // Also added RSS and Atom feeds @@ -140,64 +136,23 @@ class ApiTimelineUserAction extends ApiBareAuthAction break; case 'rss': $this->showRssTimeline( - $this->notices, $title, $link, - $subtitle, $suplink, $logo + $this->notices, + $atom->title, + $link, + $atom->subtitle, + $suplink, + $atom->logo, + $self ); break; case 'atom': header('Content-Type: application/atom+xml; charset=utf-8'); - // If this was called using an integer ID, i.e.: using the canonical - // URL for this user's feed, then pass the User object into the feed, - // so the OStatus plugin, and possibly other plugins, can access it. - // Feels sorta hacky. -- Z - - $atom = null; - $id = $this->arg('id'); - - if (strval(intval($id)) === strval($id)) { - $atom = new AtomUserNoticeFeed($this->user); - } else { - $atom = new AtomUserNoticeFeed(); - } - - $atom->setId($id); - $atom->setTitle($title); - $atom->setSubtitle($subtitle); - $atom->setLogo($logo); - $atom->setUpdated('now'); - - $atom->addLink( - common_local_url( - 'showstream', - array('nickname' => $this->user->nickname) - ) - ); - - $id = $this->arg('id'); - $aargs = array('format' => 'atom'); - if (!empty($id)) { - $aargs['id'] = $id; - } - - $atom->addLink( - $this->getSelfUri('ApiTimelineUser', $aargs), - array('rel' => 'self', 'type' => 'application/atom+xml') - ); - - $atom->addLink( - $suplink, - array( - 'rel' => 'http://api.friendfeed.com/2008/03#sup', - 'type' => 'application/json' - ) - ); - + $atom->setId($self); + $atom->setSelfLink($self); $atom->addEntryFromNotices($this->notices); - - #$this->raw($atom->getString()); - print $atom->getString(); // temporary for output buffering + $this->raw($atom->getString()); break; case 'json': @@ -222,7 +177,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction $notice = $this->user->getNotices( ($this->page-1) * $this->count, $this->count, - $this->since_id, $this->max_id, $this->since + $this->since_id, $this->max_id ); while ($notice->fetch()) {