From 7ac86e49d13af8f3b3bd0670ab309a8ab66f442a Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 18 Oct 2022 21:10:37 +0200 Subject: [PATCH 1/7] Move Core\Session::get() to DI::session()->get() --- mod/redir.php | 2 +- src/App.php | 18 +++++++++++++----- src/Content/Conversation.php | 8 +++++--- src/Content/Nav.php | 4 ++-- src/Core/Session.php | 5 ----- src/Model/Profile.php | 2 +- src/Module/Conversation/Network.php | 2 +- src/Module/Delegation.php | 4 ++-- src/Module/Profile/Status.php | 2 +- src/Module/Settings/Delegation.php | 4 ++-- src/Module/Settings/Display.php | 2 +- src/Module/Settings/TwoFactor/Verify.php | 2 +- src/Module/Update/Profile.php | 2 +- src/Object/Post.php | 8 ++++---- view/theme/frio/theme.php | 2 +- 15 files changed, 36 insertions(+), 31 deletions(-) diff --git a/mod/redir.php b/mod/redir.php index ba1b7e13b..426abfd49 100644 --- a/mod/redir.php +++ b/mod/redir.php @@ -91,7 +91,7 @@ function redir_init(App $a) { // with the local contact. Otherwise the local user would ask the local contact // for authentification everytime he/she is visiting a profile page of the local // contact. - if (($host == $remotehost) && (Session::getRemoteContactID(Session::get('visitor_visiting')) == Session::get('visitor_id'))) { + if (($host == $remotehost) && (Session::getRemoteContactID(DI::session()->get('visitor_visiting')) == DI::session()->get('visitor_id'))) { // Remote user is already authenticated. redir_check_url($contact_url, $url); $target_url = $url ?: $contact_url; diff --git a/src/App.php b/src/App.php index 55b3e72e0..003ff5658 100644 --- a/src/App.php +++ b/src/App.php @@ -26,6 +26,7 @@ use Friendica\App\Arguments; use Friendica\App\BaseURL; use Friendica\Capabilities\ICanCreateResponses; use Friendica\Core\Config\Factory\Config; +use Friendica\Core\Session\Capability\IHandleSessions; use Friendica\Module\Maintenance; use Friendica\Security\Authentication; use Friendica\Core\Config\ValueObject\Cache; @@ -127,6 +128,11 @@ class App */ private $pConfig; + /** + * @var IHandleSessions + */ + private $session; + /** * Set the user ID * @@ -328,8 +334,9 @@ class App * @param L10n $l10n The translator instance * @param App\Arguments $args The Friendica Arguments of the call * @param IManagePersonalConfigValues $pConfig Personal configuration + * @param IHandleSessions $session The Session handler */ - public function __construct(Database $database, IManageConfigValues $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, IManagePersonalConfigValues $pConfig) + public function __construct(Database $database, IManageConfigValues $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, IManagePersonalConfigValues $pConfig, IHandleSessions $session) { $this->database = $database; $this->config = $config; @@ -340,6 +347,7 @@ class App $this->l10n = $l10n; $this->args = $args; $this->pConfig = $pConfig; + $this->session = $session; $this->load(); } @@ -415,7 +423,7 @@ class App } // Specific mobile theme override - if (($this->mode->isMobile() || $this->mode->isTablet()) && Core\Session::get('show-mobile', true)) { + if (($this->mode->isMobile() || $this->mode->isTablet()) && $this->session->get('show-mobile', true)) { $user_mobile_theme = $this->getCurrentMobileTheme(); // --- means same mobile theme as desktop @@ -496,7 +504,7 @@ class App } } - $theme_name = $page_theme ?: Core\Session::get('theme', $system_theme); + $theme_name = $page_theme ?: $this->session->get('theme', $system_theme); $theme_name = Strings::sanitizeFilePathItem($theme_name); if ($theme_name @@ -528,7 +536,7 @@ class App } } - $mobile_theme_name = $page_mobile_theme ?: Core\Session::get('mobile-theme', $system_mobile_theme); + $mobile_theme_name = $page_mobile_theme ?: $this->session->get('mobile-theme', $system_mobile_theme); $mobile_theme_name = Strings::sanitizeFilePathItem($mobile_theme_name); if ($mobile_theme_name == '---' @@ -625,7 +633,7 @@ class App // Valid profile links contain a path with "/profile/" and no query parameters if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == '') && strstr(parse_url($_GET['zrl'], PHP_URL_PATH), '/profile/')) { - if (Core\Session::get('visitor_home') != $_GET['zrl']) { + if ($this->session->get('visitor_home') != $_GET['zrl']) { Core\Session::set('my_url', $_GET['zrl']); Core\Session::set('authenticated', 0); diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index 817bc402a..ede7a56b6 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -32,7 +32,6 @@ use Friendica\Core\L10n; use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; use Friendica\Core\Protocol; use Friendica\Core\Renderer; -use Friendica\Core\Session; use Friendica\Core\Theme; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -77,8 +76,10 @@ class Conversation private $page; /** @var App\Mode */ private $mode; + /** @var Session\Capability\IHandleSessions */ + private $session; - public function __construct(LoggerInterface $logger, Profiler $profiler, Activity $activity, L10n $l10n, Item $item, Arguments $args, BaseURL $baseURL, IManageConfigValues $config, IManagePersonalConfigValues $pConfig, App\Page $page, App\Mode $mode, App $app) + public function __construct(LoggerInterface $logger, Profiler $profiler, Activity $activity, L10n $l10n, Item $item, Arguments $args, BaseURL $baseURL, IManageConfigValues $config, IManagePersonalConfigValues $pConfig, App\Page $page, App\Mode $mode, App $app, Session\Capability\IHandleSessions $session) { $this->activity = $activity; $this->item = $item; @@ -92,6 +93,7 @@ class Conversation $this->pConfig = $pConfig; $this->page = $page; $this->app = $app; + $this->session = $session; } /** @@ -497,7 +499,7 @@ class Conversation if (!$update) { $live_update_div = '
' . "\r\n" - . ""; } } elseif ($mode === 'community') { diff --git a/src/Content/Nav.php b/src/Content/Nav.php index 6861d69e8..b43e926e8 100644 --- a/src/Content/Nav.php +++ b/src/Content/Nav.php @@ -208,7 +208,7 @@ class Nav // "Home" should also take you home from an authenticated remote profile connection $homelink = Profile::getMyURL(); if (! $homelink) { - $homelink = Session::get('visitor_home', ''); + $homelink = DI::session()->get('visitor_home', ''); } if ((DI::args()->getModuleName() != 'home') && (! (local_user()))) { @@ -276,7 +276,7 @@ class Nav $nav['home'] = ['profile/' . $a->getLoggedInUserNickname(), DI::l10n()->t('Home'), '', DI::l10n()->t('Your posts and conversations')]; // Don't show notifications for public communities - if (Session::get('page_flags', '') != User::PAGE_FLAGS_COMMUNITY) { + if (DI::session()->get('page_flags', '') != User::PAGE_FLAGS_COMMUNITY) { $nav['introductions'] = ['notifications/intros', DI::l10n()->t('Introductions'), '', DI::l10n()->t('Friend Requests')]; $nav['notifications'] = ['notifications', DI::l10n()->t('Notifications'), '', DI::l10n()->t('Notifications')]; $nav['notifications']['all'] = ['notifications/system', DI::l10n()->t('See all notifications'), '', '']; diff --git a/src/Core/Session.php b/src/Core/Session.php index 859dd8aa2..7c4d2974d 100644 --- a/src/Core/Session.php +++ b/src/Core/Session.php @@ -39,11 +39,6 @@ class Session return DI::session()->exists($name); } - public static function get($name, $defaults = null) - { - return DI::session()->get($name, $defaults); - } - public static function pop($name, $defaults = null) { return DI::session()->pop($name, $defaults); diff --git a/src/Model/Profile.php b/src/Model/Profile.php index b58de4efb..d9467471f 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -683,7 +683,7 @@ class Profile */ public static function getMyURL(): string { - return Session::get('my_url') ?? ''; + return DI::session()->get('my_url') ?? ''; } /** diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index bfdeb7e57..d5f4f6d2f 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -307,7 +307,7 @@ class Network extends BaseModule self::$forumContactId = $this->parameters['contact_id'] ?? 0; - self::$selectedTab = Session::get('network-tab', DI::pConfig()->get(local_user(), 'network.view', 'selected_tab', '')); + self::$selectedTab = DI::session()->get('network-tab', DI::pConfig()->get(local_user(), 'network.view', 'selected_tab', '')); if (!empty($get['star'])) { self::$selectedTab = 'star'; diff --git a/src/Module/Delegation.php b/src/Module/Delegation.php index 146e9382b..f8aeb4c76 100644 --- a/src/Module/Delegation.php +++ b/src/Module/Delegation.php @@ -46,8 +46,8 @@ class Delegation extends BaseModule $uid = local_user(); $orig_record = User::getById(DI::app()->getLoggedInUserId()); - if (Session::get('submanage')) { - $user = User::getById(Session::get('submanage')); + if (DI::session()->get('submanage')) { + $user = User::getById(DI::session()->get('submanage')); if (DBA::isResult($user)) { $uid = intval($user['uid']); $orig_record = $user; diff --git a/src/Module/Profile/Status.php b/src/Module/Profile/Status.php index 1a313cbfa..2bf9b429b 100644 --- a/src/Module/Profile/Status.php +++ b/src/Module/Profile/Status.php @@ -139,7 +139,7 @@ class Status extends BaseProfile // Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups $condition = Item::getPermissionsConditionArrayByUserId($profile['uid']); - $last_updated_array = Session::get('last_updated', []); + $last_updated_array = DI::session()->get('last_updated', []); if (!empty($category)) { $condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `category-view` WHERE `name` = ? AND `type` = ? AND `uid` = ?)", diff --git a/src/Module/Settings/Delegation.php b/src/Module/Settings/Delegation.php index aeada0871..a711c674a 100644 --- a/src/Module/Settings/Delegation.php +++ b/src/Module/Settings/Delegation.php @@ -77,7 +77,7 @@ class Delegation extends BaseSettings $user_id = $args->get(3); if ($action === 'add' && $user_id) { - if (Session::get('submanage')) { + if (DI::session()->get('submanage')) { DI::sysmsg()->addNotice(DI::l10n()->t('Delegated administrators can view but not change delegation permissions.')); DI::baseUrl()->redirect('settings/delegation'); } @@ -99,7 +99,7 @@ class Delegation extends BaseSettings } if ($action === 'remove' && $user_id) { - if (Session::get('submanage')) { + if (DI::session()->get('submanage')) { DI::sysmsg()->addNotice(DI::l10n()->t('Delegated administrators can view but not change delegation permissions.')); DI::baseUrl()->redirect('settings/delegation'); } diff --git a/src/Module/Settings/Display.php b/src/Module/Settings/Display.php index fe42b8718..81f496eea 100644 --- a/src/Module/Settings/Display.php +++ b/src/Module/Settings/Display.php @@ -157,7 +157,7 @@ class Display extends BaseSettings } $theme_selected = $user['theme'] ?: $default_theme; - $mobile_theme_selected = Session::get('mobile-theme', $default_mobile_theme); + $mobile_theme_selected = DI::session()->get('mobile-theme', $default_mobile_theme); $itemspage_network = intval(DI::pConfig()->get(local_user(), 'system', 'itemspage_network')); $itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : DI::config()->get('system', 'itemspage_network')); diff --git a/src/Module/Settings/TwoFactor/Verify.php b/src/Module/Settings/TwoFactor/Verify.php index 3d7db0118..820f7e255 100644 --- a/src/Module/Settings/TwoFactor/Verify.php +++ b/src/Module/Settings/TwoFactor/Verify.php @@ -106,7 +106,7 @@ class Verify extends BaseSettings parent::content(); $company = 'Friendica'; - $holder = Session::get('my_address'); + $holder = DI::session()->get('my_address'); $secret = $this->pConfig->get(local_user(), '2fa', 'secret'); $otpauthUrl = (new Google2FA())->getQRCodeUrl($company, $holder, $secret); diff --git a/src/Module/Update/Profile.php b/src/Module/Update/Profile.php index b7dae9ec1..4d6793605 100644 --- a/src/Module/Update/Profile.php +++ b/src/Module/Update/Profile.php @@ -66,7 +66,7 @@ class Profile extends BaseModule // Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups $sql_extra = Item::getPermissionsSQLByUserId($a->getProfileOwner()); - $last_updated_array = Session::get('last_updated', []); + $last_updated_array = DI::session()->get('last_updated', []); $last_updated = $last_updated_array[$last_updated_key] ?? 0; diff --git a/src/Object/Post.php b/src/Object/Post.php index 7300fd09b..bbce29672 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -217,7 +217,7 @@ class Post $edpost = false; if (local_user()) { - if (Strings::compareLink(Session::get('my_url'), $item['author-link'])) { + if (Strings::compareLink(DI::session()->get('my_url'), $item['author-link'])) { if ($item['event-id'] != 0) { $edpost = ['events/event/' . $item['event-id'], DI::l10n()->t('Edit')]; } else { @@ -434,9 +434,9 @@ class Post } // Fetching of Diaspora posts doesn't always work. There are issues with reshares and possibly comments - if (!local_user() && ($item['network'] != Protocol::DIASPORA) && !empty(Session::get('remote_comment'))) { + if (!local_user() && ($item['network'] != Protocol::DIASPORA) && !empty(DI::session()->get('remote_comment'))) { $remote_comment = [DI::l10n()->t('Comment this item on your system'), DI::l10n()->t('Remote comment'), - str_replace('{uri}', urlencode($item['uri']), Session::get('remote_comment'))]; + str_replace('{uri}', urlencode($item['uri']), DI::session()->get('remote_comment'))]; // Ensure to either display the remote comment or the local activities $buttons = []; @@ -507,7 +507,7 @@ class Post 'location_html' => $location_html, 'indent' => $indent, 'shiny' => $shiny, - 'owner_self' => $item['author-link'] == Session::get('my_url'), + 'owner_self' => $item['author-link'] == DI::session()->get('my_url'), 'owner_url' => $this->getOwnerUrl(), 'owner_photo' => DI::baseUrl()->remove(DI::contentItem()->getOwnerAvatar($item)), 'owner_name' => $this->getOwnerName(), diff --git a/view/theme/frio/theme.php b/view/theme/frio/theme.php index 863992c40..2913a1553 100644 --- a/view/theme/frio/theme.php +++ b/view/theme/frio/theme.php @@ -207,7 +207,7 @@ function frio_remote_nav(App $a, array &$nav_info) // get the homelink from $_SESSION $homelink = Profile::getMyURL(); if (!$homelink) { - $homelink = Session::get('visitor_home', ''); + $homelink = DI::session()->get('visitor_home', ''); } // since $userinfo isn't available for the hook we write it to the nav array From fb2b2f5c58cbdf07fe7e0683a3e9b6096e8b0497 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 18 Oct 2022 21:11:00 +0200 Subject: [PATCH 2/7] Remove unused Core\Session::create() method --- src/Core/Session.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Core/Session.php b/src/Core/Session.php index 7c4d2974d..cc8ede5ca 100644 --- a/src/Core/Session.php +++ b/src/Core/Session.php @@ -34,11 +34,6 @@ class Session public static $exists = false; public static $expire = 180000; - public static function exists($name) - { - return DI::session()->exists($name); - } - public static function pop($name, $defaults = null) { return DI::session()->pop($name, $defaults); From dfb57927732f738d1b59c77dd308dbaadb466126 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 18 Oct 2022 21:11:19 +0200 Subject: [PATCH 3/7] Remove unused Core\Session::pop() method --- src/Core/Session.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Core/Session.php b/src/Core/Session.php index cc8ede5ca..9deadbedb 100644 --- a/src/Core/Session.php +++ b/src/Core/Session.php @@ -34,11 +34,6 @@ class Session public static $exists = false; public static $expire = 180000; - public static function pop($name, $defaults = null) - { - return DI::session()->pop($name, $defaults); - } - public static function set($name, $value) { DI::session()->set($name, $value); From 3a8bcb3fbf396da7d7966016410ad6ad9275d1e9 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 18 Oct 2022 21:12:23 +0200 Subject: [PATCH 4/7] Move Core\Session::set() to DI::session()->set() --- src/App.php | 4 ++-- src/Core/Session.php | 5 ----- src/Module/Conversation/Network.php | 2 +- src/Module/Delegation.php | 2 +- src/Module/Profile/Status.php | 2 +- src/Module/Settings/TwoFactor/Verify.php | 2 +- src/Module/Update/Profile.php | 2 +- 7 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/App.php b/src/App.php index 003ff5658..95b0716e2 100644 --- a/src/App.php +++ b/src/App.php @@ -634,8 +634,8 @@ class App if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == '') && strstr(parse_url($_GET['zrl'], PHP_URL_PATH), '/profile/')) { if ($this->session->get('visitor_home') != $_GET['zrl']) { - Core\Session::set('my_url', $_GET['zrl']); - Core\Session::set('authenticated', 0); + $this->session->set('my_url', $_GET['zrl']); + $this->session->set('authenticated', 0); $remote_contact = Contact::getByURL($_GET['zrl'], false, ['subscribe']); if (!empty($remote_contact['subscribe'])) { diff --git a/src/Core/Session.php b/src/Core/Session.php index 9deadbedb..1af219dd5 100644 --- a/src/Core/Session.php +++ b/src/Core/Session.php @@ -34,11 +34,6 @@ class Session public static $exists = false; public static $expire = 180000; - public static function set($name, $value) - { - DI::session()->set($name, $value); - } - public static function setMultiple(array $values) { DI::session()->setMultiple($values); diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index d5f4f6d2f..ed32744d3 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -345,7 +345,7 @@ class Network extends BaseModule self::$star = false; } - Session::set('network-tab', self::$selectedTab); + DI::session()->set('network-tab', self::$selectedTab); DI::pConfig()->set(local_user(), 'network.view', 'selected_tab', self::$selectedTab); self::$accountTypeString = $get['accounttype'] ?? $this->parameters['accounttype'] ?? ''; diff --git a/src/Module/Delegation.php b/src/Module/Delegation.php index f8aeb4c76..e3ae977e2 100644 --- a/src/Module/Delegation.php +++ b/src/Module/Delegation.php @@ -102,7 +102,7 @@ class Delegation extends BaseModule DI::auth()->setForUser(DI::app(), $user, true, true); if ($limited_id) { - Session::set('submanage', $original_id); + DI::session()->set('submanage', $original_id); } $ret = []; diff --git a/src/Module/Profile/Status.php b/src/Module/Profile/Status.php index 2bf9b429b..fa3f36e88 100644 --- a/src/Module/Profile/Status.php +++ b/src/Module/Profile/Status.php @@ -189,7 +189,7 @@ class Status extends BaseProfile // Set a time stamp for this page. We will make use of it when we // search for new items (update routine) $last_updated_array[$last_updated_key] = time(); - Session::set('last_updated', $last_updated_array); + DI::session()->set('last_updated', $last_updated_array); if ($is_owner && !DI::config()->get('theme', 'hide_eventlist')) { $o .= ProfileModel::getBirthdays(); diff --git a/src/Module/Settings/TwoFactor/Verify.php b/src/Module/Settings/TwoFactor/Verify.php index 820f7e255..86e9af5ae 100644 --- a/src/Module/Settings/TwoFactor/Verify.php +++ b/src/Module/Settings/TwoFactor/Verify.php @@ -86,7 +86,7 @@ class Verify extends BaseSettings if ($valid) { $this->pConfig->set(local_user(), '2fa', 'verified', true); - Session::set('2fa', true); + DI::session()->set('2fa', true); DI::sysmsg()->addInfo($this->t('Two-factor authentication successfully activated.')); diff --git a/src/Module/Update/Profile.php b/src/Module/Update/Profile.php index 4d6793605..4a1360fb9 100644 --- a/src/Module/Update/Profile.php +++ b/src/Module/Update/Profile.php @@ -102,7 +102,7 @@ class Profile extends BaseModule // Set a time stamp for this page. We will make use of it when we // search for new items (update routine) $last_updated_array[$last_updated_key] = time(); - Session::set('last_updated', $last_updated_array); + DI::session()->set('last_updated', $last_updated_array); if ($is_owner && !$a->getProfileOwner() && !DI::config()->get('theme', 'hide_eventlist')) { $o .= ProfileModel::getBirthdays(); From 315ed3ed22a76fcafe991e919d4daf342239c5d0 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 18 Oct 2022 21:12:48 +0200 Subject: [PATCH 5/7] Remove unused Core\Session::setMultiple() --- src/Core/Session.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Core/Session.php b/src/Core/Session.php index 1af219dd5..41ddf9783 100644 --- a/src/Core/Session.php +++ b/src/Core/Session.php @@ -34,11 +34,6 @@ class Session public static $exists = false; public static $expire = 180000; - public static function setMultiple(array $values) - { - DI::session()->setMultiple($values); - } - public static function remove($name) { DI::session()->remove($name); From a2eb0c737877567adcacfd94c06d3af7d042c670 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 18 Oct 2022 21:13:28 +0200 Subject: [PATCH 6/7] Move Core\Session::remove() to DI::session()->remove() --- src/Core/Session.php | 5 ----- src/Module/Settings/TwoFactor/Index.php | 3 +-- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Core/Session.php b/src/Core/Session.php index 41ddf9783..c1d2b7390 100644 --- a/src/Core/Session.php +++ b/src/Core/Session.php @@ -34,11 +34,6 @@ class Session public static $exists = false; public static $expire = 180000; - public static function remove($name) - { - DI::session()->remove($name); - } - public static function clear() { DI::session()->clear(); diff --git a/src/Module/Settings/TwoFactor/Index.php b/src/Module/Settings/TwoFactor/Index.php index be3d8d232..ae4e518fa 100644 --- a/src/Module/Settings/TwoFactor/Index.php +++ b/src/Module/Settings/TwoFactor/Index.php @@ -22,7 +22,6 @@ namespace Friendica\Module\Settings\TwoFactor; use Friendica\Core\Renderer; -use Friendica\Core\Session; use Friendica\DI; use Friendica\Network\HTTPException\FoundException; use Friendica\Security\TwoFactor\Model\AppSpecificPassword; @@ -64,7 +63,7 @@ class Index extends BaseSettings RecoveryCode::deleteForUser(local_user()); DI::pConfig()->delete(local_user(), '2fa', 'secret'); DI::pConfig()->delete(local_user(), '2fa', 'verified'); - Session::remove('2fa'); + DI::session()->remove('2fa'); DI::sysmsg()->addInfo(DI::l10n()->t('Two-factor authentication successfully disabled.')); DI::baseUrl()->redirect('settings/2fa'); From 4a2f67aa9a8d5422c7bdf4ac270eda2abf74f9b3 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 18 Oct 2022 21:13:58 +0200 Subject: [PATCH 7/7] Move Core\Session::clear() to DI::session()->clear() --- src/Core/Session.php | 5 ----- src/Module/Delegation.php | 3 +-- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Core/Session.php b/src/Core/Session.php index c1d2b7390..a944cf8f5 100644 --- a/src/Core/Session.php +++ b/src/Core/Session.php @@ -34,11 +34,6 @@ class Session public static $exists = false; public static $expire = 180000; - public static function clear() - { - DI::session()->clear(); - } - /** * Returns the user id of locally logged in user or false. * diff --git a/src/Module/Delegation.php b/src/Module/Delegation.php index e3ae977e2..fc86e9b64 100644 --- a/src/Module/Delegation.php +++ b/src/Module/Delegation.php @@ -24,7 +24,6 @@ namespace Friendica\Module; use Friendica\BaseModule; use Friendica\Core\Hook; use Friendica\Core\Renderer; -use Friendica\Core\Session; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Notification; @@ -97,7 +96,7 @@ class Delegation extends BaseModule return; } - Session::clear(); + DI::session()->clear(); DI::auth()->setForUser(DI::app(), $user, true, true);