]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/BaseProfile.php
Allow the search for contacts on blocked servers via web
[friendica.git] / src / Module / BaseProfile.php
index 10384e1578289c39db5b6f76a1fd1b67c7ec7d00..b7584d9db6098c7fde3caa3600bb3ef085ed46dc 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -23,23 +23,24 @@ namespace Friendica\Module;
 
 use Friendica\App;
 use Friendica\BaseModule;
+use Friendica\Content\Feature;
 use Friendica\Core\Hook;
 use Friendica\Core\Renderer;
 use Friendica\DI;
+use Friendica\Model\User;
 
 class BaseProfile extends BaseModule
 {
        /**
         * Returns the HTML for the profile pages tabs
         *
-        * @param App    $a
         * @param string $current
         * @param bool   $is_owner
         * @param string $nickname
         * @return string
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public static function getTabsHTML(App $a, string $current, bool $is_owner, string $nickname, bool $hide_friends)
+       public static function getTabsHTML(string $current, bool $is_owner, string $nickname, bool $hide_friends)
        {
                $baseProfileUrl = DI::baseUrl() . '/profile/' . $nickname;
 
@@ -53,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',
                        ],
@@ -88,17 +89,18 @@ class BaseProfile extends BaseModule
                                'id'    => 'calendar-tab',
                                'accesskey' => 'c',
                        ];
-                       // if the user is not the owner of the calendar we only show a calendar
-                       // with the public events of the calendar owner
                } else {
-                       $tabs[] = [
-                               'label' => DI::l10n()->t('Calendar'),
-                               'url'   => DI::baseUrl() . '/calendar/show/' . $nickname,
-                               'sel'   => $current == 'calendar' ? 'active' : '',
-                               'title' => DI::l10n()->t('Calendar'),
-                               'id'    => 'calendar-tab',
-                               'accesskey' => 'c',
-                       ];
+                       $owner = User::getByNickname($nickname, ['uid']);
+                       if(DI::userSession()->isAuthenticated() || $owner && Feature::isEnabled($owner['uid'], 'public_calendar')) {
+                               $tabs[] = [
+                                       'label' => DI::l10n()->t('Calendar'),
+                                       'url'   => DI::baseUrl() . '/calendar/show/' . $nickname,
+                                       'sel'   => $current == 'calendar' ? 'active' : '',
+                                       'title' => DI::l10n()->t('Calendar'),
+                                       'id'    => 'calendar-tab',
+                                       'accesskey' => 'c',
+                               ];
+                       }
                }
 
                if ($is_owner) {