]> git.mxchange.org Git - friendica.git/blobdiff - mod/events.php
Merge branch 'develop' into rewrite/gravity-constants
[friendica.git] / mod / events.php
index 1b8a509b7015f9c7b9417734494de8350401886e..a9a2e47fe2d6ddb5dc9149762e7d68e09e6fe98e 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
  *
@@ -27,6 +27,7 @@ use Friendica\Core\ACL;
 use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
+use Friendica\Core\System;
 use Friendica\Core\Theme;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
@@ -120,19 +121,17 @@ function events_post(App $a)
        $onerror_path = 'events/' . $action . '?' . http_build_query($params, '', '&', PHP_QUERY_RFC3986);
 
        if (strcmp($finish, $start) < 0 && !$nofinish) {
-               notice(DI::l10n()->t('Event can not end before it has started.'));
+               DI::sysmsg()->addNotice(DI::l10n()->t('Event can not end before it has started.'));
                if (intval($_REQUEST['preview'])) {
-                       echo DI::l10n()->t('Event can not end before it has started.');
-                       exit();
+                       System::httpExit(DI::l10n()->t('Event can not end before it has started.'));
                }
                DI::baseUrl()->redirect($onerror_path);
        }
 
        if (!$summary || ($start === DBA::NULL_DATETIME)) {
-               notice(DI::l10n()->t('Event title and start time are required.'));
+               DI::sysmsg()->addNotice(DI::l10n()->t('Event title and start time are required.'));
                if (intval($_REQUEST['preview'])) {
-                       echo DI::l10n()->t('Event title and start time are required.');
-                       exit();
+                       System::httpExit(DI::l10n()->t('Event title and start time are required.'));
                }
                DI::baseUrl()->redirect($onerror_path);
        }
@@ -174,27 +173,26 @@ function events_post(App $a)
                $private_event = true;
        }
 
-       $datarray = [];
-       $datarray['start']     = $start;
-       $datarray['finish']    = $finish;
-       $datarray['summary']   = $summary;
-       $datarray['desc']      = $desc;
-       $datarray['location']  = $location;
-       $datarray['type']      = $type;
-       $datarray['nofinish']  = $nofinish;
-       $datarray['uid']       = $uid;
-       $datarray['cid']       = $cid;
-       $datarray['allow_cid'] = $str_contact_allow;
-       $datarray['allow_gid'] = $str_group_allow;
-       $datarray['deny_cid']  = $str_contact_deny;
-       $datarray['deny_gid']  = $str_group_deny;
-       $datarray['private']   = $private_event;
-       $datarray['id']        = $event_id;
+       $datarray = [
+               'start'     => $start,
+               'finish'    => $finish,
+               'summary'   => $summary,
+               'desc'      => $desc,
+               'location'  => $location,
+               'type'      => $type,
+               'nofinish'  => $nofinish,
+               'uid'       => $uid,
+               'cid'       => $cid,
+               'allow_cid' => $str_contact_allow,
+               'allow_gid' => $str_group_allow,
+               'deny_cid'  => $str_contact_deny,
+               'deny_gid'  => $str_group_deny,
+               'private'   => $private_event,
+               'id'        => $event_id,
+       ];
 
        if (intval($_REQUEST['preview'])) {
-               $html = Event::getHTML($datarray);
-               echo $html;
-               exit();
+               System::httpExit(Event::getHTML($datarray));
        }
 
        $event_id = Event::store($datarray);
@@ -208,7 +206,7 @@ function events_post(App $a)
        }
 
        if (!$cid && $uri_id) {
-               Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, (int)$uri_id, (int)$uid);
+               Worker::add(Worker::PRIORITY_HIGH, "Notifier", Delivery::POST, (int)$uri_id, (int)$uid);
        }
 
        DI::baseUrl()->redirect('events');
@@ -217,7 +215,7 @@ function events_post(App $a)
 function events_content(App $a)
 {
        if (!local_user()) {
-               notice(DI::l10n()->t('Permission denied.'));
+               DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
                return Login::form();
        }
 
@@ -391,8 +389,7 @@ function events_content(App $a)
                ]);
 
                if (!empty($_GET['id'])) {
-                       echo $o;
-                       exit();
+                       System::httpExit($o);
                }
 
                return $o;
@@ -535,7 +532,7 @@ function events_content(App $a)
                }
 
                if (Post::exists(['id' => $ev[0]['itemid']])) {
-                       notice(DI::l10n()->t('Failed to remove event'));
+                       DI::sysmsg()->addNotice(DI::l10n()->t('Failed to remove event'));
                }
 
                DI::baseUrl()->redirect('events');