/** * Send a Content-Disposition header. This is more complex than it sounds * because only a few browsers properly support RFC2231. For those browsers * which are behind the times or are otherwise broken, we need to use * some hacky workarounds to get them to work 'nicely' with attachments and * inline files. See http://greenbytes.de/tech/tc2231/ for full reasoning. * @param string Filename * @param boolean Display file inline (optional, default = treat as attachment) */ function http_content_disposition_header( $p_filename, $p_inline = false ) { if ( !headers_sent() ) { $t_encoded_filename = rawurlencode( $p_filename ); $t_disposition = ''; if ( !$p_inline ) { $t_disposition = 'attachment;'; } if ( is_browser_internet_explorer() || is_browser_chrome() ) { // Internet Explorer does not support RFC2231 however it does // incorrectly decode URL encoded filenames and we can use this to // get UTF8 filenames to work with the file download dialog. Chrome // behaves in the same was as Internet Explorer in this respect. // See http://greenbytes.de/tech/tc2231/#attwithfnrawpctenclong header( 'Content-Disposition:' . $t_disposition . ' filename="' . $t_encoded_filename . '"' ); } else { // For most other browsers, we can use this technique: // http://greenbytes.de/tech/tc2231/#attfnboth2 header( 'Content-Disposition:' . $t_disposition . ' filename*=UTF-8\'\'' . $t_encoded_filename . '; filename="' . $t_encoded_filename . '"' ); } } }
# Suppress "Pragma: no-cache" header. } else { if (!isset($g_allow_file_cache)) { header('Pragma: no-cache'); } } header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time())); header('Last-Modified: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', $v_date_added)); $t_filename = file_get_display_name($v_filename); # For Internet Explorer 8 as per http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx # Don't let IE second guess our content-type! header('X-Content-Type-Options: nosniff'); //Would be better to use integrated function but it brakes filename of file //http_content_disposition_header( $t_filename); $t_disposition = 'attachment;'; if (is_browser_internet_explorer() || is_browser_chrome()) { // Internet Explorer does not support RFC2231 however it does // incorrectly decode URL encoded filenames and we can use this to // get UTF8 filenames to work with the file download dialog. Chrome // behaves in the same was as Internet Explorer in this respect. // See http://greenbytes.de/tech/tc2231/#attwithfnrawpctenclong header('Content-Disposition:' . $t_disposition . ' filename="' . $t_filename . '"'); } else { // For most other browsers, we can use this technique: // http://greenbytes.de/tech/tc2231/#attfnboth2 header('Content-Disposition:' . $t_disposition . ' filename*=UTF-8\'\'' . $t_filename . '; filename="' . $t_filename . '"'); } header('Content-Length: ' . $v_filesize); header('Content-Type: ' . $v_file_type); switch (plugin_config_get('upload_method', PLUGINS_RELEASEMGT_UPLOAD_METHOD_DEFAULT)) { case DISK: