-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget.php
25 lines (23 loc) · 1 KB
/
get.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
# +--------------------------------------------------------------------+
# | phpEasyVCS |
# | The file-based version control system |
# +--------------------------------------------------------------------+
# | Copyright (c) 2011 Martin Vlcek |
# | License: GPLv3 (http://www.gnu.org/licenses/gpl-3.0.html) |
# +--------------------------------------------------------------------+
require_once('inc/basic.php');
$dir = sanitizeDir($_GET['dir']);
$name = sanitizeName($_GET['name']);
$version = (int) $_GET['version'];
$vcs = new FileVCS(DATAPATH, null, getUserName(), isReadOnly());
$file = $vcs->getEntry($dir, $name, $version);
if (!$file) {
header("HTTP/1.0 404 Not Found");
} else {
header("Content-type: ".$file->mimetype);
header('Content-disposition: attachment; filename="'.$file->name.'"');
$f = $file->stream;
fpassthru($f);
fclose($f);
}