6 $reqWritePermissions = false;
7 require_once 'www-header.php';
9 $repo = new Repository();
10 $repo->loadFromRequest();
12 if (!isset($_GET['file']) || $_GET['file'] == '') {
13 throw new Exception_Input('File name missing');
16 $file = $repo->getFileByName($_GET['file']);
17 $mimetype = $file->getMimeType();
18 if ($mimetype === null) {
19 $mimetype = 'text/plain';
21 header('Content-Type: ' . $mimetype);
22 if ($repo->hash === null) {
23 //IIRC readfile is not so memory-intensive for big files
24 readfile($file->getFullPath());
26 echo $file->getContent();