mirror of
https://github.com/myvesta/vesta
synced 2025-07-07 13:31:53 -07:00
FM changes
This commit is contained in:
parent
f064c09667
commit
d207b7a752
9 changed files with 117 additions and 136 deletions
|
@ -1,11 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
$user = $_SESSION['user'];
|
||||||
|
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
|
||||||
|
$user=$_SESSION['look'];
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($_REQUEST['path'])) {
|
if (!empty($_REQUEST['path'])) {
|
||||||
$path = $_REQUEST['path'];
|
$path = $_REQUEST['path'];
|
||||||
if (is_readable($path)) {
|
header("Content-type: application/octet-stream");
|
||||||
header("Content-disposition: attachment;filename=".basename($path));
|
header("Content-Transfer-Encoding: binary");
|
||||||
readfile($path);
|
header("Content-disposition: attachment;filename=".basename($path));
|
||||||
exit;
|
passthru (VESTA_CMD . "v-open-fs-file " . $user . " " . escapeshellarg($path));
|
||||||
}
|
exit;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
die('File not found');
|
die('File not found');
|
||||||
|
|
|
@ -1,31 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
session_start();
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
$user = $_SESSION['user'];
|
$user = $_SESSION['user'];
|
||||||
/*
|
|
||||||
if (empty($panel)) {
|
|
||||||
$command = VESTA_CMD."v-list-user '".$user."' 'json'";
|
|
||||||
exec ($command, $output, $return_var);
|
|
||||||
if ( $return_var > 0 ) {
|
|
||||||
header("Location: /error/");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$panel = json_decode(implode('', $output), true);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
// Check user session
|
|
||||||
if ((!isset($_SESSION['user'])) && (!defined('NO_AUTH_REQUIRED'))) {
|
|
||||||
$_SESSION['request_uri'] = $_SERVER['REQUEST_URI'];
|
|
||||||
header("Location: /login/");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Check module activation
|
// Check module activation
|
||||||
if (!$_SESSION['FILEMANAGER_KEY']) {
|
if (!$_SESSION['FILEMANAGER_KEY']) {
|
||||||
|
@ -34,6 +10,11 @@ if (!$_SESSION['FILEMANAGER_KEY']) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check login_as feature
|
||||||
|
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
|
||||||
|
$user=$_SESSION['look'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -55,66 +36,46 @@ if (!$_SESSION['FILEMANAGER_KEY']) {
|
||||||
if (!empty($_REQUEST['path'])) {
|
if (!empty($_REQUEST['path'])) {
|
||||||
$content = '';
|
$content = '';
|
||||||
$path = $_REQUEST['path'];
|
$path = $_REQUEST['path'];
|
||||||
if (is_readable($path)) {
|
if (!empty($_POST['save'])) {
|
||||||
$image = getimagesize($path) ? true : false;
|
$fn = tempnam ('/tmp', 'vst-save-file-');
|
||||||
|
if ($fn) {
|
||||||
if ($image) {
|
$contents = $_POST['contents'];
|
||||||
header('Location: /view/file/?path='.$path);
|
$contents = preg_replace("/\r/", "", $contents);
|
||||||
exit;
|
$f = fopen ($fn, 'w+');
|
||||||
}
|
fwrite($f, $contents);
|
||||||
|
fclose($f);
|
||||||
if (!empty($_POST['save'])) {
|
chmod($fn, 0644);
|
||||||
$fn = tempnam ('/tmp', 'vst-save-file-');
|
|
||||||
if ($fn) {
|
|
||||||
$f = fopen ($fn, 'w+');
|
|
||||||
fwrite($f, $_POST['contents']);
|
|
||||||
fclose($f);
|
|
||||||
|
|
||||||
chmod($fn, 0644);
|
|
||||||
|
|
||||||
if ($f) {
|
|
||||||
//copy($fn, $path);
|
|
||||||
exec (VESTA_CMD . "v-copy-fs-file {$user} {$fn} {$path}", $output, $return_var);
|
|
||||||
|
|
||||||
$error = check_return_code($return_var, $output);
|
if ($f) {
|
||||||
if ($return_var != 0) {
|
exec (VESTA_CMD . "v-copy-fs-file {$user} {$fn} {$path}", $output, $return_var);
|
||||||
/*var_dump(VESTA_CMD . "v-copy-fs-file {$user} {$fn} {$path}");
|
$error = check_return_code($return_var, $output);
|
||||||
var_dump($path);
|
if ($return_var != 0) {
|
||||||
var_dump($output);*/
|
print('<p style="color: white">Error while saving file</p>');
|
||||||
die('<p style="color: white">Error while saving file</p>');//echo '0';
|
exit;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
unlink($fn);
|
|
||||||
}
|
}
|
||||||
|
unlink($fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// $content = file_get_contents($path);
|
|
||||||
// v-open-fs-file
|
|
||||||
|
|
||||||
|
|
||||||
//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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*exec (VESTA_CMD . "v-open-fs-file {$user} {$path}", $content, $return_var);
|
|
||||||
if ($return_var != 0) {
|
|
||||||
print 'Error while opening file'; // todo: handle this more styled
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$content = implode("\n", $content);*/
|
|
||||||
$content = file_get_contents($path);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
exec (VESTA_CMD . "v-check-fs-permission {$user} '{$path}'", $content, $return_var);
|
||||||
|
if ($return_var != 0) {
|
||||||
|
var_dump($return_var);
|
||||||
|
var_dump($content);
|
||||||
|
exit;
|
||||||
|
print 'Error while opening file'; // todo: handle this more styled
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
exec (VESTA_CMD . "v-open-fs-file {$user} {$path}", $content, $return_var);
|
||||||
|
if ($return_var != 0) {
|
||||||
|
print 'Error while opening file'; // todo: handle this more styled
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$content = implode("\n", $content)."\n";
|
||||||
|
} else {
|
||||||
$content = '';
|
$content = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form id="edit-file-form" method="post">
|
<form id="edit-file-form" method="post">
|
||||||
|
@ -131,9 +92,11 @@ if (!$_SESSION['FILEMANAGER_KEY']) {
|
||||||
$('.editor').ace({ theme: 'twilight', lang: 'ruby' });
|
$('.editor').ace({ theme: 'twilight', lang: 'ruby' });
|
||||||
|
|
||||||
var dcrt = $('#editor').data('ace');
|
var dcrt = $('#editor').data('ace');
|
||||||
var editor = dcrt.editor.ace;
|
dcrt.editor.ace.getSession().setNewLineMode('unix');
|
||||||
editor.gotoLine(0);
|
var aceInstance = dcrt.editor.ace;
|
||||||
editor.focus();
|
aceInstance.gotoLine(0);
|
||||||
|
aceInstance.focus();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var makeBackup = function() {
|
var makeBackup = function() {
|
||||||
|
|
|
@ -44,9 +44,7 @@ class FileManager {
|
||||||
|
|
||||||
public function checkFileType($dir) {
|
public function checkFileType($dir) {
|
||||||
$dir = $this->formatFullPath($dir);
|
$dir = $this->formatFullPath($dir);
|
||||||
|
|
||||||
exec(VESTA_CMD . "v-get-fs-file-type {$this->user} {$dir}", $output, $return_var);
|
exec(VESTA_CMD . "v-get-fs-file-type {$this->user} {$dir}", $output, $return_var);
|
||||||
|
|
||||||
$error = self::check_return_code($return_var, $output);
|
$error = self::check_return_code($return_var, $output);
|
||||||
if (empty($error)) {
|
if (empty($error)) {
|
||||||
return array(
|
return array(
|
||||||
|
@ -76,12 +74,13 @@ class FileManager {
|
||||||
|
|
||||||
function deleteItem($dir, $item) {
|
function deleteItem($dir, $item) {
|
||||||
$dir = $this->formatFullPath($item);
|
$dir = $this->formatFullPath($item);
|
||||||
if (is_dir($item)) {
|
//if (is_dir($item)) {
|
||||||
|
//var_dump(VESTA_CMD . "v-delete-fs-directory {$this->user} {$dir}");die();
|
||||||
exec (VESTA_CMD . "v-delete-fs-directory {$this->user} {$dir}", $output, $return_var);
|
exec (VESTA_CMD . "v-delete-fs-directory {$this->user} {$dir}", $output, $return_var);
|
||||||
}
|
//}
|
||||||
else {
|
//else {
|
||||||
exec (VESTA_CMD . "v-delete-fs-file {$this->user} {$dir}", $output, $return_var);
|
// exec (VESTA_CMD . "v-delete-fs-file {$this->user} {$dir}", $output, $return_var);
|
||||||
}
|
//}
|
||||||
|
|
||||||
$error = self::check_return_code($return_var, $output);
|
$error = self::check_return_code($return_var, $output);
|
||||||
|
|
||||||
|
@ -189,8 +188,12 @@ class FileManager {
|
||||||
function packItem($item, $dir, $target_dir, $filename) {
|
function packItem($item, $dir, $target_dir, $filename) {
|
||||||
$item = $this->formatFullPath($item);
|
$item = $this->formatFullPath($item);
|
||||||
$dst_item = $this->formatFullPath($target_dir);
|
$dst_item = $this->formatFullPath($target_dir);
|
||||||
//print VESTA_CMD . "v-add-fs-archive {$this->user} {$item} {$dst_item}";die();
|
|
||||||
exec (VESTA_CMD . "v-add-fs-archive {$this->user} {$item} {$dst_item}", $output, $return_var);
|
$dst_item = str_replace('.tar.gz', '', $dst_item);
|
||||||
|
|
||||||
|
//$item = str_replace($dir . '/', '', $item);
|
||||||
|
//var_dump(VESTA_CMD . "v-add-fs-archive {$this->user} {$dst_item} {$item}");die();
|
||||||
|
exec (VESTA_CMD . "v-add-fs-archive {$this->user} {$dst_item} {$item}", $output, $return_var);
|
||||||
|
|
||||||
$error = self::check_return_code($return_var, $output);
|
$error = self::check_return_code($return_var, $output);
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,10 @@ FM.showError = function(type, message) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ref.find('.results').length > 0) {
|
||||||
|
ref.find('.results').html(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
FM.popupClose();
|
FM.popupClose();
|
||||||
|
@ -750,7 +754,7 @@ FM.bulkOperation = function(ref) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FM.checkBulkStatus = function(bulkStatuses, acc) {
|
FM.checkBulkStatus = function(bulkStatuses, acc) {
|
||||||
var status = false;
|
var status = true;
|
||||||
var msg = '';
|
var msg = '';
|
||||||
if (bulkStatuses.length == acc.length) {
|
if (bulkStatuses.length == acc.length) {
|
||||||
$.each(bulkStatuses, function(i, o) {
|
$.each(bulkStatuses, function(i, o) {
|
||||||
|
@ -759,18 +763,24 @@ FM.checkBulkStatus = function(bulkStatuses, acc) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (msg == '') {
|
if (msg != '') {
|
||||||
status = true;
|
status = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == true) {
|
if (status == true) {
|
||||||
$('#popup .results').html(App.Constants.FM_DONE);
|
//$('#popup .results').html(App.Constants.FM_DONE);
|
||||||
$('.controls').html('<p class="ok" onClick="FM.bulkPopupClose();">'+App.Constants.FM_DONE+'</p>');
|
//$('.controls').html('<p class="ok" onClick="FM.bulkPopupClose();">'+App.Constants.FM_DONE+'</p>');
|
||||||
|
FM.popupClose();
|
||||||
|
|
||||||
|
var box = FM['TAB_' + tab];
|
||||||
|
var tab = FM.getTabLetter(FM.CURRENT_TAB);
|
||||||
|
FM.openAndSync(FM['TAB_' + tab + '_CURRENT_PATH'], box);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('#popup .results').html(msg);
|
$('#popup .results').show().html(msg);
|
||||||
$('.controls').html('<p class="ok" onClick="FM.bulkPopupClose();">'+App.Constants.FM_DONE+'</p>');
|
//$('.controls').html('<p class="ok" onClick="FM.bulkPopupClose();">'+App.Constants.FM_DONE+'</p>');
|
||||||
|
$('#popup .ok').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1249,7 +1259,7 @@ FM.unpackItem = function() {
|
||||||
|
|
||||||
var tpl = Tpl.get('popup_unpack', 'FM');
|
var tpl = Tpl.get('popup_unpack', 'FM');
|
||||||
tpl.set(':FILENAME', src.name);
|
tpl.set(':FILENAME', src.name);
|
||||||
tpl.set(':DST_DIRNAME', (dst + '/' + src.name).replace('//', '/'));
|
tpl.set(':DST_DIRNAME', (dst).replace('//', '/'));
|
||||||
FM.popupOpen(tpl.finalize());
|
FM.popupOpen(tpl.finalize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ App.Templates.html = {
|
||||||
</div>'],
|
</div>'],
|
||||||
popup_bulk_remove: ['<div class="confirm-box delete popup-box">\
|
popup_bulk_remove: ['<div class="confirm-box delete popup-box">\
|
||||||
<div class="message">'+App.Constants.FM_CONFIRM_DELETE_BULK+' (~!:NUMBER_OF_ITEMS~!)?</div>\
|
<div class="message">'+App.Constants.FM_CONFIRM_DELETE_BULK+' (~!:NUMBER_OF_ITEMS~!)?</div>\
|
||||||
|
<div class="results"></div>\
|
||||||
<div class="controls">\
|
<div class="controls">\
|
||||||
<p class="cancel" onClick="FM.popupClose();">'+App.Constants.FM_CANCEL+'</p>\
|
<p class="cancel" onClick="FM.popupClose();">'+App.Constants.FM_CANCEL+'</p>\
|
||||||
<p class="ok" onClick="FM.bulkRemoveDo();">'+App.Constants.FM_DELETE+'</p>\
|
<p class="ok" onClick="FM.bulkRemoveDo();">'+App.Constants.FM_DELETE+'</p>\
|
||||||
|
@ -73,6 +74,7 @@ App.Templates.html = {
|
||||||
</div>'],*/
|
</div>'],*/
|
||||||
popup_delete: ['<div class="confirm-box delete popup-box">\
|
popup_delete: ['<div class="confirm-box delete popup-box">\
|
||||||
<div class="message">'+App.Constants.FM_CONFIRM_DELETE+' <span class="title">"~!:FILENAME~!"</span>?</div>\
|
<div class="message">'+App.Constants.FM_CONFIRM_DELETE+' <span class="title">"~!:FILENAME~!"</span>?</div>\
|
||||||
|
<div class="warning warning-message"></div>\
|
||||||
<div class="controls">\
|
<div class="controls">\
|
||||||
<p class="cancel" onClick="FM.popupClose();">'+App.Constants.FM_CANCEL+'</p>\
|
<p class="cancel" onClick="FM.popupClose();">'+App.Constants.FM_CANCEL+'</p>\
|
||||||
<p class="ok" onClick="FM.confirmDelete();">'+App.Constants.FM_DELETE+'</p>\
|
<p class="ok" onClick="FM.confirmDelete();">'+App.Constants.FM_DELETE+'</p>\
|
||||||
|
@ -84,6 +86,7 @@ App.Templates.html = {
|
||||||
<input type="text" id="copy_dest" value="~!:DST_FILENAME~!" class="new-title">\
|
<input type="text" id="copy_dest" value="~!:DST_FILENAME~!" class="new-title">\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="message">'+App.Constants.FM_EXISTING_FILES_WILL_BE_REPLACED+'</div>\
|
<div class="message">'+App.Constants.FM_EXISTING_FILES_WILL_BE_REPLACED+'</div>\
|
||||||
|
<div class="warning warning-message"></div>\
|
||||||
<div class="controls">\
|
<div class="controls">\
|
||||||
<p class="cancel" onClick="FM.popupClose();">'+App.Constants.FM_CANCEL+'</p>\
|
<p class="cancel" onClick="FM.popupClose();">'+App.Constants.FM_CANCEL+'</p>\
|
||||||
<p class="ok" onClick="FM.confirmCopyItems();">'+App.Constants.FM_COPY+'</p>\
|
<p class="ok" onClick="FM.confirmCopyItems();">'+App.Constants.FM_COPY+'</p>\
|
||||||
|
|
|
@ -3,14 +3,15 @@
|
||||||
include($_SERVER['DOCUMENT_ROOT'] . "/inc/main.php");
|
include($_SERVER['DOCUMENT_ROOT'] . "/inc/main.php");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ((!isset($_SESSION['FILEMANAGER_KEY'])) || (empty($_SESSION['FILEMANAGER_KEY']))) {
|
if ((!isset($_SESSION['FILEMANAGER_KEY'])) || (empty($_SESSION['FILEMANAGER_KEY']))) {
|
||||||
header("Location: /filemanager-not-purchased/");
|
header("Location: /filemanager-not-purchased/");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check login_as feature
|
||||||
|
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
|
||||||
|
$user=$_SESSION['look'];
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($panel)) {
|
if (empty($panel)) {
|
||||||
$command = VESTA_CMD."v-list-user '".$user."' 'json'";
|
$command = VESTA_CMD."v-list-user '".$user."' 'json'";
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<div class="menu menu-left menu-A">
|
<div class="menu menu-left menu-A">
|
||||||
<?php $pre_tab = 'A';include($_SERVER['DOCUMENT_ROOT'].'/templates/file_manager/tab_menu.php'); ?>
|
<?php $pre_tab = 'A';include($_SERVER['DOCUMENT_ROOT'].'/templates/file_manager/tab_menu.php'); ?>
|
||||||
</div>
|
</div>
|
||||||
<ul class="listing listing-left"></ul>
|
<ul class="listing listing-left" onClick="FM.setTabActive('.listing-left');"></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="window">
|
<div class="window">
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
<div class="menu menu-right menu-B">
|
<div class="menu menu-right menu-B">
|
||||||
<?php $pre_tab = 'B';include($_SERVER['DOCUMENT_ROOT'].'/templates/file_manager/tab_menu.php'); ?>
|
<?php $pre_tab = 'B';include($_SERVER['DOCUMENT_ROOT'].'/templates/file_manager/tab_menu.php'); ?>
|
||||||
</div>
|
</div>
|
||||||
<ul class="listing listing-right"></ul>
|
<ul class="listing listing-right" onClick="FM.setTabActive('.listing-right');"></ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -420,4 +420,4 @@
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -4,19 +4,12 @@
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
//$user = $_SESSION['user'];
|
// Check login_as feature
|
||||||
|
$user = $_SESSION['user'];
|
||||||
if (empty($panel)) {
|
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
|
||||||
$command = VESTA_CMD."v-list-user '".$user."' 'json'";
|
$user=$_SESSION['look'];
|
||||||
exec ($command, $output, $return_var);
|
|
||||||
if ( $return_var > 0 ) {
|
|
||||||
header("Location: /error/");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$panel = json_decode(implode('', $output), true);
|
|
||||||
}
|
}
|
||||||
$user = array_keys($panel);
|
|
||||||
$user = $user[0];
|
|
||||||
|
|
||||||
define('USERNAME', $user);
|
define('USERNAME', $user);
|
||||||
|
|
||||||
|
@ -478,7 +471,9 @@ class UploadHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function sanitizeFileName($file) {
|
protected function sanitizeFileName($file) {
|
||||||
$file = preg_replace("/[^A-Za-z0-9\._-]+/", '', $file);
|
// (|\\?*<\":>+[]/')
|
||||||
|
// \|\\\?\*\<\"\'\:\>\+\[\]
|
||||||
|
$file = preg_replace("/'/", '', $file);
|
||||||
|
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
|
@ -1140,11 +1135,11 @@ class UploadHandler
|
||||||
// $this->handle_image_file($file_path, $file);
|
// $this->handle_image_file($file_path, $file);
|
||||||
//}
|
//}
|
||||||
} else {
|
} else {
|
||||||
$file->size = $file_size;
|
//$file->size = $file_size;
|
||||||
if (!$content_range && $this->options['discard_aborted_uploads']) {
|
//if (!$content_range && $this->options['discard_aborted_uploads']) {
|
||||||
unlink($file_path);
|
// unlink($file_path);
|
||||||
$file->error = $this->get_error_message('abort');
|
// $file->error = $this->get_error_message('abort');
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
$this->set_additional_file_properties($file);
|
$this->set_additional_file_properties($file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,18 +2,17 @@
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
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'])) {
|
if (!empty($_REQUEST['path'])) {
|
||||||
$path = $_REQUEST['path'];
|
$path = $_REQUEST['path'];
|
||||||
if (is_readable($path) && !empty($_REQUEST['raw'])) {
|
if (!empty($_REQUEST['raw'])) {
|
||||||
//print file_get_contents($path);
|
header('content-type: image/jpeg');
|
||||||
exec (VESTA_CMD . "v-check-fs-permission {$user} {$path}", $content, $return_var);
|
passthru (VESTA_CMD . "v-open-fs-file " . $user . " " . escapeshellarg($_REQUEST['path']));
|
||||||
|
|
||||||
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);
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue