diff options
author | friendica <info@friendica.com> | 2013-10-27 18:35:40 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-10-27 18:35:40 -0700 |
commit | c9f51d78605250582002627cf43fc38a4fb03d13 (patch) | |
tree | a71660d81dd9fe30335b101ce5c701db8081d699 /include | |
parent | e2988a025388c5ea023a9e3d42b7cc40fa93f780 (diff) | |
download | volse-hubzilla-c9f51d78605250582002627cf43fc38a4fb03d13.tar.gz volse-hubzilla-c9f51d78605250582002627cf43fc38a4fb03d13.tar.bz2 volse-hubzilla-c9f51d78605250582002627cf43fc38a4fb03d13.zip |
a bit more progress on DAV driver
Diffstat (limited to 'include')
-rw-r--r-- | include/reddav.php | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/include/reddav.php b/include/reddav.php index 64c109784..0f5204314 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -13,6 +13,18 @@ class RedInode implements DAV\INode { function delete() { + if(! perm_is_allowed($this->channel_id,'','view_storage')) + return; + if($this->attach['flags'] & ATTACH_FLAG_OS) { + // FIXME delete physical file + } + if($this->attach['flags'] & ATTACH_FLAG_DIR) { + // FIXME delete contents (recursive?) + } + + q("delete from attach where id = %d limit 1", + intval($this->attach['id']) + ); } @@ -21,8 +33,16 @@ class RedInode implements DAV\INode { } function setName($newName) { + + if((! $newName) || (! perm_is_allowed($this->channel_id,'','view_storage'))) + return; + $this->attach['filename'] = $newName; - // FIXME save the DB record + $r = q("update attach set filename = '%s' where id = %d limit 1", + dbesc($this->attach['filename']), + intval($this->attach['id']) + ); + } function getLastModified() { @@ -66,10 +86,12 @@ abstract class RedDirectory extends DAV\Node implements DAV\ICollection { function getChild($name) { if(! perm_is_allowed($this->channel_id,'','view_storage')) { -//check this throw new DAV\Exception\PermissionDenied('Permission denied.'); + throw new DAV\Exception\Forbidden('Permission denied.'); return; } +// FIXME check revisions + $r = q("select * from attach where folder = '%s' and filename = '%s' and uid = %d limit 1", dbesc($this->dir_key), dbesc($name), @@ -101,7 +123,9 @@ abstract class RedDirectory extends DAV\Node implements DAV\ICollection { dbesc($name), intval($this->channel_id) ); - + if($r) + return true; + return false; } |