[Pkg-owncloud-commits] [owncloud] 57/74: 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.

David Prévot taffit at moszumanska.debian.org
Tue Dec 2 22:04:38 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit cdf37a061bb95e0695adc7b787be799570a4123c
Author: Miguel Prokop <miguel.prokop at vtu.com>
Date:   Fri Nov 21 11:01:39 2014 +0100

    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.
---
 lib/private/share/helper.php | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/private/share/helper.php b/lib/private/share/helper.php
index 2418535..1ebcdb5 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;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list