]> git.mxchange.org Git - friendica.git/commitdiff
Replace remaining mentions of "Status" by "Conversations" or "Posts"
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 8 Jan 2023 06:32:18 +0000 (01:32 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Wed, 11 Jan 2023 14:01:29 +0000 (09:01 -0500)
src/Content/Nav.php
src/Module/BaseProfile.php
src/Module/Contact.php
src/Module/Contact/Follow.php
src/Module/Contact/Unfollow.php
src/Module/Post/Tag/Add.php
src/Module/Profile/Conversations.php [new file with mode: 0644]
src/Module/Profile/Index.php
src/Module/Profile/Status.php [deleted file]
static/routes.config.php

index 9684b77ce94b85dd50da3ce4159c6afffb11a424..63eeede89fffbb58988b42670833068599bf247e 100644 (file)
@@ -226,7 +226,7 @@ class Nav
 
                if ($this->session->isAuthenticated()) {
                        // user menu
-                       $nav['usermenu'][] = ['profile/' . $this->session->getLocalUserNickname(), $this->l10n->t('Status'), '', $this->l10n->t('Your posts and conversations')];
+                       $nav['usermenu'][] = ['profile/' . $this->session->getLocalUserNickname(), $this->l10n->t('Conversations'), '', $this->l10n->t('Conversations you started')];
                        $nav['usermenu'][] = ['profile/' . $this->session->getLocalUserNickname() . '/profile', $this->l10n->t('Profile'), '', $this->l10n->t('Your profile page')];
                        $nav['usermenu'][] = ['profile/' . $this->session->getLocalUserNickname() . '/photos', $this->l10n->t('Photos'), '', $this->l10n->t('Your photos')];
                        $nav['usermenu'][] = ['profile/' . $this->session->getLocalUserNickname() . '/media', $this->l10n->t('Media'), '', $this->l10n->t('Your postings with media')];
index 28b824adb6252beb45a9629b0fe0c100ec2b0427..b7584d9db6098c7fde3caa3600bb3ef085ed46dc 100644 (file)
@@ -54,10 +54,10 @@ class BaseProfile extends BaseModule
                                'accesskey' => 'r',
                        ],
                        [
-                               'label' => DI::l10n()->t('Status'),
-                               'url'   => $baseProfileUrl . '/status',
+                               'label' => DI::l10n()->t('Conversations'),
+                               'url'   => $baseProfileUrl . '/conversations',
                                'sel'   => $current == 'status' ? 'active' : '',
-                               'title' => DI::l10n()->t('Status Messages and Posts'),
+                               'title' => DI::l10n()->t('Conversations started'),
                                'id'    => 'status-tab',
                                'accesskey' => 'm',
                        ],
index 21b1793af5b6fd1650ce3be90003e01d957edbb3..bc2f2f402c0e863460f1ed27e93269296a4ced4f 100644 (file)
@@ -451,7 +451,7 @@ class Contact extends BaseModule
        /**
         * List of pages for the Contact TabBar
         *
-        * Available Pages are 'Status', 'Profile', 'Contacts' and 'Common Friends'
+        * Available Pages are 'Conversations', 'Profile', 'Contacts' and 'Common Friends'
         *
         * @param array $contact    The contact array
         * @param int   $active_tab 1 if tab should be marked as active
@@ -473,7 +473,15 @@ class Contact extends BaseModule
                // tabs
                $tabs = [
                        [
-                               'label' => DI::l10n()->t('Status'),
+                               'label' => DI::l10n()->t('Profile'),
+                               'url'   => 'contact/' . $cid,
+                               'sel'   => (($active_tab == self::TAB_PROFILE) ? 'active' : ''),
+                               'title' => DI::l10n()->t('Profile Details'),
+                               'id'    => 'profile-tab',
+                               'accesskey' => 'o',
+                       ],
+                       [
+                               'label' => DI::l10n()->t('Conversations'),
                                'url'   => 'contact/' . $pcid . '/conversations',
                                'sel'   => (($active_tab == self::TAB_CONVERSATIONS) ? 'active' : ''),
                                'title' => DI::l10n()->t('Conversations started by this contact'),
@@ -484,7 +492,7 @@ class Contact extends BaseModule
                                'label' => DI::l10n()->t('Posts and Comments'),
                                'url'   => 'contact/' . $pcid . '/posts',
                                'sel'   => (($active_tab == self::TAB_POSTS) ? 'active' : ''),
-                               'title' => DI::l10n()->t('Status Messages and Posts'),
+                               'title' => DI::l10n()->t('Individual Posts and Replies'),
                                'id'    => 'posts-tab',
                                'accesskey' => 'p',
                        ],
@@ -496,14 +504,6 @@ class Contact extends BaseModule
                                'id'    => 'media-tab',
                                'accesskey' => 'd',
                        ],
-                       [
-                               'label' => DI::l10n()->t('Profile'),
-                               'url'   => 'contact/' . $cid,
-                               'sel'   => (($active_tab == self::TAB_PROFILE) ? 'active' : ''),
-                               'title' => DI::l10n()->t('Profile Details'),
-                               'id'    => 'profile-tab',
-                               'accesskey' => 'o',
-                       ],
                        ['label' => DI::l10n()->t('Contacts'),
                                'url'   => 'contact/' . $pcid . '/contacts',
                                'sel'   => (($active_tab == self::TAB_CONTACTS) ? 'active' : ''),
index 5e648deac672be29593b06ad406ded86d71463e0..57e9ff634ab148efe12de562283a934230d43c0b 100644 (file)
@@ -188,7 +188,7 @@ class Follow extends BaseModule
                        $this->page['aside'] = VCard::getHTML($contact);
 
                        $output .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'),
-                               ['$title' => $this->t('Status Messages and Posts')]
+                               ['$title' => $this->t('Posts and Replies')]
                        );
 
                        // Show last public posts
index 36db688181a43cb5d4f97851a8cf7df4c97a714c..9bbc34eeed5be0716def2b522cda572f115af668 100644 (file)
@@ -135,7 +135,7 @@ class Unfollow extends \Friendica\BaseModule
 
                $this->page['aside'] = Widget\VCard::getHTML(Contact::getByURL($contact['url'], false));
 
-               $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => $this->t('Status Messages and Posts')]);
+               $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => $this->t('Posts and Replies')]);
 
                // Show last public posts
                $o .= Contact::getPostsFromUrl($contact['url']);
index aea18aa64ddaacc400ecf996e64437c4a2321564..8c48587947e386532dfc1d8e76670a702579be63 100644 (file)
@@ -120,7 +120,7 @@ EOT;
 
                $tagger_link  = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
                $aauthor_link = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
-               $post_link    = '[url=' . $item['plink'] . ']' . ($item['resource-id'] ? $this->t('photo') : $this->t('status')) . '[/url]';
+               $post_link    = '[url=' . $item['plink'] . ']' . ($item['resource-id'] ? $this->t('photo') : $this->t('post')) . '[/url]';
                $term_link    = '#[url=' . $tagid . ']' . $term . '[/url]';
 
                $post = [
diff --git a/src/Module/Profile/Conversations.php b/src/Module/Profile/Conversations.php
new file mode 100644 (file)
index 0000000..322cdc8
--- /dev/null
@@ -0,0 +1,249 @@
+<?php
+/**
+ * @copyright Copyright (C) 2010-2023, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Friendica\Module\Profile;
+
+use Friendica\App;
+use Friendica\Content\Conversation;
+use Friendica\Content\Nav;
+use Friendica\Content\Pager;
+use Friendica\Content\Widget;
+use Friendica\Core\ACL;
+use Friendica\Core\Config\Capability\IManageConfigValues;
+use Friendica\Core\L10n;
+use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
+use Friendica\Core\Protocol;
+use Friendica\Core\Session\Capability\IHandleUserSessions;
+use Friendica\Database\DBA;
+use Friendica\Model\Contact;
+use Friendica\Model\Item;
+use Friendica\Model\Post;
+use Friendica\Model\Post\Category;
+use Friendica\Model\Profile as ProfileModel;
+use Friendica\Model\User;
+use Friendica\Model\Verb;
+use Friendica\Module\BaseProfile;
+use Friendica\Module\Response;
+use Friendica\Module\Security\Login;
+use Friendica\Network\HTTPException;
+use Friendica\Protocol\Activity;
+use Friendica\Security\Security;
+use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Profiler;
+use Friendica\Util\Strings;
+use Psr\Log\LoggerInterface;
+
+class Conversations extends BaseProfile
+{
+       /** @var App */
+       private $app;
+       /** @var App\Page */
+       private $page;
+       /** @var DateTimeFormat */
+       private $dateTimeFormat;
+       /** @var IManageConfigValues */
+       private $config;
+       /** @var IHandleUserSessions */
+       private $session;
+       /** @var Conversation */
+       private $conversation;
+       /** @var IManagePersonalConfigValues */
+       private $pConfig;
+       /** @var App\Mode */
+       private $mode;
+
+       public function __construct(App\Mode $mode, IManagePersonalConfigValues $pConfig, Conversation $conversation, IHandleUserSessions $session, IManageConfigValues $config, DateTimeFormat $dateTimeFormat, App\Page $page, App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
+       {
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
+
+               $this->app            = $app;
+               $this->page           = $page;
+               $this->dateTimeFormat = $dateTimeFormat;
+               $this->config         = $config;
+               $this->session        = $session;
+               $this->conversation   = $conversation;
+               $this->pConfig        = $pConfig;
+               $this->mode           = $mode;
+       }
+
+       protected function content(array $request = []): string
+       {
+               $profile = ProfileModel::load($this->app, $this->parameters['nickname'] ?? '');
+               if (empty($profile)) {
+                       throw new HTTPException\NotFoundException($this->t('User not found.'));
+               }
+
+               if ($this->config->get('system', 'block_public') && !$this->session->isAuthenticated()) {
+                       return Login::form();
+               }
+
+               if (!empty($profile['hidewall']) && !$this->session->isAuthenticated()) {
+                       $this->baseUrl->redirect('profile/' . $profile['nickname'] . '/restricted');
+               }
+
+               if (!$profile['net-publish']) {
+                       $this->page['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
+               }
+
+               $this->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/dfrn_poll/' . $this->parameters['nickname'] . '" title="DFRN: ' . $this->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
+               $this->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $this->parameters['nickname'] . '/" title="' . $this->t('%s\'s posts', $profile['name']) . '"/>' . "\n";
+               $this->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $this->parameters['nickname'] . '/comments" title="' . $this->t('%s\'s comments', $profile['name']) . '"/>' . "\n";
+               $this->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $this->parameters['nickname'] . '/activity" title="' . $this->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
+
+               $category = $datequery = $datequery2 = '';
+
+               if ($this->args->getArgc() > 3) {
+                       for ($x = 3; $x < $this->args->getArgc(); $x++) {
+                               if ($this->dateTimeFormat->isYearMonthDay($this->args->get($x))) {
+                                       if ($datequery) {
+                                               $datequery2 = $this->args->get($x);
+                                       } else {
+                                               $datequery = $this->args->get($x);
+                                       }
+                               } else {
+                                       $category = $this->args->get($x);
+                               }
+                       }
+               }
+
+               if (empty($category)) {
+                       $category = $request['category'] ?? '';
+               }
+
+               $hashtags = $request['tag'] ?? '';
+
+               $o = '';
+
+               if ($profile['uid'] == $this->session->getLocalUserId()) {
+                       Nav::setSelected('home');
+               }
+
+               $remote_contact   = $this->session->getRemoteContactID($profile['uid']);
+               $is_owner         = $this->session->getLocalUserId() == $profile['uid'];
+               $last_updated_key = "profile:" . $profile['uid'] . ":" . $this->session->getLocalUserId() . ":" . $remote_contact;
+
+               $o .= self::getTabsHTML('status', $is_owner, $profile['nickname'], $profile['hide-friends']);
+
+               $o .= Widget::commonFriendsVisitor($profile['uid'], $profile['nickname']);
+
+               $commpage    = $profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
+               $commvisitor = $commpage && $remote_contact;
+
+               $this->page['aside'] .= Widget::postedByYear($this->baseUrl . '/profile/' . $profile['nickname'] . '/conversations', $profile['profile_uid'] ?? 0, true);
+               $this->page['aside'] .= Widget::categories($profile['uid'], $this->baseUrl . '/profile/' . $profile['nickname'] . '/conversations', $category);
+               $this->page['aside'] .= Widget::tagCloud($profile['uid']);
+
+               if (Security::canWriteToUserWall($profile['uid'])) {
+                       $x = [
+                               'is_owner'         => $is_owner,
+                               'allow_location'   => ($is_owner || $commvisitor) && $profile['allow_location'],
+                               'default_location' => $is_owner ? $profile['default-location'] : '',
+                               'nickname'         => $profile['nickname'],
+                               'acl'              => $is_owner ? ACL::getFullSelectorHTML($this->page, $this->app->getLoggedInUserId(), true) : '',
+                               'visitor'          => $is_owner || $commvisitor ? 'block' : 'none',
+                               'profile_uid'      => $profile['uid'],
+                       ];
+
+                       $o .= $this->conversation->statusEditor($x);
+               }
+
+               // Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups
+               $condition = Item::getPermissionsConditionArrayByUserId($profile['uid']);
+
+               $last_updated_array = $this->session->get('last_updated', []);
+
+               if (!empty($category)) {
+                       $condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `category-view` WHERE `name` = ? AND `type` = ? AND `uid` = ?)",
+                                                                      $category, Category::CATEGORY, $profile['uid']]);
+               }
+
+               if (!empty($hashtags)) {
+                       $condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `tag-search-view` WHERE `name` = ? AND `uid` = ?)",
+                                                                      $hashtags, $profile['uid']]);
+               }
+
+               if (!empty($datequery)) {
+                       $condition = DBA::mergeConditions($condition, ["`received` <= ?", DateTimeFormat::convert($datequery, 'UTC', $this->app->getTimeZone())]);
+               }
+
+               if (!empty($datequery2)) {
+                       $condition = DBA::mergeConditions($condition, ["`received` >= ?", DateTimeFormat::convert($datequery2, 'UTC', $this->app->getTimeZone())]);
+               }
+
+               // Does the profile page belong to a forum?
+               // If not then we can improve the performance with an additional condition
+               if ($profile['account-type'] != User::ACCOUNT_TYPE_COMMUNITY) {
+                       $condition = DBA::mergeConditions($condition, ['contact-id' => $profile['id']]);
+               }
+
+               if ($this->mode->isMobile()) {
+                       $itemspage_network = $this->pConfig->get($this->session->getLocalUserId(), 'system', 'itemspage_mobile_network',
+                               $this->config->get('system', 'itemspage_network_mobile'));
+               } else {
+                       $itemspage_network = $this->pConfig->get($this->session->getLocalUserId(), 'system', 'itemspage_network',
+                               $this->config->get('system', 'itemspage_network'));
+               }
+
+               $condition = DBA::mergeConditions($condition, ["((`gravity` = ? AND `wall`) OR
+                       (`gravity` = ? AND `vid` = ? AND `origin`
+                       AND EXISTS(SELECT `uri-id` FROM `post` WHERE `uri-id` = `post-user-view`.`thr-parent-id` AND `gravity` = ? AND `network` IN (?, ?))))",
+                                                              Item::GRAVITY_PARENT, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), Item::GRAVITY_PARENT, Protocol::ACTIVITYPUB, Protocol::DFRN]);
+
+               $condition = DBA::mergeConditions($condition, ['uid'     => $profile['uid'], 'network' => Protocol::FEDERATED,
+                                                              'visible' => true, 'deleted' => false]);
+
+               $pager  = new Pager($this->l10n, $this->args->getQueryString(), $itemspage_network);
+               $params = ['limit' => [$pager->getStart(), $pager->getItemsPerPage()], 'order' => ['received' => true]];
+
+               $items_stmt = Post::select(['uri-id', 'thr-parent-id', 'gravity', 'author-id', 'received'], $condition, $params);
+
+               // Set a time stamp for this page. We will make use of it when we
+               // search for new items (update routine)
+               $last_updated_array[$last_updated_key] = time();
+               $this->session->set('last_updated', $last_updated_array);
+
+               if ($is_owner && !$this->config->get('theme', 'hide_eventlist')) {
+                       $o .= ProfileModel::getBirthdays();
+                       $o .= ProfileModel::getEventsReminderHTML();
+               }
+
+               if ($is_owner) {
+                       $unseen = Post::exists(['wall' => true, 'unseen' => true, 'uid' => $this->session->getLocalUserId()]);
+                       if ($unseen) {
+                               Item::update(['unseen' => false], ['wall' => true, 'unseen' => true, 'uid' => $this->session->getLocalUserId()]);
+                       }
+               }
+
+               $items = Post::toArray($items_stmt);
+
+               if ($pager->getStart() == 0 && !empty($profile['uid'])) {
+                       $pcid   = Contact::getPublicIdByUserId($profile['uid']);
+                       $pinned = Post\Collection::selectToArrayForContact($pcid, Post\Collection::FEATURED);
+                       $items  = array_merge($items, $pinned);
+               }
+
+               $o .= $this->conversation->create($items, 'profile', false, false, 'pinned_received', $profile['uid']);
+
+               $o .= $pager->renderMinimal(count($items));
+
+               return $o;
+       }
+}
index 149d165129a218d0169079af583e4b5fd960e97d..7a009739e4743b3983203a946be2ed7db416a4f6 100644 (file)
@@ -42,7 +42,7 @@ use Psr\Log\LoggerInterface;
  * ActivityPub endpoint, but it should show statuses to web users.
  *
  * Both these view have dedicated sub-paths,
