]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Profile/Profile.php
Merge pull request #11129 from urbalazs/copyright-2022
[friendica.git] / src / Module / Profile / Profile.php
index 2ef77ff8cb50dbd2427815914df735f561e2bf4b..199b96e2c976e4f10b8ff69b5f5e42da1583e310 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -26,7 +26,6 @@ use Friendica\Content\ForumManager;
 use Friendica\Content\Nav;
 use Friendica\Content\Text\BBCode;
 use Friendica\Content\Text\HTML;
-use Friendica\Content\Widget;
 use Friendica\Core\Hook;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
@@ -47,10 +46,10 @@ use Friendica\Util\Temporal;
 
 class Profile extends BaseProfile
 {
-       public static function rawContent(array $parameters = [])
+       protected function rawContent(array $request = [])
        {
                if (ActivityPub::isRequest()) {
-                       $user = DBA::selectFirst('user', ['uid'], ['nickname' => $parameters['nickname']]);
+                       $user = DBA::selectFirst('user', ['uid'], ['nickname' => $this->parameters['nickname']]);
                        if (DBA::isResult($user)) {
                                try {
                                        $data = ActivityPub\Transmitter::getProfile($user['uid']);
@@ -62,9 +61,9 @@ class Profile extends BaseProfile
                                }
                        }
 
-                       if (DBA::exists('userd', ['username' => $parameters['nickname']])) {
+                       if (DBA::exists('userd', ['username' => $this->parameters['nickname']])) {
                                // Known deleted user
-                               $data = ActivityPub\Transmitter::getDeletedUser($parameters['nickname']);
+                               $data = ActivityPub\Transmitter::getDeletedUser($this->parameters['nickname']);
 
                                System::jsonError(410, $data);
                        } else {
@@ -74,11 +73,11 @@ class Profile extends BaseProfile
                }
        }
 
-       public static function content(array $parameters = [])
+       protected function content(array $request = []): string
        {
                $a = DI::app();
 
-               $profile = ProfileModel::load($a, $parameters['nickname']);
+               $profile = ProfileModel::load($a, $this->parameters['nickname']);
                if (!$profile) {
                        throw new HTTPException\NotFoundException(DI::l10n()->t('Profile not found.'));
                }
@@ -99,12 +98,12 @@ class Profile extends BaseProfile
                        DI::page()['htmlhead'] .= '<meta name="friendica.community" content="true" />' . "\n";
                }
 
-               DI::page()['htmlhead'] .= self::buildHtmlHead($profile, $parameters['nickname'], $remote_contact_id);
+               DI::page()['htmlhead'] .= self::buildHtmlHead($profile, $this->parameters['nickname'], $remote_contact_id);
 
                Nav::setSelected('home');
 
                $is_owner = local_user() == $profile['uid'];
-               $o = self::getTabsHTML($a, 'profile', $is_owner, $profile);
+               $o = self::getTabsHTML($a, 'profile', $is_owner, $profile['nickname'], $profile['hide-friends']);
 
                if (!empty($profile['hidewall']) && !$is_owner && !$remote_contact_id) {
                        notice(DI::l10n()->t('Access to this profile has been restricted.'));
@@ -135,7 +134,7 @@ class Profile extends BaseProfile
                                $view_as_contact_alert = DI::l10n()->t(
                                        'You\'re currently viewing your profile as <b>%s</b> <a href="%s" class="btn btn-sm pull-right">Cancel</a>',
                                        htmlentities($view_as_contacts[$key]['name'], ENT_COMPAT, 'UTF-8'),
-                                       'profile/' . $parameters['nickname'] . '/profile'
+                                       'profile/' . $this->parameters['nickname'] . '/profile'
                                );
                        }
                }