upload.php 1.0 KB

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