diff --git a/ChangeLog b/ChangeLog index ae5447b5f..90a6f9c88 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2001-07-20 Marc Delisle + * HTTP compression patch thanks to Jeremy Brand + header.inc.php3, footer.inc.php3, ob_lib.inc.php3 + 2001-07-20 Steve Alberty * tbl_replace.php3: remove warnings if you update 'set' and nothing is selected diff --git a/footer.inc.php3 b/footer.inc.php3 index 75e0a2bdd..f2f5e2aee 100755 --- a/footer.inc.php3 +++ b/footer.inc.php3 @@ -3,3 +3,7 @@ + diff --git a/header.inc.php3 b/header.inc.php3 index bb81af08d..8726c2b97 100755 --- a/header.inc.php3 +++ b/header.inc.php3 @@ -2,6 +2,11 @@ /* $Id$ */ require('./lib.inc.php3'); +require('./ob_lib.inc.php3'); + +$ob_mode = out_buffer_mode_get(); +if ($ob_mode) + out_buffer_pre($ob_mode); /** * Send http headers diff --git a/ob_lib.inc.php3 b/ob_lib.inc.php3 new file mode 100644 index 000000000..c6b4ac640 --- /dev/null +++ b/ob_lib.inc.php3 @@ -0,0 +1,74 @@ + + # http://www.jeremybrand.com/Jeremy/Brand/Jeremy_Brand.html + + # Check for all the needed functions for output buffering + # Make some wrappers for the top and bottoms of our files. + + function out_buffer_mode_get() + # This will be used eventually to support more modes. It is + # needed because both header and footer functions must know + # what each other is doing. + { + if (function_exists('ob_start')) + $mode = 1; + else + $mode = 0; + + # Zero (0) is no mode or in other words output buffering is OFF. + + # Follow 2^0, 2^1, 2^2, 2^3 type values for the modes. + # Usefull if we ever decide to combine modes. Then a bitmask + # field of the sum of all modes will be the natural choice. + + header("X-ob_mode: $mode"); + + return $mode; + } + + # This function will need to run at the top of all pages if + # output buffering is turned on. It also needs to be passed $mode + # from the out_buffer_mode_get() function or it will be useless. + function out_buffer_pre($mode) + { + switch($mode) + { + case 1: + ob_start('ob_gzhandler'); + $retval = TRUE; + break; + + default: + case 0: + $retval = FALSE; + break; + } + return $retval; + } + + # This function will need to run at the bottom of all pages if + # output buffering is turned on. It also needs to be passed $mode + # from the out_buffer_mode_get() function or it will be useless. + function out_buffer_post($mode) + { + switch($mode) + { + case 1: + # This output buffer doesn't need a footer. + $retval = TRUE; + break; + + default: + case 0: + $retval = FALSE; + } + return $retval; + } + +?>