aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/ajax
diff options
context:
space:
mode:
authorMichael Gapczynski <GapczynskiM@gmail.com>2011-08-12 17:22:32 -0400
committerMichael Gapczynski <GapczynskiM@gmail.com>2011-08-12 17:22:32 -0400
commit497789cdd89b4a44844fa8409115dda745ff8c5b (patch)
tree3e9bb5e6e4e5177573f44823dcdc4263257abe0f /apps/files_sharing/ajax
parenta8e6be601698622753bc948924c4ef564ffccaaa (diff)
downloadnextcloud-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.php9
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