summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-05-12 16:15:13 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-05-16 18:12:13 +0200
commit7a48f24459a6e0f253c4893d5d08056e1f22dd43 (patch)
treeb923ec5cf8786606aa4fc93ee0a0884e9a70e0fa /lib
parent60efa0f1c81acaa019b45cb432d5265e230b4e94 (diff)
downloadnextcloud-server-7a48f24459a6e0f253c4893d5d08056e1f22dd43.tar.gz
nextcloud-server-7a48f24459a6e0f253c4893d5d08056e1f22dd43.zip
use default expire date only for link shares
Diffstat (limited to 'lib')
-rw-r--r--lib/private/share/helper.php6
-rw-r--r--lib/private/share/share.php14
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 a8537a916fb..33916d9eaa4 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -878,16 +878,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();