upload.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use ChamiloSession as Session;
  4. /**
  5. * Action controller for the upload process. The display scripts (web forms) redirect
  6. * the process here to do what needs to be done with each file.
  7. *
  8. * @package chamilo.upload
  9. *
  10. * @author Yannick Warnier <ywarnier@beeznest.org>
  11. */
  12. require_once __DIR__.'/../inc/global.inc.php';
  13. $toolFromSession = Session::read('my_tool');
  14. // return to index if no tool is set
  15. if (empty($toolFromSession)) {
  16. header('location:index.php');
  17. exit;
  18. }
  19. // check access permissions (edit permission is needed to add a document or a LP)
  20. $is_allowed_to_edit = api_is_allowed_to_edit();
  21. if (!$is_allowed_to_edit) {
  22. api_not_allowed(true);
  23. }
  24. /**
  25. * Redirect to the correct script to handle this type of upload.
  26. */
  27. switch ($toolFromSession) {
  28. case TOOL_LEARNPATH:
  29. require 'upload.scorm.php';
  30. break;
  31. //the following cases need to be distinguished later on
  32. case TOOL_DROPBOX:
  33. case TOOL_STUDENTPUBLICATION:
  34. case TOOL_DOCUMENT:
  35. default:
  36. require 'upload.document.php';
  37. break;
  38. }