misc generated feed tweaks (fix json content-type, etc)

This commit is contained in:
Andrew Dolgov 2013-01-18 17:37:44 +04:00
parent ca3bca990d
commit 10bdeb4b82
1 changed files with 7 additions and 4 deletions

View File

@ -66,7 +66,7 @@ class Handler_Public extends Handler {
if ($line['note']) { if ($line['note']) {
$content = "<div style=\"$note_style\">Article note: " . $line['note'] . "</div>" . $content = "<div style=\"$note_style\">Article note: " . $line['note'] . "</div>" .
$content; $content;
} }
$tpl->setVariable('ARTICLE_CONTENT', $content, true); $tpl->setVariable('ARTICLE_CONTENT', $content, true);
@ -106,7 +106,11 @@ class Handler_Public extends Handler {
$tpl->addBlock('feed'); $tpl->addBlock('feed');
$tpl->generateOutputToString($tmp); $tpl->generateOutputToString($tmp);
header("Content-Type: text/xml; charset=utf-8"); if (@!$_REQUEST["noxml"]) {
header("Content-Type: text/xml; charset=utf-8");
} else {
header("Content-Type: text/plain; charset=utf-8");
}
print $tmp; print $tmp;
} else if ($format == 'json') { } else if ($format == 'json') {
@ -165,8 +169,7 @@ class Handler_Public extends Handler {
array_push($feed['articles'], $article); array_push($feed['articles'], $article);
} }
header("Content-Type: text/plain; charset=utf-8"); header("Content-Type: text/json; charset=utf-8");
print json_encode($feed); print json_encode($feed);
} else { } else {