diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-07-23 20:08:05 -0400 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2012-07-23 22:05:53 -0400 |
commit | 7b01e3285e59d8184aae6c1a8de54c742b35fc54 (patch) | |
tree | 5d74b77edb4a1384808571116aea56e037f332cf /apps/files_sharing/lib/share | |
parent | 1ff2dd8f63efdc67302e427601b619da5867d438 (diff) | |
download | nextcloud-server-7b01e3285e59d8184aae6c1a8de54c742b35fc54.tar.gz nextcloud-server-7b01e3285e59d8184aae6c1a8de54c742b35fc54.zip |
Include a few CRUDS permissions checks in shared storage, plus a little clean-up in shared storage
Diffstat (limited to 'apps/files_sharing/lib/share')
-rw-r--r-- | apps/files_sharing/lib/share/file.php | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php index 86b82b19acd..658c42ee327 100644 --- a/apps/files_sharing/lib/share/file.php +++ b/apps/files_sharing/lib/share/file.php @@ -1,3 +1,4 @@ + <?php /** * ownCloud @@ -21,7 +22,7 @@ class OC_Share_Backend_File extends OCP\Share_Backend { - const FORMAT_SOURCE_PATH = 0; + const FORMAT_SHARED_STORAGE = 0; const FORMAT_FILE_APP = 1; const FORMAT_FILE_APP_ROOT = 2; const FORMAT_OPENDIR = 3; @@ -45,6 +46,14 @@ class OC_Share_Backend_File extends OCP\Share_Backend { $files[] = basename($file['file_target']); } return $files; + } else if ($format == self::FORMAT_SHARED_STORAGE) { + $id = $items[key($items)]['file_source']; + $query = OCP\DB::prepare('SELECT path FROM *PREFIX*fscache WHERE id = ?'); + $result = $query->execute(array($id))->fetchAll(); + if (isset($result[0]['path'])) { + return array('path' => $result[0]['path'], 'permissions' => $items[key($items)]['permissions']); + } + return false; } else { $shares = array(); $ids = array(); @@ -53,14 +62,7 @@ class OC_Share_Backend_File extends OCP\Share_Backend { $ids[] = $item['file_source']; } $ids = "'".implode("','", $ids)."'"; - if ($format == self::FORMAT_SOURCE_PATH) { - $query = OCP\DB::prepare('SELECT path FROM *PREFIX*fscache WHERE id IN ('.$ids.')'); - $result = $query->execute()->fetchAll(); - if (isset($result[0]['path'])) { - return $result[0]['path']; - } - return false; - } else if ($format == self::FORMAT_FILE_APP) { + if ($format == self::FORMAT_FILE_APP) { $query = OCP\DB::prepare('SELECT id, path, name, ctime, mtime, mimetype, size, encrypted, versioned, writable FROM *PREFIX*fscache WHERE id IN ('.$ids.')'); $result = $query->execute(); $files = array(); @@ -89,6 +91,4 @@ class OC_Share_Backend_File extends OCP\Share_Backend { return array(); } -} - -?>
\ No newline at end of file +}
\ No newline at end of file |