diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-07-23 16:42:33 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-07-28 17:28:34 +0200 |
commit | 2e28b7fff982aff352f82bafa1e2cf4ec23956ff (patch) | |
tree | e689e119efca71276bc1325e802e0c73b525edaa /core/ajax | |
parent | 1831ae9c9bf212149ab4b1a9f2fa1c1fd2604164 (diff) | |
download | nextcloud-server-2e28b7fff982aff352f82bafa1e2cf4ec23956ff.tar.gz nextcloud-server-2e28b7fff982aff352f82bafa1e2cf4ec23956ff.zip |
add OCS api call to set expire date for link shares
Diffstat (limited to 'core/ajax')
-rw-r--r-- | core/ajax/share.php | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php index be72e36541a..4b5a6cd664f 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -80,18 +80,12 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo break; case 'setExpirationDate': if (isset($_POST['date'])) { - $l = OC_L10N::get('core'); - $date = new \DateTime($_POST['date']); - $today = new \DateTime('now'); - - - - if ($date < $today) { - OC_JSON::error(array('data' => array('message' => $l->t('Expiration date is in the past.')))); - return; + try { + $return = OCP\Share::setExpirationDate($_POST['itemType'], $_POST['itemSource'], $_POST['date']); + ($return) ? OC_JSON::success() : OC_JSON::error(); + } catch (\Exception $e) { + OC_JSON::error(array('data' => array('message' => $e->getMessage()))); } - $return = OCP\Share::setExpirationDate($_POST['itemType'], $_POST['itemSource'], $_POST['date']); - ($return) ? OC_JSON::success() : OC_JSON::error(); } break; case 'informRecipients': |