-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtransfer.php
More file actions
30 lines (25 loc) · 870 Bytes
/
transfer.php
File metadata and controls
30 lines (25 loc) · 870 Bytes
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
26
27
28
29
30
<?php
// NOT IN USE
exit;
$path = $_GET['path'];
$path_parts = explode('/', $path);
if (count($path_parts) > 2 || in_array('..', $path_parts)) {
exit;
}
chdir("../../../../../../..");
require_once("./Services/Init/classes/class.ilIniFile.php");
$ilIliasIniFile = new ilIniFile("./ilias.ini.php");
$ilIliasIniFile->read();
$ilias_data_dir = $ilIliasIniFile->readVariable("clients", "datadir");
$client_id = $_COOKIE["ilClientId"];
$file = $ilias_data_dir . '/' . $client_id . '/vimp_upload/' . $path;
$filename = end($path_parts);
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Content-Description: ' . $filename);
header('Accept-Ranges: bytes');
header("Content-Length: " . (string)filesize($file));
header("Connection: close");
$file = fopen($file, "rb");
fpassthru($file);
exit;