6 require_once 'www-header.php';
7 if ($GLOBALS['phorkie']['auth']['secure'] == 2) {
8 include_once 'secure.php';
10 $repo = new Repository();
11 $repo->loadFromRequest();
13 if (!isset($_GET['file']) || $_GET['file'] == '') {
14 throw new Exception_Input('File name missing');
17 $file = $repo->getFileByName($_GET['file']);
18 $mimetype = $file->getMimeType();
19 if ($mimetype === null) {
20 $mimetype = 'text/plain';
22 header('Content-Type: ' . $mimetype);
23 if ($repo->hash === null) {
24 //IIRC readfile is not so memory-intensive for big files
25 readfile($file->getFullPath());
27 echo $file->getContent();