]> git.mxchange.org Git - friendica.git/blobdiff - mod/cal.php
Merge pull request #10437 from annando/reduce-proxy
[friendica.git] / mod / cal.php
index 8db2237844017286c5a2f4f1eef0ff416d1d6ea9..f3ff80cf99b3239d4cd8d5689f548a63c3acbdf1 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
  *
@@ -24,7 +24,6 @@
  */
 
 use Friendica\App;
-use Friendica\Content\Feature;
 use Friendica\Content\Nav;
 use Friendica\Content\Text\BBCode;
 use Friendica\Content\Widget;
@@ -68,8 +67,7 @@ function cal_init(App $a)
                return;
        }
 
-       $a->profile = Profile::getByNickname($nick, $a->profile_uid);
-
+       $a->profile = Profile::getByNickname($nick);
        if (empty($a->profile)) {
                throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
        }
@@ -86,7 +84,7 @@ function cal_init(App $a)
                '$about' => BBCode::convert($a->profile['about']),
        ]);
 
-       $cal_widget = Widget\CalendarExport::getHTML();
+       $cal_widget = Widget\CalendarExport::getHTML($user['uid']);
 
        if (empty(DI::page()['aside'])) {
                DI::page()['aside'] = '';
@@ -105,6 +103,11 @@ function cal_content(App $a)
        // get the translation strings for the callendar
        $i18n = Event::getStrings();
 
+       DI::page()->registerStylesheet('view/asset/fullcalendar/dist/fullcalendar.min.css');
+       DI::page()->registerStylesheet('view/asset/fullcalendar/dist/fullcalendar.print.min.css', 'print');
+       DI::page()->registerFooterScript('view/asset/moment/min/moment-with-locales.min.js');
+       DI::page()->registerFooterScript('view/asset/fullcalendar/dist/fullcalendar.min.js');
+
        $htpl = Renderer::getMarkupTemplate('event_head.tpl');
        DI::page()['htmlhead'] .= Renderer::replaceMacros($htpl, [
                '$module_url' => '/cal/' . $a->data['user']['nickname'],
@@ -126,6 +129,9 @@ function cal_content(App $a)
        // Setup permissions structures
        $owner_uid = intval($a->data['user']['uid']);
        $nick = $a->data['user']['nickname'];
+       if (empty($a->profile)) {
+               throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
+       }
 
        $contact_id = Session::getRemoteContactID($a->profile['uid']);
 
@@ -134,7 +140,7 @@ function cal_content(App $a)
        $is_owner = local_user() == $a->profile['uid'];
 
        if ($a->profile['hidewall'] && !$is_owner && !$remote_contact) {
-               notice(DI::l10n()->t('Access to this profile has been restricted.') . EOL);
+               notice(DI::l10n()->t('Access to this profile has been restricted.'));
                return;
        }