diff options
author | Wave <wave72@users.noreply.github.com> | 2015-11-25 09:39:44 +0100 |
---|---|---|
committer | Wave <wave72@users.noreply.github.com> | 2015-11-25 09:39:44 +0100 |
commit | 2de65ab39fc704fd8b7abcf9003ee98e3ffb1cc3 (patch) | |
tree | 783f90531c93f498609fb1dbd0e199ca65bb2cc0 /include/RedDAV | |
parent | e785b723aad51d4f7202dbbb24a0e2245428cb5b (diff) | |
parent | 0559db9cf81267c34ca014fef1aebe1cf31de2ab (diff) | |
download | volse-hubzilla-2de65ab39fc704fd8b7abcf9003ee98e3ffb1cc3.tar.gz volse-hubzilla-2de65ab39fc704fd8b7abcf9003ee98e3ffb1cc3.tar.bz2 volse-hubzilla-2de65ab39fc704fd8b7abcf9003ee98e3ffb1cc3.zip |
Merge pull request #3 from redmatrix/master
Update branch
Diffstat (limited to 'include/RedDAV')
-rw-r--r-- | include/RedDAV/RedDirectory.php | 21 | ||||
-rw-r--r-- | include/RedDAV/RedFile.php | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/include/RedDAV/RedDirectory.php b/include/RedDAV/RedDirectory.php index 87bdf8f13..8d8af5bd3 100644 --- a/include/RedDAV/RedDirectory.php +++ b/include/RedDAV/RedDirectory.php @@ -363,6 +363,27 @@ class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota { } /** + * @brief delete directory + */ + + public function delete() { + logger('delete file ' . basename($this->red_path), LOGGER_DEBUG); + + if ((! $this->auth->owner_id) || (! perm_is_allowed($this->auth->owner_id, $this->auth->observer, 'write_storage'))) { + throw new DAV\Exception\Forbidden('Permission denied.'); + } + + if ($this->auth->owner_id !== $this->auth->channel_id) { + if (($this->auth->observer !== $this->data['creator']) || intval($this->data['is_dir'])) { + throw new DAV\Exception\Forbidden('Permission denied.'); + } + } + + attach_delete($this->auth->owner_id, $this->folder_hash); + } + + + /** * @brief Checks if a child exists. * * @param string $name diff --git a/include/RedDAV/RedFile.php b/include/RedDAV/RedFile.php index 2bc3f40e5..3283a6e88 100644 --- a/include/RedDAV/RedFile.php +++ b/include/RedDAV/RedFile.php @@ -127,7 +127,7 @@ class RedFile extends DAV\Node implements DAV\IFile { } $fname = dbunescbin($d[0]['data']); if(strpos($fname,'store') === false) - $f = 'store/' . $this->auth->owner_nick . '/' . (($fname) ? $fname : ''); + $f = 'store/' . $this->auth->owner_nick . '/' . $fname ; else $f = $fname; |