Forgot I got rid of the class field backendTypes, use the array keys of the backends field instead

This commit is contained in:
Michael Gapczynski 2012-06-24 19:25:41 -04:00 committed by Bart Visscher
parent bc68f14c4b
commit f21fdf14f9
2 changed files with 5 additions and 3 deletions

View File

@ -25,7 +25,7 @@ OC.Share={
if (result && result.status === 'success') { if (result && result.status === 'success') {
OC.Share.item = result.data; OC.Share.item = result.data;
} }
}}); });
}, },
share:function(itemType, shareType, shareWith, permissions, callback) { 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) { $.post(OC.filePath('core', 'ajax', 'share.php'), { action: 'share', itemType: itemType, shareType: shareType, shareWith: shareWith, permissions: permissions }, function(result) {

View File

@ -355,8 +355,9 @@ class Share {
* @return array * @return array
*/ */
private static function getParentItemTypes($itemType) { private static function getParentItemTypes($itemType) {
$backendTypes = array_keys(self::$backends);
$parents = array($itemType); $parents = array($itemType);
foreach (self::$backendTypes as $type => $backend) { foreach ($backendTypes as $type => $backend) {
if (in_array($backend->dependsOn, $parents)) { if (in_array($backend->dependsOn, $parents)) {
$parents[] = $type; $parents[] = $type;
} }
@ -497,7 +498,8 @@ class Share {
// Check file extension for an equivalent item type to convert to // Check file extension for an equivalent item type to convert to
if ($itemType == 'file') { if ($itemType == 'file') {
$extension = strtolower(substr($item, strrpos($item, '.') + 1)); $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'])) { if (isset($backend['dependsOn']) && $backend['dependsOn'] == 'file' && isset($backend['supportedFileExtensions']) && in_array($extension, $backend['supportedFileExtensions'])) {
$itemType = $type; $itemType = $type;
break; break;