HTTP_WebDAV_Server 1.0.0RC6 changes without Server.php changes comming later

This commit is contained in:
Ralf Becker 2011-07-29 10:33:52 +00:00
parent 3112bd98c5
commit 399c835f11
2 changed files with 44 additions and 12 deletions

View File

@ -382,6 +382,19 @@ class egw_vfs extends vfs_stream_wrapper
return true;
}
/**
* Check if file is hidden: name starts with a '.' or is Thumbs.db
*
* @param string $path
* @return boolean
*/
public static function is_hidden($path)
{
$file = self::basename($path);
return $file[0] == '.' || $file == 'Thumbs.db';
}
/**
* find = recursive search over the filesystem
*
@ -481,7 +494,7 @@ class egw_vfs extends vfs_stream_wrapper
{
if ($file == '.' || $file == '..') continue; // ignore current and parent dir!
if (($file[0] == '.' || $file == 'Thumbs.db') && !$options['hidden']) continue; // ignore hidden files
if (self::is_hidden($file) && !$options['hidden']) continue; // ignore hidden files
$file = self::concat($path,$file);

View File

@ -62,16 +62,9 @@ class vfs_webdav_server extends HTTP_WebDAV_Server_Filesystem
// special treatment for litmus compliance test
// reply on its identifier header
// not needed for the test itself but eases debugging
if (function_exists('apache_request_headers'))
{
foreach (apache_request_headers() as $key => $value)
{
if (stristr($key, 'litmus'))
{
error_log("Litmus test $value");
header('X-Litmus-reply: '.$value);
}
}
if (isset($this->_SERVER['HTTP_X_LITMUS'])) {
error_log("Litmus test ".$this->_SERVER['HTTP_X_LITMUS']);
header("X-Litmus-reply: ".$this->_SERVER['HTTP_X_LITMUS']);
}
// let the base class do all the work
HTTP_WebDAV_Server::ServeRequest();
@ -260,6 +253,10 @@ class vfs_webdav_server extends HTTP_WebDAV_Server_Filesystem
$info['props'][] = HTTP_WebDAV_Server::mkprop ('creationdate', filectime($fspath));
$info['props'][] = HTTP_WebDAV_Server::mkprop ('getlastmodified', filemtime($fspath));
// Microsoft extensions: last access time and 'hidden' status
$info["props"][] = HTTP_WebDAV_Server::mkprop("lastaccessed", fileatime($fspath));
$info["props"][] = HTTP_WebDAV_Server::mkprop("ishidden", egw_vfs::is_hidden($fspath));
// type and size (caller already made sure that path exists)
if (is_dir($fspath)) {
// directory (WebDAV collection)
@ -354,6 +351,28 @@ class vfs_webdav_server extends HTTP_WebDAV_Server_Filesystem
return egw_vfs::mime_content_type($path);
}
/**
* Check if path is readable by current user
*
* @param string $fspath
* @return boolean
*/
function _is_readable($fspath)
{
return egw_vfs::is_readable($fspath);
}
/**
* Check if path is writable by current user
*
* @param string $fspath
* @return boolean
*/
function _is_writable($fspath)
{
return egw_vfs::is_writable($fspath);
}
/**
* PROPPATCH method handler
*