Merge pull request #1059 from Tulga/patch-3

Improvement on download file script
This commit is contained in:
Serghey Rodin 2017-12-28 14:52:27 +02:00 committed by GitHub
commit 22a8d3064d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,10 +13,20 @@ if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
$path = $_REQUEST['path']; $path = $_REQUEST['path'];
if (!empty($path)) { if (!empty($path)) {
set_time_limit(0);
if (ob_get_level()) {
ob_end_clean();
}
header("Content-type: application/octet-stream"); header("Content-type: application/octet-stream");
header("Content-Transfer-Encoding: binary"); header("Content-Transfer-Encoding: binary");
header("Content-disposition: attachment;filename=".basename($path)); header("Content-disposition: attachment;filename=".basename($path));
passthru(VESTA_CMD . "v-open-fs-file " . $user . " " . escapeshellarg($path)); $output = '';
exec(VESTA_CMD . "v-check-fs-permission " . $user . " " . escapeshellarg($path), $output, $return_var);
if ($return_var != 0) {
print 'Error while opening file'; // todo: handle this more styled
exit;
}
readfile($path);
exit; exit;
} else { } else {
die('File not found'); die('File not found');