diff options
author | Mario Vavti <mario@mariovavti.com> | 2017-05-12 10:04:00 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-05-12 10:04:00 +0200 |
commit | 18ee1ba589994bcda211dcb75c667cadfcce0c7e (patch) | |
tree | 10023a23ca4671ade7127497b9c1caa93d458eb2 | |
parent | 1ebc9de1e6c7e242cfe6e39ab3c4b82d53e1539b (diff) | |
parent | 795b39250fae18f081d955800b3981c47578b9b1 (diff) | |
download | volse-hubzilla-18ee1ba589994bcda211dcb75c667cadfcce0c7e.tar.gz volse-hubzilla-18ee1ba589994bcda211dcb75c667cadfcce0c7e.tar.bz2 volse-hubzilla-18ee1ba589994bcda211dcb75c667cadfcce0c7e.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev
-rw-r--r-- | Zotlabs/Module/Profile_photo.php | 2 | ||||
-rw-r--r-- | include/feedutils.php | 45 | ||||
-rw-r--r-- | include/zot.php | 4 | ||||
-rwxr-xr-x | view/tpl/atom_feed.tpl | 7 |
4 files changed, 42 insertions, 16 deletions
diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index e8f0e5186..47b627015 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -190,7 +190,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { build_sync_packet($channel['channel_id'],array('file' => array($sync))); - // Similarly, tell the nav bar to bypass the cache and update the avater image. + // Similarly, tell the nav bar to bypass the cache and update the avatar image. $_SESSION['reload_avatar'] = true; info( t('Shift-reload the page or clear browser cache if the new photo does not display immediately.') . EOL); diff --git a/include/feedutils.php b/include/feedutils.php index 6bb7d103e..6c411723a 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -79,9 +79,11 @@ function get_feed_for($channel, $observer_hash, $params) { $feed_author = ''; if(intval($params['compat']) === 1) { - $feed_author = atom_author('author',$channel['channel_address'],$channel['channel_name'],$channel['xchan_url'],300,300,$channel['xchan_photo_mimetype'],$channel['xchan_photo_l']); + $feed_author = atom_render_author('author',$channel); } + $owner = atom_render_author('zot:owner',$channel); + $atom .= replace_macros($feed_template, array( '$version' => xmlify(Zotlabs\Lib\System::get_project_version()), '$red' => xmlify(Zotlabs\Lib\System::get_platform_name()), @@ -89,6 +91,7 @@ function get_feed_for($channel, $observer_hash, $params) { '$feed_title' => xmlify($channel['channel_name']), '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now', ATOM_TIME)), '$author' => $feed_author, + '$owner' => $owner, '$name' => xmlify($channel['channel_name']), '$profile_page' => xmlify($channel['xchan_url']), '$mimephoto' => xmlify($channel['xchan_photo_mimetype']), @@ -1272,6 +1275,37 @@ function atom_author($tag, $nick, $name, $uri, $h, $w, $type, $photo) { return $o; } + +function atom_render_author($tag,$xchan) { + + + $nick = xmlify(substr($xchan['xchan_addr'],0,strpos($xchan['xchan_addr'],'@'))); + $id = xmlify($xchan['xchan_url']); + $name = xmlify($xchan['xchan_name']); + $photo = xmlify($xchan['xchan_photo_l']); + $type = xmlify($xchan['xchan_photo_mimetype']); + $w = $h = 300; + + $o .= "<$tag>\r\n"; + $o .= " <as:object-type>http://activitystrea.ms/schema/1.0/person</as:object-type>\r\n"; + $o .= " <id>$id</id>\r\n"; + $o .= " <name>$nick</name>\r\n"; + $o .= " <uri>$id</uri>\r\n"; + $o .= ' <link rel="alternate" type="text/html" href="' . $id . '" />' . "\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"; + $o .= ' <poco:preferredUsername>' . $nick . '</poco:preferredUsername>' . "\r\n"; + $o .= ' <poco:displayName>' . $name . '</poco:displayName>' . "\r\n"; + + call_hooks('atom_render_author', $o); + + $o .= "</$tag>\r\n"; + + return $o; + + +} + /** * @brief Create an item for the Atom feed. * @@ -1303,16 +1337,13 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0) { $o = "\r\n\r\n<entry>\r\n"; if(is_array($author)) { - $reddress = substr($author['xchan_addr'],0,strpos($author['xchan_addr'],'@')); - $o .= atom_author('author',$reddress,$author['xchan_name'],$author['xchan_url'],80,80,$author['xchan_photo_mimetype'],$author['xchan_photo_m']); + $o .= atom_render_author('author',$author); } else { - $reddress = substr($item['author']['xchan_addr'],0,strpos($item['author']['xchan_addr'],'@')); - $o .= atom_author('author',$reddress,$item['author']['xchan_name'],$item['author']['xchan_url'],80,80,$item['author']['xchan_photo_mimetype'], $item['author']['xchan_photo_m']); + $o .= atom_render_author('author',$item['author']); } - $reddress = substr($item['owner']['xchan_addr'],0,strpos($item['owner']['xchan_addr'],'@')); - $o .= atom_author('zot:owner',$reddress,$item['owner']['xchan_name'],$item['owner']['xchan_url'],80,80,$item['owner']['xchan_photo_mimetype'],$item['owner']['xchan_photo_m']); + $o .= atom_render_author('zot:owner',$item['owner']); 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']); diff --git a/include/zot.php b/include/zot.php index a168dff1b..748fe7b99 100644 --- a/include/zot.php +++ b/include/zot.php @@ -3160,8 +3160,8 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { if(array_key_exists('menu',$arr) && $arr['menu']) sync_menus($channel,$arr['menu']); - if(array_key_exists('menu',$arr) && $arr['menu']) - sync_menus($channel,$arr['menu']); + if(array_key_exists('file',$arr) && $arr['file']) + sync_files($channel,$arr['file']); if(array_key_exists('wiki',$arr) && $arr['wiki']) sync_items($channel,$arr['wiki'],((array_key_exists('relocate',$arr)) ? $arr['relocate'] : null)); diff --git a/view/tpl/atom_feed.tpl b/view/tpl/atom_feed.tpl index ba50867ff..fe38fdc80 100755 --- a/view/tpl/atom_feed.tpl +++ b/view/tpl/atom_feed.tpl @@ -22,9 +22,4 @@ <updated>{{$feed_updated}}</updated> - <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> +{{$owner}} |