FM changes

This commit is contained in:
Serghey Rodin 2015-11-05 03:17:21 +02:00
commit d207b7a752
9 changed files with 117 additions and 136 deletions

View file

@ -2,18 +2,17 @@
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check login_as feature
$user = $_SESSION['user'];
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
$user=$_SESSION['look'];
}
if (!empty($_REQUEST['path'])) {
$path = $_REQUEST['path'];
if (is_readable($path) && !empty($_REQUEST['raw'])) {
//print file_get_contents($path);
exec (VESTA_CMD . "v-check-fs-permission {$user} {$path}", $content, $return_var);
if ($return_var != 0) {
print 'Error while opening file'; // todo: handle this more styled
exit;
}
header('content-type: image/jpeg');
print file_get_contents($path);
if (!empty($_REQUEST['raw'])) {
header('content-type: image/jpeg');
passthru (VESTA_CMD . "v-open-fs-file " . $user . " " . escapeshellarg($_REQUEST['path']));
exit;
}
}