Changeset 702 for trunk/forum/download/file.php
- Timestamp:
- Mar 31, 2010, 6:32:40 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/forum/download/file.php
r400 r702 3 3 * 4 4 * @package phpBB3 5 * @version $Id : file.php 8792 2008-08-28 13:10:05Z Kellanved$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 17 17 18 18 19 // Thank you sun. 19 // Thank you sun. 20 20 if (isset($_SERVER['CONTENT_TYPE'])) 21 21 { … … 61 61 $avatar_group = false; 62 62 $exit = false; 63 63 64 64 if ($filename[0] === 'g') 65 65 { … … 88 88 $exit = true; 89 89 } 90 91 90 91 92 92 if (!$exit) 93 93 { … … 250 250 } 251 251 252 $attachment['physical_filename'] = basename($attachment['physical_filename']);252 $attachment['physical_filename'] = utf8_basename($attachment['physical_filename']); 253 253 $display_cat = $extensions[$attachment['extension']]['display_cat']; 254 254 … … 267 267 $attachment['physical_filename'] = 'thumb_' . $attachment['physical_filename']; 268 268 } 269 else if (($display_cat == ATTACHMENT_CATEGORY_NONE || $display_cat == ATTACHMENT_CATEGORY_IMAGE) && !$attachment['is_orphan'])269 else if (($display_cat == ATTACHMENT_CATEGORY_NONE/* || $display_cat == ATTACHMENT_CATEGORY_IMAGE*/) && !$attachment['is_orphan']) 270 270 { 271 271 // Update download count … … 279 279 { 280 280 wrap_img_in_html(append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'id=' . $attachment['attach_id']), $attachment['real_filename']); 281 file_gc(); 281 282 } 282 283 else … … 376 377 else 377 378 { 378 header('HTTP/1.0 404 not found');379 header('HTTP/1.0 404 Not Found'); 379 380 } 380 381 } … … 464 465 // Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer. 465 466 $is_ie8 = (strpos(strtolower($user->browser), 'msie 8.0') !== false); 466 header('Content-Type: ' . $attachment['mimetype'] . (($is_ie8) ? '; authoritative=true;' : '')); 467 468 if (empty($user->browser) || (!$is_ie8 && (strpos(strtolower($user->browser), 'msie') !== false))) 469 { 470 header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); 471 if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) 472 { 473 header('expires: -1'); 474 } 467 header('Content-Type: ' . $attachment['mimetype']); 468 469 if ($is_ie8) 470 { 471 header('X-Content-Type-Options: nosniff'); 472 } 473 474 if ($category == ATTACHMENT_CATEGORY_FLASH && request_var('view', 0) === 1) 475 { 476 // We use content-disposition: inline for flash files and view=1 to let it correctly play with flash player 10 - any other disposition will fail to play inline 477 header('Content-Disposition: inline'); 475 478 } 476 479 else 477 480 { 478 header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); 479 if ($is_ie8 && (strpos($attachment['mimetype'], 'image') !== 0)) 480 { 481 header('X-Download-Options: noopen'); 481 if (empty($user->browser) || (!$is_ie8 && (strpos(strtolower($user->browser), 'msie') !== false))) 482 { 483 header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); 484 if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) 485 { 486 header('expires: -1'); 487 } 488 } 489 else 490 { 491 header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); 492 if ($is_ie8 && (strpos($attachment['mimetype'], 'image') !== 0)) 493 { 494 header('X-Download-Options: noopen'); 495 } 482 496 } 483 497 } … … 655 669 if ((strpos(strtolower($browser), 'msie 6.0') === false) && (strpos(strtolower($browser), 'msie 8.0') === false)) 656 670 { 657 if ($last_load !== false && $last_load <= $stamp) 658 { 659 if (@php_sapi_name() === 'CGI') 660 { 671 if ($last_load !== false && $last_load >= $stamp) 672 { 673 if (substr(strtolower(@php_sapi_name()),0,3) === 'cgi') 674 { 675 // in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though 661 676 header('Status: 304 Not Modified', true, 304); 662 677 }
Note:
See TracChangeset
for help on using the changeset viewer.