diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-24 18:41:36 -0400 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-24 18:41:36 -0400 |
commit | 8c8490b28eb0d6ce5b0405e620eb9a9660f8c542 (patch) | |
tree | b5818aa9cfefc5e197270483915613c751a44aad | |
parent | e0ff57e8c2958ae5dde0cb7bf9b167abd5ef933e (diff) | |
download | nextcloud-server-8c8490b28eb0d6ce5b0405e620eb9a9660f8c542.tar.gz nextcloud-server-8c8490b28eb0d6ce5b0405e620eb9a9660f8c542.zip |
Show users shared with in the drop down for reshared files
-rw-r--r-- | apps/files_sharing/ajax/getitem.php | 13 | ||||
-rw-r--r-- | apps/files_sharing/ajax/share.php | 7 | ||||
-rw-r--r-- | apps/files_sharing/lib_share.php | 9 |
3 files changed, 17 insertions, 12 deletions
diff --git a/apps/files_sharing/ajax/getitem.php b/apps/files_sharing/ajax/getitem.php index cdb59b9cd1b..249af6cfa31 100644 --- a/apps/files_sharing/ajax/getitem.php +++ b/apps/files_sharing/ajax/getitem.php @@ -6,17 +6,18 @@ require_once('../lib_share.php'); $userDirectory = "/".OC_User::getUser()."/files"; $source = $userDirectory.$_GET['source']; -$users = OC_Share::getMySharedItem($source); $path = $source; -for ($i = 0; $i < count($users); $i++) { - if ($users[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) { - $users[$i]['token'] = OC_Share::getTokenFromSource($source); +if ($users = OC_Share::getMySharedItem($source)) { + for ($i = 0; $i < count($users); $i++) { + if ($users[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) { + $users[$i]['token'] = OC_Share::getTokenFromSource($source); + } } } $source = dirname($source); while ($source != "" && $source != "/" && $source != "." && $source != $userDirectory) { - $values = array_values(OC_Share::getMySharedItem($source)); - if (count($values) > 0) { + if ($values = OC_Share::getMySharedItem($source)) { + $values = array_values($values); $parentUsers = array(); for ($i = 0; $i < count($values); $i++) { if ($values[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) { diff --git a/apps/files_sharing/ajax/share.php b/apps/files_sharing/ajax/share.php index cff0acf3323..e672cf02403 100644 --- a/apps/files_sharing/ajax/share.php +++ b/apps/files_sharing/ajax/share.php @@ -13,11 +13,8 @@ foreach ($sources as $source) { if ($source && OC_FILESYSTEM::file_exists($source) && OC_FILESYSTEM::is_readable($source)) { $source = $userDirectory.$source; // If the file doesn't exist, it may be shared with the current user - } else { - $source = OC_Share::getSource($userDirectory.$source); - if (!$source) { - echo "false"; - } + } else if (!$source = OC_Share::getSource($userDirectory.$source)) { + echo "false"; } try { $shared = new OC_Share($source, $uid_shared_with, $permissions); diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php index c862f505e42..978847f4a8f 100644 --- a/apps/files_sharing/lib_share.php +++ b/apps/files_sharing/lib_share.php @@ -176,7 +176,14 @@ class OC_Share { public static function getMySharedItem($source) { $source = self::cleanPath($source); $query = OC_DB::prepare("SELECT uid_shared_with, permissions FROM *PREFIX*sharing WHERE source = ? AND uid_owner = ?"); - return $query->execute(array($source, OC_User::getUser()))->fetchAll(); + $result = $query->execute(array($source, OC_User::getUser()))->fetchAll(); + if (count($result) > 0) { + return $result; + } else if ($originalSource = self::getSource($source)) { + return $query->execute(array($originalSource, OC_User::getUser()))->fetchAll(); + } else { + return false; + } } /** |