From bd8ba08bc3aabfa4fa56eedce78bbe41163ca158 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 8 Apr 2009 09:54:13 +0000 Subject: [PATCH] allowing stream-wrappers to specify an other mime-type for directories --- etemplate/inc/class.vfs_widget.inc.php | 2 +- phpgwapi/inc/class.vfs_stream_wrapper.inc.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/etemplate/inc/class.vfs_widget.inc.php b/etemplate/inc/class.vfs_widget.inc.php index 9d622b8f55..cc1339c678 100644 --- a/etemplate/inc/class.vfs_widget.inc.php +++ b/etemplate/inc/class.vfs_widget.inc.php @@ -152,7 +152,7 @@ class vfs_widget } if (egw_vfs::check_access($path,egw_vfs::READABLE)) // show link only if we have access to the file or dir { - if ($n < count($comps)-1 || $mime == egw_vfs::DIR_MIME_TYPE) + if ($n < count($comps)-1 || $mime == egw_vfs::DIR_MIME_TYPE || egw_vfs::is_dir($path)) { $value['l'.$n] = '/index.php?menuaction=filemanager.filemanager_ui.index&path='.urlencode($path); $target = ''; diff --git a/phpgwapi/inc/class.vfs_stream_wrapper.inc.php b/phpgwapi/inc/class.vfs_stream_wrapper.inc.php index e2343188fb..3b53a6175f 100644 --- a/phpgwapi/inc/class.vfs_stream_wrapper.inc.php +++ b/phpgwapi/inc/class.vfs_stream_wrapper.inc.php @@ -595,11 +595,7 @@ class vfs_stream_wrapper implements iface_stream_wrapper { return false; } - if (is_dir($url)) - { - $mime = self::DIR_MIME_TYPE; - } - if (!$mime && ($scheme = parse_url($url,PHP_URL_SCHEME))) + if (($scheme = parse_url($url,PHP_URL_SCHEME))) { // check it it's an eGW stream wrapper returning mime-type via url_stat if (class_exists($class = self::scheme2class($scheme)) && ($mime_attr = @constant($class.'::STAT_RETURN_MIME_TYPE'))) @@ -611,6 +607,10 @@ class vfs_stream_wrapper implements iface_stream_wrapper } } } + if (!$mime && is_dir($url)) + { + $mime = self::DIR_MIME_TYPE; + } // if we operate on the regular filesystem and the mime_content_type function is available --> use it if (!$mime && !$scheme && function_exists('mime_content_type')) {