upload.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. * @package chamilo.upload
  8. * @author Yannick Warnier <ywarnier@beeznest.org>
  9. */
  10. require_once __DIR__.'/../inc/global.inc.php';
  11. $toolFromSession = Session::read('my_tool');
  12. // return to index if no tool is set
  13. if (empty($toolFromSession)) {
  14. header('location:index.php');
  15. exit;
  16. }
  17. // check access permissions (edit permission is needed to add a document or a LP)
  18. $is_allowed_to_edit = api_is_allowed_to_edit();
  19. if (!$is_allowed_to_edit) {
  20. api_not_allowed(true);
  21. }
  22. /**
  23. * Redirect to the correct script to handle this type of upload
  24. */
  25. switch ($toolFromSession) {
  26. case TOOL_LEARNPATH:
  27. require 'upload.scorm.php';
  28. break;
  29. //the following cases need to be distinguished later on
  30. case TOOL_DROPBOX:
  31. case TOOL_STUDENTPUBLICATION:
  32. case TOOL_DOCUMENT:
  33. default:
  34. require 'upload.document.php';
  35. break;
  36. }