improved out buffer function handling;
bug #1690064 headers already sent error if OBGzip = 0
This commit is contained in:
@@ -14,12 +14,8 @@ require_once('./libraries/common.inc.php');
|
|||||||
PMA_checkParameters(array('db', 'table', 'field'));
|
PMA_checkParameters(array('db', 'table', 'field'));
|
||||||
|
|
||||||
require_once('./libraries/ob.lib.php');
|
require_once('./libraries/ob.lib.php');
|
||||||
if ($cfg['OBGzip']) {
|
PMA_outBufferPre();
|
||||||
$ob_mode = PMA_outBufferModeGet();
|
|
||||||
if ($ob_mode) {
|
|
||||||
PMA_outBufferPre($ob_mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
require_once('./libraries/header_http.inc.php');
|
require_once('./libraries/header_http.inc.php');
|
||||||
$field = urldecode($field);
|
$field = urldecode($field);
|
||||||
|
|
||||||
@@ -298,13 +294,4 @@ if (isset($controllink) && $controllink) {
|
|||||||
if (isset($userlink) && $userlink) {
|
if (isset($userlink) && $userlink) {
|
||||||
@PMA_DBI_close($userlink);
|
@PMA_DBI_close($userlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends bufferized data
|
|
||||||
*/
|
|
||||||
if (isset($cfg['OBGzip']) && $cfg['OBGzip']
|
|
||||||
&& isset($ob_mode) && $ob_mode) {
|
|
||||||
PMA_outBufferPost($ob_mode);
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
@@ -40,7 +40,6 @@
|
|||||||
* @uses PMA_getenv()
|
* @uses PMA_getenv()
|
||||||
* @uses PMA_generate_common_url()
|
* @uses PMA_generate_common_url()
|
||||||
* @uses PMA_DBI_close()
|
* @uses PMA_DBI_close()
|
||||||
* @uses PMA_outBufferPost()
|
|
||||||
* @uses basename()
|
* @uses basename()
|
||||||
* @uses file_exists()
|
* @uses file_exists()
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
@@ -189,11 +188,6 @@ if (! empty($GLOBALS['cfg']['DBG']['enable'])
|
|||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* Sends bufferized data
|
|
||||||
*/
|
|
||||||
PMA_outBufferPost();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops the script execution
|
* Stops the script execution
|
||||||
*/
|
*/
|
||||||
|
@@ -17,12 +17,7 @@ if (empty($GLOBALS['is_header_sent'])) {
|
|||||||
*/
|
*/
|
||||||
require_once './libraries/common.inc.php';
|
require_once './libraries/common.inc.php';
|
||||||
require_once './libraries/ob.lib.php';
|
require_once './libraries/ob.lib.php';
|
||||||
if ($GLOBALS['cfg']['OBGzip']) {
|
PMA_outBufferPre();
|
||||||
$GLOBALS['ob_mode'] = PMA_outBufferModeGet();
|
|
||||||
if ($GLOBALS['ob_mode']) {
|
|
||||||
PMA_outBufferPre($GLOBALS['ob_mode']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// garvin: For re-usability, moved http-headers and stylesheets
|
// garvin: For re-usability, moved http-headers and stylesheets
|
||||||
// to a seperate file. It can now be included by header.inc.php,
|
// to a seperate file. It can now be included by header.inc.php,
|
||||||
|
@@ -10,12 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
require_once('./libraries/common.inc.php');
|
require_once('./libraries/common.inc.php');
|
||||||
require_once('./libraries/ob.lib.php');
|
require_once('./libraries/ob.lib.php');
|
||||||
if ($cfg['OBGzip']) {
|
PMA_outBufferPre();
|
||||||
$ob_mode = PMA_outBufferModeGet();
|
|
||||||
if ($ob_mode) {
|
|
||||||
PMA_outBufferPre($ob_mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
|
|
||||||
|
@@ -17,11 +17,10 @@
|
|||||||
* because both header and footer functions must know what each other is
|
* because both header and footer functions must know what each other is
|
||||||
* doing.
|
* doing.
|
||||||
*
|
*
|
||||||
* @uses $GLOBALS['cfg']['OBGzip']
|
* @uses $cfg['OBGzip']
|
||||||
* @uses function_exists()
|
* @uses function_exists()
|
||||||
* @uses ini_get()
|
* @uses ini_get()
|
||||||
* @uses ob_get_level()
|
* @uses ob_get_level()
|
||||||
* @uses header()
|
|
||||||
* @staticvar integer remember last calculated value
|
* @staticvar integer remember last calculated value
|
||||||
* @return integer the output buffer mode
|
* @return integer the output buffer mode
|
||||||
*/
|
*/
|
||||||
@@ -60,8 +59,6 @@ function PMA_outBufferModeGet()
|
|||||||
// Usefull if we ever decide to combine modes. Then a bitmask field of
|
// Usefull if we ever decide to combine modes. Then a bitmask field of
|
||||||
// the sum of all modes will be the natural choice.
|
// the sum of all modes will be the natural choice.
|
||||||
|
|
||||||
header('X-ob_mode: ' . $mode);
|
|
||||||
|
|
||||||
return $mode;
|
return $mode;
|
||||||
} // end of the 'PMA_outBufferModeGet()' function
|
} // end of the 'PMA_outBufferModeGet()' function
|
||||||
|
|
||||||
@@ -72,26 +69,20 @@ function PMA_outBufferModeGet()
|
|||||||
* the PMA_outBufferModeGet() function or it will be useless.
|
* the PMA_outBufferModeGet() function or it will be useless.
|
||||||
*
|
*
|
||||||
* @uses PMA_outBufferModeGet()
|
* @uses PMA_outBufferModeGet()
|
||||||
|
* @uses PMA_outBufferPost() to register it as shutdown function
|
||||||
* @uses ob_start()
|
* @uses ob_start()
|
||||||
* @param integer $mode DEPRECATED
|
* @uses header() to send X-ob_mode:
|
||||||
* @return boolean whether output buffering is enabled or not
|
* @uses register_shutdown_function() to register PMA_outBufferPost()
|
||||||
*/
|
*/
|
||||||
function PMA_outBufferPre($mode = null)
|
function PMA_outBufferPre()
|
||||||
{
|
{
|
||||||
switch(PMA_outBufferModeGet())
|
if ($mode = PMA_outBufferModeGet()) {
|
||||||
{
|
ob_start('ob_gzhandler');
|
||||||
case 1:
|
}
|
||||||
ob_start('ob_gzhandler');
|
|
||||||
$retval = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0:
|
header('X-ob_mode: ' . $mode);
|
||||||
default:
|
|
||||||
$retval = false;
|
|
||||||
break;
|
|
||||||
} // end switch
|
|
||||||
|
|
||||||
return $retval;
|
register_shutdown_function('PMA_outBufferPost');
|
||||||
} // end of the 'PMA_outBufferPre()' function
|
} // end of the 'PMA_outBufferPre()' function
|
||||||
|
|
||||||
|
|
||||||
@@ -103,27 +94,14 @@ function PMA_outBufferPre($mode = null)
|
|||||||
* @uses PMA_outBufferModeGet()
|
* @uses PMA_outBufferModeGet()
|
||||||
* @uses ob_flush()
|
* @uses ob_flush()
|
||||||
* @uses flush()
|
* @uses flush()
|
||||||
* @param integer $mode DEPRECATED
|
|
||||||
* @return boolean whether data has been send from the buffer or not
|
|
||||||
*/
|
*/
|
||||||
function PMA_outBufferPost($mode = null)
|
function PMA_outBufferPost()
|
||||||
{
|
{
|
||||||
switch(PMA_outBufferModeGet())
|
if (PMA_outBufferModeGet()) {
|
||||||
{
|
ob_flush();
|
||||||
case 1:
|
} else {
|
||||||
# This output buffer doesn't need a footer.
|
flush();
|
||||||
ob_flush();
|
}
|
||||||
$retval = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0:
|
|
||||||
default:
|
|
||||||
flush();
|
|
||||||
$retval = false;
|
|
||||||
break;
|
|
||||||
} // end switch
|
|
||||||
|
|
||||||
return $retval;
|
|
||||||
} // end of the 'PMA_outBufferPost()' function
|
} // end of the 'PMA_outBufferPost()' function
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -52,7 +52,6 @@ require_once './libraries/common.inc.php';
|
|||||||
*
|
*
|
||||||
* @uses $GLOBALS['controllink'] to close it
|
* @uses $GLOBALS['controllink'] to close it
|
||||||
* @uses $GLOBALS['userlink'] to close it
|
* @uses $GLOBALS['userlink'] to close it
|
||||||
* @uses PMA_outBufferPost()
|
|
||||||
* @uses PMA_DBI_close()
|
* @uses PMA_DBI_close()
|
||||||
* @access private only to be used in navigation.php
|
* @access private only to be used in navigation.php
|
||||||
*/
|
*/
|
||||||
@@ -70,12 +69,7 @@ function PMA_exitNavigationFrame()
|
|||||||
@PMA_DBI_close($GLOBALS['userlink']);
|
@PMA_DBI_close($GLOBALS['userlink']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
exit;
|
||||||
* Sends bufferized data
|
|
||||||
*/
|
|
||||||
PMA_outBufferPost();
|
|
||||||
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// free the session file, for the other frames to be loaded
|
// free the session file, for the other frames to be loaded
|
||||||
|
@@ -311,9 +311,4 @@ if (! empty($controllink)) {
|
|||||||
if (! empty($userlink)) {
|
if (! empty($userlink)) {
|
||||||
PMA_DBI_close($userlink);
|
PMA_DBI_close($userlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends bufferized data
|
|
||||||
*/
|
|
||||||
PMA_outBufferPost();
|
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user