source: contrib/Dms/op/op.ViewOnline.php @ 3526

Revision 3526, 1.5 KB checked in by afernandes, 13 years ago (diff)

Ticket #1416 - Disponibilizado modulos Timesheet e DMS para a comunidade.

  • Property svn:executable set to *
Line 
1<?php
2
3include("../inc/inc.Settings.php");
4include("../inc/inc.AccessUtils.php");
5include("../inc/inc.ClassAccess.php");
6include("../inc/inc.ClassDocument.php");
7include("../inc/inc.ClassFolder.php");
8include("../inc/inc.ClassGroup.php");
9include("../inc/inc.ClassUser.php");
10include("../inc/inc.DBAccess.php");
11include("../inc/inc.Language.php");
12include("../inc/inc.OutUtils.php");
13include("../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
20if ($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
37if (is_bool($content) && !$content)
38        die("Version " . $version . " of Document \"" . $document->getName() . "\" not found");
39
40if (in_array($content->getFileType(), $settings->_viewOnlineFileTypes))
41        header("Content-Type: " . $content->getMimeType());
42
43header("Content-Length: " . filesize($settings->_contentDir . $content->getDir() . $content->getFileName()));
44header("Expires: 0");
45header("Cache-Control: no-cache, must-revalidate");
46header("Pragma: no-cache");
47
48readfile($settings->_contentDir . $content->getDir() . $content->getFileName());
49exit;
50
51?>
Note: See TracBrowser for help on using the repository browser.