aboutsummaryrefslogtreecommitdiffstats
path: root/core/ajax/share.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-11-30 00:18:42 +0100
committerRobin Appelman <icewind@owncloud.com>2012-11-30 00:18:42 +0100
commitd33f697a5f3438f286ba3abe63255b6797a6fc03 (patch)
tree3bde00fb82540d9a44d0cfe97b41a7c6ecc668d3 /core/ajax/share.php
parenta609992a75d1dad15398f55e22ad2244c78650dc (diff)
parent9b709fa95df5b93b9fb05e33158122003891c154 (diff)
downloadnextcloud-server-d33f697a5f3438f286ba3abe63255b6797a6fc03.tar.gz
nextcloud-server-d33f697a5f3438f286ba3abe63255b6797a6fc03.zip
merge master into filesystem
Diffstat (limited to 'core/ajax/share.php')
-rw-r--r--core/ajax/share.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index efe01dff886..41832a3c659 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -28,13 +28,19 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
case 'share':
if (isset($_POST['shareType']) && isset($_POST['shareWith']) && isset($_POST['permissions'])) {
try {
- if ((int)$_POST['shareType'] === OCP\Share::SHARE_TYPE_LINK && $_POST['shareWith'] == '') {
+ $shareType = (int)$_POST['shareType'];
+ $shareWith = $_POST['shareWith'];
+ if ($shareType === OCP\Share::SHARE_TYPE_LINK && $shareWith == '') {
$shareWith = null;
+ }
+
+ $token = OCP\Share::shareItem($_POST['itemType'], $_POST['itemSource'], $shareType, $shareWith, $_POST['permissions']);
+
+ if (is_string($token)) {
+ OC_JSON::success(array('data' => array('token' => $token)));
} else {
- $shareWith = $_POST['shareWith'];
+ OC_JSON::success();
}
- OCP\Share::shareItem($_POST['itemType'], $_POST['itemSource'], (int)$_POST['shareType'], $shareWith, $_POST['permissions']);
- OC_JSON::success();
} catch (Exception $exception) {
OC_JSON::error(array('data' => array('message' => $exception->getMessage())));
}