diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-06-22 10:32:16 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-06-25 17:12:28 +0200 |
commit | 2e08cc958c930cd09a95e2e8e6df5d56ad5fb897 (patch) | |
tree | f28939d41d401ff43619808a117b1e54642eb6c0 /apps/accessibility | |
parent | 6fb3cd50c24ba713070274af35835c689c67c2db (diff) | |
download | nextcloud-server-2e08cc958c930cd09a95e2e8e6df5d56ad5fb897.tar.gz nextcloud-server-2e08cc958c930cd09a95e2e8e6df5d56ad5fb897.zip |
Compliance
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/accessibility')
-rw-r--r-- | apps/accessibility/lib/Controller/AccessibilityController.php | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/apps/accessibility/lib/Controller/AccessibilityController.php b/apps/accessibility/lib/Controller/AccessibilityController.php index 7e0c3ab48b6..c4b010e94f8 100644 --- a/apps/accessibility/lib/Controller/AccessibilityController.php +++ b/apps/accessibility/lib/Controller/AccessibilityController.php @@ -109,8 +109,8 @@ class AccessibilityController extends Controller { * @return DataDisplayResponse */ public function getCss(): DataDisplayResponse { - $css = ''; - $imports = ''; + $css = ''; + $imports = ''; $userValues = $this->getUserValues(); foreach ($userValues as $key => $scssFile) { @@ -145,15 +145,9 @@ class AccessibilityController extends Controller { // We don't want to override vars with url since path is different $css = $this->filterOutRule('/--[a-z-:]+url\([^;]+\)/mi', $css); - // Calculate exact absolute path to file - $path = $this->urlGenerator->linkToRoute($this->appName . '.accessibility.getCss', ['md5' => md5(implode('-', $userValues))]); - $path = explode('/', $this->serverRoot . $path); - array_pop($path); - $path = implode('/', $path); - $webDir = $this->getWebDir($path, $this->appName, $this->serverRoot, \OC::$WEBROOT); - // Rebase all urls - $css = $this->rebaseUrls($css, $webDir); + $appWebRoot = substr($this->appRoot, strlen($this->serverRoot) - strlen(\OC::$WEBROOT)); + $css = $this->rebaseUrls($css, $appWebRoot); $response = new DataDisplayResponse($css, Http::STATUS_OK, ['Content-Type' => 'text/css']); @@ -205,24 +199,4 @@ class AccessibilityController extends Controller { return preg_replace($re, $subst, $css); } - - /** - * Get WebDir root - * @param string $path the css file path - * @param string $appName the app name - * @param string $serverRoot the server root path - * @param string $webRoot the nextcloud installation root path - * @return string the webDir - */ - private function getWebDir(string $path, string $appName, string $serverRoot, string $webRoot): string { - // Detect if path is within server root AND if path is within an app path - if ( strpos($path, $serverRoot) === false && $appWebPath = \OC_App::getAppWebPath($appName)) { - // Get the file path within the app directory - $appDirectoryPath = explode($appName, $path)[1]; - // Remove the webroot - return str_replace($webRoot, '', $appWebPath.$appDirectoryPath); - } - return $webRoot.substr($path, strlen($serverRoot)); - } - } |