Skip to content

Commit

Permalink
MDL-26028 cleanup all IE6 gzip hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Apr 28, 2012
1 parent aa753ac commit 99302c5
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 41 deletions.
5 changes: 0 additions & 5 deletions calendar/export_execute.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,6 @@
die('bad serialization');
}

//IE compatibility HACK!
if (ini_get_bool('zlib.output_compression')) {
ini_set('zlib.output_compression', 'Off');
}

$filename = 'icalexport.ics';

header('Last-Modified: '. gmdate('D, d M Y H:i:s', time()) .' GMT');
Expand Down
17 changes: 5 additions & 12 deletions lib/configonlylib.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,12 @@ function min_enable_zlib_compression() {
}

// zlib.output_compression is preferred over ob_gzhandler()
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
$agent = $_SERVER['HTTP_USER_AGENT'];
// try to detect IE6 and prevent gzip because it is extremely buggy browser
$parts = explode(';', $agent);
if (isset($parts[1])) {
$parts = explode(' ', trim($parts[1]));
if (count($parts) > 1) {
if ($parts[0] === 'MSIE' and (float)$parts[1] < 7) {
@ini_set('zlib.output_compression', '0');
return false;
}
}
if (!empty($_SERVER['HTTP_USER_AGENT']) and strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false) {
@ini_set('zlib.output_compression', 'Off');
if (function_exists('apache_setenv')) {
@apache_setenv('no-gzip', 1);
}
return false;
}

@ini_set('output_handler', '');
Expand Down
6 changes: 0 additions & 6 deletions lib/filelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1624,12 +1624,6 @@ function prepare_file_content_sending() {

$olddebug = error_reporting(0);

// IE compatibility HACK - it does not like zlib compression much
// there is also a problem with the length header in older PHP versions
if (ini_get_bool('zlib.output_compression')) {
ini_set('zlib.output_compression', 'Off');
}

// flush and close all buffers if possible
while(ob_get_level()) {
if (!ob_end_flush()) {
Expand Down
9 changes: 9 additions & 0 deletions lib/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,15 @@ function stripslashes_deep($value) {

}

// // try to detect IE6 and prevent gzip because it is extremely buggy browser
if (!empty($_SERVER['HTTP_USER_AGENT']) and strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false) {
@ini_set('zlib.output_compression', 'Off');
if (function_exists('apache_setenv')) {
@apache_setenv('no-gzip', 1);
}
}


// note: we can not block non utf-8 installations here, because empty mysql database
// might be converted to utf-8 in admin/index.php during installation

Expand Down
3 changes: 3 additions & 0 deletions lib/setuplib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,9 @@ function disable_output_buffering() {
}
}

// disable any other output handlers
ini_set('output_handler', '');

error_reporting($olddebug);
}

Expand Down
10 changes: 3 additions & 7 deletions mod/scorm/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@
$mode = optional_param('mode', '', PARAM_ALPHA); // navigation mode
$attempt = required_param('attempt', PARAM_INT); // new attempt

//IE 6 Bug workaround
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false) {
@ini_set('zlib.output_compression', 'Off');
@apache_setenv('no-gzip', 1);
header( 'Content-Type: application/javascript' );
}

if (!empty($id)) {
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
print_error('invalidcoursemodule');
Expand Down Expand Up @@ -96,6 +89,9 @@
if (scorm_version_check($scorm->version, SCORM_13)) {
$userdata->{'cmi.scaled_passing_score'} = $DB->get_field('scorm_seq_objective', 'minnormalizedmeasure', array('scoid'=>$scoid));
}

header('Content-Type: text/javascript; charset=UTF-8');

$scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR)); // Just to be safe
if (file_exists($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php')) {
include_once($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php');
Expand Down
3 changes: 3 additions & 0 deletions mod/scorm/loadSCO.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@

// which API are we looking for
$LMS_api = (scorm_version_check($scorm->version, SCORM_12) || empty($scorm->version)) ? 'API' : 'API_1484_11';

header('Content-Type: text/html; charset=UTF-8');

?>
<html>
<head>
Expand Down
8 changes: 3 additions & 5 deletions mod/scorm/loaddatamodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
$mode = optional_param('mode', '', PARAM_ALPHA); // navigation mode
$attempt = required_param('attempt', PARAM_INT); // new attempt

//IE 6 Bug workaround
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false && ini_get('zlib.output_compression') == 'On') {
ini_set('zlib.output_compression', 'Off');
}

if (!empty($id)) {
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
print_error('invalidcoursemodule');
Expand Down Expand Up @@ -94,6 +89,9 @@
if (!$sco = scorm_get_sco($scoid)) {
print_error('cannotfindsco', 'scorm');
}

header('Content-Type: text/javascript; charset=UTF-8');

$scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR)); // Just to be safe
if (file_exists($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php')) {
include($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php');
Expand Down
6 changes: 0 additions & 6 deletions mod/scorm/player.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
$newattempt = optional_param('newattempt', 'off', PARAM_ALPHA); // the user request to start a new attempt
$displaymode = optional_param('display','',PARAM_ALPHA);

//IE 6 Bug workaround
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false) {
@ini_set('zlib.output_compression', 'Off');
@apache_setenv('no-gzip', 1);
}

// IE 9 workaround for Flash bug: MDL-29213
// Note that it's not clear if appending the meta tag via $CFG->additionalhtmlhead
// is correct at all, both because of the mechanism itself and because MS says
Expand Down

0 comments on commit 99302c5

Please sign in to comment.