X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FOutputHandler.php;h=c6209eebcfbb47ea77b3dabe2d295ba7aaca954a;hb=9e06b91a743b9f27a726c923bd48f32a0c1d5a11;hp=3860b8e2b384a69ab1526de947575f44baa2629c;hpb=8fe0cf970401f2796ca39165a2d0a311b551c47a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/OutputHandler.php b/includes/OutputHandler.php index 3860b8e2b3..c6209eebcf 100644 --- a/includes/OutputHandler.php +++ b/includes/OutputHandler.php @@ -23,13 +23,15 @@ /** * Standard output handler for use with ob_start * - * @param $s string + * @param string $s * * @return string */ function wfOutputHandler( $s ) { - global $wgDisableOutputCompression, $wgValidateAllHtml; - $s = wfMangleFlashPolicy( $s ); + global $wgDisableOutputCompression, $wgValidateAllHtml, $wgMangleFlashPolicy; + if ( $wgMangleFlashPolicy ) { + $s = wfMangleFlashPolicy( $s ); + } if ( $wgValidateAllHtml ) { $headers = headers_list(); $isHTML = false; @@ -94,7 +96,7 @@ function wfRequestExtension() { * Handler that compresses data with gzip if allowed by the Accept header. * Unlike ob_gzhandler, it works for HEAD requests too. * - * @param $s string + * @param string $s * * @return string */ @@ -127,7 +129,8 @@ function wfGzipHandler( $s ) { $headers = headers_list(); $foundVary = false; foreach ( $headers as $header ) { - if ( substr( $header, 0, 5 ) == 'Vary:' ) { + $headerName = strtolower( substr( $header, 0, 5 ) ); + if ( $headerName == 'vary:' ) { $foundVary = true; break; } @@ -145,7 +148,7 @@ function wfGzipHandler( $s ) { /** * Mangle flash policy tags which open up the site to XSS attacks. * - * @param $s string + * @param string $s * * @return string */ @@ -161,10 +164,13 @@ function wfMangleFlashPolicy( $s ) { /** * Add a Content-Length header if possible. This makes it cooperate with squid better. * - * @param $length int + * @param int $length */ function wfDoContentLength( $length ) { - if ( !headers_sent() && isset( $_SERVER['SERVER_PROTOCOL'] ) && $_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.0' ) { + if ( !headers_sent() + && isset( $_SERVER['SERVER_PROTOCOL'] ) + && $_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.0' + ) { header( "Content-Length: $length" ); } } @@ -172,7 +178,7 @@ function wfDoContentLength( $length ) { /** * Replace the output with an error if the HTML is not valid * - * @param $s string + * @param string $s * * @return string */