diff options
author | Björn Schießle <schiessle@owncloud.com> | 2014-07-28 17:28:32 +0200 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2014-07-28 17:28:32 +0200 |
commit | c53b56e3139e517af4bca2aca631f625f435f74e (patch) | |
tree | faea592fb96f60e69036bb43e7ccba2d35a808f8 /core | |
parent | 1fbbaed26149cd2261637e5a737b22089340345b (diff) | |
parent | b7958f79c39b78304daa19ece96072acec50c2ba (diff) | |
download | nextcloud-server-c53b56e3139e517af4bca2aca631f625f435f74e.tar.gz nextcloud-server-c53b56e3139e517af4bca2aca631f625f435f74e.zip |
Merge pull request #9798 from owncloud/ocs_share_api_add_expire_date
[share api] 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': |