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:
authorThomas Müller <thomas.mueller@tmit.eu>2013-10-16 23:30:31 +0400
committerThomas Müller <thomas.mueller@tmit.eu>2013-10-16 23:30:31 +0400
commit9628f5245c996951882e9e774520a6db657a434b (patch)
treee19e4c707804b8e4fdce9a70f5e83e6c312011da /lib/public
parent57ccd50b54a0055422d563ba8297c5e320a4533d (diff)
parent49686dc85c7ccb04625557b9947e66f120646b8f (diff)
Merge pull request #5229 from owncloud/more-link-expiration-stable5
Backport of #4856 to stable5: Fix Sharing "Expiration Date" for Shares of type Link (i.e. Token)
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/share.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index c9807126742..d7569933458 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -293,7 +293,18 @@ class Share {
if (\OC_DB::isError($result)) {
\OC_Log::write('OCP\Share', \OC_DB::getErrorMessage($result) . ', token=' . $token, \OC_Log::ERROR);
}
- return $result->fetchRow();
+ $row = $result->fetchRow();
+
+ if (!empty($row['expiration'])) {
+ $now = new \DateTime();
+ $expirationDate = new \DateTime($row['expiration'], new \DateTimeZone('UTC'));
+ if ($now > $expirationDate) {
+ self::delete($row['id']);
+ return false;
+ }
+ }
+
+ return $row;
}
/**