3 // vim: expandtab sw=4 ts=4 sts=4:
7 * Output buffer functions for phpMyAdmin
9 * Copyright 2001 Jeremy Brand <jeremy@nirvani.net>
10 * http://www.jeremybrand.com/Jeremy/Brand/Jeremy_Brand.html
12 * Check for all the needed functions for output buffering
13 * Make some wrappers for the top and bottoms of our files.
17 * This function be used eventually to support more modes. It is needed
18 * because both header and footer functions must know what each other is
21 * @return integer the output buffer mode
23 function PMA_outBufferModeGet()
25 if (@function_exists
('ob_start')) {
31 // If a user sets the output_handler in php.ini to ob_gzhandler, then
32 // any right frame file in phpMyAdmin will not be handled properly by
33 // the browser. My fix was to check the ini file within the
34 // PMA_outBufferModeGet() function.
36 // (Patch by Garth Gillespie, modified by Marc Delisle)
37 if (@ini_get
('output_handler') == 'ob_gzhandler') {
40 if (@get_cfg_var
('output_handler') == 'ob_gzhandler') {
45 // If output buffering is enabled in php.ini it's not possible to
46 // add the ob_gzhandler without a warning message from php 4.3.0.
47 // Being better safe than sorry, check for any existing output handler
48 // instead of just checking the 'output_buffering' setting.
50 if (@function_exists
('ob_get_level')) {
51 if (ob_get_level() > 0) {
56 // Zero (0) is no mode or in other words output buffering is OFF.
57 // Follow 2^0, 2^1, 2^2, 2^3 type values for the modes.
58 // Usefull if we ever decide to combine modes. Then a bitmask field of
59 // the sum of all modes will be the natural choice.
61 header('X-ob_mode: ' . $mode);
64 } // end of the 'PMA_outBufferModeGet()' function
68 * This function will need to run at the top of all pages if output
69 * output buffering is turned on. It also needs to be passed $mode from
70 * the PMA_outBufferModeGet() function or it will be useless.
72 * @param integer the output buffer mode
74 * @return boolean whether output buffering is enabled or not
76 function PMA_outBufferPre($mode)
81 ob_start('ob_gzhandler');
96 } // end of the 'PMA_outBufferPre()' function
100 * This function will need to run at the bottom of all pages if output
101 * buffering is turned on. It also needs to be passed $mode from the
102 * PMA_outBufferModeGet() function or it will be useless.
104 * @param integer the output buffer mode
106 * @return boolean whether data has been send from the buffer or not
108 function PMA_outBufferPost($mode)
113 # This output buffer doesn't need a footer.
128 } // end of the 'PMA_outBufferPost()' function