upload.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php // $Id$
  2. /**
  3. * Action controller for the upload process. The display scripts (web forms) redirect
  4. * the process here to do what needs to be done with each file.
  5. * @package dokeos.upload
  6. * @author Yannick Warnier <ywarnier@beeznest.org>
  7. */
  8. /**
  9. * First, initialise the script
  10. */
  11. // name of the language file that needs to be included
  12. $language_file = 'document';
  13. //the document file is loaded because most of the upload vocab relates to the document tool
  14. // global settings initialisation
  15. // also provides access to main api (inc/lib/main_api.lib.php)
  16. include("../inc/global.inc.php");
  17. // return to index if no tool is set
  18. if(empty($_SESSION['my_tool'])){header('location:index.php');}
  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($_SESSION['my_tool']){
  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. }
  39. ?>