Fix LP export to scorm see BT#14644

- Remove use of $_SERVER['DOCUMENT_ROOT']
- fix wrong strpos()
pull/2588/merge
Julio Montoya 8 years ago
parent 69a499a6ca
commit a15168c466
  1. 28
      main/lp/learnpath.class.php

@ -11129,12 +11129,26 @@ class learnpath
$my_dep_file->setAttribute('href', 'document/'.$file_path);
$my_dep->setAttribute('xml:base', '');
} elseif (empty($file_path)) {
$file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
$file_path = str_replace('//', '/', $file_path);
if (file_exists($file_path)) {
$file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
$docSysPartPath = str_replace(
api_get_path(REL_COURSE_PATH),
'',
$doc_info[0]
);
$docSysPartPathNoCourseCode = str_replace(
$_course['directory'].'/',
'',
$docSysPartPath
);
$docSysPath = api_get_path(SYS_COURSE_PATH).$docSysPartPath;
if (file_exists($docSysPath)) {
$file_path = $docSysPartPathNoCourseCode;
$zip_files[] = $my_sub_dir.'/'.$file_path;
$link_updates[$my_file_path][] = ['orig' => $doc_info[0], 'dest' => $file_path];
$link_updates[$my_file_path][] = [
'orig' => $doc_info[0],
'dest' => $file_path,
];
$my_dep_file->setAttribute('href', 'document/'.$file_path);
$my_dep->setAttribute('xml:base', '');
}
@ -11263,8 +11277,8 @@ class learnpath
) {
$old_new['dest'] = str_replace('video/', '../../../../video/', $old_new['dest']);
}
//Fix to avoid problems with default_course_document
if (strpos("main/default_course_document", $old_new['dest'] === false)) {
// Fix to avoid problems with default_course_document
if (strpos("main/default_course_document", $old_new['dest']) === false) {
//$newDestination = str_replace('document/', $mult.'document/', $old_new['dest']);
$newDestination = $old_new['dest'];
} else {

Loading…
Cancel
Save