From cfb55d2dbcb8c45d8660d94d3b806b53f1062569 Mon Sep 17 00:00:00 2001 From: Tulga Date: Fri, 3 Feb 2017 01:37:07 +0800 Subject: [PATCH] Update index.php - php execution timeout disabled - shell command "v-open-fs-file" is not suitable for large files. replaced with php readfile. --- web/download/file/index.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/web/download/file/index.php b/web/download/file/index.php index 0cc5b5c10..efabb0e15 100644 --- a/web/download/file/index.php +++ b/web/download/file/index.php @@ -13,10 +13,20 @@ if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) { $path = $_REQUEST['path']; if (!empty($path)) { + set_time_limit(0); + if (ob_get_level()) { + ob_end_clean(); + } header("Content-type: application/octet-stream"); header("Content-Transfer-Encoding: binary"); 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; } else { die('File not found');