From a9e7d80b435c0483da57223e8bafb37b403faa7d Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Wed, 7 Mar 2007 13:29:53 +0100 Subject: [PATCH] [svn r11483] Fixed bug with accents in files. This should be finetuned to work with any encoding (presently defaultinf to ISO-8859-1 because of htmlentities() defaults) --- main/newscorm/learnpath.class.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 92bac21e8e..8953745f26 100644 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -2704,7 +2704,15 @@ class learnpath { if(!is_file($sys_course_path.'/scorm/'.$lp_path.'/'.$lp_item_path)) {//if file not found - $file = 'blank.php'; + $decoded = html_entity_decode($lp_item_path); + if(!is_file($sys_course_path.'/scorm/'.$lp_path.'/'.$decoded)) + { + $file = 'blank.php'; + } + else + { + $file = $course_path.'/scorm/'.$lp_path.'/'.$decoded; + } } } //}else{ @@ -6926,19 +6934,20 @@ function display_thread_form($action = 'add', $id = 0, $extra_info = '') $organization->appendChild($my_item); //get the path of the file(s) from the course directory root - $my_file_path = $item->get_file_path(); + $my_file_path = $item->get_file_path(); + $my_xml_file_path = htmlentities($my_file_path); //give a child to the element $my_resource = $xmldoc->createElement('resource'); $my_resource->setAttribute('identifier','RESOURCE_'.$item->get_id()); $my_resource->setAttribute('type','webcontent'); - $my_resource->setAttribute('href',$my_file_path); + $my_resource->setAttribute('href',$my_xml_file_path); //adlcp:scormtype can be either 'sco' or 'asset' $my_resource->setAttribute('adlcp:scormtype','asset'); //xml:base is the base directory to find the files declared in this resource $my_resource->setAttribute('xml:base',''); //give a child to the element $my_file = $xmldoc->createElement('file'); - $my_file->setAttribute('href',$my_file_path); + $my_file->setAttribute('href',$my_xml_file_path); //dependency to other files - not yet supported //$my_dependency = $xmldoc->createElement('dependency'); //$my_dependency->setAttribute('identifierref','');