summaryrefslogtreecommitdiffstats
path: root/core/ajax
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-02-09 09:42:06 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-02-09 09:42:06 +0100
commit5f3a91536dbf2f2cd42dba452d69e6b0b5e45b76 (patch)
treef8e58d2f6ac6e2e3c478e04faf7c3d4881170041 /core/ajax
parent75bbd4f8b64209eaf120f1382d7cec6286e68c84 (diff)
downloadnextcloud-server-5f3a91536dbf2f2cd42dba452d69e6b0b5e45b76.tar.gz
nextcloud-server-5f3a91536dbf2f2cd42dba452d69e6b0b5e45b76.zip
Remove modifying calls in ajax/share.php
Those calls used the old sharing endpoint that created incompatible shares. Which eventually would lead to some weird bugs.
Diffstat (limited to 'core/ajax')
-rw-r--r--core/ajax/share.php86
1 files changed, 0 insertions, 86 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index cd4144bc6a7..987b637cc97 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -43,92 +43,6 @@ $defaults = new \OCP\Defaults();
if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSource'])) {
switch ($_POST['action']) {
- case 'share':
- if (isset($_POST['shareType']) && isset($_POST['shareWith']) && isset($_POST['permissions'])) {
- try {
- $shareType = (int)$_POST['shareType'];
- $shareWith = $_POST['shareWith'];
- $itemSourceName = isset($_POST['itemSourceName']) ? (string)$_POST['itemSourceName'] : null;
-
- /*
- * Nasty nasty fix for https://github.com/owncloud/core/issues/19950
- */
- $passwordChanged = null;
- if (is_array($shareWith)) {
- $passwordChanged = ($shareWith['passwordChanged'] === 'true');
- if ($shareType === OCP\Share::SHARE_TYPE_LINK && $shareWith['password'] === '') {
- $shareWith = null;
- } else {
- $shareWith = $shareWith['password'];
- }
- } else {
- /*
- * We need this branch since the calendar and contacts also use this
- * endpoint
- */
- if ($shareType === OCP\Share::SHARE_TYPE_LINK && $shareWith === '') {
- $shareWith = null;
- }
- }
-
- $itemSourceName=(isset($_POST['itemSourceName'])) ? (string)$_POST['itemSourceName']:'';
-
- $token = OCP\Share::shareItem(
- $_POST['itemType'],
- $_POST['itemSource'],
- $shareType,
- $shareWith,
- $_POST['permissions'],
- $itemSourceName,
- (!empty($_POST['expirationDate']) ? new \DateTime((string)$_POST['expirationDate']) : null),
- $passwordChanged
- );
-
- if (is_string($token)) {
- OC_JSON::success(array('data' => array('token' => $token)));
- } else {
- OC_JSON::success();
- }
- } catch (\OC\HintException $exception) {
- OC_JSON::error(array('data' => array('message' => $exception->getHint())));
- } catch (Exception $exception) {
- OC_JSON::error(array('data' => array('message' => $exception->getMessage())));
- }
- }
- break;
- case 'unshare':
- if (isset($_POST['shareType']) && isset($_POST['shareWith'])) {
- if ((int)$_POST['shareType'] === OCP\Share::SHARE_TYPE_LINK && $_POST['shareWith'] == '') {
- $shareWith = null;
- } else {
- $shareWith = (string)$_POST['shareWith'];
- }
- $return = OCP\Share::unshare((string)$_POST['itemType'],(string) $_POST['itemSource'], (int)$_POST['shareType'], $shareWith);
- ($return) ? OC_JSON::success() : OC_JSON::error();
- }
- break;
- case 'setPermissions':
- if (isset($_POST['shareType']) && isset($_POST['shareWith']) && isset($_POST['permissions'])) {
- $return = OCP\Share::setPermissions(
- (string)$_POST['itemType'],
- (string)$_POST['itemSource'],
- (int)$_POST['shareType'],
- (string)$_POST['shareWith'],
- (int)$_POST['permissions']
- );
- ($return) ? OC_JSON::success() : OC_JSON::error();
- }
- break;
- case 'setExpirationDate':
- if (isset($_POST['date'])) {
- try {
- $return = OCP\Share::setExpirationDate((string)$_POST['itemType'], (string)$_POST['itemSource'], (string)$_POST['date']);
- ($return) ? OC_JSON::success() : OC_JSON::error();
- } catch (\Exception $e) {
- OC_JSON::error(array('data' => array('message' => $e->getMessage())));
- }
- }
- break;
case 'informRecipients':
$l = \OC::$server->getL10N('core');
$shareType = (int) $_POST['shareType'];