Add empty entry author if contact query fails in DFRN

- Addresses https://github.com/friendica/friendica/issues/6338#issuecomment-462722599
This commit is contained in:
Hypolite Petovan 2019-02-24 14:00:40 -05:00
parent 0888850702
commit e66768a058

View File

@ -763,31 +763,33 @@ class DFRN
*/ */
private static function addEntryAuthor(DOMDocument $doc, $element, $contact_url, $item) private static function addEntryAuthor(DOMDocument $doc, $element, $contact_url, $item)
{ {
$contact = Contact::getDetailsByURL($contact_url, $item["uid"]);
$author = $doc->createElement($element); $author = $doc->createElement($element);
XML::addElement($doc, $author, "name", $contact["name"]);
XML::addElement($doc, $author, "uri", $contact["url"]);
XML::addElement($doc, $author, "dfrn:handle", $contact["addr"]);
/// @Todo $contact = Contact::getDetailsByURL($contact_url, $item["uid"]);
/// - Check real image type and image size if (!empty($contact)) {
/// - Check which of these boths elements we should use XML::addElement($doc, $author, "name", $contact["name"]);
$attributes = [ XML::addElement($doc, $author, "uri", $contact["url"]);
XML::addElement($doc, $author, "dfrn:handle", $contact["addr"]);
/// @Todo
/// - Check real image type and image size
/// - Check which of these boths elements we should use
$attributes = [
"rel" => "photo", "rel" => "photo",
"type" => "image/jpeg", "type" => "image/jpeg",
"media:width" => 80, "media:width" => 80,
"media:height" => 80, "media:height" => 80,
"href" => $contact["photo"]]; "href" => $contact["photo"]];
XML::addElement($doc, $author, "link", "", $attributes); XML::addElement($doc, $author, "link", "", $attributes);
$attributes = [ $attributes = [
"rel" => "avatar", "rel" => "avatar",
"type" => "image/jpeg", "type" => "image/jpeg",
"media:width" => 80, "media:width" => 80,
"media:height" => 80, "media:height" => 80,
"href" => $contact["photo"]]; "href" => $contact["photo"]];
XML::addElement($doc, $author, "link", "", $attributes); XML::addElement($doc, $author, "link", "", $attributes);
}
return $author; return $author;
} }