Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/ajax/share.php')
-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':