]> git.mxchange.org Git - friendica.git/blobdiff - mod/cal.php
Replace "notice" calls
[friendica.git] / mod / cal.php
index 75fe87e7463f3568062f5f9faeb80d875eeeadca..ec6df1f165e89630f9a8d9322dd143a6a3e98d33 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -28,12 +28,14 @@ use Friendica\Content\Nav;
 use Friendica\Content\Widget;
 use Friendica\Core\Renderer;
 use Friendica\Core\Session;
+use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Event;
 use Friendica\Model\Item;
 use Friendica\Model\User;
 use Friendica\Module\BaseProfile;
+use Friendica\Module\Response;
 use Friendica\Network\HTTPException;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Temporal;
@@ -117,7 +119,7 @@ function cal_content(App $a)
        $is_owner = local_user() == $owner['uid'];
 
        if ($owner['hidewall'] && !$is_owner && !$remote_contact) {
-               notice(DI::l10n()->t('Access to this profile has been restricted.'));
+               DI::sysmsg()->addNotice(DI::l10n()->t('Access to this profile has been restricted.'));
                return;
        }
 
@@ -216,8 +218,7 @@ function cal_content(App $a)
                $events = Event::prepareListForTemplate($r);
 
                if (!empty(DI::args()->getArgv()[2]) && (DI::args()->getArgv()[2] === 'json')) {
-                       echo json_encode($events);
-                       exit();
+                       System::jsonExit($events);
                }
 
                // links: array('href', 'text', 'extra css classes', 'title')
@@ -253,8 +254,7 @@ function cal_content(App $a)
                ]);
 
                if (!empty($_GET['id'])) {
-                       echo $o;
-                       exit();
+                       System::httpExit($o);
                }
 
                return $o;
@@ -262,7 +262,7 @@ function cal_content(App $a)
 
        if ($mode == 'export') {
                if (!$owner_uid) {
-                       notice(DI::l10n()->t('User not found'));
+                       DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
                        return;
                }
 
@@ -271,9 +271,9 @@ function cal_content(App $a)
 
                if (!$evexport["success"]) {
                        if ($evexport["content"]) {
-                               notice(DI::l10n()->t('This calendar format is not supported'));
+                               DI::sysmsg()->addNotice(DI::l10n()->t('This calendar format is not supported'));
                        } else {
-                               notice(DI::l10n()->t('No exportable data found'));
+                               DI::sysmsg()->addNotice(DI::l10n()->t('No exportable data found'));
                        }
 
                        // If it the own calendar return to the events page
@@ -289,10 +289,8 @@ function cal_content(App $a)
 
                // If nothing went wrong we can echo the export content
                if ($evexport["success"]) {
-                       header('Content-type: text/calendar');
                        header('content-disposition: attachment; filename="' . DI::l10n()->t('calendar') . '-' . $nick . '.' . $evexport["extension"] . '"');
-                       echo $evexport["content"];
-                       exit();
+                       System::httpExit($evexport["content"], Response::TYPE_BLANK, 'text/calendar');
                }
 
                return;