We have an alternate link

This commit is contained in:
Michael 2017-06-06 21:56:25 +00:00
commit 6e6941a546
3 changed files with 79 additions and 3 deletions

View file

@ -11,6 +11,17 @@ function display_init(App $a) {
$nick = (($a->argc > 1) ? $a->argv[1] : '');
$profiledata = array();
if ($a->argc == 3) {
if (substr($a->argv[2], -5) == '.atom') {
require_once('include/dfrn.php');
$item_id = substr($a->argv[2], 0, -5);
$xml = dfrn::itemFeed($item_id);
header("Content-type: application/atom+xml");
echo $xml;
http_status_exit(($xml) ? 200 : 500);
}
}
// If there is only one parameter, then check if this parameter could be a guid
if ($a->argc == 2) {
$nick = "";
@ -278,11 +289,17 @@ function display_content(App $a, $update = 0) {
return;
}
$alternate = App::get_baseurl().'/display/'.$nick.'/'.$item_id.'.atom';
// We are displaying an "alternate" link if that post was public. See issue 2864
$items = q("SELECT `id` FROM `item` WHERE `id` = %d AND NOT `private` AND `wall`", intval($item_id));
if (dbm::is_result($items)) {
$alternate = App::get_baseurl().'/display/'.$nick.'/'.$item_id.'.atom';
} else {
$alternate = '';
}
$a->page['htmlhead'] .= replace_macros(get_markup_template('display-head.tpl'),
array('$alternate' => $alternate));
$groups = array();
$contact = null;