@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * @var array $_ |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -$getUserAvatar = static function (int $size) use ($_): string { |
|
| 7 | +$getUserAvatar = static function(int $size) use ($_): string { |
|
| 8 | 8 | return \OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', [ |
| 9 | 9 | 'userId' => $_['user_uid'], |
| 10 | 10 | 'size' => $size, |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | <meta charset="utf-8"> |
| 19 | 19 | <title> |
| 20 | 20 | <?php |
| 21 | - p(!empty($_['application'])?$_['application'].' - ':''); |
|
| 21 | + p(!empty($_['application']) ? $_['application'].' - ' : ''); |
|
| 22 | 22 | p($theme->getTitle()); |
| 23 | 23 | ?> |
| 24 | 24 | </title> |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | <?php } ?> |
| 29 | 29 | <meta name="apple-mobile-web-app-capable" content="yes"> |
| 30 | 30 | <meta name="apple-mobile-web-app-status-bar-style" content="black"> |
| 31 | - <meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid'] != 'files')? $_['application']:$theme->getTitle()); ?>"> |
|
| 31 | + <meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid'] != 'files') ? $_['application'] : $theme->getTitle()); ?>"> |
|
| 32 | 32 | <meta name="mobile-web-app-capable" content="yes"> |
| 33 | 33 | <meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>"> |
| 34 | 34 | <link rel="icon" href="<?php print_unescaped(image_path($_['appid'], 'favicon.ico')); /* IE11+ supports png */ ?>"> |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | <?php emit_script_loading_tags($_); ?> |
| 41 | 41 | <?php print_unescaped($_['headers']); ?> |
| 42 | 42 | </head> |
| 43 | - <body id="<?php p($_['bodyid']);?>" <?php foreach ($_['enabledThemes'] as $themeId) { |
|
| 43 | + <body id="<?php p($_['bodyid']); ?>" <?php foreach ($_['enabledThemes'] as $themeId) { |
|
| 44 | 44 | p("data-theme-$themeId "); |
| 45 | 45 | }?> data-themes=<?php p(join(',', $_['enabledThemes'])) ?>> |
| 46 | 46 | <?php include 'layout.noscript.warning.php'; ?> |
@@ -74,14 +74,14 @@ discard block |
||
| 74 | 74 | <div id="contactsmenu"> |
| 75 | 75 | <div class="menutoggle" tabindex="0" role="button" |
| 76 | 76 | aria-haspopup="true" aria-controls="contactsmenu-menu" aria-expanded="false"> |
| 77 | - <span class="hidden-visually"><?php p($l->t('Contacts'));?></span> |
|
| 77 | + <span class="hidden-visually"><?php p($l->t('Contacts')); ?></span> |
|
| 78 | 78 | </div> |
| 79 | 79 | <div id="contactsmenu-menu" class="menu" |
| 80 | - aria-label="<?php p($l->t('Contacts menu'));?>"></div> |
|
| 80 | + aria-label="<?php p($l->t('Contacts menu')); ?>"></div> |
|
| 81 | 81 | </div> |
| 82 | 82 | <div id="settings"> |
| 83 | 83 | <div id="expand" tabindex="0" role="button" class="menutoggle" |
| 84 | - aria-label="<?php p($l->t('Open settings menu'));?>" |
|
| 84 | + aria-label="<?php p($l->t('Open settings menu')); ?>" |
|
| 85 | 85 | aria-haspopup="true" aria-controls="expanddiv" aria-expanded="false"> |
| 86 | 86 | <div id="avatardiv-menu" class="avatardiv<?php if ($_['userAvatarSet']) { |
| 87 | 87 | print_unescaped(' avatardiv-shown'); |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | <?php |
| 99 | 99 | if ($_['userAvatarSet']) {?> |
| 100 | 100 | <img alt="" width="32" height="32" |
| 101 | - src="<?php p($avatar32);?>" |
|
| 102 | - srcset="<?php p($getUserAvatar(64));?> 2x, <?php p($getUserAvatar(128));?> 4x" |
|
| 101 | + src="<?php p($avatar32); ?>" |
|
| 102 | + srcset="<?php p($getUserAvatar(64)); ?> 2x, <?php p($getUserAvatar(128)); ?> 4x" |
|
| 103 | 103 | > |
| 104 | 104 | <?php } ?> |
| 105 | 105 | </div> |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | <li data-id="<?php p($entry['id']); ?>"> |
| 111 | 111 | <a href="<?php print_unescaped($entry['href'] !== '' ? $entry['href'] : '#'); ?>" |
| 112 | 112 | <?php if ($entry["active"]): ?> class="active"<?php endif; ?>> |
| 113 | - <img alt="" src="<?php print_unescaped($entry['icon'] . '?v=' . $_['versionHash']); ?>"> |
|
| 113 | + <img alt="" src="<?php print_unescaped($entry['icon'].'?v='.$_['versionHash']); ?>"> |
|
| 114 | 114 | <?php p($entry['name']) ?> |
| 115 | 115 | </a> |
| 116 | 116 | </li> |
@@ -57,341 +57,341 @@ |
||
| 57 | 57 | use Psr\Log\LoggerInterface; |
| 58 | 58 | |
| 59 | 59 | class TemplateLayout extends \OC_Template { |
| 60 | - private static $versionHash = ''; |
|
| 61 | - |
|
| 62 | - /** @var IConfig */ |
|
| 63 | - private $config; |
|
| 64 | - |
|
| 65 | - /** @var IInitialStateService */ |
|
| 66 | - private $initialState; |
|
| 67 | - |
|
| 68 | - /** @var INavigationManager */ |
|
| 69 | - private $navigationManager; |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * @param string $renderAs |
|
| 73 | - * @param string $appId application id |
|
| 74 | - */ |
|
| 75 | - public function __construct($renderAs, $appId = '') { |
|
| 76 | - |
|
| 77 | - /** @var IConfig */ |
|
| 78 | - $this->config = \OC::$server->get(IConfig::class); |
|
| 79 | - |
|
| 80 | - /** @var IInitialStateService */ |
|
| 81 | - $this->initialState = \OC::$server->get(IInitialStateService::class); |
|
| 82 | - |
|
| 83 | - // Add fallback theming variables if theming is disabled |
|
| 84 | - if ($renderAs !== TemplateResponse::RENDER_AS_USER |
|
| 85 | - || !\OC::$server->getAppManager()->isEnabledForUser('theming')) { |
|
| 86 | - // TODO cache generated default theme if enabled for fallback if server is erroring ? |
|
| 87 | - Util::addStyle('theming', 'default'); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - // Decide which page we show |
|
| 91 | - if ($renderAs === TemplateResponse::RENDER_AS_USER) { |
|
| 92 | - /** @var INavigationManager */ |
|
| 93 | - $this->navigationManager = \OC::$server->get(INavigationManager::class); |
|
| 94 | - |
|
| 95 | - parent::__construct('core', 'layout.user'); |
|
| 96 | - if (in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) { |
|
| 97 | - $this->assign('bodyid', 'body-settings'); |
|
| 98 | - } else { |
|
| 99 | - $this->assign('bodyid', 'body-user'); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - $this->initialState->provideInitialState('core', 'active-app', $this->navigationManager->getActiveEntry()); |
|
| 103 | - $this->initialState->provideInitialState('core', 'apps', $this->navigationManager->getAll()); |
|
| 104 | - $this->initialState->provideInitialState('unified-search', 'limit-default', (int)$this->config->getAppValue('core', 'unified-search.limit-default', (string)SearchQuery::LIMIT_DEFAULT)); |
|
| 105 | - $this->initialState->provideInitialState('unified-search', 'min-search-length', (int)$this->config->getAppValue('core', 'unified-search.min-search-length', (string)2)); |
|
| 106 | - $this->initialState->provideInitialState('unified-search', 'live-search', $this->config->getAppValue('core', 'unified-search.live-search', 'yes') === 'yes'); |
|
| 107 | - Util::addScript('core', 'unified-search', 'core'); |
|
| 108 | - |
|
| 109 | - // Set body data-theme |
|
| 110 | - $this->assign('enabledThemes', []); |
|
| 111 | - if (\OC::$server->getAppManager()->isEnabledForUser('theming') && class_exists('\OCA\Theming\Service\ThemesService')) { |
|
| 112 | - /** @var \OCA\Theming\Service\ThemesService */ |
|
| 113 | - $themesService = \OC::$server->get(\OCA\Theming\Service\ThemesService::class); |
|
| 114 | - $this->assign('enabledThemes', $themesService->getEnabledThemes()); |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - // set logo link target |
|
| 118 | - $logoUrl = $this->config->getSystemValueString('logo_url', ''); |
|
| 119 | - $this->assign('logoUrl', $logoUrl); |
|
| 120 | - |
|
| 121 | - // Add navigation entry |
|
| 122 | - $this->assign('application', ''); |
|
| 123 | - $this->assign('appid', $appId); |
|
| 124 | - |
|
| 125 | - $navigation = $this->navigationManager->getAll(); |
|
| 126 | - $this->assign('navigation', $navigation); |
|
| 127 | - $settingsNavigation = $this->navigationManager->getAll('settings'); |
|
| 128 | - $this->assign('settingsnavigation', $settingsNavigation); |
|
| 129 | - |
|
| 130 | - foreach ($navigation as $entry) { |
|
| 131 | - if ($entry['active']) { |
|
| 132 | - $this->assign('application', $entry['name']); |
|
| 133 | - break; |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - foreach ($settingsNavigation as $entry) { |
|
| 138 | - if ($entry['active']) { |
|
| 139 | - $this->assign('application', $entry['name']); |
|
| 140 | - break; |
|
| 141 | - } |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - $userDisplayName = false; |
|
| 145 | - $user = \OC::$server->get(IUserSession::class)->getUser(); |
|
| 146 | - if ($user) { |
|
| 147 | - $userDisplayName = $user->getDisplayName(); |
|
| 148 | - } |
|
| 149 | - $this->assign('user_displayname', $userDisplayName); |
|
| 150 | - $this->assign('user_uid', \OC_User::getUser()); |
|
| 151 | - |
|
| 152 | - if ($user === null) { |
|
| 153 | - $this->assign('userAvatarSet', false); |
|
| 154 | - $this->assign('userStatus', false); |
|
| 155 | - } else { |
|
| 156 | - $this->assign('userAvatarSet', true); |
|
| 157 | - $this->assign('userAvatarVersion', $this->config->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0)); |
|
| 158 | - } |
|
| 159 | - } elseif ($renderAs === TemplateResponse::RENDER_AS_ERROR) { |
|
| 160 | - parent::__construct('core', 'layout.guest', '', false); |
|
| 161 | - $this->assign('bodyid', 'body-login'); |
|
| 162 | - $this->assign('user_displayname', ''); |
|
| 163 | - $this->assign('user_uid', ''); |
|
| 164 | - } elseif ($renderAs === TemplateResponse::RENDER_AS_GUEST) { |
|
| 165 | - parent::__construct('core', 'layout.guest'); |
|
| 166 | - \OC_Util::addStyle('guest'); |
|
| 167 | - $this->assign('bodyid', 'body-login'); |
|
| 168 | - |
|
| 169 | - $userDisplayName = false; |
|
| 170 | - $user = \OC::$server->get(IUserSession::class)->getUser(); |
|
| 171 | - if ($user) { |
|
| 172 | - $userDisplayName = $user->getDisplayName(); |
|
| 173 | - } |
|
| 174 | - $this->assign('user_displayname', $userDisplayName); |
|
| 175 | - $this->assign('user_uid', \OC_User::getUser()); |
|
| 176 | - } elseif ($renderAs === TemplateResponse::RENDER_AS_PUBLIC) { |
|
| 177 | - parent::__construct('core', 'layout.public'); |
|
| 178 | - $this->assign('appid', $appId); |
|
| 179 | - $this->assign('bodyid', 'body-public'); |
|
| 180 | - |
|
| 181 | - /** @var IRegistry $subscription */ |
|
| 182 | - $subscription = \OC::$server->query(IRegistry::class); |
|
| 183 | - $showSimpleSignup = $this->config->getSystemValueBool('simpleSignUpLink.shown', true); |
|
| 184 | - if ($showSimpleSignup && $subscription->delegateHasValidSubscription()) { |
|
| 185 | - $showSimpleSignup = false; |
|
| 186 | - } |
|
| 187 | - $this->assign('showSimpleSignUpLink', $showSimpleSignup); |
|
| 188 | - } else { |
|
| 189 | - parent::__construct('core', 'layout.base'); |
|
| 190 | - } |
|
| 191 | - // Send the language and the locale to our layouts |
|
| 192 | - $lang = \OC::$server->getL10NFactory()->findLanguage(); |
|
| 193 | - $locale = \OC::$server->getL10NFactory()->findLocale($lang); |
|
| 194 | - |
|
| 195 | - $lang = str_replace('_', '-', $lang); |
|
| 196 | - $this->assign('language', $lang); |
|
| 197 | - $this->assign('locale', $locale); |
|
| 198 | - |
|
| 199 | - if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
| 200 | - if (empty(self::$versionHash)) { |
|
| 201 | - $v = \OC_App::getAppVersions(); |
|
| 202 | - $v['core'] = implode('.', \OCP\Util::getVersion()); |
|
| 203 | - self::$versionHash = substr(md5(implode(',', $v)), 0, 8); |
|
| 204 | - } |
|
| 205 | - } else { |
|
| 206 | - self::$versionHash = md5('not installed'); |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - // Add the js files |
|
| 210 | - // TODO: remove deprecated OC_Util injection |
|
| 211 | - $jsFiles = self::findJavascriptFiles(array_merge(\OC_Util::$scripts, Util::getScripts())); |
|
| 212 | - $this->assign('jsfiles', []); |
|
| 213 | - if ($this->config->getSystemValue('installed', false) && $renderAs != TemplateResponse::RENDER_AS_ERROR) { |
|
| 214 | - // this is on purpose outside of the if statement below so that the initial state is prefilled (done in the getConfig() call) |
|
| 215 | - // see https://github.com/nextcloud/server/pull/22636 for details |
|
| 216 | - $jsConfigHelper = new JSConfigHelper( |
|
| 217 | - \OC::$server->getL10N('lib'), |
|
| 218 | - \OC::$server->query(Defaults::class), |
|
| 219 | - \OC::$server->getAppManager(), |
|
| 220 | - \OC::$server->getSession(), |
|
| 221 | - \OC::$server->getUserSession()->getUser(), |
|
| 222 | - $this->config, |
|
| 223 | - \OC::$server->getGroupManager(), |
|
| 224 | - \OC::$server->get(IniGetWrapper::class), |
|
| 225 | - \OC::$server->getURLGenerator(), |
|
| 226 | - \OC::$server->getCapabilitiesManager(), |
|
| 227 | - \OC::$server->query(IInitialStateService::class) |
|
| 228 | - ); |
|
| 229 | - $config = $jsConfigHelper->getConfig(); |
|
| 230 | - if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) { |
|
| 231 | - $this->assign('inline_ocjs', $config); |
|
| 232 | - } else { |
|
| 233 | - $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash])); |
|
| 234 | - } |
|
| 235 | - } |
|
| 236 | - foreach ($jsFiles as $info) { |
|
| 237 | - $web = $info[1]; |
|
| 238 | - $file = $info[2]; |
|
| 239 | - $this->append('jsfiles', $web.'/'.$file . $this->getVersionHashSuffix()); |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - try { |
|
| 243 | - $pathInfo = \OC::$server->getRequest()->getPathInfo(); |
|
| 244 | - } catch (\Exception $e) { |
|
| 245 | - $pathInfo = ''; |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - // Do not initialise scss appdata until we have a fully installed instance |
|
| 249 | - // Do not load scss for update, errors, installation or login page |
|
| 250 | - if (\OC::$server->getSystemConfig()->getValue('installed', false) |
|
| 251 | - && !\OCP\Util::needUpgrade() |
|
| 252 | - && $pathInfo !== '' |
|
| 253 | - && !preg_match('/^\/login/', $pathInfo) |
|
| 254 | - && $renderAs !== TemplateResponse::RENDER_AS_ERROR |
|
| 255 | - ) { |
|
| 256 | - $cssFiles = self::findStylesheetFiles(\OC_Util::$styles); |
|
| 257 | - } else { |
|
| 258 | - // If we ignore the scss compiler, |
|
| 259 | - // we need to load the guest css fallback |
|
| 260 | - \OC_Util::addStyle('guest'); |
|
| 261 | - $cssFiles = self::findStylesheetFiles(\OC_Util::$styles, false); |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - $this->assign('cssfiles', []); |
|
| 265 | - $this->assign('printcssfiles', []); |
|
| 266 | - $this->assign('versionHash', self::$versionHash); |
|
| 267 | - foreach ($cssFiles as $info) { |
|
| 268 | - $web = $info[1]; |
|
| 269 | - $file = $info[2]; |
|
| 270 | - |
|
| 271 | - if (substr($file, -strlen('print.css')) === 'print.css') { |
|
| 272 | - $this->append('printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix()); |
|
| 273 | - } else { |
|
| 274 | - $suffix = $this->getVersionHashSuffix($web, $file); |
|
| 275 | - |
|
| 276 | - if (strpos($file, '?v=') == false) { |
|
| 277 | - $this->append('cssfiles', $web.'/'.$file . $suffix); |
|
| 278 | - } else { |
|
| 279 | - $this->append('cssfiles', $web.'/'.$file . '-' . substr($suffix, 3)); |
|
| 280 | - } |
|
| 281 | - } |
|
| 282 | - } |
|
| 283 | - |
|
| 284 | - $this->assign('initialStates', $this->initialState->getInitialStates()); |
|
| 285 | - |
|
| 286 | - $this->assign('id-app-content', $renderAs === TemplateResponse::RENDER_AS_USER ? '#app-content' : '#content'); |
|
| 287 | - $this->assign('id-app-navigation', $renderAs === TemplateResponse::RENDER_AS_USER ? '#app-navigation' : null); |
|
| 288 | - } |
|
| 289 | - |
|
| 290 | - /** |
|
| 291 | - * @param string $path |
|
| 292 | - * @param string $file |
|
| 293 | - * @return string |
|
| 294 | - */ |
|
| 295 | - protected function getVersionHashSuffix($path = false, $file = false) { |
|
| 296 | - if ($this->config->getSystemValue('debug', false)) { |
|
| 297 | - // allows chrome workspace mapping in debug mode |
|
| 298 | - return ""; |
|
| 299 | - } |
|
| 300 | - $themingSuffix = ''; |
|
| 301 | - $v = []; |
|
| 302 | - |
|
| 303 | - if ($this->config->getSystemValue('installed', false)) { |
|
| 304 | - if (\OC::$server->getAppManager()->isInstalled('theming')) { |
|
| 305 | - $themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 306 | - } |
|
| 307 | - $v = \OC_App::getAppVersions(); |
|
| 308 | - } |
|
| 309 | - |
|
| 310 | - // Try the webroot path for a match |
|
| 311 | - if ($path !== false && $path !== '') { |
|
| 312 | - $appName = $this->getAppNamefromPath($path); |
|
| 313 | - if (array_key_exists($appName, $v)) { |
|
| 314 | - $appVersion = $v[$appName]; |
|
| 315 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
| 316 | - } |
|
| 317 | - } |
|
| 318 | - // fallback to the file path instead |
|
| 319 | - if ($file !== false && $file !== '') { |
|
| 320 | - $appName = $this->getAppNamefromPath($file); |
|
| 321 | - if (array_key_exists($appName, $v)) { |
|
| 322 | - $appVersion = $v[$appName]; |
|
| 323 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
| 324 | - } |
|
| 325 | - } |
|
| 326 | - |
|
| 327 | - return '?v=' . self::$versionHash . $themingSuffix; |
|
| 328 | - } |
|
| 329 | - |
|
| 330 | - /** |
|
| 331 | - * @param array $styles |
|
| 332 | - * @return array |
|
| 333 | - */ |
|
| 334 | - public static function findStylesheetFiles($styles, $compileScss = true) { |
|
| 335 | - // Read the selected theme from the config file |
|
| 336 | - $theme = \OC_Util::getTheme(); |
|
| 337 | - |
|
| 338 | - $locator = new \OC\Template\CSSResourceLocator( |
|
| 339 | - \OC::$server->get(LoggerInterface::class), |
|
| 340 | - $theme, |
|
| 341 | - [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
| 342 | - [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
| 343 | - ); |
|
| 344 | - $locator->find($styles); |
|
| 345 | - return $locator->getResources(); |
|
| 346 | - } |
|
| 347 | - |
|
| 348 | - /** |
|
| 349 | - * @param string $path |
|
| 350 | - * @return string|boolean |
|
| 351 | - */ |
|
| 352 | - public function getAppNamefromPath($path) { |
|
| 353 | - if ($path !== '' && is_string($path)) { |
|
| 354 | - $pathParts = explode('/', $path); |
|
| 355 | - if ($pathParts[0] === 'css') { |
|
| 356 | - // This is a scss request |
|
| 357 | - return $pathParts[1]; |
|
| 358 | - } |
|
| 359 | - return end($pathParts); |
|
| 360 | - } |
|
| 361 | - return false; |
|
| 362 | - } |
|
| 363 | - |
|
| 364 | - /** |
|
| 365 | - * @param array $scripts |
|
| 366 | - * @return array |
|
| 367 | - */ |
|
| 368 | - public static function findJavascriptFiles($scripts) { |
|
| 369 | - // Read the selected theme from the config file |
|
| 370 | - $theme = \OC_Util::getTheme(); |
|
| 371 | - |
|
| 372 | - $locator = new \OC\Template\JSResourceLocator( |
|
| 373 | - \OC::$server->get(LoggerInterface::class), |
|
| 374 | - $theme, |
|
| 375 | - [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
| 376 | - [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
| 377 | - \OC::$server->query(JSCombiner::class) |
|
| 378 | - ); |
|
| 379 | - $locator->find($scripts); |
|
| 380 | - return $locator->getResources(); |
|
| 381 | - } |
|
| 382 | - |
|
| 383 | - /** |
|
| 384 | - * Converts the absolute file path to a relative path from \OC::$SERVERROOT |
|
| 385 | - * @param string $filePath Absolute path |
|
| 386 | - * @return string Relative path |
|
| 387 | - * @throws \Exception If $filePath is not under \OC::$SERVERROOT |
|
| 388 | - */ |
|
| 389 | - public static function convertToRelativePath($filePath) { |
|
| 390 | - $relativePath = explode(\OC::$SERVERROOT, $filePath); |
|
| 391 | - if (count($relativePath) !== 2) { |
|
| 392 | - throw new \Exception('$filePath is not under the \OC::$SERVERROOT'); |
|
| 393 | - } |
|
| 394 | - |
|
| 395 | - return $relativePath[1]; |
|
| 396 | - } |
|
| 60 | + private static $versionHash = ''; |
|
| 61 | + |
|
| 62 | + /** @var IConfig */ |
|
| 63 | + private $config; |
|
| 64 | + |
|
| 65 | + /** @var IInitialStateService */ |
|
| 66 | + private $initialState; |
|
| 67 | + |
|
| 68 | + /** @var INavigationManager */ |
|
| 69 | + private $navigationManager; |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * @param string $renderAs |
|
| 73 | + * @param string $appId application id |
|
| 74 | + */ |
|
| 75 | + public function __construct($renderAs, $appId = '') { |
|
| 76 | + |
|
| 77 | + /** @var IConfig */ |
|
| 78 | + $this->config = \OC::$server->get(IConfig::class); |
|
| 79 | + |
|
| 80 | + /** @var IInitialStateService */ |
|
| 81 | + $this->initialState = \OC::$server->get(IInitialStateService::class); |
|
| 82 | + |
|
| 83 | + // Add fallback theming variables if theming is disabled |
|
| 84 | + if ($renderAs !== TemplateResponse::RENDER_AS_USER |
|
| 85 | + || !\OC::$server->getAppManager()->isEnabledForUser('theming')) { |
|
| 86 | + // TODO cache generated default theme if enabled for fallback if server is erroring ? |
|
| 87 | + Util::addStyle('theming', 'default'); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + // Decide which page we show |
|
| 91 | + if ($renderAs === TemplateResponse::RENDER_AS_USER) { |
|
| 92 | + /** @var INavigationManager */ |
|
| 93 | + $this->navigationManager = \OC::$server->get(INavigationManager::class); |
|
| 94 | + |
|
| 95 | + parent::__construct('core', 'layout.user'); |
|
| 96 | + if (in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) { |
|
| 97 | + $this->assign('bodyid', 'body-settings'); |
|
| 98 | + } else { |
|
| 99 | + $this->assign('bodyid', 'body-user'); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + $this->initialState->provideInitialState('core', 'active-app', $this->navigationManager->getActiveEntry()); |
|
| 103 | + $this->initialState->provideInitialState('core', 'apps', $this->navigationManager->getAll()); |
|
| 104 | + $this->initialState->provideInitialState('unified-search', 'limit-default', (int)$this->config->getAppValue('core', 'unified-search.limit-default', (string)SearchQuery::LIMIT_DEFAULT)); |
|
| 105 | + $this->initialState->provideInitialState('unified-search', 'min-search-length', (int)$this->config->getAppValue('core', 'unified-search.min-search-length', (string)2)); |
|
| 106 | + $this->initialState->provideInitialState('unified-search', 'live-search', $this->config->getAppValue('core', 'unified-search.live-search', 'yes') === 'yes'); |
|
| 107 | + Util::addScript('core', 'unified-search', 'core'); |
|
| 108 | + |
|
| 109 | + // Set body data-theme |
|
| 110 | + $this->assign('enabledThemes', []); |
|
| 111 | + if (\OC::$server->getAppManager()->isEnabledForUser('theming') && class_exists('\OCA\Theming\Service\ThemesService')) { |
|
| 112 | + /** @var \OCA\Theming\Service\ThemesService */ |
|
| 113 | + $themesService = \OC::$server->get(\OCA\Theming\Service\ThemesService::class); |
|
| 114 | + $this->assign('enabledThemes', $themesService->getEnabledThemes()); |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + // set logo link target |
|
| 118 | + $logoUrl = $this->config->getSystemValueString('logo_url', ''); |
|
| 119 | + $this->assign('logoUrl', $logoUrl); |
|
| 120 | + |
|
| 121 | + // Add navigation entry |
|
| 122 | + $this->assign('application', ''); |
|
| 123 | + $this->assign('appid', $appId); |
|
| 124 | + |
|
| 125 | + $navigation = $this->navigationManager->getAll(); |
|
| 126 | + $this->assign('navigation', $navigation); |
|
| 127 | + $settingsNavigation = $this->navigationManager->getAll('settings'); |
|
| 128 | + $this->assign('settingsnavigation', $settingsNavigation); |
|
| 129 | + |
|
| 130 | + foreach ($navigation as $entry) { |
|
| 131 | + if ($entry['active']) { |
|
| 132 | + $this->assign('application', $entry['name']); |
|
| 133 | + break; |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + foreach ($settingsNavigation as $entry) { |
|
| 138 | + if ($entry['active']) { |
|
| 139 | + $this->assign('application', $entry['name']); |
|
| 140 | + break; |
|
| 141 | + } |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + $userDisplayName = false; |
|
| 145 | + $user = \OC::$server->get(IUserSession::class)->getUser(); |
|
| 146 | + if ($user) { |
|
| 147 | + $userDisplayName = $user->getDisplayName(); |
|
| 148 | + } |
|
| 149 | + $this->assign('user_displayname', $userDisplayName); |
|
| 150 | + $this->assign('user_uid', \OC_User::getUser()); |
|
| 151 | + |
|
| 152 | + if ($user === null) { |
|
| 153 | + $this->assign('userAvatarSet', false); |
|
| 154 | + $this->assign('userStatus', false); |
|
| 155 | + } else { |
|
| 156 | + $this->assign('userAvatarSet', true); |
|
| 157 | + $this->assign('userAvatarVersion', $this->config->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0)); |
|
| 158 | + } |
|
| 159 | + } elseif ($renderAs === TemplateResponse::RENDER_AS_ERROR) { |
|
| 160 | + parent::__construct('core', 'layout.guest', '', false); |
|
| 161 | + $this->assign('bodyid', 'body-login'); |
|
| 162 | + $this->assign('user_displayname', ''); |
|
| 163 | + $this->assign('user_uid', ''); |
|
| 164 | + } elseif ($renderAs === TemplateResponse::RENDER_AS_GUEST) { |
|
| 165 | + parent::__construct('core', 'layout.guest'); |
|
| 166 | + \OC_Util::addStyle('guest'); |
|
| 167 | + $this->assign('bodyid', 'body-login'); |
|
| 168 | + |
|
| 169 | + $userDisplayName = false; |
|
| 170 | + $user = \OC::$server->get(IUserSession::class)->getUser(); |
|
| 171 | + if ($user) { |
|
| 172 | + $userDisplayName = $user->getDisplayName(); |
|
| 173 | + } |
|
| 174 | + $this->assign('user_displayname', $userDisplayName); |
|
| 175 | + $this->assign('user_uid', \OC_User::getUser()); |
|
| 176 | + } elseif ($renderAs === TemplateResponse::RENDER_AS_PUBLIC) { |
|
| 177 | + parent::__construct('core', 'layout.public'); |
|
| 178 | + $this->assign('appid', $appId); |
|
| 179 | + $this->assign('bodyid', 'body-public'); |
|
| 180 | + |
|
| 181 | + /** @var IRegistry $subscription */ |
|
| 182 | + $subscription = \OC::$server->query(IRegistry::class); |
|
| 183 | + $showSimpleSignup = $this->config->getSystemValueBool('simpleSignUpLink.shown', true); |
|
| 184 | + if ($showSimpleSignup && $subscription->delegateHasValidSubscription()) { |
|
| 185 | + $showSimpleSignup = false; |
|
| 186 | + } |
|
| 187 | + $this->assign('showSimpleSignUpLink', $showSimpleSignup); |
|
| 188 | + } else { |
|
| 189 | + parent::__construct('core', 'layout.base'); |
|
| 190 | + } |
|
| 191 | + // Send the language and the locale to our layouts |
|
| 192 | + $lang = \OC::$server->getL10NFactory()->findLanguage(); |
|
| 193 | + $locale = \OC::$server->getL10NFactory()->findLocale($lang); |
|
| 194 | + |
|
| 195 | + $lang = str_replace('_', '-', $lang); |
|
| 196 | + $this->assign('language', $lang); |
|
| 197 | + $this->assign('locale', $locale); |
|
| 198 | + |
|
| 199 | + if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
| 200 | + if (empty(self::$versionHash)) { |
|
| 201 | + $v = \OC_App::getAppVersions(); |
|
| 202 | + $v['core'] = implode('.', \OCP\Util::getVersion()); |
|
| 203 | + self::$versionHash = substr(md5(implode(',', $v)), 0, 8); |
|
| 204 | + } |
|
| 205 | + } else { |
|
| 206 | + self::$versionHash = md5('not installed'); |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + // Add the js files |
|
| 210 | + // TODO: remove deprecated OC_Util injection |
|
| 211 | + $jsFiles = self::findJavascriptFiles(array_merge(\OC_Util::$scripts, Util::getScripts())); |
|
| 212 | + $this->assign('jsfiles', []); |
|
| 213 | + if ($this->config->getSystemValue('installed', false) && $renderAs != TemplateResponse::RENDER_AS_ERROR) { |
|
| 214 | + // this is on purpose outside of the if statement below so that the initial state is prefilled (done in the getConfig() call) |
|
| 215 | + // see https://github.com/nextcloud/server/pull/22636 for details |
|
| 216 | + $jsConfigHelper = new JSConfigHelper( |
|
| 217 | + \OC::$server->getL10N('lib'), |
|
| 218 | + \OC::$server->query(Defaults::class), |
|
| 219 | + \OC::$server->getAppManager(), |
|
| 220 | + \OC::$server->getSession(), |
|
| 221 | + \OC::$server->getUserSession()->getUser(), |
|
| 222 | + $this->config, |
|
| 223 | + \OC::$server->getGroupManager(), |
|
| 224 | + \OC::$server->get(IniGetWrapper::class), |
|
| 225 | + \OC::$server->getURLGenerator(), |
|
| 226 | + \OC::$server->getCapabilitiesManager(), |
|
| 227 | + \OC::$server->query(IInitialStateService::class) |
|
| 228 | + ); |
|
| 229 | + $config = $jsConfigHelper->getConfig(); |
|
| 230 | + if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) { |
|
| 231 | + $this->assign('inline_ocjs', $config); |
|
| 232 | + } else { |
|
| 233 | + $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash])); |
|
| 234 | + } |
|
| 235 | + } |
|
| 236 | + foreach ($jsFiles as $info) { |
|
| 237 | + $web = $info[1]; |
|
| 238 | + $file = $info[2]; |
|
| 239 | + $this->append('jsfiles', $web.'/'.$file . $this->getVersionHashSuffix()); |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + try { |
|
| 243 | + $pathInfo = \OC::$server->getRequest()->getPathInfo(); |
|
| 244 | + } catch (\Exception $e) { |
|
| 245 | + $pathInfo = ''; |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + // Do not initialise scss appdata until we have a fully installed instance |
|
| 249 | + // Do not load scss for update, errors, installation or login page |
|
| 250 | + if (\OC::$server->getSystemConfig()->getValue('installed', false) |
|
| 251 | + && !\OCP\Util::needUpgrade() |
|
| 252 | + && $pathInfo !== '' |
|
| 253 | + && !preg_match('/^\/login/', $pathInfo) |
|
| 254 | + && $renderAs !== TemplateResponse::RENDER_AS_ERROR |
|
| 255 | + ) { |
|
| 256 | + $cssFiles = self::findStylesheetFiles(\OC_Util::$styles); |
|
| 257 | + } else { |
|
| 258 | + // If we ignore the scss compiler, |
|
| 259 | + // we need to load the guest css fallback |
|
| 260 | + \OC_Util::addStyle('guest'); |
|
| 261 | + $cssFiles = self::findStylesheetFiles(\OC_Util::$styles, false); |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + $this->assign('cssfiles', []); |
|
| 265 | + $this->assign('printcssfiles', []); |
|
| 266 | + $this->assign('versionHash', self::$versionHash); |
|
| 267 | + foreach ($cssFiles as $info) { |
|
| 268 | + $web = $info[1]; |
|
| 269 | + $file = $info[2]; |
|
| 270 | + |
|
| 271 | + if (substr($file, -strlen('print.css')) === 'print.css') { |
|
| 272 | + $this->append('printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix()); |
|
| 273 | + } else { |
|
| 274 | + $suffix = $this->getVersionHashSuffix($web, $file); |
|
| 275 | + |
|
| 276 | + if (strpos($file, '?v=') == false) { |
|
| 277 | + $this->append('cssfiles', $web.'/'.$file . $suffix); |
|
| 278 | + } else { |
|
| 279 | + $this->append('cssfiles', $web.'/'.$file . '-' . substr($suffix, 3)); |
|
| 280 | + } |
|
| 281 | + } |
|
| 282 | + } |
|
| 283 | + |
|
| 284 | + $this->assign('initialStates', $this->initialState->getInitialStates()); |
|
| 285 | + |
|
| 286 | + $this->assign('id-app-content', $renderAs === TemplateResponse::RENDER_AS_USER ? '#app-content' : '#content'); |
|
| 287 | + $this->assign('id-app-navigation', $renderAs === TemplateResponse::RENDER_AS_USER ? '#app-navigation' : null); |
|
| 288 | + } |
|
| 289 | + |
|
| 290 | + /** |
|
| 291 | + * @param string $path |
|
| 292 | + * @param string $file |
|
| 293 | + * @return string |
|
| 294 | + */ |
|
| 295 | + protected function getVersionHashSuffix($path = false, $file = false) { |
|
| 296 | + if ($this->config->getSystemValue('debug', false)) { |
|
| 297 | + // allows chrome workspace mapping in debug mode |
|
| 298 | + return ""; |
|
| 299 | + } |
|
| 300 | + $themingSuffix = ''; |
|
| 301 | + $v = []; |
|
| 302 | + |
|
| 303 | + if ($this->config->getSystemValue('installed', false)) { |
|
| 304 | + if (\OC::$server->getAppManager()->isInstalled('theming')) { |
|
| 305 | + $themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 306 | + } |
|
| 307 | + $v = \OC_App::getAppVersions(); |
|
| 308 | + } |
|
| 309 | + |
|
| 310 | + // Try the webroot path for a match |
|
| 311 | + if ($path !== false && $path !== '') { |
|
| 312 | + $appName = $this->getAppNamefromPath($path); |
|
| 313 | + if (array_key_exists($appName, $v)) { |
|
| 314 | + $appVersion = $v[$appName]; |
|
| 315 | + return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
| 316 | + } |
|
| 317 | + } |
|
| 318 | + // fallback to the file path instead |
|
| 319 | + if ($file !== false && $file !== '') { |
|
| 320 | + $appName = $this->getAppNamefromPath($file); |
|
| 321 | + if (array_key_exists($appName, $v)) { |
|
| 322 | + $appVersion = $v[$appName]; |
|
| 323 | + return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
| 324 | + } |
|
| 325 | + } |
|
| 326 | + |
|
| 327 | + return '?v=' . self::$versionHash . $themingSuffix; |
|
| 328 | + } |
|
| 329 | + |
|
| 330 | + /** |
|
| 331 | + * @param array $styles |
|
| 332 | + * @return array |
|
| 333 | + */ |
|
| 334 | + public static function findStylesheetFiles($styles, $compileScss = true) { |
|
| 335 | + // Read the selected theme from the config file |
|
| 336 | + $theme = \OC_Util::getTheme(); |
|
| 337 | + |
|
| 338 | + $locator = new \OC\Template\CSSResourceLocator( |
|
| 339 | + \OC::$server->get(LoggerInterface::class), |
|
| 340 | + $theme, |
|
| 341 | + [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
| 342 | + [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
| 343 | + ); |
|
| 344 | + $locator->find($styles); |
|
| 345 | + return $locator->getResources(); |
|
| 346 | + } |
|
| 347 | + |
|
| 348 | + /** |
|
| 349 | + * @param string $path |
|
| 350 | + * @return string|boolean |
|
| 351 | + */ |
|
| 352 | + public function getAppNamefromPath($path) { |
|
| 353 | + if ($path !== '' && is_string($path)) { |
|
| 354 | + $pathParts = explode('/', $path); |
|
| 355 | + if ($pathParts[0] === 'css') { |
|
| 356 | + // This is a scss request |
|
| 357 | + return $pathParts[1]; |
|
| 358 | + } |
|
| 359 | + return end($pathParts); |
|
| 360 | + } |
|
| 361 | + return false; |
|
| 362 | + } |
|
| 363 | + |
|
| 364 | + /** |
|
| 365 | + * @param array $scripts |
|
| 366 | + * @return array |
|
| 367 | + */ |
|
| 368 | + public static function findJavascriptFiles($scripts) { |
|
| 369 | + // Read the selected theme from the config file |
|
| 370 | + $theme = \OC_Util::getTheme(); |
|
| 371 | + |
|
| 372 | + $locator = new \OC\Template\JSResourceLocator( |
|
| 373 | + \OC::$server->get(LoggerInterface::class), |
|
| 374 | + $theme, |
|
| 375 | + [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
| 376 | + [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
| 377 | + \OC::$server->query(JSCombiner::class) |
|
| 378 | + ); |
|
| 379 | + $locator->find($scripts); |
|
| 380 | + return $locator->getResources(); |
|
| 381 | + } |
|
| 382 | + |
|
| 383 | + /** |
|
| 384 | + * Converts the absolute file path to a relative path from \OC::$SERVERROOT |
|
| 385 | + * @param string $filePath Absolute path |
|
| 386 | + * @return string Relative path |
|
| 387 | + * @throws \Exception If $filePath is not under \OC::$SERVERROOT |
|
| 388 | + */ |
|
| 389 | + public static function convertToRelativePath($filePath) { |
|
| 390 | + $relativePath = explode(\OC::$SERVERROOT, $filePath); |
|
| 391 | + if (count($relativePath) !== 2) { |
|
| 392 | + throw new \Exception('$filePath is not under the \OC::$SERVERROOT'); |
|
| 393 | + } |
|
| 394 | + |
|
| 395 | + return $relativePath[1]; |
|
| 396 | + } |
|
| 397 | 397 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $this->navigationManager = \OC::$server->get(INavigationManager::class); |
| 94 | 94 | |
| 95 | 95 | parent::__construct('core', 'layout.user'); |
| 96 | - if (in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) { |
|
| 96 | + if (in_array(\OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) { |
|
| 97 | 97 | $this->assign('bodyid', 'body-settings'); |
| 98 | 98 | } else { |
| 99 | 99 | $this->assign('bodyid', 'body-user'); |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $this->initialState->provideInitialState('core', 'active-app', $this->navigationManager->getActiveEntry()); |
| 103 | 103 | $this->initialState->provideInitialState('core', 'apps', $this->navigationManager->getAll()); |
| 104 | - $this->initialState->provideInitialState('unified-search', 'limit-default', (int)$this->config->getAppValue('core', 'unified-search.limit-default', (string)SearchQuery::LIMIT_DEFAULT)); |
|
| 105 | - $this->initialState->provideInitialState('unified-search', 'min-search-length', (int)$this->config->getAppValue('core', 'unified-search.min-search-length', (string)2)); |
|
| 104 | + $this->initialState->provideInitialState('unified-search', 'limit-default', (int) $this->config->getAppValue('core', 'unified-search.limit-default', (string) SearchQuery::LIMIT_DEFAULT)); |
|
| 105 | + $this->initialState->provideInitialState('unified-search', 'min-search-length', (int) $this->config->getAppValue('core', 'unified-search.min-search-length', (string) 2)); |
|
| 106 | 106 | $this->initialState->provideInitialState('unified-search', 'live-search', $this->config->getAppValue('core', 'unified-search.live-search', 'yes') === 'yes'); |
| 107 | 107 | Util::addScript('core', 'unified-search', 'core'); |
| 108 | 108 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | foreach ($jsFiles as $info) { |
| 237 | 237 | $web = $info[1]; |
| 238 | 238 | $file = $info[2]; |
| 239 | - $this->append('jsfiles', $web.'/'.$file . $this->getVersionHashSuffix()); |
|
| 239 | + $this->append('jsfiles', $web.'/'.$file.$this->getVersionHashSuffix()); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | try { |
@@ -269,14 +269,14 @@ discard block |
||
| 269 | 269 | $file = $info[2]; |
| 270 | 270 | |
| 271 | 271 | if (substr($file, -strlen('print.css')) === 'print.css') { |
| 272 | - $this->append('printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix()); |
|
| 272 | + $this->append('printcssfiles', $web.'/'.$file.$this->getVersionHashSuffix()); |
|
| 273 | 273 | } else { |
| 274 | 274 | $suffix = $this->getVersionHashSuffix($web, $file); |
| 275 | 275 | |
| 276 | 276 | if (strpos($file, '?v=') == false) { |
| 277 | - $this->append('cssfiles', $web.'/'.$file . $suffix); |
|
| 277 | + $this->append('cssfiles', $web.'/'.$file.$suffix); |
|
| 278 | 278 | } else { |
| 279 | - $this->append('cssfiles', $web.'/'.$file . '-' . substr($suffix, 3)); |
|
| 279 | + $this->append('cssfiles', $web.'/'.$file.'-'.substr($suffix, 3)); |
|
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | if ($this->config->getSystemValue('installed', false)) { |
| 304 | 304 | if (\OC::$server->getAppManager()->isInstalled('theming')) { |
| 305 | - $themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 305 | + $themingSuffix = '-'.$this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 306 | 306 | } |
| 307 | 307 | $v = \OC_App::getAppVersions(); |
| 308 | 308 | } |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | $appName = $this->getAppNamefromPath($path); |
| 313 | 313 | if (array_key_exists($appName, $v)) { |
| 314 | 314 | $appVersion = $v[$appName]; |
| 315 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
| 315 | + return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix; |
|
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | // fallback to the file path instead |
@@ -320,11 +320,11 @@ discard block |
||
| 320 | 320 | $appName = $this->getAppNamefromPath($file); |
| 321 | 321 | if (array_key_exists($appName, $v)) { |
| 322 | 322 | $appVersion = $v[$appName]; |
| 323 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
| 323 | + return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix; |
|
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - return '?v=' . self::$versionHash . $themingSuffix; |
|
| 327 | + return '?v='.self::$versionHash.$themingSuffix; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | /** |
@@ -338,8 +338,8 @@ discard block |
||
| 338 | 338 | $locator = new \OC\Template\CSSResourceLocator( |
| 339 | 339 | \OC::$server->get(LoggerInterface::class), |
| 340 | 340 | $theme, |
| 341 | - [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
| 342 | - [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
| 341 | + [\OC::$SERVERROOT => \OC::$WEBROOT], |
|
| 342 | + [\OC::$SERVERROOT => \OC::$WEBROOT], |
|
| 343 | 343 | ); |
| 344 | 344 | $locator->find($styles); |
| 345 | 345 | return $locator->getResources(); |
@@ -372,8 +372,8 @@ discard block |
||
| 372 | 372 | $locator = new \OC\Template\JSResourceLocator( |
| 373 | 373 | \OC::$server->get(LoggerInterface::class), |
| 374 | 374 | $theme, |
| 375 | - [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
| 376 | - [ \OC::$SERVERROOT => \OC::$WEBROOT ], |
|
| 375 | + [\OC::$SERVERROOT => \OC::$WEBROOT], |
|
| 376 | + [\OC::$SERVERROOT => \OC::$WEBROOT], |
|
| 377 | 377 | \OC::$server->query(JSCombiner::class) |
| 378 | 378 | ); |
| 379 | 379 | $locator->find($scripts); |