Changeset 0ced2b9 in github


Ignore:
Timestamp:
Aug 22, 2008 5:58:48 AM (5 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
26f5b09
Parents:
f74b283
Message:

Revert r1670 but improve part download step by fixing headers and adding set_time_limit(0)

Location:
program
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_browser.php

    r47124c22 r0ced2b9  
    3939        $this->unix  = stristr($HTTP_USER_AGENT, 'unix'); 
    4040 
     41        $this->opera = stristr($HTTP_USER_AGENT, 'opera'); 
    4142        $this->ns4 = stristr($HTTP_USER_AGENT, 'mozilla/4') && !stristr($HTTP_USER_AGENT, 'msie'); 
    4243        $this->ns  = ($this->ns4 || stristr($HTTP_USER_AGENT, 'netscape')); 
    43         $this->ie  = stristr($HTTP_USER_AGENT, 'msie'); 
     44        $this->ie  = stristr($HTTP_USER_AGENT, 'compatible; msie') && !$this->opera; 
    4445        $this->mz  = stristr($HTTP_USER_AGENT, 'mozilla/5'); 
    45         $this->opera = stristr($HTTP_USER_AGENT, 'opera'); 
    4646        $this->safari = stristr($HTTP_USER_AGENT, 'safari'); 
    4747 
  • program/steps/mail/get.inc

    r2c6fa93 r0ced2b9  
    5555    $ctype_secondary = strtolower($part->ctype_secondary); 
    5656    $mimetype = sprintf('%s/%s', $ctype_primary, $ctype_secondary); 
     57     
     58    $browser = new rcube_browser; 
    5759 
    5860    header("Expires: 0"); 
     
    6365    // send download headers 
    6466    if ($_GET['_download']) { 
    65       header("Cache-Control: private", false); 
    6667      header("Content-Type: application/octet-stream"); 
     68      if ($browser->ie) 
     69        header("Content-Type: application/force-download"); 
    6770    } 
    6871    else if ($ctype_primary == 'text') 
    69       header("Content-Type: text/$ctype_secondary; charset=" . RCMAIL_CHARSET); 
     72      header("Content-Type: text/$ctype_secondary; charset=" . ($part->charset ? $part->charset : RCMAIL_CHARSET)); 
    7073    else 
    7174      header("Content-Type: $mimetype"); 
     
    7982    // deliver part content 
    8083    if ($ctype_primary == 'text' && $ctype_secondary == 'html') { 
    81       // we have to analyze the whole structure again to find inline objects 
    82       /* what was this good for again ? 
    83       list($new_parts, $new_attachments) = 
    84         rcmail_parse_message($MESSAGE['structure'], 
    85                              array('safe' => intval($_GET['_safe']), 
    86                                    'prefer_html' => TRUE, 
    87                                    'get_url' => $GET_URL.'&_part=%s')); 
    88  
    89       $all_parts = array_merge($new_parts, $new_attachments); 
    90       for ($partix = 0; $partix < sizeof($all_parts); $partix++) 
    91         if ($all_parts[$partix]->mime_id == $pid) 
    92           $part = &$all_parts[$partix]; 
    93       */ 
    94  
    9584      // get part body if not available 
    9685      if (!$part->body) 
     
    10190    } 
    10291    else { 
    103       header(sprintf('Content-Length: %d', $part->size)); 
    104       header(sprintf('Content-Disposition: %s; filename="%s";', 
    105                      $_GET['_download'] ? 'attachment' : 'inline', 
    106                      $part->filename ? abbreviate_string($part->filename, 55) : "roundcube.$ctype_secondary")); 
     92      // don't kill the connection if download takes more than 30 sec. 
     93      if (!ini_get('safe_mode')) { 
     94          set_time_limit(0); 
     95      } 
     96       
     97      $filename = $part->filename ? $part->filename : ($MESSAGE->subject ? $MESSAGE->subject : 'roundcube') . '.'.$ctype_secondary; 
     98      $filename = abbreviate_string($part->filename, 55); 
     99      $filename = $browser->ie ? rawurlencode($filename) : addslashes($filename); 
     100      $disposition = !empty($_GET['_download']) ? 'attachment' : 'inline'; 
     101       
     102      header("Content-Disposition: $disposition; filename=\"$filename\""); 
    107103 
    108104      // turn off output buffering and print part content 
Note: See TracChangeset for help on using the changeset viewer.