]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Delegation.php
Posts from contacts can now be collapsed
[friendica.git] / src / Module / Delegation.php
index fc86e9b64e05a7e874c5835f55742911174d2baa..0003ae08be74125bf4ff4f36e8f5e5147c14d624 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -38,15 +38,15 @@ class Delegation extends BaseModule
 {
        protected function post(array $request = [])
        {
-               if (!local_user()) {
+               if (!DI::userSession()->getLocalUserId()) {
                        return;
                }
 
-               $uid = local_user();
+               $uid = DI::userSession()->getLocalUserId();
                $orig_record = User::getById(DI::app()->getLoggedInUserId());
 
-               if (DI::session()->get('submanage')) {
-                       $user = User::getById(DI::session()->get('submanage'));
+               if (DI::userSession()->getSubManagedUserId()) {
+                       $user = User::getById(DI::userSession()->getSubManagedUserId());
                        if (DBA::isResult($user)) {
                                $uid = intval($user['uid']);
                                $orig_record = $user;
@@ -101,7 +101,7 @@ class Delegation extends BaseModule
                DI::auth()->setForUser(DI::app(), $user, true, true);
 
                if ($limited_id) {
-                       DI::session()->set('submanage', $original_id);
+                       DI::userSession()->setSubManagedUserId($original_id);
                }
 
                $ret = [];
@@ -114,11 +114,11 @@ class Delegation extends BaseModule
 
        protected function content(array $request = []): string
        {
-               if (!local_user()) {
+               if (!DI::userSession()->getLocalUserId()) {
                        throw new ForbiddenException(DI::l10n()->t('Permission denied.'));
                }
 
-               $identities = User::identities(DI::session()->get('submanage', local_user()));
+               $identities = User::identities(DI::userSession()->getSubManagedUserId() ?: DI::userSession()->getLocalUserId());
 
                //getting additinal information for each identity
                foreach ($identities as $key => $identity) {