]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Contact.php
Changed to null-coalscing style (??) as sugguested by @MrPetovan
[friendica.git] / src / Model / Contact.php
index 172540dd1f67402f32751eeb7f6bd8e54e470994..3ed2785cfa41972f0676360fbea35df4ca24d3a3 100644 (file)
@@ -1818,36 +1818,111 @@ class Contact
 
                if (!DI::config()->get('system', 'remote_avatar_lookup')) {
                        $platform = '';
+                       $type     = Contact::TYPE_PERSON;
 
                        if (!empty($contact['id'])) {
-                               $account = DBA::selectFirst('account-user-view', ['platform'], ['id' => $contact['id']]);
+                               $account = DBA::selectFirst('account-user-view', ['platform', 'contact-type'], ['id' => $contact['id']]);
                                $platform = $account['platform'] ?? '';
+                               $type     = $account['contact-type'] ?? Contact::TYPE_PERSON;
                        }
-       
+
                        if (empty($platform) && !empty($contact['uri-id'])) {
-                               $account = DBA::selectFirst('account-user-view', ['platform'], ['uri-id' => $contact['uri-id']]);
+                               $account = DBA::selectFirst('account-user-view', ['platform', 'contact-type'], ['uri-id' => $contact['uri-id']]);
                                $platform = $account['platform'] ?? '';
+                               $type     = $account['contact-type'] ?? Contact::TYPE_PERSON;
                        }
 
                        switch ($platform) {
-                               case 'mastodon':
-                                       // @see https://github.com/mastodon/mastodon/tree/main/public/avatars/original/missing.png
-                                       $default = '/images/default/mastodon.png';
-                                       break;
-       
-                               case 'pleroma':
-                                       // @see https://git.pleroma.social/pleroma/pleroma/-/blob/develop/priv/static/images/avi.png
-                                       $default = '/images/default/pleroma.png';
+                               case 'corgidon':
+                                       /**
+                                        * Picture credits
+                                        * @license GNU Affero General Public License v3.0
+                                        * @link    https://github.com/msdos621/corgidon/blob/main/public/avatars/original/missing.png
+                                        */
+                                       $default = '/images/default/corgidon.png';
                                        break;
 
                                case 'diaspora':
-                                       // @see https://github.com/diaspora/diaspora/
+                                       /**
+                                        * Picture credits
+                                        * @license GNU Affero General Public License v3.0
+                                        * @link    https://github.com/diaspora/diaspora/
+                                        */
                                        $default = '/images/default/diaspora.png';
                                        break;
 
+                               case 'gotosocial':
+                                       /**
+                                        * Picture credits
+                                        * @license GNU Affero General Public License v3.0
+                                        * @link    https://github.com/superseriousbusiness/gotosocial/blob/main/web/assets/default_avatars/GoToSocial_icon1.svg
+                                        */
+                                       $default = '/images/default/gotosocial.svg';
+                                       break;
+
+                               case 'hometown':
+                                       /**
+                                        * Picture credits
+                                        * @license GNU Affero General Public License v3.0
+                                        * @link    https://github.com/hometown-fork/hometown/blob/hometown-dev/public/avatars/original/missing.png
+                                        */
+                                       $default = '/images/default/hometown.png';
+                                       break;
+
+                               case 'koyuspace':
+                                       /**
+                                        * Picture credits
+                                        * @license GNU Affero General Public License v3.0
+                                        * @link    https://github.com/koyuspace/mastodon/blob/main/public/avatars/original/missing.png
+                                        */
+                                       $default = '/images/default/koyuspace.png';
+                                       break;
+
+                               case 'ecko':
+                               case 'qoto':
+                               case 'mastodon':
+                                       /**
+                                        * Picture credits
+                                        * @license GNU Affero General Public License v3.0
+                                        * @link    https://github.com/mastodon/mastodon/tree/main/public/avatars/original/missing.png
+                                        */
+                                       $default = '/images/default/mastodon.png';
+                                       break;
+
                                case 'peertube':
-                                       // @see https://github.com/Chocobozzz/PeerTube/blob/develop/client/src/assets/images/default-avatar-video-channel.png
-                                       $default = '/images/default/peertube.png';
+                                       if ($type == Contact::TYPE_COMMUNITY) {
+                                               /**
+                                                * Picture credits
+                                                * @license GNU Affero General Public License v3.0
+                                                * @link    https://github.com/Chocobozzz/PeerTube/blob/develop/client/src/assets/images/default-avatar-video-channel.png
+                                                */
+                                               $default = '/images/default/peertube-channel.png';
+                                       } else {
+                                               /**
+                                                * Picture credits
+                                                * @license GNU Affero General Public License v3.0
+                                                * @link    https://github.com/Chocobozzz/PeerTube/blob/develop/client/src/assets/images/default-avatar-account.png
+                                                */
+                                               $default = '/images/default/peertube-account.png';
+                                       }
+                                       break;
+
+                               case 'pleroma':
+                                       /**
+                                        * Picture credits
+                                        * @license GNU Affero General Public License v3.0
+                                        * @link    https://git.pleroma.social/pleroma/pleroma/-/blob/develop/priv/static/images/avi.png
+                                        */
+                                       $default = '/images/default/pleroma.png';
+                                       break;
+
+                               case 'plume':
+                                       /**
+                                        * Picture credits
+                                        * @license GNU Affero General Public License v3.0
+                                        * @link    https://github.com/Plume-org/Plume/blob/main/assets/images/default-avatar.png
+                                        */
+                                       $default = '/images/default/plume.png';
                                        break;
                        }
                        return DI::baseUrl() . $default;