mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-13 21:21:27 +00:00
if GET parameter version is not set do nothing
This commit is contained in:
parent
20df7fa523
commit
2704750e40
|
@ -41,6 +41,7 @@ if ($document->getAccessMode($user) < M_READ) {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if(isset($_GET["version"])) {
|
||||
$version = $_GET["version"];
|
||||
|
||||
if (!isset($version) || !is_numeric($version) || intval($version)<1) {
|
||||
|
@ -63,6 +64,30 @@ header("Cache-Control: no-cache, must-revalidate");
|
|||
header("Pragma: no-cache");
|
||||
|
||||
readfile($dms->contentDir . $content->getPath());
|
||||
} elseif(isset($_GET["file"])) {
|
||||
$fileid = $_GET["file"];
|
||||
|
||||
if (!is_numeric($fileid) || intval($fileid)<1) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
$file = $document->getDocumentFile($fileid);
|
||||
|
||||
if (!is_object($file)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_file_id"));
|
||||
}
|
||||
|
||||
if (isset($settings->_viewOnlineFileTypes) && is_array($settings->_viewOnlineFileTypes) && in_array(strtolower($file->getFileType()), $settings->_viewOnlineFileTypes)) {
|
||||
header("Content-Type: " . $file->getMimeType());
|
||||
}
|
||||
header("Content-Disposition: filename=\"" . $file->getOriginalFileName()) . "\"";
|
||||
header("Content-Length: " . filesize($dms->contentDir . $file->getPath() ));
|
||||
header("Expires: 0");
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
header("Pragma: no-cache");
|
||||
|
||||
readfile($dms->contentDir . $file->getPath());
|
||||
}
|
||||
|
||||
add_log_line();
|
||||
exit;
|
||||
|
|
Loading…
Reference in New Issue
Block a user