showinframes.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php // $Id: showinframes.php 14904 2008-04-15 17:22:45Z juliomontoya $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2008 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Hugues Peeters
  9. Copyright (c) Roan Embrechts
  10. For a full list of contributors, see "credits.txt".
  11. The full license can be read in "license.txt".
  12. This program is free software; you can redistribute it and/or
  13. modify it under the terms of the GNU General Public License
  14. as published by the Free Software Foundation; either version 2
  15. of the License, or (at your option) any later version.
  16. See the GNU General Public License for more details.
  17. Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  18. Mail: info@dokeos.com
  19. ==============================================================================
  20. */
  21. /**
  22. ==============================================================================
  23. * This file will show documents in a separate frame.
  24. * We don't like frames, but it was the best of two bad things.
  25. *
  26. * display html files within Dokeos - html files have the Dokeos header.
  27. *
  28. * --- advantages ---
  29. * users "feel" like they are in Dokeos,
  30. * and they can use the navigation context provided by the header.
  31. *
  32. * --- design ---
  33. * a file gets a parameter (an html file)
  34. * and shows
  35. * - dokeos header
  36. * - html file from parameter
  37. * - (removed) dokeos footer
  38. *
  39. * @version 0.6
  40. * @author Roan Embrechts (roan.embrechts@vub.ac.be)
  41. * @package dokeos.document
  42. ==============================================================================
  43. */
  44. /*
  45. ==============================================================================
  46. DOKEOS INIT
  47. ==============================================================================
  48. */
  49. $language_file[] = 'document';
  50. include('../inc/global.inc.php');
  51. if (!empty($_GET['nopages']))
  52. {
  53. $nopages=Security::remove_XSS($_GET['nopages']);
  54. if ($nopages==1)
  55. {
  56. require_once(api_get_path(INCLUDE_PATH) . 'reduced_header.inc.php');
  57. Display::display_error_message(get_lang('FileNotFound'));
  58. }
  59. exit();
  60. }
  61. $_SESSION['whereami'] = 'document/view';
  62. $interbreadcrumb[]= array ('url'=>'./document.php', 'name'=> get_lang('Documents'));
  63. $nameTools = get_lang('Documents');
  64. $file = Security::remove_XSS(urldecode($_GET['file']));
  65. /*
  66. ==============================================================================
  67. Main section
  68. ==============================================================================
  69. */
  70. header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
  71. //header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
  72. header('Last-Modified: Wed, 01 Jan 2100 00:00:00 GMT');
  73. header('Cache-Control: no-cache, must-revalidate');
  74. header('Pragma: no-cache');
  75. $browser_display_title = "Dokeos Documents - " . $_GET['cidReq'] . " - " . $file;
  76. //only admins get to see the "no frames" link in pageheader.php, so students get a header that's not so high
  77. $frameheight = 130;
  78. if($is_courseAdmin)
  79. {
  80. $frameheight = 150;
  81. }
  82. $file_root=$_course['path'].'/document'.str_replace('%2F', '/',$file);
  83. $file_url_sys=api_get_path('SYS_COURSE_PATH').$file_root;
  84. $file_url_web=api_get_path('WEB_COURSE_PATH').$file_root;
  85. ?>
  86. <html>
  87. <head>
  88. <title><?php echo $browser_display_title;?></title>
  89. </head>
  90. <frameset rows="<?php echo $frameheight; ?>,*" border="0" frameborder="no" >
  91. <frame name="top" scrolling="no" noresize target="contents" src="headerpage.php?file=<?php echo $file.'&amp;'.api_get_cidreq(); ?>">
  92. <?php
  93. if (file_exists($file_url_sys))
  94. {
  95. echo '<frame name="main" src="'.$file_url_web.'?'.api_get_cidreq().'&rand='.mt_rand(1,10000).'">';
  96. }
  97. else
  98. {
  99. echo '<frame name="main" src=showinframes.php?nopages=1>';
  100. }
  101. ?>
  102. <noframes>
  103. <body>
  104. <p>This page uses frames, but your browser doesn't support them.<br/>
  105. We suggest you try Mozilla, Firefox, Safari, Opera, or other browsers updated this millenium.</p>
  106. </body>
  107. </noframes>
  108. </frameset>
  109. </html>