]> git.mxchange.org Git - friendica.git/blobdiff - mod/events.php
Merge pull request #12025 from annando/no-boot-src-module
[friendica.git] / mod / events.php
index a9a2e47fe2d6ddb5dc9149762e7d68e09e6fe98e..ac2a08afc5433fc6726e6ee72785d9072f9a5efa 100644 (file)
@@ -27,6 +27,7 @@ use Friendica\Core\ACL;
 use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
+use Friendica\Core\Session;
 use Friendica\Core\System;
 use Friendica\Core\Theme;
 use Friendica\Core\Worker;
@@ -46,7 +47,7 @@ use Friendica\Worker\Delivery;
 
 function events_init(App $a)
 {
-       if (!local_user()) {
+       if (!Session::getLocalUser()) {
                return;
        }
 
@@ -54,7 +55,7 @@ function events_init(App $a)
                DI::page()['aside'] = '';
        }
 
-       $cal_widget = CalendarExport::getHTML(local_user());
+       $cal_widget = CalendarExport::getHTML(Session::getLocalUser());
 
        DI::page()['aside'] .= $cal_widget;
 
@@ -64,13 +65,13 @@ function events_init(App $a)
 function events_post(App $a)
 {
        Logger::debug('post', ['request' => $_REQUEST]);
-       if (!local_user()) {
+       if (!Session::getLocalUser()) {
                return;
        }
 
        $event_id = !empty($_POST['event_id']) ? intval($_POST['event_id']) : 0;
        $cid = !empty($_POST['cid']) ? intval($_POST['cid']) : 0;
-       $uid = local_user();
+       $uid = Session::getLocalUser();
 
        $start_text  = Strings::escapeHtml($_REQUEST['start_text'] ?? '');
        $finish_text = Strings::escapeHtml($_REQUEST['finish_text'] ?? '');
@@ -214,7 +215,7 @@ function events_post(App $a)
 
 function events_content(App $a)
 {
-       if (!local_user()) {
+       if (!Session::getLocalUser()) {
                DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
                return Login::form();
        }
@@ -224,11 +225,11 @@ function events_content(App $a)
        }
 
        if ((DI::args()->getArgc() > 2) && (DI::args()->getArgv()[1] === 'ignore') && intval(DI::args()->getArgv()[2])) {
-               DBA::update('event', ['ignore' => true], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]);
+               DBA::update('event', ['ignore' => true], ['id' => DI::args()->getArgv()[2], 'uid' => Session::getLocalUser()]);
        }
 
        if ((DI::args()->getArgc() > 2) && (DI::args()->getArgv()[1] === 'unignore') && intval(DI::args()->getArgv()[2])) {
-               DBA::update('event', ['ignore' => false], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]);
+               DBA::update('event', ['ignore' => false], ['id' => DI::args()->getArgv()[2], 'uid' => Session::getLocalUser()]);
        }
 
        if ($a->getThemeInfoValue('events_in_profile')) {
@@ -323,9 +324,9 @@ function events_content(App $a)
 
                // get events by id or by date
                if ($event_params['event_id']) {
-                       $r = Event::getListById(local_user(), $event_params['event_id']);
+                       $r = Event::getListById(Session::getLocalUser(), $event_params['event_id']);
                } else {
-                       $r = Event::getListByDate(local_user(), $event_params);
+                       $r = Event::getListByDate(Session::getLocalUser(), $event_params);
                }
 
                $links = [];
@@ -396,7 +397,7 @@ function events_content(App $a)
        }
 
        if (($mode === 'edit' || $mode === 'copy') && $event_id) {
-               $orig_event = DBA::selectFirst('event', [], ['id' => $event_id, 'uid' => local_user()]);
+               $orig_event = DBA::selectFirst('event', [], ['id' => $event_id, 'uid' => Session::getLocalUser()]);
        }
 
        // Passed parameters overrides anything found in the DB
@@ -405,8 +406,8 @@ function events_content(App $a)
                $share_disabled = '';
 
                if (empty($orig_event)) {
-                       $orig_event = User::getById(local_user(), ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']);;
-               } elseif ($orig_event['allow_cid'] !== '<' . local_user() . '>'
+                       $orig_event = User::getById(Session::getLocalUser(), ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']);;
+               } elseif ($orig_event['allow_cid'] !== '<' . Session::getLocalUser() . '>'
                        || $orig_event['allow_gid']
                        || $orig_event['deny_cid']
                        || $orig_event['deny_gid']) {
@@ -524,11 +525,11 @@ function events_content(App $a)
 
        // Remove an event from the calendar and its related items
        if ($mode === 'drop' && $event_id) {
-               $ev = Event::getListById(local_user(), $event_id);
+               $ev = Event::getListById(Session::getLocalUser(), $event_id);
 
                // Delete only real events (no birthdays)
                if (DBA::isResult($ev) && $ev[0]['type'] == 'event') {
-                       Item::deleteForUser(['id' => $ev[0]['itemid']], local_user());
+                       Item::deleteForUser(['id' => $ev[0]['itemid']], Session::getLocalUser());
                }
 
                if (Post::exists(['id' => $ev[0]['itemid']])) {