Fixes BT#794: A weird bug that blocks FF 3.6 when calling a pdf file in a LP (bug reported using FF 3.6 + WinXP SP3 + adobe reader 9) requires testing

skala
Julio Montoya 15 years ago
parent 446adf348a
commit 777f70fee1
  1. 40
      main/newscorm/lp_view.php
  2. 99
      main/newscorm/lp_view_item.php

@ -1,32 +1,28 @@
<?php // $Id: lp_view.php,v 1.33 2006/09/12 10:20:46 yannoo Exp $
<?php
/* For licensing terms, see /license.txt */
/**
==============================================================================
* This file was origially the copy of document.php, but many modifications happened since then ;
* This file was originally the copy of document.php, but many modifications happened since then ;
* the direct file view is not needed anymore, if the user uploads a scorm zip file, a directory
* will be automatically created for it, and the files will be uncompressed there for example ;
*
* @package dokeos.learnpath
* @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> - redesign
* @author Denes Nagy, principal author
* @author Isthvan Mandak, several new features
* @author Roan Embrechts, code improvements and refactoring
* @license GNU/GPL - See Dokeos license directory for details
==============================================================================
*/
/**
* Script
*/
/*
==============================================================================
INIT SECTION
==============================================================================
*/
/* INIT SECTION */
$_SESSION['whereami'] = 'lp/view';
$this_section=SECTION_COURSES;
if($lp_controller_touched!=1){
header('location: lp_controller.php?action=view&item_id='.$_REQUEST['item_id']);
exit;
}
/*
@ -61,11 +57,8 @@ $user_id = api_get_user_id();
$platform_theme = api_get_setting('stylesheets'); // plataform's css
$my_style=$platform_theme;
//escape external variables
/*
-----------------------------------------------------------
Header
-----------------------------------------------------------
*/
/* Header */
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setting('show_glossary_in_documents') == 'isautomatic' ) {
@ -116,9 +109,14 @@ if (!isset($src)) {
$htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>';
$prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
if($prereq_check === true){
$src = $_SESSION['oLP']->get_link('http',$lp_item_id);
$src = $_SESSION['oLP']->get_link('http',$lp_item_id);
//Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP
$file_info = pathinfo($src);
if (api_strtolower(substr($file_info['extension'], 0, 3) == 'pdf')) {
$src = 'lp_view_item.php?src='.$src;
}
$_SESSION['oLP']->start_current_item(); //starts time counter manually if asset
}else{
} else {
$src = 'blank.php?error=prerequisites';
}
break;
@ -169,9 +167,9 @@ if ($type_quiz && !empty($_REQUEST['exeId']) && isset($_GET['lp_id']) && isset($
$TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$TBL_LP_VIEW = Database::get_course_table(TABLE_LP_VIEW);
$TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM);
$safe_item_id = Database::escape_string($_GET['lp_item_id']);
$safe_id = Database::escape_string($_GET['lp_id']);
$safe_exe_id = Database::escape_string($_REQUEST['exeId']);
$safe_item_id = Database::escape_string($_GET['lp_item_id']);
$safe_id = Database::escape_string($_GET['lp_id']);
$safe_exe_id = Database::escape_string($_REQUEST['exeId']);
if ($safe_id == strval(intval($safe_id)) && $safe_item_id == strval(intval($safe_item_id))) {
@ -528,7 +526,7 @@ window.onresize = updateContentHeight;
</div>
<!-- end left Zone -->
<!-- right Zone -->
<!-- right Zone -->
<div id="learning_path_right_zone" style="margin-left:282px;height:100%">
<iframe id="content_id" name="content_name" src="<?php echo $src; ?>" border="0" frameborder="0" style="width:100%;height:600px" ></iframe>
</div>

@ -1,48 +1,38 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2009 Dokeos SPRL
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Patrick Cool
Copyright (c) Denes Nagy
Copyright (c) Yannick Warnier
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /license.txt */
/**
==============================================================================
* This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php
*
* @author Patrick Cool
* @author Denes Nagy
* @author Roan Embrechts, refactoring and code cleaning
* @author Yannick Warnier <ywarnier@beeznest.org> - cleaning and update for new SCORM tool
* @package dokeos.learnpath
==============================================================================
* @package chamilo.learnpath
*/
/*
==============================================================================
INIT SECTION
==============================================================================
*/
//Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP
if(isset($_GET['src'])) {
// including the global file
require_once '../inc/global.inc.php';
api_protect_course_script();
//get parameter only came from lp_view.php
$url_info = parse_url($_GET['src']);
$real_url_info = parse_url(api_get_path(WEB_PATH));
//the host must be the same
if ($url_info['host'] == $real_url_info['host']) {
header("Location: ".urldecode(Security::remove_XSS($_GET['src'])));
exit;
} else {
header("Location: blank.php?error=document_not_found");
exit;
}
}
/* INIT SECTION */
$_SESSION['whereami'] = 'lp/build';
if(isset($_SESSION['oLP']) && isset($_GET['id']))
{
if(isset($_SESSION['oLP']) && isset($_GET['id'])) {
$_SESSION['oLP'] -> current = intval($_GET['id']);
}
$this_section=SECTION_COURSES;
@ -50,30 +40,21 @@ $this_section=SECTION_COURSES;
api_protect_course_script();
/*
-----------------------------------------------------------
Libraries
-----------------------------------------------------------
*/
//the main_api.lib.php, database.lib.php and display.lib.php
//libraries are included by default
include('learnpath_functions.inc.php');
require_once 'learnpath_functions.inc.php';
//include('../resourcelinker/resourcelinker.inc.php');
include('resourcelinker.inc.php');
require_once 'resourcelinker.inc.php';
//rewrite the language file, sadly overwritten by resourcelinker.inc.php
// name of the language file that needs to be included
$language_file = "learnpath";
/*
-----------------------------------------------------------
Header and action code
-----------------------------------------------------------
*/
/*
-----------------------------------------------------------
Constants and variables
-----------------------------------------------------------
*/
/* Header and action code */
/* Constants and variables */
$is_allowed_to_edit = api_is_allowed_to_edit(null,true);
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
@ -96,9 +77,7 @@ $prereq = $_REQUEST['prereq'];
$type = $_REQUEST['type'];
*/
/*
==============================================================================
MAIN CODE
==============================================================================
*/
// using the resource linker as a tool for adding resources to the learning path
if ($action=="add" and $type=="learnpathitem")
@ -123,15 +102,11 @@ $therow=Database::fetch_array($result);
- all the functions not available for students - always available in this case (page only shown to admin)
-----------------------------------------------------------
*/
/*==================================================
SHOWING THE ADMIN TOOLS
==================================================*/
/* SHOWING THE ADMIN TOOLS */
/*==================================================
prerequisites setting end
==================================================*/
/* prerequisites setting end */
if (isset($_SESSION['gradebook'])){
$gradebook= $_SESSION['gradebook'];
}
@ -179,11 +154,7 @@ function confirmation(name) {
//echo $admin_output;
/*
-----------------------------------------------------------
DISPLAY SECTION
-----------------------------------------------------------
*/
/* DISPLAY SECTION */
echo $_SESSION['oLP']->build_action_menu();
echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
@ -200,10 +171,6 @@ echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
echo '</tr>';
echo '</table>';
/*
==============================================================================
FOOTER
==============================================================================
*/
/* FOOTER */
Display::display_footer();
?>
Loading…
Cancel
Save