]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/ContactSelector.php
Show only the user's categories on their profile
[friendica.git] / src / Content / ContactSelector.php
index dbf7e0a468f5eee5eda5dbe5d633db48b41a6d99..9035d37e73c01d3c838e35c30bbc662e1507acc0 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -117,7 +117,7 @@ class ContactSelector
         * @return string
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public static function networkToName($network, $profile = '', $protocol = '')
+       public static function networkToName($network, $profile = '', $protocol = '', $gsid = 0)
        {
                $nets = [
                        Protocol::DFRN      =>   DI::l10n()->t('DFRN'),
@@ -147,7 +147,14 @@ class ContactSelector
                $networkname = str_replace($search, $replace, $network);
 
                if ((in_array($network, Protocol::FEDERATED)) && ($profile != "")) {
-                       $gserver = self::getServerForProfile($profile);
+                       if (!empty($gsid) && !empty(self::$serverdata[$gsid])) {
+                               $gserver = self::$serverdata[$gsid];
+                       } elseif (!empty($gsid)) {
+                               $gserver = DBA::selectFirst('gserver', ['platform', 'network'], ['id' => $gsid]);
+                               self::$serverdata[$gsid] = $gserver;
+                       } else {
+                               $gserver = self::getServerForProfile($profile);
+                       }
 
                        if (!empty($gserver['platform'])) {
                                $platform = $gserver['platform'];