]> git.mxchange.org Git - friendica.git/commitdiff
Fix various Notices
authorPhilipp <admin@philipp.info>
Mon, 13 Sep 2021 18:22:55 +0000 (20:22 +0200)
committerPhilipp <admin@philipp.info>
Sat, 18 Sep 2021 10:51:06 +0000 (12:51 +0200)
src/Model/Contact.php
src/Model/Item.php
src/Module/Contact.php
src/Protocol/ActivityPub/Processor.php
src/Protocol/DFRN.php
src/Protocol/Diaspora.php
src/Protocol/OStatus.php

index 93e745456a7590cb8f50258b28bda0cf4e70412d..51d162ae22181ce07673b87da3bd4d245c4e85f8 100644 (file)
@@ -2757,12 +2757,14 @@ class Contact
                return null;
        }
 
-       public static function removeFollower($importer, $contact)
+       public static function removeFollower(array $contact)
        {
-               if (($contact['rel'] == self::FRIEND) || ($contact['rel'] == self::SHARING)) {
+               if (!empty($contact['rel']) && (($contact['rel'] == self::FRIEND) || ($contact['rel'] == self::SHARING))) {
                        DBA::update('contact', ['rel' => self::SHARING], ['id' => $contact['id']]);
-               } else {
+               } elseif (!empty($contact['id'])) {
                        self::remove($contact['id']);
+               } else {
+                       DI::logger()->info('Couldn\'t remove follower because of invalid contact array', ['contact' => $contact]);
                }
        }
 
index 8327252abc7acc2f69bb062cb732e06884edd2e9..992c8d471077d1f0977cafc128f83691871b2228 100644 (file)
@@ -2292,9 +2292,9 @@ class Item
                                continue;
                        } elseif (!$expire_starred && intval($item['starred'])) {
                                continue;
-                       } elseif (!$expire_notes && ($item['post-type'] == self::PT_PERSONAL_NOTE)) {
+                       } elseif (!$expire_notes && (($item['post-type'] ?? null) == self::PT_PERSONAL_NOTE)) {
                                continue;
-                       } elseif (!$expire_items && ($item['post-type'] != self::PT_PERSONAL_NOTE)) {
+                       } elseif (!$expire_items && (($item['post-type'] ?? null) != self::PT_PERSONAL_NOTE)) {
                                continue;
                        }
 
index ceb2b6757c3fd2329a28ec898af6e98b462b4762..0260e90f1fb3d8b8d1528c853bc13c0c87036b26 100644 (file)
@@ -293,7 +293,7 @@ class Contact extends BaseModule
                        $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => [0, local_user()], 'deleted' => false]);
 
                        // Don't display contacts that are about to be deleted
-                       if ($contact['network'] == Protocol::PHANTOM) {
+                       if (DBA::isResult($contact) && !empty($contact['network']) && $contact['network'] == Protocol::PHANTOM) {
                                $contact = false;
                        }
                }
index 47a5300352d03ee73104ad05290d4f134c4035b8..1fe527f407be568ed0cd95a49ab9af44aa75539a 100644 (file)
@@ -1102,7 +1102,7 @@ class Processor
                        return;
                }
 
-               Contact::removeFollower($owner, $contact);
+               Contact::removeFollower($contact);
                Logger::info('Undo following request', ['contact' => $cid, 'user' => $uid]);
        }
 
index 4ccd259f21c71655c6ff9e5ada0a3b538eae5565..6797608e6160e04fcbe5c685571e0c5c707a3817 100644 (file)
@@ -1584,7 +1584,7 @@ class DFRN
                        }
                        if ($activity->match($item["verb"], Activity::UNFOLLOW)) {
                                Logger::log("Lost follower");
-                               Contact::removeFollower($importer, $contact, $item);
+                               Contact::removeFollower($contact);
                                return false;
                        }
                        if ($activity->match($item["verb"], Activity::REQ_FRIEND)) {
index 48d7a3371cbfd49c62700b2da5fd30701f940213..8ab89d950f1cffc3d39225c29807e0810bb49635 100644 (file)
@@ -2211,7 +2211,7 @@ class Diaspora
                                return true;
                        } else {
                                Logger::log("Author ".$author." doesn't want to follow us anymore.", Logger::DEBUG);
-                               Contact::removeFollower($importer, $contact);
+                               Contact::removeFollower($contact);
                                return true;
                        }
                }
index 2404db2df92dcf93fdc9b1bdb9be4f52adaf3d51..4f16f40f11970924ce31211309948717a1c8181a 100644 (file)
@@ -471,7 +471,7 @@ class OStatus
 
                        if ($item["verb"] == Activity::O_UNFOLLOW) {
                                $dummy = null;
-                               Contact::removeFollower($importer, $contact, $item, $dummy);
+                               Contact::removeFollower($contact);
                                continue;
                        }