diff --git a/core/js/share.js b/core/js/share.js index 9ba35616a4..b7821ce14b 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -25,7 +25,7 @@ OC.Share={ if (result && result.status === 'success') { OC.Share.item = result.data; } - }}); + }); }, share:function(itemType, shareType, shareWith, permissions, callback) { $.post(OC.filePath('core', 'ajax', 'share.php'), { action: 'share', itemType: itemType, shareType: shareType, shareWith: shareWith, permissions: permissions }, function(result) { diff --git a/lib/public/share.php b/lib/public/share.php index b77a986f44..0ba4cefad9 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -355,8 +355,9 @@ class Share { * @return array */ private static function getParentItemTypes($itemType) { + $backendTypes = array_keys(self::$backends); $parents = array($itemType); - foreach (self::$backendTypes as $type => $backend) { + foreach ($backendTypes as $type => $backend) { if (in_array($backend->dependsOn, $parents)) { $parents[] = $type; } @@ -497,7 +498,8 @@ class Share { // Check file extension for an equivalent item type to convert to if ($itemType == 'file') { $extension = strtolower(substr($item, strrpos($item, '.') + 1)); - foreach (self::$backendTypes as $type => $backend) { + $backendTypes = array_keys(self::$backends); + foreach ($backendTypes as $type => $backend) { if (isset($backend['dependsOn']) && $backend['dependsOn'] == 'file' && isset($backend['supportedFileExtensions']) && in_array($extension, $backend['supportedFileExtensions'])) { $itemType = $type; break;