summaryrefslogtreecommitdiffstats
path: root/core/ajax
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-09-02 14:41:46 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2013-09-02 14:41:46 +0200
commitb918c06be60eea9edde26b05621898627c71130d (patch)
treef16cbad18677ee2f3262474f5668603adf52896e /core/ajax
parent4bbefdf608fdf930fa6fd1f783d6f58267752394 (diff)
parent06870a6e390f68d741893b4454b8fe4063404ca8 (diff)
downloadnextcloud-server-b918c06be60eea9edde26b05621898627c71130d.tar.gz
nextcloud-server-b918c06be60eea9edde26b05621898627c71130d.zip
Merge branch 'master' into sharing_mail_notification_master
Conflicts: lib/util.php
Diffstat (limited to 'core/ajax')
-rw-r--r--core/ajax/preview.php40
-rw-r--r--core/ajax/share.php11
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(