? .buildpath ? .project ? .settings ? LICENSE.txt ? bin Index: filefield.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/filefield/filefield.module,v retrieving revision 1.203 diff -u -F^[fc] -r1.203 filefield.module --- filefield.module 3 Jul 2009 20:53:07 -0000 1.203 +++ filefield.module 8 Jul 2009 00:17:18 -0000 @@ -194,8 +194,16 @@ function filefield_file_download($file) // Access is granted. $name = mime_header_encode($file->filename); $type = mime_header_encode($file->filemime); - // Serve images and text inline for display rather than download. - $disposition = (ereg('^(text/|image/)', $file->filemime) || ereg('flash$', $file->filemime)) ? 'inline' : 'attachment'; + // By default, serve images, text, and flash content for display rather than download. + // But if variable 'filefield_inline_types' is set, use its patterns instead. + $intypes = variable_get('filefield_inline_types', array('text\/*', 'image\/*', 'flash$')); + $disposition = 'attachment'; + foreach ($intypes as $inline_type) { + $pattern = sprintf('/%s/',$inline_type); + if (strlen($inline_type)>0 && preg_match($pattern, $file->filemime)) { + $disposition = 'inline'; + } + } return array( 'Content-Type: ' . $type . '; name='. $name, 'Content-Length: ' . $file->filesize,