summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2013-07-08 17:59:50 +0200
committerBart Visscher <bartv@thisnet.nl>2013-07-08 17:59:50 +0200
commit52553c64ed59f4a30ad42586abd8e06a8446ecd9 (patch)
tree902e6debac03494ba7c426afa5db96909d3da690 /lib/public
parent492a35737c634fee27b0eb9d3ea6425bc6d98396 (diff)
parent02d2e41e04735e91c94864a98c5eed89b6ceb7f7 (diff)
downloadnextcloud-server-52553c64ed59f4a30ad42586abd8e06a8446ecd9.tar.gz
nextcloud-server-52553c64ed59f4a30ad42586abd8e06a8446ecd9.zip
Merge branch 'master' into convert-oc_config
Conflicts: lib/config.php
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/share.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index de7025d7b15..7ae0ffe0bfd 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -292,6 +292,29 @@ class Share {
}
/**
+ * @brief resolves reshares down to the last real share
+ * @param $linkItem
+ * @return $fileOwner
+ */
+ public static function resolveReShare($linkItem)
+ {
+ if (isset($linkItem['parent'])) {
+ $parent = $linkItem['parent'];
+ while (isset($parent)) {
+ $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `id` = ?', 1);
+ $item = $query->execute(array($parent))->fetchRow();
+ if (isset($item['parent'])) {
+ $parent = $item['parent'];
+ } else {
+ return $item;
+ }
+ }
+ }
+ return $linkItem;
+ }
+
+
+ /**
* @brief Get the shared items of item type owned by the current user
* @param string Item type
* @param int Format (optional) Format type must be defined by the backend
@@ -312,7 +335,7 @@ class Share {
* @return Return depends on format
*/
public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE,
- $parameters = null, $includeCollections = false) {
+ $parameters = null, $includeCollections = false) {
return self::getItems($itemType, $itemSource, null, null, \OC_User::getUser(), $format,
$parameters, -1, $includeCollections);
}