Dokeos PHP Cross Reference Learning Management Systems

Source: /main/document/showinframes.php - 128 lines - 5714 bytes - Summary - Text - Print

Description: This file will show documents in a separate frame. We don't like frames, but it was the best of two bad things.

   1  <?php // $Id: showinframes.php 22177 2009-07-16 22:30:39Z iflorespaz $
   2  
   3  /* For licensing terms, see /dokeos_license.txt */
   4  
   5  /**
   6  ==============================================================================
   7  *    This file will show documents in a separate frame.
   8  *    We don't like frames, but it was the best of two bad things.
   9  *
  10  *    display html files within Dokeos - html files have the Dokeos header.
  11  *
  12  *    --- advantages ---
  13  *    users "feel" like they are in Dokeos,
  14  *    and they can use the navigation context provided by the header.
  15  *
  16  *    --- design ---
  17  *    a file gets a parameter (an html file)
  18  *    and shows
  19  *    - dokeos header
  20  *    - html file from parameter
  21  *    - (removed) dokeos footer
  22  *
  23  *    @version 0.6
  24  *    @author Roan Embrechts (roan.embrechts@vub.ac.be)
  25  *    @package dokeos.document
  26  ==============================================================================
  27  */
  28  
  29  // name of the language file that needs to be included 
  30  $language_file[] = 'document';
  31  
  32  // include the global Dokeos file
  33  require_once  '../inc/global.inc.php';
  34  
  35  // include additional libraries
  36  require_once  '../glossary/glossary.class.php';
  37  
  38  if (!empty($_GET['nopages'])) {
  39      $nopages=Security::remove_XSS($_GET['nopages']);
  40      if ($nopages==1) {
  41          require_once api_get_path(INCLUDE_PATH).'reduced_header.inc.php';
  42          echo '<div id="content"><br/><br/><div class="confirmation-message">'.get_lang('FileNotFound').'</div></div>';
  43      }
  44      exit;
  45  }
  46  
  47  $_SESSION['whereami'] = 'document/view';
  48  $_SESSION['dbName'] = $_course['dbName'];
  49  // breadcrumbs
  50  $interbreadcrumb[]= array ('url'=>'./document.php', 'name'=> get_lang('Documents'));
  51  
  52  $nameTools = get_lang('Documents');
  53  
  54  $file = Security::remove_XSS($_GET['file']);
  55  /*
  56  ==============================================================================
  57          Main section
  58  ==============================================================================
  59  */
  60  header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
  61  //header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
  62  header('Last-Modified: Wed, 01 Jan 2100 00:00:00 GMT');
  63  
  64  header('Cache-Control: no-cache, must-revalidate');
  65  header('Pragma: no-cache');
  66  
  67  /*$browser_display_title = "Dokeos Documents - " . Security::remove_XSS($_GET['cidReq']) . " - " . $file;
  68  
  69  //only admins get to see the "no frames" link in pageheader.php, so students get a header that's not so high
  70  $frameheight = 135;
  71  if($is_courseAdmin) {
  72      $frameheight = 165;
  73  }*/
  74  
  75  $file_root=$_course['path'].'/document'.str_replace('%2F', '/',$file);
  76  $file_url_sys=api_get_path(SYS_COURSE_PATH).$file_root;
  77  $file_url_web=api_get_path(WEB_COURSE_PATH).$file_root;
  78  $path_info= pathinfo($file_url_sys);
  79  
  80  $is_allowed_to_edit  = api_is_allowed_to_edit();
  81  $curdirpathurl = Security::remove_XSS($_REQUEST['curdirpath']);
  82  
  83  Display :: display_tool_header($nameTools, "Doc");
  84  echo '<div class="actions">';
  85  echo '<a href="document.php?'.api_get_cidreq().'&curdirpath='.$curdirpathurl.$req_gid.'">'.Display::return_icon('pixel.gif',get_lang('Documents'),array('class' => 'toolactionplaceholdericon toolactionback')).get_lang('Documents').'</a>';
  86  if ($is_allowed_to_edit) {
  87      if (!$is_certificate_mode) {
  88        echo '<a href="create_document.php?'.api_get_cidreq().'&amp;dir='.$curdirpathurl.$req_gid.'">'.Display::return_icon('pixel.gif', get_lang('CreateDoc'), array('class' => 'toolactionplaceholdericon toolactiondocumentcreate')).' '.get_lang('CreateDoc').'</a>';
  89      } else {
  90        echo '<a href="create_document.php?'.api_get_cidreq().'&amp;dir='.$curdirpathurl.$req_gid.'&amp;certificate=true&amp;selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.Display::return_icon('pixel.gif', get_lang('CreateCertificate'), array('class' => 'toolactionplaceholdericon toolactiondocumentcreate')).' '.get_lang('CreateCertificate').'</a>';
  91      }
  92      echo '<a href="template_gallery.php?doc=N&dir='.$curdirpathurl.$req_gid.'&'.  api_get_cidreq().'&amp;selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.Display::return_icon('pixel.gif', get_lang('Templates'), array('class' => 'toolactionplaceholdericon toolactiontemplates')).' '.get_lang('Templates').'</a>';
  93      echo '<a href="mediabox.php?curdirpath='.$curdirpathurl.$req_gid.'&'.  api_get_cidreq().'">'.Display::return_icon('pixel.gif', get_lang('Mediabox'), array('class' => 'toolactionplaceholdericon toolactionmediabox')).' '.get_lang('Mediabox').'</a>';
  94      echo '<a href="upload.php?'.api_get_cidreq().'&amp;path='.$curdirpathurl.$req_gid.'&amp;selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.Display::return_icon('pixel.gif', get_lang('UplUpload'), array('class' => 'toolactionplaceholdericon toolactionupload')).' '.get_lang('UplUpload').'</a>';
  95  }
  96  echo '</div>';
  97  ?>
  98  <?php
  99  if (file_exists($file_url_sys)) {
 100    $url = $file_url_web.'?'.api_get_cidreq().'&rand='.mt_rand(1,10000);
 101    $path_info = pathinfo($file_url_sys);
 102    // Check only HTML documents
 103    if ($path_info['extension'] == 'html') {
 104        $get_file_content = file_get_contents($file_url_sys);
 105        $matches = preg_match('/<embed/i', $get_file_content,$matches);
 106        // Only for files that has embed tags
 107        if (count($matches) > 0) {
 108            $get_file_content = str_replace(array('wmode="opaque"','wmode="transparent"'), "", $get_file_content);
 109            $get_file_content = str_replace(array('<embed'), array('<embed wmode="opaque" '), $get_file_content);
 110            file_put_contents($file_url_sys, $get_file_content);
 111        }
 112    }
 113  
 114  } else {
 115    $url = 'showinframes.php?nopages=1';
 116  }
 117  ?>
 118  <div id="content_with_secondary_actions">
 119  <iframe id="content_id" name="content_id" src ="<?php echo $url; ?>" width="100%" height="700" frameborder="0">
 120    <p>Your browser does not support iframes.</p>
 121  </iframe>
 122  </div>
 123  <?php
 124   // bottom actions bar
 125  echo '<div class="actions">';
 126  echo '</div>';
 127  Display :: display_footer();
 128  ?>

title

Description

title

Description

title

Description

title

title

Body