|
|
|
@ -248,10 +248,8 @@ function handle_uploaded_document($_course,$uploaded_file,$base_work_dir,$upload |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
//clean up the name and prevent dangerous files |
|
|
|
|
//remove strange characters |
|
|
|
|
//clean up the name, only ASCII characters should stay. |
|
|
|
|
$clean_name = replace_dangerous_char($uploaded_file['name']); |
|
|
|
|
$clean_name = replace_accents($clean_name); |
|
|
|
|
//no "dangerous" files |
|
|
|
|
$clean_name = disable_dangerous_file($clean_name); |
|
|
|
|
if(!filter_extension($clean_name)) |
|
|
|
@ -265,8 +263,9 @@ function handle_uploaded_document($_course,$uploaded_file,$base_work_dir,$upload |
|
|
|
|
//echo "<br/>clean name = ".$clean_name; |
|
|
|
|
//echo "<br/>upload_path = ".$upload_path; |
|
|
|
|
//if the upload path differs from / (= root) it will need a slash at the end |
|
|
|
|
if ($upload_path!='/') |
|
|
|
|
if ($upload_path!='/') { |
|
|
|
|
$upload_path = $upload_path.'/'; |
|
|
|
|
} |
|
|
|
|
//echo "<br/>upload_path = ".$upload_path; |
|
|
|
|
$file_path = $upload_path.$clean_name; |
|
|
|
|
//echo "<br/>file path = ".$file_path; |
|
|
|
@ -1905,7 +1904,7 @@ $handle=opendir($path); |
|
|
|
|
* @param string The accentuated string |
|
|
|
|
* @return string The escaped string, not absolutely correct but satisfying |
|
|
|
|
*/ |
|
|
|
|
function replace_accents($string, $encoding = null){ |
|
|
|
|
function replace_accents($string, $encoding = null) { |
|
|
|
|
/* |
|
|
|
|
global $charset; |
|
|
|
|
$string = api_htmlentities($string,ENT_QUOTES,$charset); |
|
|
|
@ -1918,7 +1917,7 @@ function replace_accents($string, $encoding = null){ |
|
|
|
|
/** |
|
|
|
|
* @deprecated Use transliteration instead, it is applicable for all languages. |
|
|
|
|
*/ |
|
|
|
|
function remove_accents($string, $encoding = null){ |
|
|
|
|
function remove_accents($string, $encoding = null) { |
|
|
|
|
/* |
|
|
|
|
$string = strtr ( $string, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn"); |
|
|
|
|
return $string; |
|
|
|
|