]> git.mxchange.org Git - friendica.git/blobdiff - mod/events.php
Merge remote-tracking branch 'upstream/develop' into network-thread-view
[friendica.git] / mod / events.php
index f20d173dc752126b69bda817f895cf147d139d55..89da0c2c0eb40b91bde9b7513a29890322d4a2cc 100644 (file)
@@ -242,17 +242,11 @@ function events_content(App $a)
        }
 
        if ((DI::args()->getArgc() > 2) && (DI::args()->getArgv()[1] === 'ignore') && intval(DI::args()->getArgv()[2])) {
-               q("UPDATE `event` SET `ignore` = 1 WHERE `id` = %d AND `uid` = %d",
-                       intval(DI::args()->getArgv()[2]),
-                       intval(local_user())
-               );
+               DBA::update('event', ['ignore' => true], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]);
        }
 
        if ((DI::args()->getArgc() > 2) && (DI::args()->getArgv()[1] === 'unignore') && intval(DI::args()->getArgv()[2])) {
-               q("UPDATE `event` SET `ignore` = 0 WHERE `id` = %d AND `uid` = %d",
-                       intval(DI::args()->getArgv()[2]),
-                       intval(local_user())
-               );
+               DBA::update('event', ['ignore' => false], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]);
        }
 
        if ($a->getThemeInfoValue('events_in_profile')) {
@@ -280,7 +274,7 @@ function events_content(App $a)
        $tabs = '';
        // tabs
        if ($a->getThemeInfoValue('events_in_profile')) {
-               $tabs = BaseProfile::getTabsHTML($a, 'events', true, $a->user);
+               $tabs = BaseProfile::getTabsHTML($a, 'events', true, $a->getLoggedInUserNickname(), false);
        }
 
        $mode = 'view';
@@ -444,13 +438,7 @@ function events_content(App $a)
        }
 
        if (($mode === 'edit' || $mode === 'copy') && $event_id) {
-               $r = q("SELECT * FROM `event` WHERE `id` = %d AND `uid` = %d LIMIT 1",
-                       intval($event_id),
-                       intval(local_user())
-               );
-               if (DBA::isResult($r)) {
-                       $orig_event = $r[0];
-               }
+               $orig_event = DBA::selectFirst('event', [], ['id' => $event_id, 'uid' => local_user()]);
        }
 
        // Passed parameters overrides anything found in the DB
@@ -513,7 +501,7 @@ function events_content(App $a)
                $fminute = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : '00';
 
                if (!$cid && in_array($mode, ['new', 'copy'])) {
-                       $acl = ACL::getFullSelectorHTML(DI::page(), $a->user, false, ACL::getDefaultUserPermissions($orig_event));
+                       $acl = ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId(), false, ACL::getDefaultUserPermissions($orig_event));
                } else {
                        $acl = '';
                }