diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2013-10-02 10:11:18 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2013-10-02 10:11:18 +0200 |
commit | 8b08b1b455b474de3fa376dfafa3de63727364ea (patch) | |
tree | 536b2d4ba4f979d69f4f6e73755e06635345f78a /lib/public/share.php | |
parent | 084f76fd14125023d5b7277c558eb86a20ea07d3 (diff) | |
parent | 535ed8369f701a184340a428e82cc8d7cc7588bb (diff) | |
download | nextcloud-server-8b08b1b455b474de3fa376dfafa3de63727364ea.tar.gz nextcloud-server-8b08b1b455b474de3fa376dfafa3de63727364ea.zip |
Merge branch 'master' into sharing_mail_notification_master
Conflicts:
lib/private/util.php
Diffstat (limited to 'lib/public/share.php')
-rw-r--r-- | lib/public/share.php | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/public/share.php b/lib/public/share.php index be61d046f0b..e6a74117aa2 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -342,7 +342,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; } /** @@ -821,10 +832,10 @@ class Share { /** * @brief Get the backend class for the specified item type - * @param string Item type - * @return Sharing backend object + * @param string $itemType + * @return Share_Backend */ - private static function getBackend($itemType) { + public static function getBackend($itemType) { if (isset(self::$backends[$itemType])) { return self::$backends[$itemType]; } else if (isset(self::$backendTypes[$itemType]['class'])) { |