summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@owncloud.com>2013-09-14 18:44:28 +0200
committerAndreas Fischer <bantu@owncloud.com>2013-09-16 21:24:17 +0200
commita92d4c2c0932f5c662ed846763e3059ebdcde07c (patch)
tree5914637dbdcfb4d5652ed105108439341969e416
parent07714d9a72bbc4d9bdc25a8c42d83b5a70fb5be3 (diff)
downloadnextcloud-server-a92d4c2c0932f5c662ed846763e3059ebdcde07c.tar.gz
nextcloud-server-a92d4c2c0932f5c662ed846763e3059ebdcde07c.zip
Perform expiration date checking before returning share data for token.
-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 9ab956d84b9..cc3c4de6208 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;
}
/**