From 18cc6c11b51b94ef0e2be55a0cf11de920b87870 Mon Sep 17 00:00:00 2001 From: Karel Hink Date: Fri, 30 Jul 2021 19:28:52 +0000 Subject: [PATCH] Fix Lots of Error: file_exists(): open_basedir restriction in effect. in Log Signed-off-by: Karel Hink --- lib/private/Route/Router.php | 5 +++-- lib/private/Template/Base.php | 2 +- lib/private/Template/IconsCacher.php | 5 ++++- lib/private/Template/ResourceLocator.php | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php index 0bccb8190cd2b..fcde8f088971d 100644 --- a/lib/private/Route/Router.php +++ b/lib/private/Route/Router.php @@ -130,8 +130,9 @@ public function loadRoutes($app = null) { if (isset($this->loadedApps[$app])) { return; } - $file = \OC_App::getAppPath($app) . '/appinfo/routes.php'; - if ($file !== false && file_exists($file)) { + $appPath = \OC_App::getAppPath($app); + $file = $appPath . '/appinfo/routes.php'; + if ($appPath !== false && file_exists($file)) { $routingFiles = [$app => $file]; } else { $routingFiles = []; diff --git a/lib/private/Template/Base.php b/lib/private/Template/Base.php index 2087f5f8ed9af..2de8c7ad5b18c 100644 --- a/lib/private/Template/Base.php +++ b/lib/private/Template/Base.php @@ -65,7 +65,7 @@ public function __construct($template, $requestToken, $l10n, $theme) { */ protected function getAppTemplateDirs($theme, $app, $serverRoot, $app_dir) { // Check if the app is in the app folder or in the root - if (file_exists($app_dir.'/templates/')) { + if ($app_dir !== false && file_exists($app_dir.'/templates/')) { return [ $serverRoot.'/themes/'.$theme.'/apps/'.$app.'/templates/', $app_dir.'/templates/', diff --git a/lib/private/Template/IconsCacher.php b/lib/private/Template/IconsCacher.php index e379a8ed92de3..01500aa2e9c4d 100644 --- a/lib/private/Template/IconsCacher.php +++ b/lib/private/Template/IconsCacher.php @@ -170,7 +170,10 @@ private function parseUrl($url): array { } elseif (\strpos($url, $base) === 0) { if (\preg_match('/([A-z0-9\_\-]+)\/([a-zA-Z0-9-_\~\/\.\=\:\;\+\,]+)\?color=([0-9a-fA-F]{3,6})/', $cleanUrl, $matches)) { [,$app,$cleanUrl, $color] = $matches; - $location = \OC_App::getAppPath($app) . '/img/' . $cleanUrl . '.svg'; + $appPath = \OC_App::getAppPath($app); + if ($appPath !== false) { + $location = $appPath . '/img/' . $cleanUrl . '.svg'; + } if ($app === 'settings') { $location = \OC::$SERVERROOT . '/settings/img/' . $cleanUrl . '.svg'; } diff --git a/lib/private/Template/ResourceLocator.php b/lib/private/Template/ResourceLocator.php index 3f3299e2e8446..3ca342599071a 100755 --- a/lib/private/Template/ResourceLocator.php +++ b/lib/private/Template/ResourceLocator.php @@ -102,7 +102,7 @@ public function find($resources) { * @return bool True if the resource was found, false otherwise */ protected function appendIfExist($root, $file, $webRoot = null) { - if (is_file($root.'/'.$file)) { + if ($root !== false && is_file($root.'/'.$file)) { $this->append($root, $file, $webRoot, false); return true; }