upload.php 1.3 KB

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