diff options
-rwxr-xr-x | include/items.php | 26 | ||||
-rw-r--r-- | include/network.php | 6 |
2 files changed, 21 insertions, 11 deletions
diff --git a/include/items.php b/include/items.php index 07cf2e0e8..95822c0ba 100755 --- a/include/items.php +++ b/include/items.php @@ -4118,22 +4118,26 @@ function feed_meta($xml) { $rawauthor = $feed->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'author'); logger('rawauthor: ' . print_r($rawauthor,true)); - if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) { - $base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; - foreach($base as $link) { - if(!x($author, 'author_photo') || ! $author['author_photo']) { - if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar') { - $author['author_photo'] = unxmlify($link['attribs']['']['href']); - break; - } - } - } + if($rawauthor) { + if($rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) { + $base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; + foreach($base as $link) { + if(!x($author, 'author_photo') || ! $author['author_photo']) { + if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar') { + $author['author_photo'] = unxmlify($link['attribs']['']['href']); + break; + } + } + } + } if($rawauthor[0]['child'][NAMESPACE_POCO]['displayName'][0]['data']) $author['full_name'] = unxmlify($rawauthor[0]['child'][NAMESPACE_POCO]['displayName'][0]['data']); + if($rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']) + $author['author_uri'] = unxmlify($rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']); + } } - if(substr($author['author_link'],-1,1) == '/') $author['author_link'] = substr($author['author_link'],0,-1); diff --git a/include/network.php b/include/network.php index 7c7da8727..c9ae8b283 100644 --- a/include/network.php +++ b/include/network.php @@ -1265,6 +1265,12 @@ function discover_by_webbie($webbie) { if($feed_meta['author']['author_photo']) $avatar = $feed_meta['author']['author_photo']; } + + // for GNU-social over-ride any url aliases we may have picked up in webfinger + // The author.uri element in the feed is likely to be more accurate + + if($gnusoc && $feed_meta['author']['author_uri']) + $location = $feed_meta['author']['author_uri']; } } else { |