summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-09-26 17:52:28 +0200
committerRobin Appelman <icewind@owncloud.com>2012-09-26 17:52:28 +0200
commit88bca9bc49343906b5b498f4d3837002d346b3af (patch)
tree7a918e09963310c812617df0328b4331edb3b3d2 /lib/public
parent522d7df860fb47d3cc56e315850dda2797569ac5 (diff)
parenta7292e897a70a2f7e79f61396d4888cb694f0860 (diff)
downloadnextcloud-server-88bca9bc49343906b5b498f4d3837002d346b3af.tar.gz
nextcloud-server-88bca9bc49343906b5b498f4d3837002d346b3af.zip
Merge branch 'master' into filesystem
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/share.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index b215d7f9389..1039d6f0dbf 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -418,11 +418,20 @@ 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)) {
+ if ($date == '') {
+ $date = null;
+ } else {
+ $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;
}