download.php 859 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This file is responsible for passing requested documents to the browser.
  5. * Html files are parsed to fix a few problems with URLs,
  6. * but this code will hopefully be replaced soon by an Apache URL
  7. * rewrite mechanism.
  8. *
  9. * @package chamilo.work
  10. */
  11. require_once __DIR__.'/../inc/global.inc.php';
  12. require_once 'work.lib.php';
  13. $current_course_tool = TOOL_STUDENTPUBLICATION;
  14. $this_section = SECTION_COURSES;
  15. // Course protection
  16. api_protect_course_script(true);
  17. $id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
  18. $courseInfo = api_get_course_info();
  19. if (empty($courseInfo) || empty($id)) {
  20. api_not_allowed(true);
  21. }
  22. $correction = isset($_REQUEST['correction']) ? true : false;
  23. $result = downloadFile($id, $courseInfo, $correction);
  24. if ($result === false) {
  25. api_not_allowed(true);
  26. }
  27. exit;