From: Dan Brown Date: Sat, 3 Jul 2021 11:02:13 +0000 (+0100) Subject: Merge branch 'v21.05.x' X-Git-Tag: v21.08~1^2~28 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/1c43602f4bed60a84f47735ca8bc4a399018e013?ds=inline;hp=-c Merge branch 'v21.05.x' --- 1c43602f4bed60a84f47735ca8bc4a399018e013 diff --combined app/Theming/ThemeService.php index 6fe80559e,44605bf32..602abaf1c --- a/app/Theming/ThemeService.php +++ b/app/Theming/ThemeService.php @@@ -1,6 -1,4 +1,6 @@@ -make(SocialAuthService::class); $socialAuthService->addSocialDriver($driverName, $config, $socialiteHandler, $configureForRedirect); } -} +} diff --combined app/Translation/FileLoader.php index 1ed7b06cc,e65146677..775eefc47 --- a/app/Translation/FileLoader.php +++ b/app/Translation/FileLoader.php @@@ -1,6 -1,4 +1,6 @@@ -loadPath(theme_path('lang'), $locale, $group); - $originalTranslations = $this->loadPath($this->path, $locale, $group); - + $themePath = theme_path('lang'); + $themeTranslations = $themePath ? $this->loadPath($themePath, $locale, $group) : []; + $originalTranslations = $this->loadPath($this->path, $locale, $group); return array_merge($originalTranslations, $themeTranslations); } diff --combined app/helpers.php index 618c71bee,a5a04f113..9edc22c40 --- a/app/helpers.php +++ b/app/helpers.php @@@ -7,7 -7,6 +7,7 @@@ use BookStack\Settings\SettingService /** * Get the path to a versioned file. + * * @throws Exception */ function versioned_asset(string $file = ''): string @@@ -25,7 -24,6 +25,7 @@@ } $path = $file . '?version=' . urlencode($version) . $additional; + return url($path); } @@@ -66,7 -64,6 +66,7 @@@ function userCan(string $permission, Mo // Check permission on ownable item $permissionService = app(PermissionService::class); + return $permissionService->checkOwnableUserAccess($ownable, $permission); } @@@ -77,13 -74,11 +77,13 @@@ function userCanOnAny(string $permission, string $entityClass = null): bool { $permissionService = app(PermissionService::class); + return $permissionService->checkUserHasPermissionOnAnything($permission, $entityClass); } /** * Helper to access system settings. + * * @return mixed|SettingService */ function setting(string $key = null, $default = null) @@@ -99,16 -94,18 +99,18 @@@ /** * Get a path to a theme resource. + * Returns null if a theme is not configured and + * therefore a full path is not available for use. */ - function theme_path(string $path = ''): string + function theme_path(string $path = ''): ?string { $theme = config('view.theme'); if (!$theme) { - return ''; + return null; } - return base_path('themes/' . $theme .($path ? DIRECTORY_SEPARATOR.$path : $path)); + return base_path('themes/' . $theme . ($path ? DIRECTORY_SEPARATOR . $path : $path)); } /** @@@ -127,7 -124,7 +129,7 @@@ function icon(string $name, array $attr ], $attrs); $attrString = ' '; foreach ($attrs as $attrName => $attr) { - $attrString .= $attrName . '="' . $attr . '" '; + $attrString .= $attrName . '="' . $attr . '" '; } $iconPath = resource_path('icons/' . $name . '.svg'); @@@ -135,12 -132,11 +137,12 @@@ if ($themeIconPath && file_exists($themeIconPath)) { $iconPath = $themeIconPath; - } else if (!file_exists($iconPath)) { + } elseif (!file_exists($iconPath)) { return ''; } $fileContents = file_get_contents($iconPath); + return str_replace('=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "bin": [ - "bin/phpcs", - "bin/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", - "keywords": [ - "phpcs", - "standards" - ], - "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" - }, - "time": "2021-04-09T00:54:41+00:00" - }, { "name": "symfony/dom-crawler", "version": "v4.4.25", @@@ -9555,16 -9522,16 +9555,16 @@@ }, { "name": "symfony/filesystem", - "version": "v5.3.0", + "version": "v5.3.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "348116319d7fb7d1faa781d26a48922428013eb2" + "reference": "19b71c8f313b411172dd5f470fd61f24466d79a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/348116319d7fb7d1faa781d26a48922428013eb2", - "reference": "348116319d7fb7d1faa781d26a48922428013eb2", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/19b71c8f313b411172dd5f470fd61f24466d79a9", + "reference": "19b71c8f313b411172dd5f470fd61f24466d79a9", "shasum": "" }, "require": { @@@ -9597,7 -9564,7 +9597,7 @@@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.3.0" + "source": "https://github.com/symfony/filesystem/tree/v5.3.3" }, "funding": [ { @@@ -9613,7 -9580,7 +9613,7 @@@ "type": "tidelift" } ], - "time": "2021-05-26T17:43:10+00:00" + "time": "2021-06-30T07:27:52+00:00" }, { "name": "theseer/tokenizer",