diff --git a/api/src/Framework.php b/api/src/Framework.php index 8b5ec52bec..b56a950ae0 100644 --- a/api/src/Framework.php +++ b/api/src/Framework.php @@ -1510,7 +1510,7 @@ abstract class Framework extends Framework\Extra static function includeJS($package, $file=null, $app='api', $append=true) { // prefer app.min.js over old, pre RollupJS app.js - if ($package[0] === '/' && substr($package, -7) === '/app.js' && + if ($package && $package[0] === '/' && substr($package, -7) === '/app.js' && self::$js_include_mgr->include_js_file(substr($package, 0, -3).'.min.js', $file, $app, $append) || $file === 'app' && self::$js_include_mgr->include_js_file($package, 'app.min', $app, $append)) { diff --git a/api/src/Framework/IncludeMgr.php b/api/src/Framework/IncludeMgr.php index bc665ff07d..a803d98055 100644 --- a/api/src/Framework/IncludeMgr.php +++ b/api/src/Framework/IncludeMgr.php @@ -314,10 +314,10 @@ class IncludeMgr */ private function translate_params($package, $file=null, $app='api') { - if ($package[0] == '/' && is_readable(EGW_SERVER_ROOT.parse_url($path = $package, PHP_URL_PATH)) || + if ($package && $package[0] == '/' && is_readable(EGW_SERVER_ROOT.parse_url($path = $package, PHP_URL_PATH)) || // fix old /phpgwapi/js/ path by replacing it with /api/js/ substr($package, 0, 13) == '/phpgwapi/js/' && is_readable(EGW_SERVER_ROOT.parse_url($path = str_replace('/phpgwapi/js/', '/api/js/', $package), PHP_URL_PATH)) || - $package[0] == '/' && is_readable(EGW_SERVER_ROOT.($path = $package)) || + $package && $package[0] == '/' && is_readable(EGW_SERVER_ROOT.($path = $package)) || $package == '.' && is_readable(EGW_SERVER_ROOT.($path="/$app/js/$file.js")) || is_readable(EGW_SERVER_ROOT.($path="/$app/js/$package/$file.js")) || // fix not found by using app='api' @@ -325,7 +325,7 @@ class IncludeMgr $app != 'phpgwapi' && is_readable(EGW_SERVER_ROOT.($path="/phpgwapi/js/$package/$file.js"))) { // normalise /./ to / - $path = str_replace('/./', '/', $path); + $path = str_replace(['/./', '//'], '/', $path); // Handle the special case, that the file is an url - in this case // we will do no further processing but just include the file @@ -481,4 +481,4 @@ if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE_ } } echo "\n\n"; -} +} \ No newline at end of file