diff options
author | Björn Schießle <schiessle@owncloud.com> | 2014-05-16 22:57:11 +0400 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2014-05-16 22:57:11 +0400 |
commit | 42b99b6d0fbcaf54b3cf3b3c9be5bc8a9c7a2e12 (patch) | |
tree | e5eef49dd4ca7a5bb71ef5f2cae583639f79202b /lib/private/share | |
parent | b52cb8f5570f4ec0e73aa5b2e1a5dbd178135382 (diff) | |
parent | 7a48f24459a6e0f253c4893d5d08056e1f22dd43 (diff) |
Merge pull request #8555 from owncloud/sharing_default_expire_only_public_links
use default expire date only for link shares
Diffstat (limited to 'lib/private/share')
-rw-r--r-- | lib/private/share/helper.php | 6 | ||||
-rw-r--r-- | lib/private/share/share.php | 14 |
2 files changed, 12 insertions, 8 deletions
diff --git a/lib/private/share/helper.php b/lib/private/share/helper.php index bc83d569840..e04180e00e4 100644 --- a/lib/private/share/helper.php +++ b/lib/private/share/helper.php @@ -232,7 +232,7 @@ class Helper extends \OC\Share\Constants { $expires = false; - if (isset($defaultExpireSettings['defaultExpireDateSet']) && $defaultExpireSettings['defaultExpireDateSet']) { + if (!empty($defaultExpireSettings['defaultExpireDateSet'])) { $expires = $creationTime + $defaultExpireSettings['expireAfterDays'] * 86400; } @@ -240,8 +240,8 @@ class Helper extends \OC\Share\Constants { if (isset($userExpireDate)) { // if the admin decided to enforce the default expire date then we only take // the user defined expire date of it is before the default expire date - if ($expires && isset($defaultExpireSettings['enforceExpireDate']) && $defaultExpireSettings['enforceExpireDate']) { - $expires = ($userExpireDate < $expires) ? $userExpireDate : $expires; + if ($expires && !empty($defaultExpireSettings['enforceExpireDate'])) { + $expires = min($userExpireDate, $expires); } else { $expires = $userExpireDate; } diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 440889ea6dc..e0f8e5a184e 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -887,16 +887,20 @@ class Share extends \OC\Share\Constants { */ protected static function expireItem(array $item) { - // get default expire settings - $defaultSettings = Helper::getDefaultExpireSetting(); // calculate expire date if (!empty($item['expiration'])) { $userDefinedExpire = new \DateTime($item['expiration']); - $userDefinedExpireTimestamp = $userDefinedExpire->getTimestamp(); + $expires = $userDefinedExpire->getTimestamp(); } else { - $userDefinedExpireTimestamp = null; + $expires = null; + } + + // only use default expire date for link shares + if((int)$item['share_type'] === self::SHARE_TYPE_LINK) { + // get default expire settings + $defaultSettings = Helper::getDefaultExpireSetting(); + $expires = Helper::calculateExpireDate($defaultSettings, $item['stime'], $expires); } - $expires = Helper::calculateExpireDate($defaultSettings, $item['stime'], $userDefinedExpireTimestamp); if (is_int($expires)) { $now = time(); |