Ignore:
Timestamp:
Mar 31, 2010, 6:32:40 PM (14 years ago)
Author:
george
Message:
  • Upraveno: Aktualizace fóra.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/forum/download/file.php

    r400 r702  
    33*
    44* @package phpBB3
    5 * @version $Id: file.php 8792 2008-08-28 13:10:05Z Kellanved $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    1717
    1818
    19 // Thank you sun. 
     19// Thank you sun.
    2020if (isset($_SERVER['CONTENT_TYPE']))
    2121{
     
    6161        $avatar_group = false;
    6262        $exit = false;
    63        
     63
    6464        if ($filename[0] === 'g')
    6565        {
     
    8888                $exit = true;
    8989        }
    90        
    91        
     90
     91
    9292        if (!$exit)
    9393        {
     
    250250}
    251251
    252 $attachment['physical_filename'] = basename($attachment['physical_filename']);
     252$attachment['physical_filename'] = utf8_basename($attachment['physical_filename']);
    253253$display_cat = $extensions[$attachment['extension']]['display_cat'];
    254254
     
    267267        $attachment['physical_filename'] = 'thumb_' . $attachment['physical_filename'];
    268268}
    269 else if (($display_cat == ATTACHMENT_CATEGORY_NONE || $display_cat == ATTACHMENT_CATEGORY_IMAGE) && !$attachment['is_orphan'])
     269else if (($display_cat == ATTACHMENT_CATEGORY_NONE/* || $display_cat == ATTACHMENT_CATEGORY_IMAGE*/) && !$attachment['is_orphan'])
    270270{
    271271        // Update download count
     
    279279{
    280280        wrap_img_in_html(append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'id=' . $attachment['attach_id']), $attachment['real_filename']);
     281        file_gc();
    281282}
    282283else
     
    376377        else
    377378        {
    378                 header('HTTP/1.0 404 not found');
     379                header('HTTP/1.0 404 Not Found');
    379380        }
    380381}
     
    464465        // Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer.
    465466        $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');
    475478        }
    476479        else
    477480        {
    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                        }
    482496                }
    483497        }
     
    655669        if ((strpos(strtolower($browser), 'msie 6.0') === false) && (strpos(strtolower($browser), 'msie 8.0') === false))
    656670        {
    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
    661676                                header('Status: 304 Not Modified', true, 304);
    662677                        }
Note: See TracChangeset for help on using the changeset viewer.