]> git.mxchange.org Git - friendica.git/blobdiff - mod/cal.php
Merge pull request #7974 from tobiasd/20191220-lng
[friendica.git] / mod / cal.php
index b77abaa828b7fa4874ac7c01dc86bfb4938cb171..51d17a10a43b98cb850d25bb39d7197b0f5969d1 100644 (file)
@@ -14,6 +14,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Core\System;
+use Friendica\Core\Session;
 use Friendica\Database\DBA;
 use Friendica\Model\Contact;
 use Friendica\Model\Event;
@@ -26,11 +27,7 @@ use Friendica\Util\Temporal;
 
 function cal_init(App $a)
 {
-       if ($a->argc > 1) {
-               DFRN::autoRedir($a, $a->argv[1]);
-       }
-
-       if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
+       if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
                throw new \Friendica\Network\HTTPException\ForbiddenException(L10n::t('Access denied.'));
        }
 
@@ -113,13 +110,11 @@ function cal_content(App $a)
        $owner_uid = intval($a->data['user']['uid']);
        $nick = $a->data['user']['nickname'];
 
-       if (!empty(remote_user($a->profile['profile_uid']))) {
-               $contact_id = remote_user($a->profile['profile_uid']);
+       if (!empty(Session::getRemoteContactID($a->profile['profile_uid']))) {
+               $contact_id = Session::getRemoteContactID($a->profile['profile_uid']);
        }
 
-       $groups = [];
        if ($contact_id) {
-               $groups = Group::getIdsByContactId($contact_id);
                $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
                        intval($contact_id),
                        intval($a->profile['profile_uid'])
@@ -137,7 +132,7 @@ function cal_content(App $a)
        }
 
        // get the permissions
-       $sql_perms = Item::getPermissionsSQLByUserId($owner_uid, $remote_contact, $groups);
+       $sql_perms = Item::getPermissionsSQLByUserId($owner_uid);
        // we only want to have the events of the profile owner
        $sql_extra = " AND `event`.`cid` = 0 " . $sql_perms;
 
@@ -205,7 +200,7 @@ function cal_content(App $a)
 
                // put the event parametes in an array so we can better transmit them
                $event_params = [
-                       'event_id'      => intval(defaults($_GET, 'id', 0)),
+                       'event_id'      => intval($_GET['id'] ?? 0),
                        'start'         => $start,
                        'finish'        => $finish,
                        'adjust_start'  => $adjust_start,