forked from GNUsocial/gnu-social
- Output correct content type header for public timeline Atom feed
- Also calculate Atom link and self links properly
This commit is contained in:
parent
e1537d8387
commit
d10cb89f6a
@ -107,7 +107,8 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
|||||||
$title = sprintf(_("%s public timeline"), $sitename);
|
$title = sprintf(_("%s public timeline"), $sitename);
|
||||||
$taguribase = TagURI::base();
|
$taguribase = TagURI::base();
|
||||||
$id = "tag:$taguribase:PublicTimeline";
|
$id = "tag:$taguribase:PublicTimeline";
|
||||||
$link = common_root_url();
|
$link = common_local_url('public');
|
||||||
|
$self = $this->getSelfUri();
|
||||||
$subtitle = sprintf(_("%s updates from everyone!"), $sitename);
|
$subtitle = sprintf(_("%s updates from everyone!"), $sitename);
|
||||||
|
|
||||||
switch($this->format) {
|
switch($this->format) {
|
||||||
@ -115,10 +116,20 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
|||||||
$this->showXmlTimeline($this->notices);
|
$this->showXmlTimeline($this->notices);
|
||||||
break;
|
break;
|
||||||
case 'rss':
|
case 'rss':
|
||||||
$this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo);
|
$this->showRssTimeline(
|
||||||
|
$this->notices,
|
||||||
|
$title,
|
||||||
|
$link,
|
||||||
|
$subtitle,
|
||||||
|
null,
|
||||||
|
$sitelogo,
|
||||||
|
$self
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case 'atom':
|
case 'atom':
|
||||||
|
|
||||||
|
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||||
|
|
||||||
$atom = new AtomNoticeFeed();
|
$atom = new AtomNoticeFeed();
|
||||||
|
|
||||||
$atom->setId($id);
|
$atom->setId($id);
|
||||||
@ -126,16 +137,8 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
|||||||
$atom->setSubtitle($subtitle);
|
$atom->setSubtitle($subtitle);
|
||||||
$atom->setLogo($sitelogo);
|
$atom->setLogo($sitelogo);
|
||||||
$atom->setUpdated('now');
|
$atom->setUpdated('now');
|
||||||
|
|
||||||
$atom->addLink(common_local_url('public'));
|
$atom->addLink(common_local_url('public'));
|
||||||
|
$atom->setSelfLink($self);
|
||||||
$atom->addLink(
|
|
||||||
$this->getSelfUri(
|
|
||||||
'ApiTimelinePublic', array('format' => 'atom')
|
|
||||||
),
|
|
||||||
array('rel' => 'self', 'type' => 'application/atom+xml')
|
|
||||||
);
|
|
||||||
|
|
||||||
$atom->addEntryFromNotices($this->notices);
|
$atom->addEntryFromNotices($this->notices);
|
||||||
|
|
||||||
$this->raw($atom->getString());
|
$this->raw($atom->getString());
|
||||||
|
Loading…
Reference in New Issue
Block a user