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