summaryrefslogtreecommitdiffstats
path: root/core/ajax
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-03-19 15:53:08 +0100
committerVincent Petry <pvince81@owncloud.com>2014-03-19 15:53:08 +0100
commit6252c248c23661beef6484cf1ffa24db406e28ae (patch)
tree724a05b26de55b6325448f49e05bb4f58cd0fc8f /core/ajax
parent4f95adfb7680deafa8dba60ecd138f049afdc673 (diff)
parent7ab2632085440d3e792b4ccca3c527d26f10cad2 (diff)
downloadnextcloud-server-6252c248c23661beef6484cf1ffa24db406e28ae.tar.gz
nextcloud-server-6252c248c23661beef6484cf1ffa24db406e28ae.zip
Merge pull request #7557 from owncloud/issue/7297
Do not allow setting an expiration date in the past
Diffstat (limited to 'core/ajax')
-rw-r--r--core/ajax/share.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index ca1951ec9ae..3f04e1e4ad1 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -80,6 +80,14 @@ 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;
+ }
$return = OCP\Share::setExpirationDate($_POST['itemType'], $_POST['itemSource'], $_POST['date']);
($return) ? OC_JSON::success() : OC_JSON::error();
}