X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FStreamFile.php;h=1ad643ac9874a9466ca888002e0d0ef93d505175;hb=7db558ee417ccae95e2bf295554a8eecd2d49e04;hp=e7f781173134b3c1ba0f7fa1495e72febe5163fb;hpb=fae05504fedd31eee393b5c2263521874c9383a8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/StreamFile.php b/includes/StreamFile.php index e7f7811731..1ad643ac98 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -32,15 +32,17 @@ class StreamFile { * Headers sent include: Content-type, Content-Length, Last-Modified, * and Content-Disposition. * - * @param $fname string Full name and path of the file to stream - * @param $headers array Any additional headers to send - * @param $sendErrors bool Send error messages if errors occur (like 404) + * @param string $fname Full name and path of the file to stream + * @param array $headers Any additional headers to send + * @param bool $sendErrors Send error messages if errors occur (like 404) + * @throws MWException * @return bool Success */ public static function stream( $fname, $headers = array(), $sendErrors = true ) { wfProfileIn( __METHOD__ ); if ( FileBackend::isStoragePath( $fname ) ) { // sanity + wfProfileOut( __METHOD__ ); throw new MWException( __FUNCTION__ . " given storage path '$fname'." ); } @@ -70,17 +72,15 @@ class StreamFile { * (b) cancels any PHP output buffering and automatic gzipping of output * (c) sends Content-Length header based on HTTP_IF_MODIFIED_SINCE check * - * @param $path string Storage path or file system path - * @param $info Array|bool File stat info with 'mtime' and 'size' fields - * @param $headers Array Additional headers to send - * @param $sendErrors bool Send error messages if errors occur (like 404) + * @param string $path Storage path or file system path + * @param array|bool $info File stat info with 'mtime' and 'size' fields + * @param array $headers Additional headers to send + * @param bool $sendErrors Send error messages if errors occur (like 404) * @return int|bool READY_STREAM, NOT_MODIFIED, or false on failure */ public static function prepareForStream( $path, $info, $headers = array(), $sendErrors = true ) { - global $wgLanguageCode; - if ( !is_array( $info ) ) { if ( $sendErrors ) { header( 'HTTP/1.0 404 Not Found' ); @@ -121,9 +121,6 @@ class StreamFile { return false; } - header( "Content-Disposition: inline;filename*=utf-8'$wgLanguageCode'" . - urlencode( basename( $path ) ) ); - // Send additional headers foreach ( $headers as $header ) { header( $header ); @@ -147,8 +144,8 @@ class StreamFile { /** * Determine the file type of a file based on the path * - * @param $filename string Storage path or file system path - * @param $safe bool Whether to do retroactive upload blacklist checks + * @param string $filename Storage path or file system path + * @param bool $safe Whether to do retroactive upload blacklist checks * @return null|string */ public static function contentTypeFromPath( $filename, $safe = true ) {