showinframes.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2005 Dokeos S.A.
  6. For a full list of contributors, see "credits.txt".
  7. The full license can be read in "license.txt".
  8. This program is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU General Public License
  10. as published by the Free Software Foundation; either version 2
  11. of the License, or (at your option) any later version.
  12. See the GNU General Public License for more details.
  13. Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  14. Mail: info@dokeos.com
  15. ==============================================================================
  16. */
  17. /**
  18. ==============================================================================
  19. * This is the copy of showinframes.php, with little modifications for the scorm player.
  20. *
  21. * Based on showincontext.php, this file will show documents in a separate frame.
  22. *
  23. * @author Denes Nagy
  24. * @package dokeos.scorm
  25. ==============================================================================
  26. */
  27. $langFile = "scormdocument";
  28. include('../inc/global.inc.php');
  29. $this_section=SECTION_COURSES;
  30. $openfirst = $_REQUEST['openfirst'];
  31. $indexRoute = $_REQUEST['indexRoute'];
  32. $file = $_REQUEST['file'];
  33. $openDir = $_REQUEST['openDir'];
  34. // Check if the requested file is in the right location (scorm folder in course directory and no .. in the path)
  35. $file_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/scorm';
  36. if(substr($file,0,strlen($file_path)) != $file_path || strpos($file,'..') > 0)
  37. {
  38. api_not_allowed();
  39. }
  40. echo "<html><head><title>".get_lang('Doc')." - Dokeos</title></head>";
  41. $path=api_get_path(WEB_COURSE_PATH).api_get_course_path().'/scorm'.$openDir;
  42. //if we find the given text in file (=imsmanifest.xml), then the content is an e-doceo contentm so
  43. // API frames are not to be implemented
  44. $filename=$path.'/imsmanifest.xml';
  45. $edoceo='no';
  46. // introducing the brand new... file check! ;-)
  47. if (!is_file($filename)){
  48. // is this AICC?
  49. }else{
  50. //detect if AICC
  51. $handle = fopen($filename, "rb");
  52. $contents = '';
  53. while (!feof($handle)) {
  54. $contents .= fread($handle, 8192);
  55. }
  56. fclose($handle);
  57. $needle="Made with elearning maker";
  58. $pos=strpos($contents, $needle);
  59. if ($pos > 0) { $edoceo="yes"; } else { $edoceo="no"; }
  60. }
  61. $time=time();
  62. $backurl = getURL(api_get_path(WEB_PATH)).$_SERVER['REQUEST_URI'];
  63. if ((isset($_GET["fs"])) && (strcmp($_GET["fs"],"true")==0)) //fullscreen
  64. {
  65. ?>
  66. <frameset rows="0,27,0,*,70,0,0" frameborder="no" framespacing="0">
  67. <frame name="top" scrolling="no" target="contents" src="headerpage.php?openDir=<?php echo urlencode($openDir); ?>">
  68. <frame name="load" src="load.php<?php echo "?file=".urlencode($file)."&openDir=".urlencode($openDir)."&time=$time&backurl=$backurl&fs=true&edoceo=$edoceo"; ?>" scrolling="no">
  69. <frame name='contents' scrolling='auto' src="contents.php<?php echo "?file=".urlencode($file)."&openDir=".urlencode($openDir)."&time=$time&openfirst=$openfirst&edoceo=$edoceo"; ?>">
  70. <frame src="UntitledFrame-12" name="sco" scrolling="auto">
  71. <frame name="message" scrolling="no" src="blank.php">
  72. <?php if (empty($indexRoute)) { ?>
  73. <?php if ($edoceo=="no") { ?>
  74. <frame name="API" src="scormfunctions.php<?php echo "?$time"; ?>"> <!-- Scorm 1.2 contents search for this -->
  75. <frame name="API_1484_11" src="scormfunctions.php<?php echo "?$time"; ?>"> <!-- Scorm 1.3 contents search for this -->
  76. <?php } else { ?>
  77. <frame name="edoceo1" src="blank.php">
  78. <frame name="edoceo2" src="blank.php">
  79. <?php } ?>
  80. <?php } else { //indexRoute exists -> Plantyn content ?>
  81. <frame name='contents' scrolling='auto' src="<?php echo "$path/$indexRoute"; ?>">
  82. <frame name="Untitled" src="blank.php">
  83. <?php } ?>
  84. </frameset>
  85. <?php
  86. } else { //not fullscreen
  87. ?>
  88. <frameset rows="100,*" frameborder="no" framespacing="0">
  89. <frame name="top" scrolling="no" target="contents" src="headerpage.php?openDir=<?php echo urlencode($openDir); ?>">
  90. <?php if (empty($indexRoute)) { ?>
  91. <frameset cols="220,*" frameborder="1" framespacing="2" border="1">
  92. <frameset rows="*,27,70" frameborder="no" framespacing="0">
  93. <frame name='contents' scrolling='auto' src="contents.php<?php echo "?file=".urlencode($file)."&openDir=".urlencode($openDir)."&time=$time&openfirst=$openfirst&edoceo=$edoceo"; ?>">
  94. <frameset cols="0,0,275" frameborder="no" framespacing="0">
  95. <?php if ($edoceo=="no") { ?>
  96. <frame name="API" src="scormfunctions.php<?php echo "?$time"; ?>"> <!-- Scorm 1.2 contents search for this -->
  97. <frame name="API_1484_11" src="scormfunctions.php<?php echo "?$time"; ?>"> <!-- Scorm 1.3 contents search for this -->
  98. <?php } else { ?>
  99. <frame name="edoceo1" src="blank.php">
  100. <frame name="edoceo2" src="blank.php">
  101. <?php } ?>
  102. <frame name="load" src="load.php<?php echo "?file=".urlencode($file)."&openDir=".urlencode($openDir)."&time=$time&backurl=$backurl&edoceo=$edoceo"; ?>" scrolling="no">
  103. </frameset>
  104. <frame name="message" scrolling="no" src="blank.php">
  105. </frameset>
  106. <frame name="sco" scrolling="auto">
  107. </frameset>
  108. <?php } else { //indexRoute exists -> Plantyn content ?>
  109. <frame name='contents' scrolling='auto' src="<?php echo "$path/$indexRoute"; ?>">
  110. <?php } ?>
  111. </frameset>
  112. <?php
  113. }
  114. ?>
  115. <noframes>
  116. <body>
  117. <p>This page uses frames, but your browser doesn't support them.
  118. If you cannot use a more modern browser, please contact us to ask for a non-frames version.
  119. </p>
  120. </body>
  121. </noframes>
  122. </frameset>
  123. </html>