]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apitimelinehome.php
Fix localization for license notice in page footer (for ticket #2274: i18n cleanup)
[quix0rs-gnu-social.git] / actions / apitimelinehome.php
index 828eae6cf6f912382f350afe2fe17ba716041bc9..1618c9923c8be7eb79b4c8bd2221afb982bca4b8 100644 (file)
@@ -72,7 +72,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
     function prepare($args)
     {
         parent::prepare($args);
-        common_debug("api home_timeline");
+
         $this->user = $this->getTargetUser($this->arg('id'));
 
         if (empty($this->user)) {
@@ -113,41 +113,58 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
         $avatar     = $profile->getAvatar(AVATAR_PROFILE_SIZE);
         $sitename   = common_config('site', 'name');
         $title      = sprintf(_("%s and friends"), $this->user->nickname);
-        $taguribase = common_config('integration', 'taguri');
+        $taguribase = TagURI::base();
         $id         = "tag:$taguribase:HomeTimeline:" . $this->user->id;
-        $link       = common_local_url(
-            'all', array('nickname' => $this->user->nickname)
-        );
+
         $subtitle   = sprintf(
             _('Updates from %1$s and friends on %2$s!'),
             $this->user->nickname, $sitename
         );
-        $logo       = ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(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);
             break;
         case 'rss':
-            $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $logo);
+            $this->showRssTimeline(
+                $this->notices,
+                $title,
+                $link,
+                $subtitle,
+                null,
+                $logo,
+                $self
+            );
             break;
         case 'atom':
 
-            $target_id = $this->arg('id');
+            header('Content-Type: application/atom+xml; charset=utf-8');
 
-            if (isset($target_id)) {
-                $selfuri = common_root_url() .
-                    'api/statuses/home_timeline/' .
-                    $target_id . '.atom';
-            } else {
-                $selfuri = common_root_url() .
-                    'api/statuses/home_timeline.atom';
-            }
+            $atom = new AtomNoticeFeed();
+
+            $atom->setId($id);
+            $atom->setTitle($title);
+            $atom->setSubtitle($subtitle);
+            $atom->setLogo($logo);
+            $atom->setUpdated('now');
+
+            $atom->addLink($link);
+            $atom->setSelfLink($self);
+
+            $atom->addEntryFromNotices($this->notices);
+            $this->raw($atom->getString());
 
-            $this->showAtomTimeline(
-                $this->notices, $title, $id, $link,
-                $subtitle, null, $selfuri, $logo
-            );
             break;
         case 'json':
             $this->showJsonTimeline($this->notices);
@@ -172,13 +189,13 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
             $notice = $this->user->noticeInbox(
                 ($this->page-1) * $this->count,
                 $this->count, $this->since_id,
-                $this->max_id, $this->since
+                $this->max_id
             );
         } else {
             $notice = $this->user->noticesWithFriends(
                 ($this->page-1) * $this->count,
                 $this->count, $this->since_id,
-                $this->max_id, $this->since
+                $this->max_id
             );
         }