X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FOStatus.php;h=7052205e1706b57f55689a15865bbb40998efed9;hb=31d47ade784c080e15626305e7cc49be85ee67b6;hp=80c6edbe9f2b8614fe884b875f811f1aeda8a531;hpb=e06fc2aa6900d8cf5ae4e8d5cf52f9262bf7ada7;p=friendica.git diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 80c6edbe9f..7052205e17 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -1351,13 +1351,15 @@ class OStatus switch ($siteinfo["type"]) { case 'photo': - $imgdata = Image::getInfoFromURL($siteinfo["image"]); - if ($imgdata) { - $attributes = ["rel" => "enclosure", - "href" => $siteinfo["image"], - "type" => $imgdata["mime"], - "length" => intval($imgdata["size"])]; - XML::addElement($doc, $root, "link", "", $attributes); + if (!empty($siteinfo["image"])) { + $imgdata = Image::getInfoFromURL($siteinfo["image"]); + if ($imgdata) { + $attributes = ["rel" => "enclosure", + "href" => $siteinfo["image"], + "type" => $imgdata["mime"], + "length" => intval($imgdata["size"])]; + XML::addElement($doc, $root, "link", "", $attributes); + } } break; case 'video': @@ -1595,12 +1597,9 @@ class OStatus } if (!DBA::isResult($r)) { - $r = q( - "SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1", - DBA::escape(normalise_link($url)) - ); + $gcontact = DBA::selectFirst('gcontact', [], ['nurl' => normalise_link($url)]); if (DBA::isResult($r)) { - $contact = $r[0]; + $contact = $gcontact; $contact["uid"] = -1; $contact["success_update"] = $contact["updated"]; } @@ -1801,14 +1800,11 @@ class OStatus $item['follow'] = $contact['alias']; } - $r = q( - "SELECT `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s'", - intval($owner['uid']), - DBA::escape(normalise_link($contact["url"])) - ); + $condition = ['uid' => $owner['uid'], 'nurl' => normalise_link($contact["url"])]; + $user_contact = DBA::selectFirst('contact', ['id'], $condition); - if (DBA::isResult($r)) { - $connect_id = $r[0]['id']; + if (DBA::isResult($user_contact)) { + $connect_id = $user_contact['id']; } else { $connect_id = 0; }