[svn r15502] fix bugs when converting documents in visioconference :

- folders were not created at the good place
- it didn't work at all if they were accents or uppercase chars in filename
skala
Eric Marguin 17 years ago
parent 4a5a51a5f6
commit f2d65b92a2
  1. 2
      main/conference/api.php
  2. 19
      main/newscorm/openoffice_document.class.php
  3. 5
      main/newscorm/openoffice_presentation.class.php

@ -102,7 +102,7 @@ else if ($action == "upload")
}
/*==== file upload ====*/
$newPath = handle_uploaded_document($_course,$_FILES['Filedata'],$coursePath,VIDEOCONF_UPLOAD_PATH,$user_id,0,NULL,'',0,'rename',false);
$newPath = $_FILES['Filedata']['name'];
if($debug>0) error_log($newPath);
/*==== extension extraction ====*/

@ -39,24 +39,23 @@ abstract class OpenofficeDocument extends learnpath {
$this->file_name = remove_accents($this->file_name);
$this->file_name = replace_dangerous_char($this->file_name,'strict');
$this->file_name = strtolower($this->file_name);
$visio_dir = ($action_after_conversion=='add_docs_to_visio')?VIDEOCONF_UPLOAD_PATH:'';
$this->file_path = $this->file_name.'.'.pathinfo($file['name'],PATHINFO_EXTENSION);
$dir_name = '/'.$this->file_name;
$this->file_path = $visio_dir.'/'.$this->file_name.'.'.pathinfo($file['name'],PATHINFO_EXTENSION);
$dir_name = $visio_dir.'/'.$this->file_name;
//create the directory
//create the directory
$this->base_work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$visio_dir = ($action_after_conversion=='add_docs_to_visio')?VIDEOCONF_UPLOAD_PATH:'';
$this->created_dir = create_unexisting_directory($_course,$_user['user_id'],0,0,$this->base_work_dir,$visio_dir.$dir_name);
$this->created_dir = create_unexisting_directory($_course,$_user['user_id'],0,0,$this->base_work_dir,$dir_name);
move_uploaded_file($file['tmp_name'],$this->base_work_dir.'/'.$this->file_path);
$perm = api_get_setting('permissions_for_new_files');
@ -80,7 +79,7 @@ abstract class OpenofficeDocument extends learnpath {
// to allow openoffice to manipulate docs.
chmod ($this->base_work_dir.$this->created_dir,0777);
chmod($this->base_work_dir.'/'.$this->file_path,0777);
chmod ($this->base_work_dir.'/'.$this->file_path,0777);
$locale = 'en_US.UTF-8'; // TODO : improve it because we're not sure this locale is present everywhere
putenv('LC_ALL='.$locale);

@ -110,7 +110,10 @@ class OpenofficePresentation extends OpenofficeDocument {
foreach($files as $file){
list($slide_name,$file_name) = explode('||',$file); // '||' is used as separator between slide name (with accents) and file name (without accents)
$slide_name = utf8_decode($slide_name); //filename has been written in java, so unicode
$slide_name = htmlentities($slide_name,ENT_COMPAT,'utf-8');
$slide_name = str_replace('’','\'',$slide_name);
$slide_name = mb_convert_encoding($slide_name, api_get_setting('platform_charset'), 'utf-8');
$slide_name = html_entity_decode($slide_name);
$did = add_document($_course, $this->created_dir.'/'.urlencode($file_name), 'file', filesize($this->base_work_dir.$this->created_dir.'/'.$file_name), $slide_name);
if ($did)

Loading…
Cancel
Save