X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FModel%2FFContact.php;h=1c5c186e6994adec3f171ac979092378663f0626;hb=1d86d79778bb7e2d00bd9031877e566a6037144e;hp=cf75a03dbc1df976ecc84c505d7fde2325df95ad;hpb=2a431b580f2e8f6a596e84175932e793678cde63;p=friendica.git diff --git a/src/Model/FContact.php b/src/Model/FContact.php index cf75a03dbc..1c5c186e69 100644 --- a/src/Model/FContact.php +++ b/src/Model/FContact.php @@ -60,7 +60,7 @@ class FContact $update = true; } - if ($person["guid"] == "") { + if (empty($person['guid']) || empty($person['uri-id'])) { $update = true; } } @@ -100,6 +100,7 @@ class FContact 'batch' => $arr["batch"], 'notify' => $arr["notify"], 'poll' => $arr["poll"], 'confirm' => $arr["confirm"], 'alias' => $arr["alias"], 'pubkey' => $arr["pubkey"], + 'uri-id' => ItemURI::insert(['uri' => $arr['url'], 'guid' => $arr['guid']]), 'updated' => DateTimeFormat::utcNow()]; $condition = ['url' => $arr["url"], 'network' => $arr["network"]]; @@ -120,14 +121,9 @@ class FContact { Logger::info('fcontact', ['guid' => $fcontact_guid]); - $r = q( - "SELECT `url` FROM `fcontact` WHERE `url` != '' AND `network` = '%s' AND `guid` = '%s'", - DBA::escape(Protocol::DIASPORA), - DBA::escape($fcontact_guid) - ); - - if (DBA::isResult($r)) { - return $r[0]['url']; + $fcontact = DBA::selectFirst('fcontact', ['url'], ["`url` != ? AND `network` = ? AND `guid` = ?", '', Protocol::DIASPORA, $fcontact_guid]); + if (DBA::isResult($fcontact)) { + return $fcontact['url']; } return null; @@ -175,7 +171,7 @@ class FContact $suggest['body'] = $note; $hash = Strings::getRandomHex(); - $fields = ['uid' => $suggest['uid'], 'fid' => $fid, 'contact-id' => $suggest['cid'], + $fields = ['uid' => $suggest['uid'], 'fid' => $fid, 'contact-id' => $suggest['cid'], 'note' => $suggest['body'], 'hash' => $hash, 'datetime' => DateTimeFormat::utcNow(), 'blocked' => false]; DBA::insert('intro', $fields);