download.php 817 B

123456789101112131415161718192021222324252627282930313233343536
  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 '../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 = intval($_GET['id']);
  18. $courseInfo = api_get_course_info();
  19. if (empty($courseInfo)) {
  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;