upload.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. /**
  10. * First, initialise the script
  11. */
  12. // global settings initialisation
  13. // also provides access to main api (inc/lib/main_api.lib.php)
  14. require_once '../inc/global.inc.php';
  15. // return to index if no tool is set
  16. if (empty($_SESSION['my_tool'])) {
  17. header('location:index.php');
  18. exit;
  19. }
  20. // check access permissions (edit permission is needed to add a document or a LP)
  21. $is_allowed_to_edit = api_is_allowed_to_edit();
  22. if (!$is_allowed_to_edit) {
  23. api_not_allowed(true);
  24. }
  25. /**
  26. * Redirect to the correct script to handle this type of upload
  27. */
  28. switch ($_SESSION['my_tool']) {
  29. case TOOL_LEARNPATH:
  30. require 'upload.scorm.php';
  31. break;
  32. //the following cases need to be distinguished later on
  33. case TOOL_DROPBOX:
  34. case TOOL_STUDENTPUBLICATION:
  35. case TOOL_DOCUMENT:
  36. default:
  37. require 'upload.document.php';
  38. break;
  39. }