123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- session_cache_limiter('public');
- require_once '../inc/global.inc.php';
- $this_section=SECTION_COURSES;
- require_once api_get_path(LIBRARY_PATH).'document.lib.php';
- require_once 'agenda.inc.php';
- header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
- header('Cache-Control: public');
- header('Pragma: no-cache');
- api_protect_course_script(true);
- $doc_url = $_GET['file'];
- $doc_url = str_replace('///', '&', $doc_url);
- $doc_url = str_replace(' ', '+', $doc_url);
- $doc_url = str_replace('/..', '', $doc_url);
- if (!isset($_course)) {
- api_not_allowed(true);
- }
- $full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/calendar/'.$doc_url;
- if (is_dir($full_file_name))
- {
-
-
-
- while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul);
-
- $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path();
-
- header('Location: '.$document_explorer);
- }
- $tbl_agenda_attachment = Database::get_course_table(TABLE_AGENDA_ATTACHMENT);
- event_download($doc_url);
- $sql='SELECT filename FROM '.$tbl_agenda_attachment.'
- WHERE path LIKE BINARY "'.$doc_url.'"';
- $result= Database::query($sql, __FILE__, __LINE__);
- $row= Database::fetch_array($result);
- $title = str_replace(' ','_', $row['filename']);
- DocumentManager::file_send_for_download($full_file_name,TRUE, $title);
- exit;
- ?>
|