|
@@ 9464-9488 (lines=25) @@
|
| 9461 |
|
$file_path = str_replace('\\', '/', $file_path); |
| 9462 |
|
$my_dep_file->setAttribute('href', 'document/'.$file_path); |
| 9463 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9464 |
|
if (strstr($file_path, $main_path) !== false) { |
| 9465 |
|
// The calculated real path is really inside the chamilo root path. |
| 9466 |
|
// Reduce file path to what's under the DocumentRoot. |
| 9467 |
|
$file_path = substr($file_path, strlen($root_path)); |
| 9468 |
|
//echo $file_path;echo '<br /><br />'; |
| 9469 |
|
//error_log('Reduced path: '.$file_path, 0); |
| 9470 |
|
$zip_files_abs[] = $file_path; |
| 9471 |
|
$link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => 'document/'.$file_path); |
| 9472 |
|
$my_dep_file->setAttribute('href', 'document/'.$file_path); |
| 9473 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9474 |
|
} elseif (empty($file_path)) { |
| 9475 |
|
/*$document_root = substr(api_get_path(SYS_PATH), 0, strpos(api_get_path(SYS_PATH),api_get_path(REL_PATH))); |
| 9476 |
|
if (strpos($document_root,-1) == '/') { |
| 9477 |
|
$document_root = substr(0, -1, $document_root); |
| 9478 |
|
}*/ |
| 9479 |
|
$file_path = $_SERVER['DOCUMENT_ROOT'].$abs_path; |
| 9480 |
|
$file_path = str_replace('//', '/', $file_path); |
| 9481 |
|
if (file_exists($file_path)) { |
| 9482 |
|
$file_path = substr($file_path, strlen($current_dir)); // We get the relative path. |
| 9483 |
|
$zip_files[] = $my_sub_dir.'/'.$file_path; |
| 9484 |
|
$link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => 'document/'.$file_path); |
| 9485 |
|
$my_dep_file->setAttribute('href', 'document/'.$file_path); |
| 9486 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9487 |
|
} |
| 9488 |
|
} |
| 9489 |
|
break; |
| 9490 |
|
case 'abs': // Absolute path from DocumentRoot. Save file and leave path as is in the zip. |
| 9491 |
|
$current_dir = dirname($current_course_path.'/'.$item->get_file_path()).'/'; |
|
@@ 9498-9522 (lines=25) @@
|
| 9495 |
|
$my_dep_file->setAttribute('href', $file_path); |
| 9496 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9497 |
|
|
| 9498 |
|
if (strstr($file_path,$main_path) !== false) { |
| 9499 |
|
// The calculated real path is really inside the chamilo root path. |
| 9500 |
|
// Reduce file path to what's under the DocumentRoot. |
| 9501 |
|
$file_path = substr($file_path, strlen($root_path)); |
| 9502 |
|
//echo $file_path;echo '<br /><br />'; |
| 9503 |
|
//error_log('Reduced path: '.$file_path, 0); |
| 9504 |
|
$zip_files_abs[] = $file_path; |
| 9505 |
|
$link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); |
| 9506 |
|
$my_dep_file->setAttribute('href', 'document/'.$file_path); |
| 9507 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9508 |
|
} elseif (empty($file_path)) { |
| 9509 |
|
/*$document_root = substr(api_get_path(SYS_PATH), 0, strpos(api_get_path(SYS_PATH), api_get_path(REL_PATH))); |
| 9510 |
|
if (strpos($document_root,-1) == '/') { |
| 9511 |
|
$document_root = substr(0, -1, $document_root); |
| 9512 |
|
}*/ |
| 9513 |
|
$file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0]; |
| 9514 |
|
$file_path = str_replace('//', '/', $file_path); |
| 9515 |
|
if (file_exists($file_path)) { |
| 9516 |
|
$file_path = substr($file_path,strlen($current_dir)); // We get the relative path. |
| 9517 |
|
$zip_files[] = $my_sub_dir.'/'.$file_path; |
| 9518 |
|
$link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); |
| 9519 |
|
$my_dep_file->setAttribute('href', 'document/'.$file_path); |
| 9520 |
|
$my_dep->setAttribute('xml:base', ''); |
| 9521 |
|
} |
| 9522 |
|
} |
| 9523 |
|
break; |
| 9524 |
|
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 |
| 9525 |
|
if (substr($doc_info[0], 0, 2) == '..') { |