diff options
-rwxr-xr-x | include/items.php | 79 | ||||
-rw-r--r-- | mod/feed.php | 7 | ||||
-rwxr-xr-x | view/tpl/atom_feed.tpl | 26 |
3 files changed, 52 insertions, 60 deletions
diff --git a/include/items.php b/include/items.php index 7fc132fe2..2b38adb1a 100755 --- a/include/items.php +++ b/include/items.php @@ -204,9 +204,7 @@ function get_public_feed($channel,$params) { } - echo get_feed_for($channel,get_observer_hash(),$params); - killme(); - + return get_feed_for($channel,get_observer_hash(),$params); } function get_feed_for($channel, $observer_hash, $params) { @@ -232,22 +230,19 @@ function get_feed_for($channel, $observer_hash, $params) { $atom = ''; - $hubxml = feed_hublinks(); - - $salmon = feed_salmonlinks($owner_nick); - $atom .= replace_macros($feed_template, array( '$version' => xmlify(RED_VERSION), + '$red' => xmlify(RED_PLATFORM), '$feed_id' => xmlify($channel['channel_url']), '$feed_title' => xmlify($channel['channel_name']), '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now' , ATOM_TIME)) , - '$hub' => feed_hublinks(), - '$salmon' => feed_salmonlinks($channel['channel_address']), + '$hub' => '', // feed_hublinks(), + '$salmon' => '', // feed_salmonlinks($channel['channel_address']), '$name' => xmlify($channel['channel_name']), '$profile_page' => xmlify($channel['channel_url']), - '$mimephoto' => xmlify($channel['channel_photo_mimetype']), - '$photo' => xmlify($channel['channel_photo_l']), - '$thumb' => xmlify($channel['channel_photo_m']), + '$mimephoto' => xmlify($channel['xchan_photo_mimetype']), + '$photo' => xmlify($channel['xchan_photo_l']), + '$thumb' => xmlify($channel['xchan_photo_m']), '$picdate' => '', '$uridate' => '', '$namdate' => '', @@ -285,8 +280,7 @@ function construct_activity_object($item) { if($item['object']) { $o = '<as:object>' . "\r\n"; - $r = parse_xml_string($item['object'],false); - + $r = json_decode($item['object'],false); if(! $r) return ''; @@ -296,7 +290,8 @@ function construct_activity_object($item) { $o .= '<id>' . xmlify($r->id) . '</id>' . "\r\n"; if($r->title) $o .= '<title>' . xmlify($r->title) . '</title>' . "\r\n"; - if($r->link) { + if($r->links) { + // FIXME!! if(substr($r->link,0,1) === '<') { $r->link = preg_replace('/\<link(.*?)\"\>/','<link$1"/>',$r->link); $o .= $r->link; @@ -317,7 +312,7 @@ function construct_activity_target($item) { if($item['target']) { $o = '<as:target>' . "\r\n"; - $r = parse_xml_string($item['target'],false); + $r = json_decode($item['target'],false); if(! $r) return ''; if($r->type) @@ -326,7 +321,8 @@ function construct_activity_target($item) { $o .= '<id>' . xmlify($r->id) . '</id>' . "\r\n"; if($r->title) $o .= '<title>' . xmlify($r->title) . '</title>' . "\r\n"; - if($r->link) { + if($r->links) { + // FIXME !!! if(substr($r->link,0,1) === '<') { if(strstr($r->link,'&') && (! strstr($r->link,'&'))) $r->link = str_replace('&','&', $r->link); @@ -3957,7 +3953,7 @@ function lose_sharer($importer,$contact,$datarray,$item) { } -function atom_author($tag,$name,$uri,$h,$w,$photo) { +function atom_author($tag,$name,$uri,$h,$w,$type,$photo) { $o = ''; if(! $tag) return $o; @@ -3971,8 +3967,8 @@ function atom_author($tag,$name,$uri,$h,$w,$photo) { $o .= "<$tag>\r\n"; $o .= "<name>$name</name>\r\n"; $o .= "<uri>$uri</uri>\r\n"; - $o .= '<link rel="photo" type="image/jpeg" media:width="' . $w . '" media:height="' . $h . '" href="' . $photo . '" />' . "\r\n"; - $o .= '<link rel="avatar" type="image/jpeg" media:width="' . $w . '" media:height="' . $h . '" href="' . $photo . '" />' . "\r\n"; + $o .= '<link rel="photo" type="' . $type . '" media:width="' . $w . '" media:height="' . $h . '" href="' . $photo . '" />' . "\r\n"; + $o .= '<link rel="avatar" type="' . $type . '" media:width="' . $w . '" media:height="' . $h . '" href="' . $photo . '" />' . "\r\n"; call_hooks('atom_author', $o); @@ -4000,35 +3996,36 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) { $o = "\r\n\r\n<entry>\r\n"; if(is_array($author)) - $o .= atom_author('author',$author['name'],$author['url'],80,80,$author['thumb']); + $o .= atom_author('author',$author['xchan_name'],$author['xchan_url'],80,80,$author['xchan_photo_mimetype'],$author['xchan_photo_m']); else - $o .= atom_author('author',(($item['author-name']) ? $item['author-name'] : $item['name']),(($item['author-link']) ? $item['author-link'] : $item['url']),80,80,(($item['author-avatar']) ? $item['author-avatar'] : $item['thumb'])); - if(strlen($item['owner-name'])) - $o .= atom_author('dfrn:owner',$item['owner-name'],$item['owner-link'],80,80,$item['owner-avatar']); + $o .= atom_author('author',$item['author']['xchan_name'],$item['author']['xchan_url'],80,80,$item['author']['xchan_photo_mimetype'], $item['author']['xchan_photo_m']); + + $o .= atom_author('zot:owner',$item['owner']['xchan_name'],$item['owner']['xchan_url'],80,80,$item['owner']['xchan_photo_mimetype'],$item['owner']['xchan_photo_m']); if(($item['parent'] != $item['id']) || ($item['parent_mid'] !== $item['mid']) || (($item['thr_parent'] !== '') && ($item['thr_parent'] !== $item['mid']))) { $parent_item = (($item['thr_parent']) ? $item['thr_parent'] : $item['parent_mid']); - $o .= '<thr:in-reply-to ref="' . xmlify($parent_item) . '" type="text/html" href="' . xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['parent']) . '" />' . "\r\n"; + $o .= '<thr:in-reply-to ref="' . xmlify($parent_item) . '" type="text/html" href="' . xmlify($item['plink']) . '" />' . "\r\n"; } $o .= '<id>' . xmlify($item['mid']) . '</id>' . "\r\n"; $o .= '<title>' . xmlify($item['title']) . '</title>' . "\r\n"; $o .= '<published>' . xmlify(datetime_convert('UTC','UTC',$item['created'] . '+00:00',ATOM_TIME)) . '</published>' . "\r\n"; $o .= '<updated>' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '</updated>' . "\r\n"; - $o .= '<dfrn:env>' . base64url_encode($body, true) . '</dfrn:env>' . "\r\n"; + $o .= '<zot:env>' . base64url_encode($body, true) . '</zot:env>' . "\r\n"; + // FIXME for other content types $o .= '<content type="' . $type . '" >' . xmlify((($type === 'html') ? bbcode($body) : $body)) . '</content>' . "\r\n"; - $o .= '<link rel="alternate" type="text/html" href="' . xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']) . '" />' . "\r\n"; + $o .= '<link rel="alternate" type="text/html" href="' . xmlify($item['plink']) . '" />' . "\r\n"; if($item['location']) { - $o .= '<dfrn:location>' . xmlify($item['location']) . '</dfrn:location>' . "\r\n"; + $o .= '<zot:location>' . xmlify($item['location']) . '</zot:location>' . "\r\n"; $o .= '<poco:address><poco:formatted>' . xmlify($item['location']) . '</poco:formatted></poco:address>' . "\r\n"; } if($item['coord']) $o .= '<georss:point>' . xmlify($item['coord']) . '</georss:point>' . "\r\n"; - if(($item['private']) || strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) - $o .= '<dfrn:private>' . (($item['private']) ? $item['private'] : 1) . '</dfrn:private>' . "\r\n"; + if(($item['item_private']) || strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) + $o .= '<zot:private>' . (($item['item_private']) ? $item['item_private'] : 1) . '</zot:private>' . "\r\n"; if($item['app']) @@ -4044,18 +4041,20 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) { if(strlen($actarg)) $o .= $actarg; - $tags = item_getfeedtags($item); - if(count($tags)) { - foreach($tags as $t) { - $o .= '<category scheme="X-DFRN:' . xmlify($t[0]) . ':' . xmlify($t[1]) . '" term="' . xmlify($t[2]) . '" />' . "\r\n"; - } - } + // FIXME +// $tags = item_getfeedtags($item); +// if(count($tags)) { +// foreach($tags as $t) { +// $o .= '<category scheme="X-DFRN:' . xmlify($t[0]) . ':' . xmlify($t[1]) . '" term="' . xmlify($t[2]) . '" />' . "\r\n"; +// } +// } - $o .= item_getfeedattach($item); +// FIXME +// $o .= item_getfeedattach($item); - $mentioned = get_mentions($item,$tags); - if($mentioned) - $o .= $mentioned; +// $mentioned = get_mentions($item,$tags); +// if($mentioned) +// $o .= $mentioned; call_hooks('atom_entry', $o); diff --git a/mod/feed.php b/mod/feed.php index a6adc620e..104208875 100644 --- a/mod/feed.php +++ b/mod/feed.php @@ -13,7 +13,7 @@ function feed_init(&$a) { $channel = ''; if(argc() > 1) { - $r = q("select * from channel where channel_address = '%s' limit 1", + $r = q("select * from channel left join xchan on channel_hash = xchan_hash where channel_address = '%s' limit 1", dbesc(argv(1)) ); if(!($r && count($r))) @@ -21,11 +21,6 @@ function feed_init(&$a) { $channel = $r[0]; - // check site and channel permissions - - if(!($channel['channel_r_stream'] & PERMS_PUBLIC)) - killme(); - if((intval(get_config('system','block_public'))) && (! get_account_id())) killme(); diff --git a/view/tpl/atom_feed.tpl b/view/tpl/atom_feed.tpl index db553d99f..2c8024d47 100755 --- a/view/tpl/atom_feed.tpl +++ b/view/tpl/atom_feed.tpl @@ -1,14 +1,10 @@ -{{* - * AUTOMATICALLY GENERATED TEMPLATE - * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN - * - *}} <?xml version="1.0" encoding="utf-8" ?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:at="http://purl.org/atompub/tombstones/1.0" xmlns:media="http://purl.org/syndication/atommedia" xmlns:dfrn="http://purl.org/macgirvin/dfrn/1.0" + xmlns:zot="http://purl.org/zot" xmlns:as="http://activitystrea.ms/spec/1.0/" xmlns:georss="http://www.georss.org/georss" xmlns:poco="http://portablecontacts.net/spec/1.0" @@ -17,18 +13,20 @@ <id>{{$feed_id}}</id> <title>{{$feed_title}}</title> - <generator uri="http://friendica.com" version="{{$version}}">Friendica</generator> + <generator uri="http://getzot.com" version="{{$version}}">{{$red}}</generator> <link rel="license" href="http://creativecommons.org/licenses/by/3.0/" /> +{{if $hub}} {{$hub}} +{{/if}} +{{if $salmon}} {{$salmon}} - {{$community}} +{{/if}} <updated>{{$feed_updated}}</updated> - <dfrn:owner> - <name dfrn:updated="{{$namdate}}" >{{$name}}</name> - <uri dfrn:updated="{{$uridate}}" >{{$profile_page}}</uri> - <link rel="photo" type="image/jpeg" dfrn:updated="{{$picdate}}" media:width="175" media:height="175" href="{{$photo}}" /> - <link rel="avatar" type="image/jpeg" dfrn:updated="{{$picdate}}" media:width="175" media:height="175" href="{{$photo}}" /> - {{$birthday}} - </dfrn:owner> + <zot:owner> + <name>{{$name}}</name> + <uri>{{$profile_page}}</uri> + <link rel="photo" type="{{$mimephoto}}" media:width="175" media:height="175" href="{{$photo}}" /> + <link rel="avatar" type="{{$mimephoto}}" media:width="175" media:height="175" href="{{$photo}}" /> + </zot:owner> |