diff options
Diffstat (limited to 'lib/private/TemplateLayout.php')
-rw-r--r-- | lib/private/TemplateLayout.php | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 01d22edc0fb..cfc387d2164 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -80,12 +80,6 @@ class TemplateLayout { } else { Util::addScript('core', 'unified-search', 'core'); } - // Set body data-theme - $page->assign('enabledThemes', []); - if ($this->appManager->isEnabledForUser('theming') && class_exists('\OCA\Theming\Service\ThemesService')) { - $themesService = Server::get(\OCA\Theming\Service\ThemesService::class); - $page->assign('enabledThemes', $themesService->getEnabledThemes()); - } // Set logo link target $logoUrl = $this->config->getSystemValueString('logo_url', ''); @@ -149,6 +143,7 @@ class TemplateLayout { if ($user) { $userDisplayName = $user->getDisplayName(); } + $page->assign('user_displayname', $userDisplayName); $page->assign('user_uid', \OC_User::getUser()); break; @@ -157,13 +152,6 @@ class TemplateLayout { $page->assign('appid', $appId); $page->assign('bodyid', 'body-public'); - // Set body data-theme - $page->assign('enabledThemes', []); - if ($this->appManager->isEnabledForUser('theming') && class_exists('\OCA\Theming\Service\ThemesService')) { - $themesService = Server::get(\OCA\Theming\Service\ThemesService::class); - $page->assign('enabledThemes', $themesService->getEnabledThemes()); - } - // Set logo link target $logoUrl = $this->config->getSystemValueString('logo_url', ''); $page->assign('logoUrl', $logoUrl); @@ -203,9 +191,17 @@ class TemplateLayout { $page->assign('locale', $locale); $page->assign('direction', $direction); + // Set body data-theme + try { + $themesService = Server::get(\OCA\Theming\Service\ThemesService::class); + } catch (\Exception) { + $themesService = null; + } + $page->assign('enabledThemes', $themesService?->getEnabledThemes() ?? []); + if ($this->config->getSystemValueBool('installed', false)) { if (empty(self::$versionHash)) { - $v = $this->appManager->getAppInstalledVersions(); + $v = $this->appManager->getAppInstalledVersions(true); $v['core'] = implode('.', $this->serverVersion->getVersion()); self::$versionHash = substr(md5(implode(',', $v)), 0, 8); } @@ -214,8 +210,7 @@ class TemplateLayout { } // Add the js files - // TODO: remove deprecated OC_Util injection - $jsFiles = self::findJavascriptFiles(array_merge(\OC_Util::$scripts, Util::getScripts())); + $jsFiles = self::findJavascriptFiles(Util::getScripts()); $page->assign('jsfiles', []); if ($this->config->getSystemValueBool('installed', false) && $renderAs != TemplateResponse::RENDER_AS_ERROR) { // this is on purpose outside of the if statement below so that the initial state is prefilled (done in the getConfig() call) |