1 | <?php |
---|
2 | |
---|
3 | include("../inc/inc.Settings.php"); |
---|
4 | include("../inc/inc.AccessUtils.php"); |
---|
5 | include("../inc/inc.ClassAccess.php"); |
---|
6 | include("../inc/inc.ClassDocument.php"); |
---|
7 | include("../inc/inc.ClassFolder.php"); |
---|
8 | include("../inc/inc.ClassGroup.php"); |
---|
9 | include("../inc/inc.ClassUser.php"); |
---|
10 | include("../inc/inc.DBAccess.php"); |
---|
11 | include("../inc/inc.Language.php"); |
---|
12 | include("../inc/inc.OutUtils.php"); |
---|
13 | include("../inc/inc.Authentication.php"); |
---|
14 | |
---|
15 | $documentid = (isset($_GET['documentid'])) ? (int) $_GET['documentid'] : NULL; |
---|
16 | $version = (isset($_GET['version'])) ? (int) $_GET['version'] : NULL; |
---|
17 | |
---|
18 | $document = getDocument($documentid); |
---|
19 | |
---|
20 | if ($document->getAccessMode($user) < M_READ) |
---|
21 | { |
---|
22 | printHTMLHead( getMLText("download") ); |
---|
23 | printCenterStart(); |
---|
24 | printStartBox(getMLText("download")); |
---|
25 | print "<div class=\"standardText\">"; |
---|
26 | printMLText("operation_not_allowed"); |
---|
27 | printGoBack(); |
---|
28 | print "</div>"; |
---|
29 | printEndBox(); |
---|
30 | printCenterEnd(); |
---|
31 | printHTMLFoot(); |
---|
32 | exit; |
---|
33 | } |
---|
34 | |
---|
35 | $content = $document->getContentByVersion($version); |
---|
36 | |
---|
37 | if (is_bool($content) && !$content) |
---|
38 | die("Version " . $version . " of Document \"" . $document->getName() . "\" not found"); |
---|
39 | |
---|
40 | if (in_array($content->getFileType(), $settings->_viewOnlineFileTypes)) |
---|
41 | header("Content-Type: " . $content->getMimeType()); |
---|
42 | |
---|
43 | header("Content-Length: " . filesize($settings->_contentDir . $content->getDir() . $content->getFileName())); |
---|
44 | header("Expires: 0"); |
---|
45 | header("Cache-Control: no-cache, must-revalidate"); |
---|
46 | header("Pragma: no-cache"); |
---|
47 | |
---|
48 | readfile($settings->_contentDir . $content->getDir() . $content->getFileName()); |
---|
49 | exit; |
---|
50 | |
---|
51 | ?> |
---|