]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
- Output correct content type header for public timeline Atom feed
authorZach Copley <zach@status.net>
Fri, 12 Mar 2010 02:00:53 +0000 (02:00 +0000)
committerZach Copley <zach@status.net>
Fri, 12 Mar 2010 02:00:53 +0000 (02:00 +0000)
- Also calculate Atom link and self links properly

actions/apitimelinepublic.php

index 3e4dad690e83ee80684ef39544ca49b3f5b01e66..9034614253d438b5566a1993c6b1da0182094b18 100644 (file)
@@ -107,7 +107,8 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
         $title      = sprintf(_("%s public timeline"), $sitename);
         $taguribase = TagURI::base();
         $id         = "tag:$taguribase:PublicTimeline";
-        $link       = common_root_url();
+        $link       = common_local_url('public');
+        $self       = $this->getSelfUri();
         $subtitle   = sprintf(_("%s updates from everyone!"), $sitename);
 
         switch($this->format) {
@@ -115,10 +116,20 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
             $this->showXmlTimeline($this->notices);
             break;
         case 'rss':
-            $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo);
+            $this->showRssTimeline(
+                $this->notices,
+                $title,
+                $link,
+                $subtitle,
+                null,
+                $sitelogo,
+                $self
+            );
             break;
         case 'atom':
 
+            header('Content-Type: application/atom+xml; charset=utf-8');
+
             $atom = new AtomNoticeFeed();
 
             $atom->setId($id);
@@ -126,16 +137,8 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
             $atom->setSubtitle($subtitle);
             $atom->setLogo($sitelogo);
             $atom->setUpdated('now');
-
             $atom->addLink(common_local_url('public'));
-
-            $atom->addLink(
-                $this->getSelfUri(
-                    'ApiTimelinePublic', array('format' => 'atom')
-                ),
-                array('rel' => 'self', 'type' => 'application/atom+xml')
-            );
-
+            $atom->setSelfLink($self);
             $atom->addEntryFromNotices($this->notices);
 
             $this->raw($atom->getString());