diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-07-23 16:42:33 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-07-25 13:38:18 +0200 |
commit | ecc1f92bb6c7ac3121c35affad607a344a79ef52 (patch) | |
tree | faf5bb913b3750f809cdd6e7a4ab6f835a2dca6e /core | |
parent | 9834e3854201d68fbd5dcbef09122c48cc5bcb10 (diff) | |
download | nextcloud-server-ecc1f92bb6c7ac3121c35affad607a344a79ef52.tar.gz nextcloud-server-ecc1f92bb6c7ac3121c35affad607a344a79ef52.zip |
add OCS api call to set expire date for link shares
Diffstat (limited to 'core')
-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': |