浏览代码

Fixing document validation for swf files

Julio Montoya 12 年之前
父节点
当前提交
ffb5518658
共有 1 个文件被更改,包括 2 次插入5 次删除
  1. 2 5
      main/document/download.php

+ 2 - 5
main/document/download.php

@@ -70,7 +70,7 @@ if (substr($refer_script, 0, 15) == '/fillsurvey.php') {
 //the character "-" the filename was changed from "-" to "_" in the DB for no reason
 $path_info = pathinfo($doc_url);
 $fix_file_name = false;
-if (isset($path_info['extension']) == 'swf') {
+if (isset($path_info['extension']) && $path_info['extension'] == 'swf') {
     $original_doc_url =  $doc_url;
     $doc_url = str_replace('_', '-', $doc_url);
     $fix_file_name = true;
@@ -78,13 +78,10 @@ if (isset($path_info['extension']) == 'swf') {
 
 if (Security::check_abs_path($sys_course_path.$doc_url, $sys_course_path.'/')) {
     $full_file_name = $sys_course_path.$doc_url;
-
-    // Check visibility of document and paths
-    
     if ($fix_file_name) {
         $doc_url = $original_doc_url;
     }
-    
+    // Check visibility of document and paths
     $is_visible = DocumentManager::is_visible($doc_url, $_course, api_get_session_id());
     
 	//Documents' slideshow thumbnails