diff --git a/web/skins/classic/views/files.php b/web/skins/classic/views/files.php index df566e375d..6a27237f95 100644 --- a/web/skins/classic/views/files.php +++ b/web/skins/classic/views/files.php @@ -23,23 +23,34 @@ return; } -$path = (!empty($_REQUEST['path'])) ? detaintPathAllowAbsolute($_REQUEST['path']) : ZM_DIR_EVENTS; +$storage_areas = ZM\Storage::find(); $is_ok_path = false; -foreach (ZM\Storage::find() as $storage) { - $rc = strstr($path, $storage->Path(), true); - ZM\Debug("rc from strstr ($rc) $path ".$storage->Path()); - if ((false !== $rc) and ($rc == '')) { - # Must be at the beginning - $is_ok_path = true; +$path = (!empty($_REQUEST['path'])) ? detaintPathAllowAbsolute($_REQUEST['path']) : ''; +if (!$path) { + if (count($storage_areas)==0) { + $path = ZM_DIR_EVENTS; + } else if (count($storage_areas)==0) { + $path = $storage_areas[0]->Path(); } } -$path_parts = pathinfo($path); -if (@is_file($path)) { - if (output_file($path)) - return; - $path = $path_parts['dirname']; -} +if ($path) { + foreach ($storage_areas as $storage) { + $rc = strstr($path, $storage->Path(), true); + if ((false !== $rc) and ($rc == '')) { + # Must be at the beginning + $is_ok_path = true; + } + } + $path_parts = pathinfo($path); + + if (@is_file($path)) { + if (output_file($path)) + return; + $path = $path_parts['dirname']; + } +} # end if path + $show_hidden = isset($_REQUEST['show_hidden']) ? $_REQUEST['show_hidden'] : 0; function guess_material_icon($file) { @@ -63,24 +74,30 @@ function guess_material_icon($file) {
@@ -135,9 +156,6 @@ function guess_material_icon($file) { ?> |