]> git.mxchange.org Git - friendica.git/blobdiff - mod/cal.php
UserSession class [2] - Refactor mod/ files
[friendica.git] / mod / cal.php
index 3f249da0aca21c457146fd4243eebc669ea06430..9329aac325d7e913bc85d04bbd82e52afa72bd7c 100644 (file)
@@ -42,7 +42,7 @@ use Friendica\Util\Temporal;
 
 function cal_init(App $a)
 {
-       if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
+       if (DI::config()->get('system', 'block_public') && !DI::userSession()->isAuthenticated()) {
                throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
        }
 
@@ -112,14 +112,14 @@ function cal_content(App $a)
        $owner_uid = intval($owner['uid']);
        $nick = $owner['nickname'];
 
-       $contact_id = Session::getRemoteContactID($owner['uid']);
+       $contact_id = DI::userSession()->getRemoteContactID($owner['uid']);
 
        $remote_contact = $contact_id && DBA::exists('contact', ['id' => $contact_id, 'uid' => $owner['uid']]);
 
-       $is_owner = local_user() == $owner['uid'];
+       $is_owner = DI::userSession()->getLocalUserId() == $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;
        }
 
@@ -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,14 +271,14 @@ 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
                        // otherwise to the profile calendar page
-                       if (local_user() === $owner_uid) {
+                       if (DI::userSession()->getLocalUserId() === $owner_uid) {
                                $return_path = "events";
                        } else {
                                $return_path = "cal/" . $nick;