|
@@ 9518-9542 (lines=25) @@
|
| 9515 |
|
$file_path = str_replace('\\', '/', $file_path); |
| 9516 |
|
$my_dep_file->setAttribute('href', 'document/'.$file_path); |
| 9517 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9518 |
|
if (strstr($file_path, $main_path) !== false) { |
| 9519 |
|
// The calculated real path is really inside the chamilo root path. |
| 9520 |
|
// Reduce file path to what's under the DocumentRoot. |
| 9521 |
|
$file_path = substr($file_path, strlen($root_path)); |
| 9522 |
|
//echo $file_path;echo '<br /><br />'; |
| 9523 |
|
//error_log('Reduced path: '.$file_path, 0); |
| 9524 |
|
$zip_files_abs[] = $file_path; |
| 9525 |
|
$link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => 'document/'.$file_path); |
| 9526 |
|
$my_dep_file->setAttribute('href', 'document/'.$file_path); |
| 9527 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9528 |
|
} elseif (empty($file_path)) { |
| 9529 |
|
/*$document_root = substr(api_get_path(SYS_PATH), 0, strpos(api_get_path(SYS_PATH),api_get_path(REL_PATH))); |
| 9530 |
|
if (strpos($document_root,-1) == '/') { |
| 9531 |
|
$document_root = substr(0, -1, $document_root); |
| 9532 |
|
}*/ |
| 9533 |
|
$file_path = $_SERVER['DOCUMENT_ROOT'].$abs_path; |
| 9534 |
|
$file_path = str_replace('//', '/', $file_path); |
| 9535 |
|
if (file_exists($file_path)) { |
| 9536 |
|
$file_path = substr($file_path, strlen($current_dir)); // We get the relative path. |
| 9537 |
|
$zip_files[] = $my_sub_dir.'/'.$file_path; |
| 9538 |
|
$link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => 'document/'.$file_path); |
| 9539 |
|
$my_dep_file->setAttribute('href', 'document/'.$file_path); |
| 9540 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9541 |
|
} |
| 9542 |
|
} |
| 9543 |
|
break; |
| 9544 |
|
case 'abs': // Absolute path from DocumentRoot. Save file and leave path as is in the zip. |
| 9545 |
|
$current_dir = dirname($current_course_path.'/'.$item->get_file_path()).'/'; |
|
@@ 9552-9576 (lines=25) @@
|
| 9549 |
|
$my_dep_file->setAttribute('href', $file_path); |
| 9550 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9551 |
|
|
| 9552 |
|
if (strstr($file_path,$main_path) !== false) { |
| 9553 |
|
// The calculated real path is really inside the chamilo root path. |
| 9554 |
|
// Reduce file path to what's under the DocumentRoot. |
| 9555 |
|
$file_path = substr($file_path, strlen($root_path)); |
| 9556 |
|
//echo $file_path;echo '<br /><br />'; |
| 9557 |
|
//error_log('Reduced path: '.$file_path, 0); |
| 9558 |
|
$zip_files_abs[] = $file_path; |
| 9559 |
|
$link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); |
| 9560 |
|
$my_dep_file->setAttribute('href', 'document/'.$file_path); |
| 9561 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9562 |
|
} elseif (empty($file_path)) { |
| 9563 |
|
/*$document_root = substr(api_get_path(SYS_PATH), 0, strpos(api_get_path(SYS_PATH), api_get_path(REL_PATH))); |
| 9564 |
|
if (strpos($document_root,-1) == '/') { |
| 9565 |
|
$document_root = substr(0, -1, $document_root); |
| 9566 |
|
}*/ |
| 9567 |
|
$file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0]; |
| 9568 |
|
$file_path = str_replace('//', '/', $file_path); |
| 9569 |
|
if (file_exists($file_path)) { |
| 9570 |
|
$file_path = substr($file_path,strlen($current_dir)); // We get the relative path. |
| 9571 |
|
$zip_files[] = $my_sub_dir.'/'.$file_path; |
| 9572 |
|
$link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); |
| 9573 |
|
$my_dep_file->setAttribute('href', 'document/'.$file_path); |
| 9574 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9575 |
|
} |
| 9576 |
|
} |
| 9577 |
|
break; |
| 9578 |
|
case 'rel': // Path relative to the current document. Save xml:base as current document's directory and save file in zip as subdir.file_path |
| 9579 |
|
if (substr($doc_info[0], 0, 2) == '..') { |