Should fix bug when uploading swf files in 1.8.8.x

skala
Julio Montoya 13 years ago
parent 5493bd31a3
commit 0b810b4b93
  1. 14
      main/document/download.php

@ -69,17 +69,21 @@ if (substr($refer_script, 0, 15) == '/fillsurvey.php') {
//Fixes swf upload problem in chamilo 1.8.x. When uploading a file with
//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']) && $path_info['extension'] == 'swf') {
$original_doc_url = $doc_url;
$doc_url = str_replace('_', '-', $doc_url);
$fix_file_name = true;
$fixed_url = str_replace('-', '_', $doc_url);
$doc_id = DocumentManager::get_document_id(api_get_course_info(), $doc_url);
if (!$doc_id) {
$fix_file_name = true;
}
}
if (Security::check_abs_path($sys_course_path.$doc_url, $sys_course_path.'/')) {
$full_file_name = $sys_course_path.$doc_url;
$full_file_name = $sys_course_path.$doc_url;
if ($fix_file_name) {
$doc_url = $original_doc_url;
$doc_url = $fixed_url;
}
// Check visibility of document and paths
$is_visible = DocumentManager::is_visible($doc_url, $_course, api_get_session_id());

Loading…
Cancel
Save