Browse Source

[svn r21717] FS#4378 - Implementing a system-wide patch about the "__flash__removeCallback" bug (javascript error).

Ivan Tcholakov 15 years ago
parent
commit
50c0bb9c97
2 changed files with 273 additions and 217 deletions
  1. 58 30
      main/inc/header.inc.php
  2. 215 187
      main/inc/reduced_header.inc.php

+ 58 - 30
main/inc/header.inc.php

@@ -1,4 +1,4 @@
-<?php // $Id: header.inc.php 20457 2009-05-11 04:03:35Z ivantcholakov $
+<?php // $Id: header.inc.php 21717 2009-07-02 03:27:31Z ivantcholakov $
  
  
 /*
 /*
 ==============================================================================
 ==============================================================================
@@ -92,8 +92,8 @@ if(!empty($_course['official_code']))
 	echo $_course['official_code'].' - ';
 	echo $_course['official_code'].' - ';
 }
 }
 
 
-echo get_setting('siteName');
-	
+echo api_get_setting('siteName');
+
 ?>
 ?>
 </title>
 </title>
 <style type="text/css" media="screen, projection">
 <style type="text/css" media="screen, projection">
@@ -103,8 +103,8 @@ echo get_setting('siteName');
 $platform_theme= api_get_setting('stylesheets'); 	// plataform's css
 $platform_theme= api_get_setting('stylesheets'); 	// plataform's css
 $my_style=$platform_theme;
 $my_style=$platform_theme;
 
 
-if(api_get_setting('user_selected_theme') == 'true') 
-{		
+if(api_get_setting('user_selected_theme') == 'true')
+{
 	$useri = api_get_user_info();
 	$useri = api_get_user_info();
 	$user_theme = $useri['theme'];
 	$user_theme = $useri['theme'];
 	if(!empty($user_theme) && $user_theme != $my_style)
 	if(!empty($user_theme) && $user_theme != $my_style)
@@ -113,37 +113,37 @@ if(api_get_setting('user_selected_theme') == 'true')
 	}
 	}
 }
 }
 $mycourseid = api_get_course_id();
 $mycourseid = api_get_course_id();
-if (!empty($mycourseid) && $mycourseid != -1) 
-{	
-	if (api_get_setting('allow_course_theme') == 'true') 
-	{	
+if (!empty($mycourseid) && $mycourseid != -1)
+{
+	if (api_get_setting('allow_course_theme') == 'true')
+	{
 		$mycoursetheme=api_get_course_setting('course_theme');
 		$mycoursetheme=api_get_course_setting('course_theme');
-					
-		if (!empty($mycoursetheme) && $mycoursetheme!=-1)		 
-		{							
+
+		if (!empty($mycoursetheme) && $mycoursetheme!=-1)
+		{
 			if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
 			if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
-			{				
+			{
 				$my_style = $mycoursetheme;		// course's css
 				$my_style = $mycoursetheme;		// course's css
-			}			
+			}
 		}
 		}
-				
+
 		$mycourselptheme=api_get_course_setting('allow_learning_path_theme');
 		$mycourselptheme=api_get_course_setting('allow_learning_path_theme');
-		if (!empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1)		 
-		{	
-			
-			global $lp_theme_css; //  it comes from the lp_controller.php 
+		if (!empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1)
+		{
+
+			global $lp_theme_css; //  it comes from the lp_controller.php
 			global $lp_theme_config; // it comes from the lp_controller.php
 			global $lp_theme_config; // it comes from the lp_controller.php
-											
-			if (!$lp_theme_config)			 											
+
+			if (!$lp_theme_config)
 			{
 			{
-				if ($lp_theme_css!='') 
-				{				
-					$theme=$lp_theme_css;						
+				if ($lp_theme_css!='')
+				{
+					$theme=$lp_theme_css;
 					if(!empty($theme) && $theme != $my_style)
 					if(!empty($theme) && $theme != $my_style)
-					{								
+					{
 						$my_style = $theme;	 // LP's css
 						$my_style = $theme;	 // LP's css
 					}
 					}
-				}				
+				}
 			}
 			}
 		}
 		}
 	}
 	}
@@ -151,11 +151,11 @@ if (!empty($mycourseid) && $mycourseid != -1)
 
 
 global $show_learn_path;
 global $show_learn_path;
 
 
-if ($show_learn_path) 
+if ($show_learn_path)
 {
 {
 	$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CODE_PATH).'css/'.$my_style.'/learnpath.css"/>';
 	$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CODE_PATH).'css/'.$my_style.'/learnpath.css"/>';
 	$htmlHeadXtra[] = "<link rel='stylesheet' type='text/css' href='dtree.css' />"; //will be moved
 	$htmlHeadXtra[] = "<link rel='stylesheet' type='text/css' href='dtree.css' />"; //will be moved
-	$htmlHeadXtra[] = "<script src='dtree.js' type='text/javascript'></script>"; //will be moved		
+	$htmlHeadXtra[] = "<script src='dtree.js' type='text/javascript'></script>"; //will be moved
 }
 }
 
 
 $my_code_path = api_get_path(WEB_CODE_PATH);
 $my_code_path = api_get_path(WEB_CODE_PATH);
@@ -184,6 +184,34 @@ echo '@import "'.$my_code_path.'css/'.$my_style.'/course.css";'."\n";
 <link href="http://www.dokeos.com" rel="Copyright" />
 <link href="http://www.dokeos.com" rel="Copyright" />
 <link rel="shortcut icon" href="<?php echo api_get_path(WEB_PATH); ?>favicon.ico" type="image/x-icon" />
 <link rel="shortcut icon" href="<?php echo api_get_path(WEB_PATH); ?>favicon.ico" type="image/x-icon" />
 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
+
+<script type="text/javascript">
+//<![CDATA[
+// This is a patch for the "__flash__removeCallback" bug, see FS#4378.
+if ( ( navigator.userAgent.toLowerCase().indexOf('msie') != -1 ) && ( navigator.userAgent.toLowerCase().indexOf( 'opera' ) == -1 ) )
+{
+	window.attachEvent( 'onunload', function()
+		{
+			window['__flash__removeCallback'] = function ( instance, name )
+			{ 
+				try
+				{ 
+					if ( instance )
+					{ 
+						instance[name] = null ; 
+					} 
+				}
+				catch ( flashEx )
+				{
+
+				} 
+			} ;
+		}
+	) ;
+}
+//]]>
+</script>
+
 <?php
 <?php
 if ( isset($htmlHeadXtra) && $htmlHeadXtra )
 if ( isset($htmlHeadXtra) && $htmlHeadXtra )
 {
 {
@@ -213,7 +241,7 @@ include(api_get_path(LIBRARY_PATH).'/javascript/email_links.lib.js.php');
 <li><a href="#content" accesskey="2"><?php echo ( get_lang('WCAGGoContent') )?></a></li>
 <li><a href="#content" accesskey="2"><?php echo ( get_lang('WCAGGoContent') )?></a></li>
 </ul>
 </ul>
 </div>
 </div>
-		
-<?php						
+
+<?php
 //  Banner
 //  Banner
 include(api_get_path(INCLUDE_PATH)."banner.inc.php");
 include(api_get_path(INCLUDE_PATH)."banner.inc.php");

+ 215 - 187
main/inc/reduced_header.inc.php

@@ -1,187 +1,215 @@
-<?php
-/**
-==============================================================================
-*	This script displays the Dokeos header up to the </head> tag
-*   IT IS A COPY OF header.inc.php EXCEPT that it doesn't start the body
-*   output.
-*
-*	@package dokeos.include
-==============================================================================
-*/
-
-/*----------------------------------------
-              HEADERS SECTION
-  --------------------------------------*/
-
-/*
- * HTTP HEADER
- */
-
-//Give a default value to $charset. Should change to UTF-8 some time in the future.
-//This parameter should be set in the platform configuration interface in time.
-if(empty($charset))
-{
-	$charset = 'ISO-8859-15';
-}
-
-//header('Content-Type: text/html; charset='. $charset)
-//	or die ("WARNING : it remains some characters before &lt;?php bracket or after ?&gt end");
-
-header('Content-Type: text/html; charset='. $charset);
-if ( isset($httpHeadXtra) && $httpHeadXtra )
-{
-	foreach($httpHeadXtra as $thisHttpHead)
-	{
-		header($thisHttpHead);
-	}
-}
-
-// Get language iso-code for this page - ignore errors
-// The error ignorance is due to the non compatibility of function_exists() 
-// with the object syntax of Database::get_language_isocode()
-@$document_language = Database::get_language_isocode($language_interface);
-if(empty($document_language))
-{
-  //if there was no valid iso-code, use the english one
-  $document_language = 'en';
-}
-
-/*
- * HTML HEADER
- */
-?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $document_language; ?>" lang="<?php echo $document_language; ?>">
-<head>
-<title>
-<?php
-if(!empty($nameTools))
-{
-	echo $nameTools.' - ';
-}
-
-if(!empty($_course['official_code']))
-{
-	echo $_course['official_code'].' - ';
-}
-
-echo get_setting('siteName');
-?>
-</title>
-
-<?php
-
-/*
- * Choose CSS style platform's, user's, course's, or Learning path CSS 
- */
- 
-$platform_theme = api_get_setting('stylesheets'); 	// plataform's css
-$my_style=$platform_theme;
-if(api_get_setting('user_selected_theme') == 'true') 
-{		
-	$useri = api_get_user_info();
-	$user_theme = $useri['theme'];
-	if(!empty($user_theme) && $user_theme != $my_style)
-	{
-		$my_style = $user_theme;					// user's css
-	}
-}
-$mycourseid = api_get_course_id();
-if (!empty($mycourseid) && $mycourseid != -1) 
-{	
-	if (api_get_setting('allow_course_theme') == 'true') 
-	{	
-		$mycoursetheme=api_get_course_setting('course_theme');			
-		if (!empty($mycoursetheme) && $mycoursetheme!=-1)		 
-		{							
-			if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
-			{				
-				$my_style = $mycoursetheme;		// course's css
-			}			
-		}
-				
-		$mycourselptheme=api_get_course_setting('allow_learning_path_theme');
-		if (!empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1)		 
-		{				
-			global $lp_theme_css; //  it comes from the lp_controller.php 
-			global $lp_theme_config; // it comes from the lp_controller.php
-							
-			if (!empty($lp_theme_css)) 
-				{
-					$theme=$lp_theme_css;						
-					if(!empty($theme) && $theme != $my_style)
-					{								
-						$my_style = $theme;	 // LP's css
-					}
-				}				
-			
-		}
-	}
-}
-
-if (!empty($lp_theme_log)){
-	$my_style=$platform_theme;
-}
-
-// Sets the css reference it is call from lp_nav.php, lp_toc.php, lp_message, lp_log.php
-if (!empty($scorm_css_header)) 
-{	
-	if (!empty($my_style)) 
-	{
-		$scorm_css=api_get_path(WEB_CODE_PATH).'css/'.$my_style.'/scorm.css';
-		$scormfs_css=api_get_path(WEB_CODE_PATH).'css/'.$my_style.'/scormfs.css';
-	}
-	else 
-	{
-		$scorm_css='scorm.css';
-		$scormfs_css='scormfs.css';		
-	}	
-		
-	if(!empty($display_mode) && $display_mode == 'fullscreen')
-	{	
-		$htmlHeadXtra[] = '<style type="text/css" media="screen, projection">
-							/*<![CDATA[*/
-							@import "'.$scormfs_css.'";
-							/*]]>*/
-							</style>';
-	}
-	else
-	{
-		$htmlHeadXtra[] = '<style type="text/css" media="screen, projection">
-							/*<![CDATA[*/
-							@import "'.$scorm_css.'";
-							/*]]>*/
-							</style>';
-	}	
-}
-
-
-if($my_style!='')
-{
-?>
-<style type="text/css" media="screen, projection">
-/*<![CDATA[*/
-@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo $my_style;?>/default.css";
-/*]]>*/
-</style>
-<?php
-}
-?>
-
-<link rel="top" href="<?php echo api_get_path(WEB_PATH); ?>index.php" title="" />
-<link rel="courses" href="<?php echo api_get_path(WEB_CODE_PATH) ?>auth/courses.php" title="<?php echo htmlentities(get_lang('OtherCourses'),ENT_QUOTES,$charset); ?>" />
-<link rel="profil" href="<?php echo api_get_path(WEB_CODE_PATH) ?>auth/profile.php" title="<?php echo htmlentities(get_lang('ModifyProfile'),ENT_QUOTES,$charset); ?>" />
-<link href="http://www.dokeos.com/documentation.php" rel="Help" />
-<link href="http://www.dokeos.com/team.php" rel="Author" />
-<link href="http://www.dokeos.com" rel="Copyright" />
-<link rel="shortcut icon" href="<?php echo api_get_path(WEB_PATH); ?>favicon.ico" type="image/x-icon" />
-<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
-<?php
-if ( isset($htmlHeadXtra) && $htmlHeadXtra )
-{
-	foreach($htmlHeadXtra as $this_html_head)
-	{
-		echo($this_html_head);
-	}
-}
-?>
-</head>
+<?php
+/**
+==============================================================================
+*	This script displays the Dokeos header up to the </head> tag
+*   IT IS A COPY OF header.inc.php EXCEPT that it doesn't start the body
+*   output.
+*
+*	@package dokeos.include
+==============================================================================
+*/
+
+/*----------------------------------------
+              HEADERS SECTION
+  --------------------------------------*/
+
+/*
+ * HTTP HEADER
+ */
+
+//Give a default value to $charset. Should change to UTF-8 some time in the future.
+//This parameter should be set in the platform configuration interface in time.
+if(empty($charset))
+{
+	$charset = 'ISO-8859-15';
+}
+
+//header('Content-Type: text/html; charset='. $charset)
+//	or die ("WARNING : it remains some characters before &lt;?php bracket or after ?&gt end");
+
+header('Content-Type: text/html; charset='. $charset);
+if ( isset($httpHeadXtra) && $httpHeadXtra )
+{
+	foreach($httpHeadXtra as $thisHttpHead)
+	{
+		header($thisHttpHead);
+	}
+}
+
+// Get language iso-code for this page - ignore errors
+// The error ignorance is due to the non compatibility of function_exists()
+// with the object syntax of Database::get_language_isocode()
+@$document_language = Database::get_language_isocode($language_interface);
+if(empty($document_language))
+{
+  //if there was no valid iso-code, use the english one
+  $document_language = 'en';
+}
+
+/*
+ * HTML HEADER
+ */
+?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $document_language; ?>" lang="<?php echo $document_language; ?>">
+<head>
+<title>
+<?php
+if(!empty($nameTools))
+{
+	echo $nameTools.' - ';
+}
+
+if(!empty($_course['official_code']))
+{
+	echo $_course['official_code'].' - ';
+}
+
+echo api_get_setting('siteName');
+?>
+</title>
+
+<?php
+
+/*
+ * Choose CSS style platform's, user's, course's, or Learning path CSS
+ */
+
+$platform_theme = api_get_setting('stylesheets'); 	// plataform's css
+$my_style=$platform_theme;
+if(api_get_setting('user_selected_theme') == 'true')
+{
+	$useri = api_get_user_info();
+	$user_theme = $useri['theme'];
+	if(!empty($user_theme) && $user_theme != $my_style)
+	{
+		$my_style = $user_theme;					// user's css
+	}
+}
+$mycourseid = api_get_course_id();
+if (!empty($mycourseid) && $mycourseid != -1)
+{
+	if (api_get_setting('allow_course_theme') == 'true')
+	{
+		$mycoursetheme=api_get_course_setting('course_theme');
+		if (!empty($mycoursetheme) && $mycoursetheme!=-1)
+		{
+			if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
+			{
+				$my_style = $mycoursetheme;		// course's css
+			}
+		}
+
+		$mycourselptheme=api_get_course_setting('allow_learning_path_theme');
+		if (!empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1)
+		{
+			global $lp_theme_css; //  it comes from the lp_controller.php
+			global $lp_theme_config; // it comes from the lp_controller.php
+
+			if (!empty($lp_theme_css))
+				{
+					$theme=$lp_theme_css;
+					if(!empty($theme) && $theme != $my_style)
+					{
+						$my_style = $theme;	 // LP's css
+					}
+				}
+
+		}
+	}
+}
+
+if (!empty($lp_theme_log)){
+	$my_style=$platform_theme;
+}
+
+// Sets the css reference it is call from lp_nav.php, lp_toc.php, lp_message, lp_log.php
+if (!empty($scorm_css_header))
+{
+	if (!empty($my_style))
+	{
+		$scorm_css=api_get_path(WEB_CODE_PATH).'css/'.$my_style.'/scorm.css';
+		$scormfs_css=api_get_path(WEB_CODE_PATH).'css/'.$my_style.'/scormfs.css';
+	}
+	else
+	{
+		$scorm_css='scorm.css';
+		$scormfs_css='scormfs.css';
+	}
+
+	if(!empty($display_mode) && $display_mode == 'fullscreen')
+	{
+		$htmlHeadXtra[] = '<style type="text/css" media="screen, projection">
+							/*<![CDATA[*/
+							@import "'.$scormfs_css.'";
+							/*]]>*/
+							</style>';
+	}
+	else
+	{
+		$htmlHeadXtra[] = '<style type="text/css" media="screen, projection">
+							/*<![CDATA[*/
+							@import "'.$scorm_css.'";
+							/*]]>*/
+							</style>';
+	}
+}
+
+
+if($my_style!='')
+{
+?>
+<style type="text/css" media="screen, projection">
+/*<![CDATA[*/
+@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo $my_style;?>/default.css";
+/*]]>*/
+</style>
+<?php
+}
+?>
+
+<link rel="top" href="<?php echo api_get_path(WEB_PATH); ?>index.php" title="" />
+<link rel="courses" href="<?php echo api_get_path(WEB_CODE_PATH) ?>auth/courses.php" title="<?php echo api_htmlentities(get_lang('OtherCourses'),ENT_QUOTES,$charset); ?>" />
+<link rel="profil" href="<?php echo api_get_path(WEB_CODE_PATH) ?>auth/profile.php" title="<?php echo api_htmlentities(get_lang('ModifyProfile'),ENT_QUOTES,$charset); ?>" />
+<link href="http://www.dokeos.com/documentation.php" rel="Help" />
+<link href="http://www.dokeos.com/team.php" rel="Author" />
+<link href="http://www.dokeos.com" rel="Copyright" />
+<link rel="shortcut icon" href="<?php echo api_get_path(WEB_PATH); ?>favicon.ico" type="image/x-icon" />
+<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
+
+<script type="text/javascript">
+//<![CDATA[
+// This is a patch for the "__flash__removeCallback" bug, see FS#4378.
+if ( ( navigator.userAgent.toLowerCase().indexOf('msie') != -1 ) && ( navigator.userAgent.toLowerCase().indexOf( 'opera' ) == -1 ) )
+{
+	window.attachEvent( 'onunload', function()
+		{
+			window['__flash__removeCallback'] = function ( instance, name )
+			{ 
+				try
+				{ 
+					if ( instance )
+					{ 
+						instance[name] = null ; 
+					} 
+				}
+				catch ( flashEx )
+				{
+
+				} 
+			} ;
+		}
+	) ;
+}
+//]]>
+</script>
+
+<?php
+if ( isset($htmlHeadXtra) && $htmlHeadXtra )
+{
+	foreach($htmlHeadXtra as $this_html_head)
+	{
+		echo($this_html_head);
+	}
+}
+?>
+</head>