diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-09-25 23:54:46 -0400 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2012-09-25 23:54:46 -0400 |
commit | f967bfc9566c2b5a6ca393f1ac5e2e8b0ff1ac7e (patch) | |
tree | f061e63557ae884b8737f602e4c0750162fbba17 /lib/public | |
parent | 2bdf89f4d4d754c4cb4e1498b977085a67269460 (diff) | |
download | nextcloud-server-f967bfc9566c2b5a6ca393f1ac5e2e8b0ff1ac7e.tar.gz nextcloud-server-f967bfc9566c2b5a6ca393f1ac5e2e8b0ff1ac7e.zip |
Properly format the share expiration time for the database, fixes bug oc-1779
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/share.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/public/share.php b/lib/public/share.php index b215d7f9389..6ef984732b9 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -418,11 +418,16 @@ class Share { } public static function setExpirationDate($itemType, $itemSource, $date) { - if ($item = self::getItems($itemType, $itemSource, null, null, \OC_User::getUser(), self::FORMAT_NONE, null, 1, false)) { - error_log('setting'); - $query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `expiration` = ? WHERE `id` = ?'); - $query->execute(array($date, $item['id'])); - return true; + if ($items = self::getItems($itemType, $itemSource, null, null, \OC_User::getUser(), self::FORMAT_NONE, null, -1, false)) { + if (!empty($items)) { + $date = new \DateTime($date); + $date = date('Y-m-d H:i', $date->format('U') - $date->getOffset()); + $query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `expiration` = ? WHERE `id` = ?'); + foreach ($items as $item) { + $query->execute(array($date, $item['id'])); + } + return true; + } } return false; } |