- * respectively https://domain.tld/profile/nickname/profile and https://domain.tld/profile/nickname/status
+ * respectively https://domain.tld/profile/nickname/profile and https://domain.tld/profile/nickname/conversations
  */
 class Index extends BaseModule
 {
@@ -90,6 +90,6 @@ class Index extends BaseModule
 
        protected function content(array $request = []): string
        {
-               return (new Status($this->mode, $this->pConfig, $this->conversation, $this->session, $this->config, $this->dateTimeFormat, $this->page, $this->app, $this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->response, $this->server, $this->parameters))->content();
+               return (new Conversations($this->mode, $this->pConfig, $this->conversation, $this->session, $this->config, $this->dateTimeFormat, $this->page, $this->app, $this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->response, $this->server, $this->parameters))->content();
        }
 }
diff --git a/src/Module/Profile/Status.php b/src/Module/Profile/Status.php
deleted file mode 100644 (file)
index 38c9a69..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-<?php
-/**
- * @copyright Copyright (C) 2010-2023, the Friendica project
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <https://www.gnu.org/licenses/>.
- *
- */
-
-namespace Friendica\Module\Profile;
-
-use Friendica\App;
-use Friendica\Content\Conversation;
-use Friendica\Content\Nav;
-use Friendica\Content\Pager;
-use Friendica\Content\Widget;
-use Friendica\Core\ACL;
-use Friendica\Core\Config\Capability\IManageConfigValues;
-use Friendica\Core\L10n;
-use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
-use Friendica\Core\Protocol;
-use Friendica\Core\Session\Capability\IHandleUserSessions;
-use Friendica\Database\DBA;
-use Friendica\Model\Contact;
-use Friendica\Model\Item;
-use Friendica\Model\Post;
-use Friendica\Model\Post\Category;
-use Friendica\Model\Profile as ProfileModel;
-use Friendica\Model\User;
-use Friendica\Model\Verb;
-use Friendica\Module\BaseProfile;
-use Friendica\Module\Response;
-use Friendica\Module\Security\Login;
-use Friendica\Network\HTTPException;
-use Friendica\Protocol\Activity;
-use Friendica\Security\Security;
-use Friendica\Util\DateTimeFormat;
-use Friendica\Util\Profiler;
-use Friendica\Util\Strings;
-use Psr\Log\LoggerInterface;
-
-class Status extends BaseProfile
-{
-       /** @var App */
-       private $app;
-       /** @var App\Page */
-       private $page;
-       /** @var DateTimeFormat */
-       private $dateTimeFormat;
-       /** @var IManageConfigValues */
-       private $config;
-       /** @var IHandleUserSessions */
-       private $session;
-       /** @var Conversation */
-       private $conversation;
-       /** @var IManagePersonalConfigValues */
-       private $pConfig;
-       /** @var App\Mode */
-       private $mode;
-
-       public function __construct(App\Mode $mode, IManagePersonalConfigValues $pConfig, Conversation $conversation, IHandleUserSessions $session, IManageConfigValues $config, DateTimeFormat $dateTimeFormat, App\Page $page, App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
-       {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
-
-               $this->app            = $app;
-               $this->page           = $page;
-               $this->dateTimeFormat = $dateTimeFormat;
-               $this->config         = $config;
-               $this->session        = $session;
-               $this->conversation   = $conversation;
-               $this->pConfig        = $pConfig;
-               $this->mode           = $mode;
-       }
-
-       protected function content(array $request = []): string
-       {
-               $profile = ProfileModel::load($this->app, $this->parameters['nickname'] ?? '');
-               if (empty($profile)) {
-                       throw new HTTPException\NotFoundException($this->t('User not found.'));
-               }
-
-               if ($this->config->get('system', 'block_public') && !$this->session->isAuthenticated()) {
-                       return Login::form();
-               }
-
-               if (!empty($profile['hidewall']) && !$this->session->isAuthenticated()) {
-                       $this->baseUrl->redirect('profile/' . $profile['nickname'] . '/restricted');
-               }
-
-               if (!$profile['net-publish']) {
-                       $this->page['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
-               }
-
-               $this->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/dfrn_poll/' . $this->parameters['nickname'] . '" title="DFRN: ' . $this->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
-               $this->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $this->parameters['nickname'] . '/" title="' . $this->t('%s\'s posts', $profile['name']) . '"/>' . "\n";
-               $this->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $this->parameters['nickname'] . '/comments" title="' . $this->t('%s\'s comments', $profile['name']) . '"/>' . "\n";
-               $this->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $this->parameters['nickname'] . '/activity" title="' . $this->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
-
-               $category = $datequery = $datequery2 = '';
-
-               if ($this->args->getArgc() > 3) {
-                       for ($x = 3; $x < $this->args->getArgc(); $x++) {
-                               if ($this->dateTimeFormat->isYearMonthDay($this->args->get($x))) {
-                                       if ($datequery) {
-                                               $datequery2 = $this->args->get($x);
-                                       } else {
-                                               $datequery = $this->args->get($x);
-                                       }
-                               } else {
-                                       $category = $this->args->get($x);
-                               }
-                       }
-               }
-
-               if (empty($category)) {
-                       $category = $request['category'] ?? '';
-               }
-
-               $hashtags = $request['tag'] ?? '';
-
-               $o = '';
-
-               if ($profile['uid'] == $this->session->getLocalUserId()) {
-                       Nav::setSelected('home');
-               }
-
-               $remote_contact   = $this->session->getRemoteContactID($profile['uid']);
-               $is_owner         = $this->session->getLocalUserId() == $profile['uid'];
-               $last_updated_key = "profile:" . $profile['uid'] . ":" . $this->session->getLocalUserId() . ":" . $remote_contact;
-
-               $o .= self::getTabsHTML('status', $is_owner, $profile['nickname'], $profile['hide-friends']);
-
-               $o .= Widget::commonFriendsVisitor($profile['uid'], $profile['nickname']);
-
-               $commpage    = $profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
-               $commvisitor = $commpage && $remote_contact;
-
-               $this->page['aside'] .= Widget::postedByYear($this->baseUrl . '/profile/' . $profile['nickname'] . '/status', $profile['profile_uid'] ?? 0, true);
-               $this->page['aside'] .= Widget::categories($profile['uid'], $this->baseUrl . '/profile/' . $profile['nickname'] . '/status', $category);
-               $this->page['aside'] .= Widget::tagCloud($profile['uid']);
-
-               if (Security::canWriteToUserWall($profile['uid'])) {
-                       $x = [
-                               'is_owner'         => $is_owner,
-                               'allow_location'   => ($is_owner || $commvisitor) && $profile['allow_location'],
-                               'default_location' => $is_owner ? $profile['default-location'] : '',
-                               'nickname'         => $profile['nickname'],
-                               'acl'              => $is_owner ? ACL::getFullSelectorHTML($this->page, $this->app->getLoggedInUserId(), true) : '',
-                               'visitor'          => $is_owner || $commvisitor ? 'block' : 'none',
-                               'profile_uid'      => $profile['uid'],
-                       ];
-
-                       $o .= $this->conversation->statusEditor($x);
-               }
-
-               // Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups
-               $condition = Item::getPermissionsConditionArrayByUserId($profile['uid']);
-
-               $last_updated_array = $this->session->get('last_updated', []);
-
-               if (!empty($category)) {
-                       $condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `category-view` WHERE `name` = ? AND `type` = ? AND `uid` = ?)",
-                                                                      $category, Category::CATEGORY, $profile['uid']]);
-               }
-
-               if (!empty($hashtags)) {
-                       $condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `tag-search-view` WHERE `name` = ? AND `uid` = ?)",
-                                                                      $hashtags, $profile['uid']]);
-               }
-
-               if (!empty($datequery)) {
-                       $condition = DBA::mergeConditions($condition, ["`received` <= ?", DateTimeFormat::convert($datequery, 'UTC', $this->app->getTimeZone())]);
-               }
-
-               if (!empty($datequery2)) {
-                       $condition = DBA::mergeConditions($condition, ["`received` >= ?", DateTimeFormat::convert($datequery2, 'UTC', $this->app->getTimeZone())]);
-               }
-
-               // Does the profile page belong to a forum?
-               // If not then we can improve the performance with an additional condition
-               if ($profile['account-type'] != User::ACCOUNT_TYPE_COMMUNITY) {
-                       $condition = DBA::mergeConditions($condition, ['contact-id' => $profile['id']]);
-               }
-
-               if ($this->mode->isMobile()) {
-                       $itemspage_network = $this->pConfig->get($this->session->getLocalUserId(), 'system', 'itemspage_mobile_network',
-                               $this->config->get('system', 'itemspage_network_mobile'));
-               } else {
-                       $itemspage_network = $this->pConfig->get($this->session->getLocalUserId(), 'system', 'itemspage_network',
-                               $this->config->get('system', 'itemspage_network'));
-               }
-
-               $condition = DBA::mergeConditions($condition, ["((`gravity` = ? AND `wall`) OR
-                       (`gravity` = ? AND `vid` = ? AND `origin`
-                       AND EXISTS(SELECT `uri-id` FROM `post` WHERE `uri-id` = `post-user-view`.`thr-parent-id` AND `gravity` = ? AND `network` IN (?, ?))))",
-                                                              Item::GRAVITY_PARENT, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), Item::GRAVITY_PARENT, Protocol::ACTIVITYPUB, Protocol::DFRN]);
-
-               $condition = DBA::mergeConditions($condition, ['uid'     => $profile['uid'], 'network' => Protocol::FEDERATED,
-                                                              'visible' => true, 'deleted' => false]);
-
-               $pager  = new Pager($this->l10n, $this->args->getQueryString(), $itemspage_network);
-               $params = ['limit' => [$pager->getStart(), $pager->getItemsPerPage()], 'order' => ['received' => true]];
-
-               $items_stmt = Post::select(['uri-id', 'thr-parent-id', 'gravity', 'author-id', 'received'], $condition, $params);
-
-               // Set a time stamp for this page. We will make use of it when we
-               // search for new items (update routine)
-               $last_updated_array[$last_updated_key] = time();
-               $this->session->set('last_updated', $last_updated_array);
-
-               if ($is_owner && !$this->config->get('theme', 'hide_eventlist')) {
-                       $o .= ProfileModel::getBirthdays();
-                       $o .= ProfileModel::getEventsReminderHTML();
-               }
-
-               if ($is_owner) {
-                       $unseen = Post::exists(['wall' => true, 'unseen' => true, 'uid' => $this->session->getLocalUserId()]);
-                       if ($unseen) {
-                               Item::update(['unseen' => false], ['wall' => true, 'unseen' => true, 'uid' => $this->session->getLocalUserId()]);
-                       }
-               }
-
-               $items = Post::toArray($items_stmt);
-
-               if ($pager->getStart() == 0 && !empty($profile['uid'])) {
-                       $pcid   = Contact::getPublicIdByUserId($profile['uid']);
-                       $pinned = Post\Collection::selectToArrayForContact($pcid, Post\Collection::FEATURED);
-                       $items  = array_merge($items, $pinned);
-               }
-
-               $o .= $this->conversation->create($items, 'profile', false, false, 'pinned_received', $profile['uid']);
-
-               $o .= $pager->renderMinimal(count($items));
-
-               return $o;
-       }
-}
index bc10fdac07a41e532a398b1f8edab4421d53156e..2219ea454444d2bbe9a450032a7fb51b446a4969 100644 (file)
@@ -31,17 +31,17 @@ use Friendica\App\Router as R;
 use Friendica\Module;
 
 $profileRoutes = [
-       ''                                         => [Module\Profile\Index::class,        [R::GET]],
-       '/contacts/common'                         => [Module\Profile\Common::class,       [R::GET]],
-       '/contacts[/{type}]'                       => [Module\Profile\Contacts::class,     [R::GET]],
-       '/media'                                   => [Module\Profile\Media::class,        [R::GET]],
-       '/photos'                                  => [Module\Profile\Photos::class,       [R::GET, R::POST]],
-       '/profile'                                 => [Module\Profile\Profile::class,      [R::GET]],
-       '/remote_follow'                           => [Module\Profile\RemoteFollow::class, [R::GET, R::POST]],
-       '/restricted'                              => [Module\Profile\Restricted::class,   [R::GET         ]],
-       '/schedule'                                => [Module\Profile\Schedule::class,     [R::GET, R::POST]],
-       '/status[/{category}[/{date1}[/{date2}]]]' => [Module\Profile\Status::class,       [R::GET]],
-       '/unkmail'                                 => [Module\Profile\UnkMail::class,      [R::GET, R::POST]],
+       ''                                                => [Module\Profile\Index::class,         [R::GET]],
+       '/contacts/common'                                => [Module\Profile\Common::class,        [R::GET]],
+       '/contacts[/{type}]'                              => [Module\Profile\Contacts::class,      [R::GET]],
+       '/media'                                          => [Module\Profile\Media::class,         [R::GET]],
+       '/photos'                                         => [Module\Profile\Photos::class,        [R::GET, R::POST]],
+       '/profile'                                        => [Module\Profile\Profile::class,       [R::GET]],
+       '/remote_follow'                                  => [Module\Profile\RemoteFollow::class,  [R::GET, R::POST]],
+       '/restricted'                                     => [Module\Profile\Restricted::class,    [R::GET         ]],
+       '/schedule'                                       => [Module\Profile\Schedule::class,      [R::GET, R::POST]],
+       '/conversations[/{category}[/{date1}[/{date2}]]]' => [Module\Profile\Conversations::class, [R::GET]],
+       '/unkmail'                                        => [Module\Profile\UnkMail::class,       [R::GET, R::POST]],
 ];
 
 $apiRoutes = [