From 62367923e069da9fe6e0d8bde741bdb3360610cd Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 11 Apr 2022 18:57:30 +0000 Subject: [PATCH] Fix several notices --- src/Model/GServer.php | 8 ++++++-- src/Protocol/ActivityPub/Processor.php | 2 ++ src/Protocol/Diaspora.php | 8 ++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Model/GServer.php b/src/Model/GServer.php index dd38367c67..a6be93ff78 100644 --- a/src/Model/GServer.php +++ b/src/Model/GServer.php @@ -493,9 +493,13 @@ class GServer // Detect the directory type $serverdata['directory-type'] = self::DT_NONE; - $serverdata = self::checkPoCo($url, $serverdata); + $serverdata = self::checkMastodonDirectory($url, $serverdata); + if ($serverdata['directory-type'] == self::DT_NONE) { + $serverdata = self::checkPoCo($url, $serverdata); + } + // We can't detect the network type. Possibly it is some system that we don't know yet if (empty($serverdata['network'])) { $serverdata['network'] = Protocol::PHANTOM; @@ -1350,7 +1354,7 @@ class GServer $contact = Contact::selectFirst(['id'], ['uid' => 0, 'failed' => false, 'gsid' => $gserver['id']]); // Via probing we can be sure that the server is responding - if (Contact::updateFromProbe($contact['id'])) { + if (!empty($contact['id']) && Contact::updateFromProbe($contact['id'])) { $contact = Contact::selectFirst(['network', 'failed'], ['id' => $contact['id']]); if (!$contact['failed'] && in_array($contact['network'], Protocol::FEDERATED)) { $serverdata['network'] = $contact['network']; diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index e5653a554f..8bd08b95b4 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -1002,6 +1002,8 @@ class Processor $posts = Post\Collection::selectToArrayForContact($pcid, Post\Collection::FEATURED); if (!empty($posts)) { $old_featured = array_column($posts, 'uri-id'); + } else { + $old_featured = []; } $featured = ActivityPub::fetchItems($apcontact['featured']); diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 71726534d0..70fd0f1f8d 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -4101,10 +4101,10 @@ class Diaspora 'author-id' => $author, 'owner-id' => $author, 'body' => $post, - 'allow_cid' => $owner['allow_cid'], - 'allow_gid' => $owner['allow_gid'], - 'deny_cid' => $owner['deny_cid'], - 'deny_gid' => $owner['deny_gid'], + 'allow_cid' => $owner['allow_cid'] ?? '', + 'allow_gid' => $owner['allow_gid']?? '', + 'deny_cid' => $owner['deny_cid'] ?? '', + 'deny_gid' => $owner['deny_gid'] ?? '', ]; if (!empty($item['allow_cid'] . $item['allow_gid'] . $item['deny_cid'] . $item['deny_gid'])) { -- 2.39.5