Skip to content

Commit e02e470

Browse files
committed
FileManager latest changes
1 parent 5dbb80a commit e02e470

File tree

5 files changed

+16
-19
lines changed

5 files changed

+16
-19
lines changed

web/download/file/index.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?php
22
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
33

4+
if ((!isset($_SESSION['FILEMANAGER_KEY'])) || (empty($_SESSION['FILEMANAGER_KEY']))) {
5+
header("Location: /login/");
6+
exit;
7+
}
8+
49
$user = $_SESSION['user'];
510
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
611
$user=$_SESSION['look'];

web/edit/file/index.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
chmod($fn, 0644);
4848

4949
if ($f) {
50-
exec (VESTA_CMD . "v-copy-fs-file {$user} {$fn} {$path}", $output, $return_var);
50+
exec (VESTA_CMD . "v-copy-fs-file {$user} {$fn} ".escapeshellarg($path), $output, $return_var);
5151
$error = check_return_code($return_var, $output);
5252
if ($return_var != 0) {
5353
print('<p style="color: white">Error while saving file</p>');
@@ -58,16 +58,7 @@
5858
}
5959
}
6060

61-
exec (VESTA_CMD . "v-check-fs-permission {$user} '{$path}'", $content, $return_var);
62-
if ($return_var != 0) {
63-
var_dump($return_var);
64-
var_dump($content);
65-
exit;
66-
print 'Error while opening file'; // todo: handle this more styled
67-
exit;
68-
}
69-
70-
exec (VESTA_CMD . "v-open-fs-file {$user} {$path}", $content, $return_var);
61+
exec (VESTA_CMD . "v-open-fs-file {$user} ".escapeshellarg($path), $content, $return_var);
7162
if ($return_var != 0) {
7263
print 'Error while opening file'; // todo: handle this more styled
7364
exit;

web/file_manager/fm_core.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,7 @@ public function formatFullPath($path_part = '') {
7474

7575
function deleteItem($dir, $item) {
7676
$dir = $this->formatFullPath($item);
77-
//if (is_dir($item)) {
78-
//var_dump(VESTA_CMD . "v-delete-fs-directory {$this->user} {$dir}");die();
79-
exec (VESTA_CMD . "v-delete-fs-directory {$this->user} {$dir}", $output, $return_var);
80-
//}
81-
//else {
82-
// exec (VESTA_CMD . "v-delete-fs-file {$this->user} {$dir}", $output, $return_var);
83-
//}
77+
exec (VESTA_CMD . "v-delete-fs-directory {$this->user} {$dir}", $output, $return_var);
8478

8579
$error = self::check_return_code($return_var, $output);
8680

web/file_manager/index.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
header("Location: /login/");
3+
exit;

web/view/file/index.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
44

5-
// Check login_as feature
5+
if ((!isset($_SESSION['FILEMANAGER_KEY'])) || (empty($_SESSION['FILEMANAGER_KEY']))) {
6+
header("Location: /login/");
7+
exit;
8+
}
9+
610
$user = $_SESSION['user'];
711
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
812
$user=$_SESSION['look'];

0 commit comments

Comments
 (0)