diff options
author | Miguel Prokop <miguel.prokop@vtu.com> | 2014-11-21 13:01:39 +0300 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-11-26 15:03:45 +0300 |
commit | cdf37a061bb95e0695adc7b787be799570a4123c (patch) | |
tree | 9fa84d46539a20b72568f4a6abe0932f4f045091 /lib/private/share | |
parent | b1f838814d133e03ed7214cb904c9cba56e6fac6 (diff) |
fix calculation of expiration date if there is a default expiration date set (but not forced) and the user does not want the link to expire.
Diffstat (limited to 'lib/private/share')
-rw-r--r-- | lib/private/share/helper.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/private/share/helper.php b/lib/private/share/helper.php index 2418535c9d5..1ebcdb563a5 100644 --- a/lib/private/share/helper.php +++ b/lib/private/share/helper.php @@ -189,20 +189,25 @@ class Helper extends \OC\Share\Constants { public static function calculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate = null) { $expires = false; + $defaultExpires = null; if (!empty($defaultExpireSettings['defaultExpireDateSet'])) { - $expires = $creationTime + $defaultExpireSettings['expireAfterDays'] * 86400; + $defaultExpires = $creationTime + $defaultExpireSettings['expireAfterDays'] * 86400; } 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 && !empty($defaultExpireSettings['enforceExpireDate'])) { - $expires = min($userExpireDate, $expires); + if ($defaultExpires && !empty($defaultExpireSettings['enforceExpireDate'])) { + $expires = min($userExpireDate, $defaultExpires); } else { $expires = $userExpireDate; } + } else { + if ($defaultExpires && !empty($defaultExpireSettings['enforceExpireDate'])) { + $expires = $defaultExpires; + } } return $expires; |