|
@@ 9440-9464 (lines=25) @@
|
| 9437 |
|
$file_path = str_replace('\\', '/', $file_path); |
| 9438 |
|
$my_dep_file->setAttribute('href', 'document/'.$file_path); |
| 9439 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9440 |
|
if (strstr($file_path, $main_path) !== false) { |
| 9441 |
|
// The calculated real path is really inside the chamilo root path. |
| 9442 |
|
// Reduce file path to what's under the DocumentRoot. |
| 9443 |
|
$file_path = substr($file_path, strlen($root_path)); |
| 9444 |
|
//echo $file_path;echo '<br /><br />'; |
| 9445 |
|
//error_log('Reduced path: '.$file_path, 0); |
| 9446 |
|
$zip_files_abs[] = $file_path; |
| 9447 |
|
$link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => 'document/'.$file_path); |
| 9448 |
|
$my_dep_file->setAttribute('href', 'document/'.$file_path); |
| 9449 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9450 |
|
} elseif (empty($file_path)) { |
| 9451 |
|
/*$document_root = substr(api_get_path(SYS_PATH), 0, strpos(api_get_path(SYS_PATH),api_get_path(REL_PATH))); |
| 9452 |
|
if (strpos($document_root,-1) == '/') { |
| 9453 |
|
$document_root = substr(0, -1, $document_root); |
| 9454 |
|
}*/ |
| 9455 |
|
$file_path = $_SERVER['DOCUMENT_ROOT'].$abs_path; |
| 9456 |
|
$file_path = str_replace('//', '/', $file_path); |
| 9457 |
|
if (file_exists($file_path)) { |
| 9458 |
|
$file_path = substr($file_path, strlen($current_dir)); // We get the relative path. |
| 9459 |
|
$zip_files[] = $my_sub_dir.'/'.$file_path; |
| 9460 |
|
$link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => 'document/'.$file_path); |
| 9461 |
|
$my_dep_file->setAttribute('href', 'document/'.$file_path); |
| 9462 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9463 |
|
} |
| 9464 |
|
} |
| 9465 |
|
break; |
| 9466 |
|
case 'abs': // Absolute path from DocumentRoot. Save file and leave path as is in the zip. |
| 9467 |
|
$current_dir = dirname($current_course_path.'/'.$item->get_file_path()).'/'; |
|
@@ 9474-9498 (lines=25) @@
|
| 9471 |
|
$my_dep_file->setAttribute('href', $file_path); |
| 9472 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9473 |
|
|
| 9474 |
|
if (strstr($file_path,$main_path) !== false) { |
| 9475 |
|
// The calculated real path is really inside the chamilo root path. |
| 9476 |
|
// Reduce file path to what's under the DocumentRoot. |
| 9477 |
|
$file_path = substr($file_path, strlen($root_path)); |
| 9478 |
|
//echo $file_path;echo '<br /><br />'; |
| 9479 |
|
//error_log('Reduced path: '.$file_path, 0); |
| 9480 |
|
$zip_files_abs[] = $file_path; |
| 9481 |
|
$link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); |
| 9482 |
|
$my_dep_file->setAttribute('href', 'document/'.$file_path); |
| 9483 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9484 |
|
} elseif (empty($file_path)) { |
| 9485 |
|
/*$document_root = substr(api_get_path(SYS_PATH), 0, strpos(api_get_path(SYS_PATH), api_get_path(REL_PATH))); |
| 9486 |
|
if (strpos($document_root,-1) == '/') { |
| 9487 |
|
$document_root = substr(0, -1, $document_root); |
| 9488 |
|
}*/ |
| 9489 |
|
$file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0]; |
| 9490 |
|
$file_path = str_replace('//', '/', $file_path); |
| 9491 |
|
if (file_exists($file_path)) { |
| 9492 |
|
$file_path = substr($file_path,strlen($current_dir)); // We get the relative path. |
| 9493 |
|
$zip_files[] = $my_sub_dir.'/'.$file_path; |
| 9494 |
|
$link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); |
| 9495 |
|
$my_dep_file->setAttribute('href', 'document/'.$file_path); |
| 9496 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9497 |
|
} |
| 9498 |
|
} |
| 9499 |
|
break; |
| 9500 |
|
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 |
| 9501 |
|
if (substr($doc_info[0], 0, 2) == '..') { |