mirror of
https://github.com/myvesta/vesta
synced 2025-08-21 13:54:28 -07:00
Merge pull request #508 from SysVoid/patch-5
Added file existence check.
This commit is contained in:
commit
47bfb426a3
2 changed files with 10 additions and 9 deletions
|
@ -33,6 +33,11 @@ if [ ! -z "$src_file" ]; then
|
||||||
echo "Error: invalid source path $src_file"
|
echo "Error: invalid source path $src_file"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$src_file" ]; then
|
||||||
|
echo "Error: file not found $src_file"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Reading file
|
# Reading file
|
||||||
|
|
|
@ -11,17 +11,13 @@ if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
|
||||||
$user = $_SESSION['look'];
|
$user = $_SESSION['look'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_REQUEST['path'])) {
|
|
||||||
$path = $_REQUEST['path'];
|
$path = $_REQUEST['path'];
|
||||||
|
if (!empty($path)) {
|
||||||
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));
|
passthru(VESTA_CMD . "v-open-fs-file " . $user . " " . escapeshellarg($path));
|
||||||
exit;
|
exit;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
die('File not found');
|
die('File not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue