123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
- session_cache_limiter('public');
- include('../inc/global.inc.php');
- $this_section=SECTION_COURSES;
- include(api_get_path(LIBRARY_PATH).'document.lib.php');
- header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
- header('Cache-Control: public');
- header('Pragma: no-cache');
- api_protect_course_script();
- $doc_url = $_GET['doc_url'];
- $doc_url = str_replace('///', '&', $doc_url);
- $doc_url = str_replace(' ', '+', $doc_url);
- $doc_url = str_replace('/..', '', $doc_url);
- include(api_get_path(LIBRARY_PATH).'events.lib.inc.php');
- if (! isset($_course))
- {
- api_not_allowed(true);
- }
- if(is_dir(api_get_path(SYS_COURSE_PATH).$_course['path']."/document".$doc_url))
- {
-
-
-
- while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul);
-
- $gid_req = ($_GET['gidReq'])?'&gidReq='.$_GET['gidReq']:'';
-
- $document_explorer = api_get_path(WEB_CODE_PATH).'document/document.php?curdirpath='.urlencode($doc_url).'&cidReq='.$_GET['cidReq'].$gid_req;
-
- header('Location: '.$document_explorer);
- }
- event_download($doc_url);
- $sys_course_path = api_get_path(SYS_COURSE_PATH);
- $full_file_name = $sys_course_path.$_course['path'].'/document'.$doc_url;
- DocumentManager::file_send_for_download($full_file_name);
- ?>
|