Completed
Push — master ( 2a3272...8d57d6 )
by Morris
16:32 queued 15:30
created
lib/private/TemplateLayout.php 2 patches
Indentation   +282 added lines, -282 removed lines patch added patch discarded remove patch
@@ -45,286 +45,286 @@
 block discarded – undo
45 45
 
46 46
 class TemplateLayout extends \OC_Template {
47 47
 
48
-	private static $versionHash = '';
49
-
50
-	/**
51
-	 * @var \OCP\IConfig
52
-	 */
53
-	private $config;
54
-
55
-	/**
56
-	 * @param string $renderAs
57
-	 * @param string $appId application id
58
-	 */
59
-	public function __construct( $renderAs, $appId = '' ) {
60
-
61
-		// yes - should be injected ....
62
-		$this->config = \OC::$server->getConfig();
63
-
64
-
65
-		// Decide which page we show
66
-		if($renderAs == 'user') {
67
-			parent::__construct( 'core', 'layout.user' );
68
-			if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) {
69
-				$this->assign('bodyid', 'body-settings');
70
-			}else{
71
-				$this->assign('bodyid', 'body-user');
72
-			}
73
-
74
-			// Code integrity notification
75
-			$integrityChecker = \OC::$server->getIntegrityCodeChecker();
76
-			if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
77
-				\OCP\Util::addScript('core', 'integritycheck-failed-notification');
78
-			}
79
-
80
-			// Add navigation entry
81
-			$this->assign( 'application', '');
82
-			$this->assign( 'appid', $appId );
83
-			$navigation = \OC_App::getNavigation();
84
-			$this->assign( 'navigation', $navigation);
85
-			$settingsNavigation = \OC_App::getSettingsNavigation();
86
-			$this->assign( 'settingsnavigation', $settingsNavigation);
87
-			foreach($navigation as $entry) {
88
-				if ($entry['active']) {
89
-					$this->assign( 'application', $entry['name'] );
90
-					break;
91
-				}
92
-			}
93
-
94
-			foreach($settingsNavigation as $entry) {
95
-				if ($entry['active']) {
96
-					$this->assign( 'application', $entry['name'] );
97
-					break;
98
-				}
99
-			}
100
-			$userDisplayName = \OC_User::getDisplayName();
101
-			$this->assign('user_displayname', $userDisplayName);
102
-			$this->assign('user_uid', \OC_User::getUser());
103
-
104
-			if (\OC_User::getUser() === false) {
105
-				$this->assign('userAvatarSet', false);
106
-			} else {
107
-				$this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists());
108
-				$this->assign('userAvatarVersion', $this->config->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0));
109
-			}
110
-
111
-			// check if app menu icons should be inverted
112
-			try {
113
-				/** @var \OCA\Theming\Util $util */
114
-				$util = \OC::$server->query(\OCA\Theming\Util::class);
115
-				$this->assign('themingInvertMenu', $util->invertTextColor(\OC::$server->getThemingDefaults()->getColorPrimary()));
116
-			} catch (\OCP\AppFramework\QueryException $e) {
117
-				$this->assign('themingInvertMenu', false);
118
-			}
119
-
120
-		} else if ($renderAs == 'error') {
121
-			parent::__construct('core', 'layout.guest', '', false);
122
-			$this->assign('bodyid', 'body-login');
123
-		} else if ($renderAs == 'guest') {
124
-			parent::__construct('core', 'layout.guest');
125
-			$this->assign('bodyid', 'body-login');
126
-		} else {
127
-			parent::__construct('core', 'layout.base');
128
-
129
-		}
130
-		// Send the language to our layouts
131
-		$lang = \OC::$server->getL10NFactory()->findLanguage();
132
-		$lang = str_replace('_', '-', $lang);
133
-		$this->assign('language', $lang);
134
-
135
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
136
-			if (empty(self::$versionHash)) {
137
-				$v = \OC_App::getAppVersions();
138
-				$v['core'] = implode('.', \OCP\Util::getVersion());
139
-				self::$versionHash = substr(md5(implode(',', $v)), 0, 8);
140
-			}
141
-		} else {
142
-			self::$versionHash = md5('not installed');
143
-		}
144
-
145
-		// Add the js files
146
-		$jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
147
-		$this->assign('jsfiles', array());
148
-		if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
149
-			if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) {
150
-				$jsConfigHelper = new JSConfigHelper(
151
-					\OC::$server->getL10N('lib'),
152
-					\OC::$server->query(Defaults::class),
153
-					\OC::$server->getAppManager(),
154
-					\OC::$server->getSession(),
155
-					\OC::$server->getUserSession()->getUser(),
156
-					$this->config,
157
-					\OC::$server->getGroupManager(),
158
-					\OC::$server->getIniWrapper(),
159
-					\OC::$server->getURLGenerator()
160
-				);
161
-				$this->assign('inline_ocjs', $jsConfigHelper->getConfig());
162
-			} else {
163
-				$this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash]));
164
-			}
165
-		}
166
-		foreach($jsFiles as $info) {
167
-			$web = $info[1];
168
-			$file = $info[2];
169
-			$this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
170
-		}
171
-
172
-		try {
173
-			$pathInfo = \OC::$server->getRequest()->getPathInfo();
174
-		} catch (\Exception $e) {
175
-			$pathInfo = '';
176
-		}
177
-
178
-		// Do not initialise scss appdata until we have a fully installed instance
179
-		// Do not load scss for update, errors, installation or login page
180
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)
181
-			&& !\OCP\Util::needUpgrade()
182
-			&& $pathInfo !== ''
183
-			&& !preg_match('/^\/login/', $pathInfo)
184
-			&& $renderAs !== 'error' && $renderAs !== 'guest'
185
-		) {
186
-			$cssFiles = self::findStylesheetFiles(\OC_Util::$styles);
187
-		} else {
188
-			// If we ignore the scss compiler,
189
-			// we need to load the guest css fallback
190
-			\OC_Util::addStyle('guest');
191
-			$cssFiles = self::findStylesheetFiles(\OC_Util::$styles, false);
192
-		}
193
-
194
-		$this->assign('cssfiles', array());
195
-		$this->assign('printcssfiles', []);
196
-		$this->assign('versionHash', self::$versionHash);
197
-		foreach($cssFiles as $info) {
198
-			$web = $info[1];
199
-			$file = $info[2];
200
-
201
-			if (substr($file, -strlen('print.css')) === 'print.css') {
202
-				$this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
203
-			} else {
204
-				$this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix($web, $file)  );
205
-			}
206
-		}
207
-	}
208
-
209
-	/**
210
-	 * @param string $path
211
- 	 * @param string $file
212
-	 * @return string
213
-	 */
214
-	protected function getVersionHashSuffix($path = false, $file = false) {
215
-		if ($this->config->getSystemValue('debug', false)) {
216
-			// allows chrome workspace mapping in debug mode
217
-			return "";
218
-		}
219
-		$themingSuffix = '';
220
-		$v = [];
221
-
222
-		if ($this->config->getSystemValue('installed', false)) {
223
-			if (\OC::$server->getAppManager()->isInstalled('theming')) {
224
-				$themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
225
-			}
226
-			$v = \OC_App::getAppVersions();
227
-		}
228
-
229
-		// Try the webroot path for a match
230
-		if ($path !== false && $path !== '') {
231
-			$appName = $this->getAppNamefromPath($path);
232
-			if(array_key_exists($appName, $v)) {
233
-				$appVersion = $v[$appName];
234
-				return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix;
235
-			}
236
-		}
237
-		// fallback to the file path instead
238
-		if ($file !== false && $file !== '') {
239
-			$appName = $this->getAppNamefromPath($file);
240
-			if(array_key_exists($appName, $v)) {
241
-				$appVersion = $v[$appName];
242
-				return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix;
243
-			}
244
-		}
245
-
246
-		return '?v=' . self::$versionHash . $themingSuffix;
247
-	}
248
-
249
-	/**
250
-	 * @param array $styles
251
-	 * @return array
252
-	 */
253
-	static public function findStylesheetFiles($styles, $compileScss = true) {
254
-		// Read the selected theme from the config file
255
-		$theme = \OC_Util::getTheme();
256
-
257
-		if($compileScss) {
258
-			$SCSSCacher = \OC::$server->query(SCSSCacher::class);
259
-		} else {
260
-			$SCSSCacher = null;
261
-		}
262
-
263
-		$locator = new \OC\Template\CSSResourceLocator(
264
-			\OC::$server->getLogger(),
265
-			$theme,
266
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
267
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
268
-			$SCSSCacher
269
-		);
270
-		$locator->find($styles);
271
-		return $locator->getResources();
272
-	}
273
-
274
-	/**
275
-	 * @param string $path
276
-	 * @return string|boolean
277
-	 */
278
-	public function getAppNamefromPath($path) {
279
-		if ($path !== '' && is_string($path)) {
280
-			$pathParts = explode('/', $path);
281
-			if ($pathParts[0] === 'css') {
282
-				// This is a scss request
283
-				return $pathParts[1];
284
-			}
285
-			return end($pathParts);
286
-		}
287
-		return false;
288
-
289
-	}
290
-
291
-	/**
292
-	 * @param array $scripts
293
-	 * @return array
294
-	 */
295
-	static public function findJavascriptFiles($scripts) {
296
-		// Read the selected theme from the config file
297
-		$theme = \OC_Util::getTheme();
298
-
299
-		$locator = new \OC\Template\JSResourceLocator(
300
-			\OC::$server->getLogger(),
301
-			$theme,
302
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
303
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
304
-			new JSCombiner(
305
-				\OC::$server->getAppDataDir('js'),
306
-				\OC::$server->getURLGenerator(),
307
-				\OC::$server->getMemCacheFactory()->createDistributed('JS'),
308
-				\OC::$server->getSystemConfig(),
309
-				\OC::$server->getLogger()
310
-			)
311
-			);
312
-		$locator->find($scripts);
313
-		return $locator->getResources();
314
-	}
315
-
316
-	/**
317
-	 * Converts the absolute file path to a relative path from \OC::$SERVERROOT
318
-	 * @param string $filePath Absolute path
319
-	 * @return string Relative path
320
-	 * @throws \Exception If $filePath is not under \OC::$SERVERROOT
321
-	 */
322
-	public static function convertToRelativePath($filePath) {
323
-		$relativePath = explode(\OC::$SERVERROOT, $filePath);
324
-		if(count($relativePath) !== 2) {
325
-			throw new \Exception('$filePath is not under the \OC::$SERVERROOT');
326
-		}
327
-
328
-		return $relativePath[1];
329
-	}
48
+    private static $versionHash = '';
49
+
50
+    /**
51
+     * @var \OCP\IConfig
52
+     */
53
+    private $config;
54
+
55
+    /**
56
+     * @param string $renderAs
57
+     * @param string $appId application id
58
+     */
59
+    public function __construct( $renderAs, $appId = '' ) {
60
+
61
+        // yes - should be injected ....
62
+        $this->config = \OC::$server->getConfig();
63
+
64
+
65
+        // Decide which page we show
66
+        if($renderAs == 'user') {
67
+            parent::__construct( 'core', 'layout.user' );
68
+            if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) {
69
+                $this->assign('bodyid', 'body-settings');
70
+            }else{
71
+                $this->assign('bodyid', 'body-user');
72
+            }
73
+
74
+            // Code integrity notification
75
+            $integrityChecker = \OC::$server->getIntegrityCodeChecker();
76
+            if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
77
+                \OCP\Util::addScript('core', 'integritycheck-failed-notification');
78
+            }
79
+
80
+            // Add navigation entry
81
+            $this->assign( 'application', '');
82
+            $this->assign( 'appid', $appId );
83
+            $navigation = \OC_App::getNavigation();
84
+            $this->assign( 'navigation', $navigation);
85
+            $settingsNavigation = \OC_App::getSettingsNavigation();
86
+            $this->assign( 'settingsnavigation', $settingsNavigation);
87
+            foreach($navigation as $entry) {
88
+                if ($entry['active']) {
89
+                    $this->assign( 'application', $entry['name'] );
90
+                    break;
91
+                }
92
+            }
93
+
94
+            foreach($settingsNavigation as $entry) {
95
+                if ($entry['active']) {
96
+                    $this->assign( 'application', $entry['name'] );
97
+                    break;
98
+                }
99
+            }
100
+            $userDisplayName = \OC_User::getDisplayName();
101
+            $this->assign('user_displayname', $userDisplayName);
102
+            $this->assign('user_uid', \OC_User::getUser());
103
+
104
+            if (\OC_User::getUser() === false) {
105
+                $this->assign('userAvatarSet', false);
106
+            } else {
107
+                $this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists());
108
+                $this->assign('userAvatarVersion', $this->config->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0));
109
+            }
110
+
111
+            // check if app menu icons should be inverted
112
+            try {
113
+                /** @var \OCA\Theming\Util $util */
114
+                $util = \OC::$server->query(\OCA\Theming\Util::class);
115
+                $this->assign('themingInvertMenu', $util->invertTextColor(\OC::$server->getThemingDefaults()->getColorPrimary()));
116
+            } catch (\OCP\AppFramework\QueryException $e) {
117
+                $this->assign('themingInvertMenu', false);
118
+            }
119
+
120
+        } else if ($renderAs == 'error') {
121
+            parent::__construct('core', 'layout.guest', '', false);
122
+            $this->assign('bodyid', 'body-login');
123
+        } else if ($renderAs == 'guest') {
124
+            parent::__construct('core', 'layout.guest');
125
+            $this->assign('bodyid', 'body-login');
126
+        } else {
127
+            parent::__construct('core', 'layout.base');
128
+
129
+        }
130
+        // Send the language to our layouts
131
+        $lang = \OC::$server->getL10NFactory()->findLanguage();
132
+        $lang = str_replace('_', '-', $lang);
133
+        $this->assign('language', $lang);
134
+
135
+        if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
136
+            if (empty(self::$versionHash)) {
137
+                $v = \OC_App::getAppVersions();
138
+                $v['core'] = implode('.', \OCP\Util::getVersion());
139
+                self::$versionHash = substr(md5(implode(',', $v)), 0, 8);
140
+            }
141
+        } else {
142
+            self::$versionHash = md5('not installed');
143
+        }
144
+
145
+        // Add the js files
146
+        $jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
147
+        $this->assign('jsfiles', array());
148
+        if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
149
+            if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) {
150
+                $jsConfigHelper = new JSConfigHelper(
151
+                    \OC::$server->getL10N('lib'),
152
+                    \OC::$server->query(Defaults::class),
153
+                    \OC::$server->getAppManager(),
154
+                    \OC::$server->getSession(),
155
+                    \OC::$server->getUserSession()->getUser(),
156
+                    $this->config,
157
+                    \OC::$server->getGroupManager(),
158
+                    \OC::$server->getIniWrapper(),
159
+                    \OC::$server->getURLGenerator()
160
+                );
161
+                $this->assign('inline_ocjs', $jsConfigHelper->getConfig());
162
+            } else {
163
+                $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash]));
164
+            }
165
+        }
166
+        foreach($jsFiles as $info) {
167
+            $web = $info[1];
168
+            $file = $info[2];
169
+            $this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
170
+        }
171
+
172
+        try {
173
+            $pathInfo = \OC::$server->getRequest()->getPathInfo();
174
+        } catch (\Exception $e) {
175
+            $pathInfo = '';
176
+        }
177
+
178
+        // Do not initialise scss appdata until we have a fully installed instance
179
+        // Do not load scss for update, errors, installation or login page
180
+        if(\OC::$server->getSystemConfig()->getValue('installed', false)
181
+            && !\OCP\Util::needUpgrade()
182
+            && $pathInfo !== ''
183
+            && !preg_match('/^\/login/', $pathInfo)
184
+            && $renderAs !== 'error' && $renderAs !== 'guest'
185
+        ) {
186
+            $cssFiles = self::findStylesheetFiles(\OC_Util::$styles);
187
+        } else {
188
+            // If we ignore the scss compiler,
189
+            // we need to load the guest css fallback
190
+            \OC_Util::addStyle('guest');
191
+            $cssFiles = self::findStylesheetFiles(\OC_Util::$styles, false);
192
+        }
193
+
194
+        $this->assign('cssfiles', array());
195
+        $this->assign('printcssfiles', []);
196
+        $this->assign('versionHash', self::$versionHash);
197
+        foreach($cssFiles as $info) {
198
+            $web = $info[1];
199
+            $file = $info[2];
200
+
201
+            if (substr($file, -strlen('print.css')) === 'print.css') {
202
+                $this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
203
+            } else {
204
+                $this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix($web, $file)  );
205
+            }
206
+        }
207
+    }
208
+
209
+    /**
210
+     * @param string $path
211
+     * @param string $file
212
+     * @return string
213
+     */
214
+    protected function getVersionHashSuffix($path = false, $file = false) {
215
+        if ($this->config->getSystemValue('debug', false)) {
216
+            // allows chrome workspace mapping in debug mode
217
+            return "";
218
+        }
219
+        $themingSuffix = '';
220
+        $v = [];
221
+
222
+        if ($this->config->getSystemValue('installed', false)) {
223
+            if (\OC::$server->getAppManager()->isInstalled('theming')) {
224
+                $themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
225
+            }
226
+            $v = \OC_App::getAppVersions();
227
+        }
228
+
229
+        // Try the webroot path for a match
230
+        if ($path !== false && $path !== '') {
231
+            $appName = $this->getAppNamefromPath($path);
232
+            if(array_key_exists($appName, $v)) {
233
+                $appVersion = $v[$appName];
234
+                return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix;
235
+            }
236
+        }
237
+        // fallback to the file path instead
238
+        if ($file !== false && $file !== '') {
239
+            $appName = $this->getAppNamefromPath($file);
240
+            if(array_key_exists($appName, $v)) {
241
+                $appVersion = $v[$appName];
242
+                return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix;
243
+            }
244
+        }
245
+
246
+        return '?v=' . self::$versionHash . $themingSuffix;
247
+    }
248
+
249
+    /**
250
+     * @param array $styles
251
+     * @return array
252
+     */
253
+    static public function findStylesheetFiles($styles, $compileScss = true) {
254
+        // Read the selected theme from the config file
255
+        $theme = \OC_Util::getTheme();
256
+
257
+        if($compileScss) {
258
+            $SCSSCacher = \OC::$server->query(SCSSCacher::class);
259
+        } else {
260
+            $SCSSCacher = null;
261
+        }
262
+
263
+        $locator = new \OC\Template\CSSResourceLocator(
264
+            \OC::$server->getLogger(),
265
+            $theme,
266
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
267
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
268
+            $SCSSCacher
269
+        );
270
+        $locator->find($styles);
271
+        return $locator->getResources();
272
+    }
273
+
274
+    /**
275
+     * @param string $path
276
+     * @return string|boolean
277
+     */
278
+    public function getAppNamefromPath($path) {
279
+        if ($path !== '' && is_string($path)) {
280
+            $pathParts = explode('/', $path);
281
+            if ($pathParts[0] === 'css') {
282
+                // This is a scss request
283
+                return $pathParts[1];
284
+            }
285
+            return end($pathParts);
286
+        }
287
+        return false;
288
+
289
+    }
290
+
291
+    /**
292
+     * @param array $scripts
293
+     * @return array
294
+     */
295
+    static public function findJavascriptFiles($scripts) {
296
+        // Read the selected theme from the config file
297
+        $theme = \OC_Util::getTheme();
298
+
299
+        $locator = new \OC\Template\JSResourceLocator(
300
+            \OC::$server->getLogger(),
301
+            $theme,
302
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
303
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
304
+            new JSCombiner(
305
+                \OC::$server->getAppDataDir('js'),
306
+                \OC::$server->getURLGenerator(),
307
+                \OC::$server->getMemCacheFactory()->createDistributed('JS'),
308
+                \OC::$server->getSystemConfig(),
309
+                \OC::$server->getLogger()
310
+            )
311
+            );
312
+        $locator->find($scripts);
313
+        return $locator->getResources();
314
+    }
315
+
316
+    /**
317
+     * Converts the absolute file path to a relative path from \OC::$SERVERROOT
318
+     * @param string $filePath Absolute path
319
+     * @return string Relative path
320
+     * @throws \Exception If $filePath is not under \OC::$SERVERROOT
321
+     */
322
+    public static function convertToRelativePath($filePath) {
323
+        $relativePath = explode(\OC::$SERVERROOT, $filePath);
324
+        if(count($relativePath) !== 2) {
325
+            throw new \Exception('$filePath is not under the \OC::$SERVERROOT');
326
+        }
327
+
328
+        return $relativePath[1];
329
+    }
330 330
 }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -56,44 +56,44 @@  discard block
 block discarded – undo
