]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Profile/Contacts.php
Merge pull request #10987 from annando/api4
[friendica.git] / src / Module / Profile / Contacts.php
index 959552542f59a0c04a910ce9e9bea338cb31fb35..e20fd3f2d5451d0628c7694975b3d16d6cd567be 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
 
 class Contacts extends Module\BaseProfile
 {
-       public static function content(array $parameters = [])
+       public function content(): string
        {
                if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
                        throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
@@ -42,33 +42,33 @@ class Contacts extends Module\BaseProfile
 
                $a = DI::app();
 
-               $nickname = $parameters['nickname'];
-               $type = $parameters['type'] ?? 'all';
+               $nickname = $this->parameters['nickname'];
+               $type = $this->parameters['type'] ?? 'all';
 
-               Model\Profile::load($a, $nickname);
-
-               if (empty($a->profile)) {
+               $profile = Model\Profile::load($a, $nickname);
+               if (empty($profile)) {
                        throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
                }
 
-               $is_owner = $a->profile['uid'] == local_user();
+               $is_owner = $profile['uid'] == local_user();
 
-               if (!empty($a->profile['hide-friends']) && !$is_owner) {
+               if ($profile['hide-friends'] && !$is_owner) {
                        throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
                }
 
                Nav::setSelected('home');
 
-               $o = self::getTabsHTML($a, 'contacts', $is_owner, $nickname);
+               $o = self::getTabsHTML($a, 'contacts', $is_owner, $profile['nickname'], $profile['hide-friends']);
 
-               $tabs = self::getContactFilterTabs('profile/' . $nickname, $type, Session::isAuthenticated() && $a->profile['uid'] != local_user());
+               $tabs = self::getContactFilterTabs('profile/' . $nickname, $type, Session::isAuthenticated() && $profile['uid'] != local_user());
 
                $condition = [
-                       'uid'     => $a->profile['uid'],
+                       'uid'     => $profile['uid'],
                        'blocked' => false,
                        'pending' => false,
                        'hidden'  => false,
                        'archive' => false,
+                       'failed'  => false,
                        'self'    => false,
                        'network' => [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, Protocol::FEED]
                ];
@@ -102,7 +102,7 @@ class Contacts extends Module\BaseProfile
                                $title = DI::l10n()->tt('Mutual friend (%s)', 'Mutual friends (%s)', $total);
                                $desc = DI::l10n()->t(
                                        'These contacts both follow and are followed by <strong>%s</strong>.',
-                                       htmlentities($a->profile['name'], ENT_COMPAT, 'UTF-8')
+                                       htmlentities($profile['name'], ENT_COMPAT, 'UTF-8')
                                );
                                break;
                        case 'all':