소스 검색

Merge pull request #508 from SysVoid/patch-5

Added file existence check.
Serghey Rodin 9 년 전
부모
커밋
47bfb426a3
2개의 변경된 파일10개의 추가작업 그리고 9개의 파일을 삭제
  1. 5 0
      bin/v-open-fs-file
  2. 5 9
      web/download/file/index.php

+ 5 - 0
bin/v-open-fs-file

@@ -33,6 +33,11 @@ if [ ! -z "$src_file" ]; then
         echo "Error: invalid source path $src_file"
         exit 2
     fi
+    
+    if [ ! -f "$src_file" ]; then
+        echo "Error: file not found $src_file"
+        exit 2
+    fi
 fi
 
 # Reading file

+ 5 - 9
web/download/file/index.php

@@ -8,20 +8,16 @@ if ((!isset($_SESSION['FILEMANAGER_KEY'])) || (empty($_SESSION['FILEMANAGER_KEY'
 
 $user = $_SESSION['user'];
 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-Transfer-Encoding: binary");
     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;
-}
-else {
+} else {
     die('File not found');
 }
-
-
-?>