diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-12 17:22:32 -0400 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-12 17:22:32 -0400 |
commit | 497789cdd89b4a44844fa8409115dda745ff8c5b (patch) | |
tree | 3e9bb5e6e4e5177573f44823dcdc4263257abe0f /apps/files_sharing/ajax | |
parent | a8e6be601698622753bc948924c4ef564ffccaaa (diff) | |
download | nextcloud-server-497789cdd89b4a44844fa8409115dda745ff8c5b.tar.gz nextcloud-server-497789cdd89b4a44844fa8409115dda745ff8c5b.zip |
Clean up constructor for OC_Share, add some error handling for sharing files
Diffstat (limited to 'apps/files_sharing/ajax')
-rw-r--r-- | apps/files_sharing/ajax/share.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/files_sharing/ajax/share.php b/apps/files_sharing/ajax/share.php index 10a235e4323..f0166f391db 100644 --- a/apps/files_sharing/ajax/share.php +++ b/apps/files_sharing/ajax/share.php @@ -8,7 +8,14 @@ $sources = explode(";", $_POST['sources']); $uid_shared_with = $_POST['uid_shared_with']; $permissions = $_POST['permissions']; foreach ($sources as $source) { - new OC_Share($source, $uid_shared_with, $permissions); + if ($source && OC_FILESYSTEM::file_exists($source) && OC_FILESYSTEM::is_readable($source)) { + $source = "/".OC_User::getUser()."/files".$source; + try { + new OC_Share($source, $uid_shared_with, $permissions); + } catch (Exception $exception) { + echo "false"; + } + } } ?>
\ No newline at end of file |