checksession.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. /* See license terms in /license.txt */
  3. /* FIX for IE cache when using https */
  4. session_cache_limiter("none");
  5. /**
  6. * This script gives information to the videoconference scripts (in OpenLaszlo)
  7. * to use the right URL and ports for the videoconference.
  8. */
  9. require_once('../newscorm/learnpath.class.php');
  10. if($debug>0) error_log('New LP - Included learnpath',0);
  11. require_once('../newscorm/learnpathItem.class.php');
  12. if($debug>0) error_log('New LP - Included learnpathItem',0);
  13. require_once('../newscorm/scorm.class.php');
  14. if($debug>0) error_log('New LP - Included scorm',0);
  15. require_once('../newscorm/scormItem.class.php');
  16. if($debug>0) error_log('New LP - Included scormItem',0);
  17. require_once('../newscorm/aicc.class.php');
  18. if($debug>0) error_log('New LP - Included aicc',0);
  19. require_once('../newscorm/aiccItem.class.php');
  20. if($debug>0) error_log('New LP - Included aiccItem',0);
  21. require("../../main/inc/global.inc.php");
  22. require_once('get_translation.lib.php');
  23. api_block_anonymous_users();
  24. //$confkey = "0123456789abcdef0123456789abcdef";
  25. $confkey = api_get_setting('service_visio','visio_pass');
  26. $challenge = api_generate_password(32); //generate a 32 characters-long challenge key
  27. require_once (api_get_path(LIBRARY_PATH)."course.lib.php");
  28. printf ('<?xml version="1.0" encoding="UTF-8" ?>');
  29. printf('<dokeosobject>');
  30. printf('<courseobject>');
  31. foreach ($_SESSION['_course'] as $key => $val)
  32. printf('<%s>%s</%s>',$key,api_utf8_encode($val),$key);
  33. printf('</courseobject>');
  34. printf('<userobject>');
  35. foreach ($_SESSION['_user'] as $key => $val)
  36. if ($key != "auth_source")
  37. {
  38. if (( $key == "lastName" || $key == "firstName" ) && strlen($val) == 0)
  39. $val = get_lang('Unknown');
  40. printf('<%s>%s</%s>',$key,api_utf8_encode($val),$key);
  41. }
  42. printf('<sid>%s</sid>', session_id());
  43. $isadmin =((CourseManager::get_user_in_course_status($_SESSION['_user']['user_id'], $_SESSION['_course']['sysCode']) == COURSEMANAGER)||
  44. api_is_platform_admin() ||
  45. api_is_course_tutor() ||
  46. api_is_course_admin() ||
  47. api_is_course_coach() ? "true" : "false");
  48. printf('<key>%s</key>', md5($confkey.$challenge));
  49. printf('<challenge>%s</challenge>', $challenge);
  50. printf('<isUploadAllowed>%s</isUploadAllowed>', $isadmin);
  51. printf('<canStartModerator>%s</canStartModerator>',($isadmin=='true' || $_SESSION["roomType"] == "conference")?'true':'false');
  52. printf('<mustStartModerator>%s</mustStartModerator>',($isadmin=='true' || $_SESSION["roomType"] == "conference")?'true':'false');
  53. printf('</userobject>');
  54. printf('<config>');
  55. printf('<host>'.api_get_setting('service_visio','visio_host').'</host>');
  56. printf('<port>'.api_get_setting('service_visio','visio_port').'</port>');
  57. printf('</config>');
  58. $path = preg_replace('/^([^:]*:\/\/)/','',api_get_path(WEB_PATH));
  59. $path = str_replace('/','_',$path);
  60. printf('<roomConfig>');
  61. printf('<portal>%s</portal>', $path);
  62. printf('<roomType>%s</roomType>', $_SESSION['roomType']); // fixme remove +
  63. printf('</roomConfig>');
  64. printf('<recorderparams>');
  65. if(isset($_SESSION['oLP']))
  66. {
  67. switch ($_SESSION['whereami'])
  68. {
  69. case 'lp/build' :
  70. $student_view = 'false';
  71. break;
  72. default :
  73. $student_view = 'true';
  74. break;
  75. }
  76. $document_id = $_SESSION['oLP']->current;
  77. }
  78. printf('<studentview>%s</studentview>',$student_view);
  79. printf('<documentid>%s</documentid>',$document_id);
  80. printf('</recorderparams>');
  81. printf('<languageobject>');
  82. printf(get_language_file_as_xml($language_interface));
  83. printf('</languageobject>');
  84. printf('</dokeosobject>');
  85. ?>