]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Contact/Posts.php
Removed redundant maximagesize = INF statements
[friendica.git] / src / Module / Contact / Posts.php
index 3409d9169bc9f947ff751f7c4c00a531b7b11f9c..c5a6da0d17328c86ac813bca17ddfe88d5afb11b 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
  *
@@ -28,11 +28,15 @@ use Friendica\Content\Nav;
 use Friendica\Content\Widget;
 use Friendica\Core\L10n;
 use Friendica\Core\Protocol;
+use Friendica\Core\Session\Capability\IHandleUserSessions;
 use Friendica\Database\DBA;
 use Friendica\Model;
 use Friendica\Module\Contact;
+use Friendica\Module\Response;
 use Friendica\Module\Security\Login;
 use Friendica\Network\HTTPException\NotFoundException;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
 
 /**
  *  Show a contact posts and comments
@@ -43,33 +47,33 @@ class Posts extends BaseModule
         * @var LocalRelationship
         */
        private $localRelationship;
-       /**
-        * @var App\BaseURL
-        */
-       private $baseUrl;
        /**
         * @var App\Page
         */
        private $page;
+       /**
+        * @var IHandleUserSessions
+        */
+       private $userSession;
 
-       public function __construct(L10n $l10n, LocalRelationship $localRelationship, App\BaseURL $baseUrl, App\Page $page, array $parameters = [])
+       public function __construct(L10n $l10n, LocalRelationship $localRelationship, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, App\Page $page, IHandleUserSessions $userSession, $server, array $parameters = [])
        {
-               parent::__construct($l10n, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->localRelationship = $localRelationship;
-               $this->baseUrl           = $baseUrl;
                $this->page              = $page;
+               $this->userSession       = $userSession;
        }
 
-       public function content(): string
+       protected function content(array $request = []): string
        {
-               if (!local_user()) {
+               if (!$this->userSession->getLocalUserId()) {
                        return Login::form($_SERVER['REQUEST_URI']);
                }
 
                // Backward compatibility: Ensure to use the public contact when the user contact is provided
                // Remove by version 2022.03
-               $data = Model\Contact::getPublicAndUserContactID(intval($this->parameters['id']), local_user());
+               $data = Model\Contact::getPublicAndUserContactID(intval($this->parameters['id']), $this->userSession->getLocalUserId());
                if (empty($data)) {
                        throw new NotFoundException($this->t('Contact not found.'));
                }
@@ -84,7 +88,7 @@ class Posts extends BaseModule
                        throw new NotFoundException($this->t('Contact not found.'));
                }
 
-               $localRelationship = $this->localRelationship->getForUserContact(local_user(), $contact['id']);
+               $localRelationship = $this->localRelationship->getForUserContact($this->userSession->getLocalUserId(), $contact['id']);
                if ($localRelationship->rel === Model\Contact::SELF) {
                        $this->baseUrl->redirect('profile/' . $contact['nick']);
                }