]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Profile/Common.php
Merge pull request #10632 from annando/fox-notifications
[friendica.git] / src / Module / Profile / Common.php
index 0b08d327c950fcbe386e369d82761b0ec2f8fa39..7138ac73fdb5404075070b874f56ac082c7c2909 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
  *
@@ -47,26 +47,27 @@ class Common extends BaseProfile
 
                $nickname = $parameters['nickname'];
 
-               Profile::load($a, $nickname);
-
-               if (empty($a->profile)) {
+               $profile = Profile::load($a, $nickname);
+               if (empty($profile)) {
                        throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
                }
 
-               $o = self::getTabsHTML($a, 'contacts', false, $nickname);
-
-               if (!empty($a->profile['hide-friends'])) {
+               if (!empty($profile['hide-friends'])) {
                        throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
                }
 
-               $displayCommonTab = Session::isAuthenticated() && $a->profile['uid'] != local_user();
+               $displayCommonTab = Session::isAuthenticated() && $profile['uid'] != local_user();
 
                if (!$displayCommonTab) {
                        $a->redirect('profile/' . $nickname . '/contacts');
                };
 
+               $o = self::getTabsHTML($a, 'contacts', false, $profile['nickname'], $profile['hide-friends']);
+
+               $tabs = self::getContactFilterTabs('profile/' . $nickname, 'common', $displayCommonTab);
+
                $sourceId = Contact::getIdForURL(Profile::getMyURL());
-               $targetId = Contact::getPublicIdByUserId($a->profile['uid']);
+               $targetId = Contact::getPublicIdByUserId($profile['uid']);
 
                $condition = [
                        'blocked' => false,
@@ -76,7 +77,7 @@ class Common extends BaseProfile
 
                $total = Contact\Relation::countCommon($sourceId, $targetId, $condition);
 
-               $pager = new Pager(DI::l10n(), DI::args()->getQueryString());
+               $pager = new Pager(DI::l10n(), DI::args()->getQueryString(), 30);
 
                $commonFollows = Contact\Relation::listCommon($sourceId, $targetId, $condition, $pager->getItemsPerPage(), $pager->getStart());
 
@@ -85,22 +86,15 @@ class Common extends BaseProfile
                $title = DI::l10n()->tt('Common contact (%s)', 'Common contacts (%s)', $total);
                $desc = DI::l10n()->t(
                        'Both <strong>%s</strong> and yourself have publicly interacted with these contacts (follow, comment or likes on public posts).',
-                       htmlentities($a->profile['name'], ENT_COMPAT, 'UTF-8')
+                       htmlentities($profile['name'], ENT_COMPAT, 'UTF-8')
                );
 
                $tpl = Renderer::getMarkupTemplate('profile/contacts.tpl');
                $o .= Renderer::replaceMacros($tpl, [
                        '$title'    => $title,
                        '$desc'     => $desc,
-                       '$nickname' => $nickname,
-                       '$type'     => 'common',
-                       '$displayCommonTab' => $displayCommonTab,
-
-                       '$all_label'       => DI::l10n()->t('All contacts'),
-                       '$followers_label' => DI::l10n()->t('Followers'),
-                       '$following_label' => DI::l10n()->t('Following'),
-                       '$mutuals_label'   => DI::l10n()->t('Mutual friends'),
-                       '$common_label'    => DI::l10n()->t('Common'),
+                       '$tabs'     => $tabs,
+
                        '$noresult_label'  => DI::l10n()->t('No common contacts.'),
 
                        '$contacts' => $contacts,