summaryrefslogtreecommitdiffstats
path: root/core/ajax
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-07-23 16:42:33 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-07-28 17:28:34 +0200
commit2e28b7fff982aff352f82bafa1e2cf4ec23956ff (patch)
treee689e119efca71276bc1325e802e0c73b525edaa /core/ajax
parent1831ae9c9bf212149ab4b1a9f2fa1c1fd2604164 (diff)
downloadnextcloud-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.php16
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':