Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fix #285 again
Browse files Browse the repository at this point in the history
Signed-off-by: Etienne CHAMPETIER <etienne.champetier@fiducial.net>
  • Loading branch information
Etienne CHAMPETIER committed Oct 23, 2013
1 parent 86f63f0 commit 0b00b84
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions core/src/plugins/action.share/class.ShareCenter.php
Expand Up @@ -146,17 +146,23 @@ public function switchAction($action, $httpVars, $fileVars)
}
print($url);
} else {
$maxdownload = intval($this->getFilteredOption("FILE_MAX_DOWNLOAD", $this->repository->getId()));
if (!empty($httpVars["downloadlimit"])) {
if(!empty($maxdownload)) $httpVars["downloadlimit"] = min($maxdownload, intval($httpVars["downloadlimit"]));
$maxdownload = abs(intval($this->getFilteredOption("FILE_MAX_DOWNLOAD", $this->repository->getId())));
$download = isset($httpVars["downloadlimit"]) ? abs(intval($httpVars["downloadlimit"])) : 0;
if ($maxdownload == 0) {
$httpVars["downloadlimit"] = $download;
} elseif ($maxdownload > 0 && $download == 0) {
$httpVars["downloadlimit"] = $maxdownload;
} else {
if(!empty($maxdownload)) $httpVars["downloadlimit"] = $maxdownload;
$httpVars["downloadlimit"] = min($download,$maxdownload);
}
$maxexpiration = intval($this->getFilteredOption("FILE_MAX_EXPIRATION", $this->repository->getId()));
if (!empty($httpVars["expiration"])) {
if(!empty($maxexpiration)) $httpVars["expiration"] = min($maxexpiration, intval($httpVars["expiration"]));
$maxexpiration = abs(intval($this->getFilteredOption("FILE_MAX_EXPIRATION", $this->repository->getId())));
$expiration = isset($httpVars["expiration"]) ? abs(intval($httpVars["expiration"])) : 0;
if ($maxexpiration == 0) {
$httpVars["expiration"] = $expiration;
} elseif ($maxexpiration > 0 && $expiration == 0) {
$httpVars["expiration"] = $maxexpiration;
} else {
if(!empty($maxexpiration)) $httpVars["expiration"] = $maxexpiration;
$httpVars["expiration"] = min($expiration,$maxexpiration);
}

$data = $this->accessDriver->makePublicletOptions($file, $httpVars["password"], $httpVars["expiration"], $httpVars["downloadlimit"], $this->repository);
Expand Down

0 comments on commit 0b00b84

Please sign in to comment.