56 56
 	 * @param string $renderAs
57 57
 	 * @param string $appId application id
58 58
 	 */
59
-	public function __construct( $renderAs, $appId = '' ) {
59
+	public function __construct($renderAs, $appId = '') {
60 60
 
61 61
 		// yes - should be injected ....
62 62
 		$this->config = \OC::$server->getConfig();
63 63
 
64 64
 
65 65
 		// Decide which page we show
66
-		if($renderAs == 'user') {
67
-			parent::__construct( 'core', 'layout.user' );
68
-			if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) {
66
+		if ($renderAs == 'user') {
67
+			parent::__construct('core', 'layout.user');
68
+			if (in_array(\OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) {
69 69
 				$this->assign('bodyid', 'body-settings');
70
-			}else{
70
+			} else {
71 71
 				$this->assign('bodyid', 'body-user');
72 72
 			}
73 73
 
74 74
 			// Code integrity notification
75 75
 			$integrityChecker = \OC::$server->getIntegrityCodeChecker();
76
-			if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
76
+			if (\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
77 77
 				\OCP\Util::addScript('core', 'integritycheck-failed-notification');
78 78
 			}
79 79
 
80 80
 			// Add navigation entry
81
-			$this->assign( 'application', '');
82
-			$this->assign( 'appid', $appId );
81
+			$this->assign('application', '');
82
+			$this->assign('appid', $appId);
83 83
 			$navigation = \OC_App::getNavigation();
84
-			$this->assign( 'navigation', $navigation);
84
+			$this->assign('navigation', $navigation);
85 85
 			$settingsNavigation = \OC_App::getSettingsNavigation();
86
-			$this->assign( 'settingsnavigation', $settingsNavigation);
87
-			foreach($navigation as $entry) {
86
+			$this->assign('settingsnavigation', $settingsNavigation);
87
+			foreach ($navigation as $entry) {
88 88
 				if ($entry['active']) {
89
-					$this->assign( 'application', $entry['name'] );
89
+					$this->assign('application', $entry['name']);
90 90
 					break;
91 91
 				}
92 92
 			}
93 93
 
94
-			foreach($settingsNavigation as $entry) {
94
+			foreach ($settingsNavigation as $entry) {
95 95
 				if ($entry['active']) {
96
-					$this->assign( 'application', $entry['name'] );
96
+					$this->assign('application', $entry['name']);
97 97
 					break;
98 98
 				}
99 99
 			}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		$lang = str_replace('_', '-', $lang);
133 133
 		$this->assign('language', $lang);
134 134
 
135
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
135
+		if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
136 136
 			if (empty(self::$versionHash)) {
137 137
 				$v = \OC_App::getAppVersions();
138 138
 				$v['core'] = implode('.', \OCP\Util::getVersion());
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 				$this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash]));
164 164
 			}
165 165
 		}
166
-		foreach($jsFiles as $info) {
166
+		foreach ($jsFiles as $info) {
167 167
 			$web = $info[1];
168 168
 			$file = $info[2];
169
-			$this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
169
+			$this->append('jsfiles', $web.'/'.$file.$this->getVersionHashSuffix());
170 170
 		}
171 171
 
172 172
 		try {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
 		// Do not initialise scss appdata until we have a fully installed instance
179 179
 		// Do not load scss for update, errors, installation or login page
180
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)
180
+		if (\OC::$server->getSystemConfig()->getValue('installed', false)
181 181
 			&& !\OCP\Util::needUpgrade()
182 182
 			&& $pathInfo !== ''
183 183
 			&& !preg_match('/^\/login/', $pathInfo)
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 		$this->assign('cssfiles', array());
195 195
 		$this->assign('printcssfiles', []);
196 196
 		$this->assign('versionHash', self::$versionHash);
197
-		foreach($cssFiles as $info) {
197
+		foreach ($cssFiles as $info) {
198 198
 			$web = $info[1];
199 199
 			$file = $info[2];
200 200
 
201 201
 			if (substr($file, -strlen('print.css')) === 'print.css') {
202
-				$this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
202
+				$this->append('printcssfiles', $web.'/'.$file.$this->getVersionHashSuffix());
203 203
 			} else {
204
-				$this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix($web, $file)  );
204
+				$this->append('cssfiles', $web.'/'.$file.$this->getVersionHashSuffix($web, $file));
205 205
 			}
206 206
 		}
207 207
 	}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 
222 222
 		if ($this->config->getSystemValue('installed', false)) {
223 223
 			if (\OC::$server->getAppManager()->isInstalled('theming')) {
224
-				$themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
224
+				$themingSuffix = '-'.$this->config->getAppValue('theming', 'cachebuster', '0');
225 225
 			}
226 226
 			$v = \OC_App::getAppVersions();
227 227
 		}
@@ -229,21 +229,21 @@  discard block
 block discarded – undo
229 229
 		// Try the webroot path for a match
230 230
 		if ($path !== false && $path !== '') {
231 231
 			$appName = $this->getAppNamefromPath($path);
232
-			if(array_key_exists($appName, $v)) {
232
+			if (array_key_exists($appName, $v)) {
233 233
 				$appVersion = $v[$appName];
234
-				return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix;
234
+				return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix;
235 235
 			}
236 236
 		}
237 237
 		// fallback to the file path instead
238 238
 		if ($file !== false && $file !== '') {
239 239
 			$appName = $this->getAppNamefromPath($file);
240
-			if(array_key_exists($appName, $v)) {
240
+			if (array_key_exists($appName, $v)) {
241 241
 				$appVersion = $v[$appName];
242
-				return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix;
242
+				return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix;
243 243
 			}
244 244
 		}
245 245
 
246
-		return '?v=' . self::$versionHash . $themingSuffix;
246
+		return '?v='.self::$versionHash.$themingSuffix;
247 247
 	}
248 248
 
249 249
 	/**
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 		// Read the selected theme from the config file
255 255
 		$theme = \OC_Util::getTheme();
256 256
 
257
-		if($compileScss) {
257
+		if ($compileScss) {
258 258
 			$SCSSCacher = \OC::$server->query(SCSSCacher::class);
259 259
 		} else {
260 260
 			$SCSSCacher = null;
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
 		$locator = new \OC\Template\CSSResourceLocator(
264 264
 			\OC::$server->getLogger(),
265 265
 			$theme,
266
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
267
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
266
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
267
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
268 268
 			$SCSSCacher
269 269
 		);
270 270
 		$locator->find($styles);
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
 		$locator = new \OC\Template\JSResourceLocator(
300 300
 			\OC::$server->getLogger(),
301 301
 			$theme,
302
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
303
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
302
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
303
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
304 304
 			new JSCombiner(
305 305
 				\OC::$server->getAppDataDir('js'),
306 306
 				\OC::$server->getURLGenerator(),
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 	 */
322 322
 	public static function convertToRelativePath($filePath) {
323 323
 		$relativePath = explode(\OC::$SERVERROOT, $filePath);
324
-		if(count($relativePath) !== 2) {
324
+		if (count($relativePath) !== 2) {
325 325
 			throw new \Exception('$filePath is not under the \OC::$SERVERROOT');
326 326
 		}
327 327
 
Please login to merge, or discard this patch.