From 0342f9e08437384401395a534807274831146e7e Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 17 Aug 2018 03:19:42 +0000 Subject: [PATCH] Removed notices, will it ever end? --- include/api.php | 2 +- mod/network.php | 2 +- mod/smilies.php | 2 +- src/Model/Contact.php | 5 +++++ src/Network/Probe.php | 4 +++- src/Protocol/DFRN.php | 10 ++++++++++ 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/include/api.php b/include/api.php index 9fe3cb4bd7..293a8750dd 100644 --- a/include/api.php +++ b/include/api.php @@ -5812,7 +5812,7 @@ function api_friendica_profile_show($type) $nurls = q( "SELECT `id`, `nurl` FROM `contact` WHERE `uid`= %d AND `profile-id` = %d", intval(api_user()), - intval($rr['profile_id']) + intval($rr['id']) ); foreach ($nurls as $nurl) { diff --git a/mod/network.php b/mod/network.php index 6cee4d2b80..e029f1905c 100644 --- a/mod/network.php +++ b/mod/network.php @@ -449,7 +449,7 @@ function networkFlatView(App $a, $update = 0) while ($term = DBA::fetch($result)) { $posts[] = $term['oid']; } - DBA::close($terms); + DBA::close($result); $condition = ['uid' => local_user(), 'id' => $posts]; } else { diff --git a/mod/smilies.php b/mod/smilies.php index 1c0a1bbd76..ecea3400e2 100644 --- a/mod/smilies.php +++ b/mod/smilies.php @@ -13,7 +13,7 @@ use Friendica\Core\System; function smilies_content(App $a) { $smilies = Smilies::getList(); - if ($a->argv[1] === "json") { + if (!empty($a->argv[1]) && ($a->argv[1] === "json")) { $results = []; for ($i = 0; $i < count($smilies['texts']); $i++) { $results[] = ['text' => $smilies['texts'][$i], 'icon' => $smilies['icons'][$i]]; diff --git a/src/Model/Contact.php b/src/Model/Contact.php index b18159d40c..ddca508561 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -364,6 +364,11 @@ class Contact extends BaseObject */ public static function markForArchival(array $contact) { + + if (!isset($contact['url'])) { + logger('Empty contact. ' . System::callstack(10), LOGGER_DEBUG); + } + // Contact already archived or "self" contact? => nothing to do if ($contact['archive'] || $contact['self']) { return; diff --git a/src/Network/Probe.php b/src/Network/Probe.php index 366853c999..76c48c3d2d 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -988,7 +988,9 @@ class Probe if (!empty($webfinger["aliases"]) && is_array($webfinger["aliases"])) { foreach ($webfinger["aliases"] as $alias) { - if (normalise_link($alias) != normalise_link($data["url"]) && ! strstr($alias, "@")) { + if (empty($data["url"]) && !strstr($alias, "@")) { + $data["url"] = $alias; + } elseif (!strstr($alias, "@") && normalise_link($alias) != normalise_link($data["url"])) { $data["alias"] = $alias; } elseif (substr($alias, 0, 5) == 'acct:') { $data["addr"] = substr($alias, 5); diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index 55d635d2e0..2802e20301 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -1580,6 +1580,16 @@ class DFRN $author["avatar"] = current($avatarlist); } + if (empty($author['avatar']) && !empty($author['link'])) { + $cid = Contact::getIdForURL($author['link'], 0); + if (!empty($cid)) { + $contact = DBA::selectFirst('contact', ['avatar'], ['id' => $cid]); + if (DBA::isResult($contact)) { + $author['avatar'] = $contact['avatar']; + } + } + } + if (DBA::isResult($contact_old) && !$onlyfetch) { logger("Check if contact details for contact " . $contact_old["id"] . " (" . $contact_old["nick"] . ") have to be updated.", LOGGER_DEBUG); -- 2.39.5