diff options
author | Andreas Fischer <bantu@owncloud.com> | 2013-09-14 18:44:28 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@owncloud.com> | 2013-10-09 13:25:43 +0200 |
commit | 49686dc85c7ccb04625557b9947e66f120646b8f (patch) | |
tree | 1fb50a535dac598f0ac9902840a1617947e03904 /lib/public | |
parent | 6c683baccb3a75a171553ddb91930c216ab5d540 (diff) | |
download | nextcloud-server-49686dc85c7ccb04625557b9947e66f120646b8f.tar.gz nextcloud-server-49686dc85c7ccb04625557b9947e66f120646b8f.zip |
Perform expiration date checking before returning share data for token.
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/share.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/public/share.php b/lib/public/share.php index 0a88ea4ea44..ea4116eaa76 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; } /** |