diff --git a/view/theme/duepuntozero/config.php b/view/theme/duepuntozero/config.php index 1a2d231f43..a64f6f5fed 100644 --- a/view/theme/duepuntozero/config.php +++ b/view/theme/duepuntozero/config.php @@ -21,16 +21,15 @@ use Friendica\App; use Friendica\Core\Renderer; -use Friendica\Core\Session; use Friendica\DI; function theme_content(App $a) { - if (!Session::getLocalUser()) { + if (!DI::userSession()->getLocalUserId()) { return; } - $colorset = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset'); + $colorset = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset'); $user = true; return clean_form($a, $colorset, $user); @@ -38,12 +37,12 @@ function theme_content(App $a) function theme_post(App $a) { - if (! Session::getLocalUser()) { + if (!DI::userSession()->getLocalUserId()) { return; } if (isset($_POST['duepuntozero-settings-submit'])) { - DI::pConfig()->set(Session::getLocalUser(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']); } } @@ -76,7 +75,7 @@ function clean_form(App $a, &$colorset, $user) ]; if ($user) { - $color = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset'); + $color = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset'); } else { $color = DI::config()->get('duepuntozero', 'colorset'); } diff --git a/view/theme/duepuntozero/theme.php b/view/theme/duepuntozero/theme.php index 70190eb02c..729c5bb085 100644 --- a/view/theme/duepuntozero/theme.php +++ b/view/theme/duepuntozero/theme.php @@ -21,7 +21,6 @@ use Friendica\App; use Friendica\Core\Renderer; -use Friendica\Core\Session; use Friendica\DI; /* @@ -35,7 +34,7 @@ function duepuntozero_init(App $a) { $colorset = null; if (DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) { - $colorset = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset'); + $colorset = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset'); if (!$colorset) $colorset = DI::config()->get('duepuntozero', 'colorset'); // user setting have priority, then node settings } diff --git a/view/theme/frio/config.php b/view/theme/frio/config.php index 4c7a13542b..04d4188615 100644 --- a/view/theme/frio/config.php +++ b/view/theme/frio/config.php @@ -21,14 +21,13 @@ use Friendica\App; use Friendica\Core\Renderer; -use Friendica\Core\Session; use Friendica\DI; require_once 'view/theme/frio/php/Image.php'; function theme_post(App $a) { - if (!Session::getLocalUser()) { + if (!DI::userSession()->getLocalUserId()) { return; } @@ -48,12 +47,12 @@ function theme_post(App $a) 'always_open_compose', ] as $field) { if (isset($_POST['frio_' . $field])) { - DI::pConfig()->set(Session::getLocalUser(), 'frio', $field, $_POST['frio_' . $field]); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'frio', $field, $_POST['frio_' . $field]); } } - DI::pConfig()->set(Session::getLocalUser(), 'frio', 'css_modified', time()); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'frio', 'css_modified', time()); } } @@ -89,13 +88,13 @@ function theme_admin_post(App $a) function theme_content(): string { - if (!Session::getLocalUser()) { + if (!DI::userSession()->getLocalUserId()) { return ''; } $arr = [ - 'scheme' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'scheme', - DI::pConfig()->get(Session::getLocalUser(), 'frio', 'schema', + 'scheme' => DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'frio', 'scheme', + DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'frio', 'schema', DI::config()->get('frio', 'scheme', DI::config()->get('frio', 'schema') ) @@ -103,15 +102,15 @@ function theme_content(): string ), 'share_string' => '', - 'scheme_accent' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'scheme_accent' , DI::config()->get('frio', 'scheme_accent')), - 'nav_bg' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'nav_bg' , DI::config()->get('frio', 'nav_bg')), - 'nav_icon_color' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'nav_icon_color' , DI::config()->get('frio', 'nav_icon_color')), - 'link_color' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'link_color' , DI::config()->get('frio', 'link_color')), - 'background_color' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'background_color' , DI::config()->get('frio', 'background_color')), - 'contentbg_transp' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'contentbg_transp' , DI::config()->get('frio', 'contentbg_transp')), - 'background_image' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'background_image' , DI::config()->get('frio', 'background_image')), - 'bg_image_option' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'bg_image_option' , DI::config()->get('frio', 'bg_image_option')), - 'always_open_compose' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'always_open_compose', DI::config()->get('frio', 'always_open_compose', false)), + 'scheme_accent' => DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'frio', 'scheme_accent' , DI::config()->get('frio', 'scheme_accent')), + 'nav_bg' => DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'frio', 'nav_bg' , DI::config()->get('frio', 'nav_bg')), + 'nav_icon_color' => DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'frio', 'nav_icon_color' , DI::config()->get('frio', 'nav_icon_color')), + 'link_color' => DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'frio', 'link_color' , DI::config()->get('frio', 'link_color')), + 'background_color' => DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'frio', 'background_color' , DI::config()->get('frio', 'background_color')), + 'contentbg_transp' => DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'frio', 'contentbg_transp' , DI::config()->get('frio', 'contentbg_transp')), + 'background_image' => DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'frio', 'background_image' , DI::config()->get('frio', 'background_image')), + 'bg_image_option' => DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'frio', 'bg_image_option' , DI::config()->get('frio', 'bg_image_option')), + 'always_open_compose' => DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'frio', 'always_open_compose', DI::config()->get('frio', 'always_open_compose', false)), ]; return frio_form($arr); @@ -119,7 +118,7 @@ function theme_content(): string function theme_admin(): string { - if (!Session::getLocalUser()) { + if (!DI::userSession()->getLocalUserId()) { return ''; } diff --git a/view/theme/frio/php/scheme.php b/view/theme/frio/php/scheme.php index 26c3588776..f99b1bff00 100644 --- a/view/theme/frio/php/scheme.php +++ b/view/theme/frio/php/scheme.php @@ -34,7 +34,6 @@ * 'overwrites' => Variables which overwriting custom settings */ -use Friendica\Core\Session; use Friendica\DI; use Friendica\Util\Strings; @@ -43,7 +42,7 @@ function get_scheme_info($scheme) $theme = DI::app()->getCurrentTheme(); $themepath = 'view/theme/' . $theme . '/'; if (empty($scheme)) { - $scheme = DI::pConfig()->get(Session::getLocalUser(), 'frio', 'scheme', DI::pConfig()->get(Session::getLocalUser(), 'frio', 'schema', '---')); + $scheme = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'frio', 'scheme', DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'frio', 'schema', '---')); } $scheme = Strings::sanitizeFilePathItem($scheme); diff --git a/view/theme/frio/theme.php b/view/theme/frio/theme.php index ce1e376e66..c29b1f13d5 100644 --- a/view/theme/frio/theme.php +++ b/view/theme/frio/theme.php @@ -29,7 +29,6 @@ use Friendica\Content\Widget; use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Renderer; -use Friendica\Core\Session; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model; @@ -215,8 +214,8 @@ function frio_remote_nav(App $a, array &$nav_info) $fields = ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl', 'updated']; if ($a->isLoggedIn()) { $remoteUser = Contact::selectFirst($fields, ['uid' => $a->getLoggedInUserId(), 'self' => true]); - } elseif (!Session::getLocalUser() && Session::getRemoteUser()) { - $remoteUser = Contact::getById(Session::getRemoteUser(), $fields); + } elseif (!DI::userSession()->getLocalUserId() && DI::userSession()->getRemoteUserId()) { + $remoteUser = Contact::getById(DI::userSession()->getRemoteUserId(), $fields); $nav_info['nav']['remote'] = DI::l10n()->t('Guest'); } elseif (Profile::getMyURL()) { $remoteUser = Contact::getByURL($homelink, null, $fields); @@ -233,7 +232,7 @@ function frio_remote_nav(App $a, array &$nav_info) $server_url = $remoteUser['baseurl']; } - if (!Session::getLocalUser() && !empty($server_url) && !is_null($remoteUser)) { + if (!DI::userSession()->getLocalUserId() && !empty($server_url) && !is_null($remoteUser)) { // user menu $nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'], DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')]; $nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')]; @@ -257,8 +256,8 @@ function frio_display_item(App $a, &$arr) // Add follow to the item menu $followThread = []; if ( - Session::getLocalUser() - && in_array($arr['item']['uid'], [0, Session::getLocalUser()]) + DI::userSession()->getLocalUserId() + && in_array($arr['item']['uid'], [0, DI::userSession()->getLocalUserId()]) && $arr['item']['gravity'] == Item::GRAVITY_PARENT && !$arr['item']['self'] && !$arr['item']['mention'] diff --git a/view/theme/quattro/config.php b/view/theme/quattro/config.php index 48ef298f98..245f6a2211 100644 --- a/view/theme/quattro/config.php +++ b/view/theme/quattro/config.php @@ -21,32 +21,31 @@ use Friendica\App; use Friendica\Core\Renderer; -use Friendica\Core\Session; use Friendica\DI; function theme_content(App $a) { - if (!Session::getLocalUser()) { + if (!DI::userSession()->getLocalUserId()) { return; } - $align = DI::pConfig()->get(Session::getLocalUser(), 'quattro', 'align' ); - $color = DI::pConfig()->get(Session::getLocalUser(), 'quattro', 'color' ); - $tfs = DI::pConfig()->get(Session::getLocalUser(),"quattro","tfs"); - $pfs = DI::pConfig()->get(Session::getLocalUser(),"quattro","pfs"); + $align = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'quattro', 'align' ); + $color = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'quattro', 'color' ); + $tfs = DI::pConfig()->get(DI::userSession()->getLocalUserId(),"quattro","tfs"); + $pfs = DI::pConfig()->get(DI::userSession()->getLocalUserId(),"quattro","pfs"); return quattro_form($a,$align, $color, $tfs, $pfs); } function theme_post(App $a) { - if (! Session::getLocalUser()) { + if (! DI::userSession()->getLocalUserId()) { return; } if (isset($_POST['quattro-settings-submit'])){ - DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'align', $_POST['quattro_align']); - DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'color', $_POST['quattro_color']); - DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'tfs', $_POST['quattro_tfs']); - DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'pfs', $_POST['quattro_pfs']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'quattro', 'align', $_POST['quattro_align']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'quattro', 'color', $_POST['quattro_color']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'quattro', 'tfs', $_POST['quattro_tfs']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'quattro', 'pfs', $_POST['quattro_pfs']); } } diff --git a/view/theme/vier/config.php b/view/theme/vier/config.php index 28aebf9700..f20a5afea0 100644 --- a/view/theme/vier/config.php +++ b/view/theme/vier/config.php @@ -21,14 +21,13 @@ use Friendica\App; use Friendica\Core\Renderer; -use Friendica\Core\Session; use Friendica\DI; require_once __DIR__ . '/theme.php'; function theme_content(App $a) { - if (!Session::getLocalUser()) { + if (!DI::userSession()->getLocalUserId()) { return; } @@ -36,7 +35,7 @@ function theme_content(App $a) return; } - $style = DI::pConfig()->get(Session::getLocalUser(), 'vier', 'style'); + $style = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'vier', 'style'); if ($style == "") { $style = DI::config()->get('vier', 'style'); @@ -59,18 +58,18 @@ function theme_content(App $a) function theme_post(App $a) { - if (! Session::getLocalUser()) { + if (! DI::userSession()->getLocalUserId()) { return; } if (isset($_POST['vier-settings-submit'])) { - DI::pConfig()->set(Session::getLocalUser(), 'vier', 'style', $_POST['vier_style']); - DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_pages', $_POST['vier_show_pages']); - DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_profiles', $_POST['vier_show_profiles']); - DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_helpers', $_POST['vier_show_helpers']); - DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_services', $_POST['vier_show_services']); - DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_friends', $_POST['vier_show_friends']); - DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_lastusers', $_POST['vier_show_lastusers']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'vier', 'style', $_POST['vier_style']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'vier', 'show_pages', $_POST['vier_show_pages']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'vier', 'show_profiles', $_POST['vier_show_profiles']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'vier', 'show_helpers', $_POST['vier_show_helpers']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'vier', 'show_services', $_POST['vier_show_services']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'vier', 'show_friends', $_POST['vier_show_friends']); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'vier', 'show_lastusers', $_POST['vier_show_lastusers']); } } diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php index ec82cf428d..2d313cb29e 100644 --- a/view/theme/vier/theme.php +++ b/view/theme/vier/theme.php @@ -31,7 +31,6 @@ use Friendica\Content\ForumManager; use Friendica\Core\Addon; use Friendica\Core\Renderer; use Friendica\Core\Search; -use Friendica\Core\Session; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; @@ -53,7 +52,7 @@ function vier_init(App $a) DI::mode()->has(App\Mode::MAINTENANCEDISABLED) && ( $args->get(0) === 'profile' && $args->get(1) === ($a->getLoggedInUserNickname() ?? '') - || $args->get(0) === 'network' && Session::getLocalUser() + || $args->get(0) === 'network' && DI::userSession()->getLocalUserId() ) ) { vier_community_info(); @@ -115,8 +114,8 @@ EOT; function get_vier_config($key, $default = false, $admin = false) { - if (Session::getLocalUser() && !$admin) { - $result = DI::pConfig()->get(Session::getLocalUser(), "vier", $key); + if (DI::userSession()->getLocalUserId() && !$admin) { + $result = DI::pConfig()->get(DI::userSession()->getLocalUserId(), "vier", $key); if (!is_null($result)) { return $result; } @@ -145,7 +144,7 @@ function vier_community_info() // comunity_profiles if ($show_profiles) { - $contacts = Contact\Relation::getSuggestions(Session::getLocalUser(), 0, 9); + $contacts = Contact\Relation::getSuggestions(DI::userSession()->getLocalUserId(), 0, 9); $tpl = Renderer::getMarkupTemplate('ch_directory_item.tpl'); if (DBA::isResult($contacts)) { @@ -192,7 +191,7 @@ function vier_community_info() } //right_aside FIND FRIENDS - if ($show_friends && Session::getLocalUser()) { + if ($show_friends && DI::userSession()->getLocalUserId()) { $nv = []; $nv['findpeople'] = DI::l10n()->t('Find People'); $nv['desc'] = DI::l10n()->t('Enter name or interest'); @@ -211,8 +210,8 @@ function vier_community_info() } //Community_Pages at right_aside - if ($show_pages && Session::getLocalUser()) { - $aside['$page'] = ForumManager::widget('network/forum', Session::getLocalUser());; + if ($show_pages && DI::userSession()->getLocalUserId()) { + $aside['$page'] = ForumManager::widget('network/forum', DI::userSession()->getLocalUserId());; } // END Community Page