X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FBaseProfile.php;h=3573542c05ef7b79009e2e33f0f35d0499c5ab0b;hb=99284222c1d7fb4adca9077e3057faf3b36f7180;hp=56577ef33ac4e03d6b418dc2c2cbfa25dd908a82;hpb=d2ba254a5ad762c858ddbe6bae6c4a5c01b65d1a;p=friendica.git diff --git a/src/Module/BaseProfile.php b/src/Module/BaseProfile.php index 56577ef33a..3573542c05 100644 --- a/src/Module/BaseProfile.php +++ b/src/Module/BaseProfile.php @@ -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; @@ -79,7 +80,7 @@ class BaseProfile extends BaseModule ]; // the calendar link for the full-featured events calendar - if ($is_owner && $a->getThemeInfoValue('events_in_profile')) { + if ($is_owner) { $tabs[] = [ 'label' => DI::l10n()->t('Calendar'), 'url' => DI::baseUrl() . '/calendar', @@ -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 - } elseif (!$is_owner) { - $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', - ]; + } else { + $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) {