From 5f3a91536dbf2f2cd42dba452d69e6b0b5e45b76 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 9 Feb 2016 09:42:06 +0100 Subject: 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. --- core/ajax/share.php | 86 ----------------------------------------------------- 1 file changed, 86 deletions(-) (limited to 'core/ajax') 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']; -- cgit v1.2.3