diff options
Diffstat (limited to 'core/ajax')
-rw-r--r-- | core/ajax/preview.php | 40 | ||||
-rw-r--r-- | core/ajax/share.php | 11 |
2 files changed, 45 insertions, 6 deletions
diff --git a/core/ajax/preview.php b/core/ajax/preview.php new file mode 100644 index 00000000000..af0f0493f4c --- /dev/null +++ b/core/ajax/preview.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ +\OC_Util::checkLoggedIn(); + +$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : ''; +$maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36'; +$maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36'; +$scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; + +if($file === '') { + //400 Bad Request + \OC_Response::setStatus(400); + \OC_Log::write('core-preview', 'No file parameter was passed', \OC_Log::DEBUG); + exit; +} + +if($maxX === 0 || $maxY === 0) { + //400 Bad Request + \OC_Response::setStatus(400); + \OC_Log::write('core-preview', 'x and/or y set to 0', \OC_Log::DEBUG); + exit; +} + +try{ + $preview = new \OC\Preview(\OC_User::getUser(), 'files'); + $preview->setFile($file); + $preview->setMaxX($maxX); + $preview->setMaxY($maxY); + $preview->setScalingUp($scalingUp); + + $preview->show(); +}catch(\Exception $e) { + \OC_Response::setStatus(500); + \OC_Log::write('core', $e->getmessage(), \OC_Log::DEBUG); +}
\ No newline at end of file diff --git a/core/ajax/share.php b/core/ajax/share.php index 8b5191e6550..1e954ac4f9d 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -265,10 +265,10 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo // } // } // } + $groups = OC_Group::getGroups($_GET['search']); if ($sharePolicy == 'groups_only') { - $groups = OC_Group::getUserGroups(OC_User::getUser()); - } else { - $groups = OC_Group::getGroups(); + $usergroups = OC_Group::getUserGroups(OC_User::getUser()); + $groups = array_intersect($groups, $usergroups); } $count = 0; $users = array(); @@ -303,11 +303,10 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo foreach ($groups as $group) { if ($count < 15) { - if (stripos($group, $_GET['search']) !== false - && (!isset($_GET['itemShares']) + if (!isset($_GET['itemShares']) || !isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) - || !in_array($group, $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]))) { + || !in_array($group, $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])) { $shareWith[] = array( 'label' => $group.' ('.$l->t('group').')', 'value' => array( |