]> git.mxchange.org Git - friendica.git/commitdiff
Fix several notices
authorMichael <heluecht@pirati.ca>
Mon, 11 Apr 2022 18:57:30 +0000 (18:57 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 11 Apr 2022 18:57:30 +0000 (18:57 +0000)
src/Model/GServer.php
src/Protocol/ActivityPub/Processor.php
src/Protocol/Diaspora.php

index dd38367c67f5a9d4e27ce930b54d131c28519785..a6be93ff78f44aecea01896af1b2eaf96f5f6f3c 100644 (file)
@@ -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'];
index e5653a554fd565aa79cf286e9fd2604e28d0ed1a..8bd08b95b48c93e6e47eecef7f15b9ddd2794ad8 100644 (file)
@@ -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']);
index 71726534d0d737ebef2a7b1bd833ef87fc8018c8..70fd0f1f8d9acb06f8d66d6bb21f922c7fa7a140 100644 (file)
@@ -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'])) {