Changeset 19cc5b9 in github for program/steps/mail/get.inc
- Timestamp:
- May 30, 2012 5:22:18 AM (12 months ago)
- Branches:
- master, HEAD, dev-browser-capabilities, pdo
- Children:
- d901205
- Parents:
- b9854b8
- File:
-
- 1 edited
-
program/steps/mail/get.inc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/steps/mail/get.inc
r041c93c r19cc5b9 23 23 // show loading page 24 24 if (!empty($_GET['_preload'])) { 25 $url = preg_replace('/ [&?]+_preload=1/', '', $_SERVER['REQUEST_URI']);25 $url = preg_replace('/([&?]+)_preload=/', '\\1_embed=', $_SERVER['REQUEST_URI']); 26 26 $message = rcube_label('loadingdata'); 27 27 … … 77 77 // overwrite modified vars from plugin 78 78 $mimetype = $plugin['mimetype']; 79 80 // TIFF to JPEG conversion, if needed 81 $tiff_support = !empty($_SESSION['browser_caps']) && !empty($_SESSION['browser_caps']['tif']); 82 if (!empty($_REQUEST['_embed']) && !$tiff_support 83 && $RCMAIL->config->get('im_convert_path') 84 && rcmail_part_image_type($part) == 'image/tiff' 85 ) { 86 $tiff2jpeg = true; 87 $mimetype = 'image/jpeg'; 88 } 89 79 90 list($ctype_primary, $ctype_secondary) = explode('/', $mimetype); 80 91 if ($plugin['body']) … … 151 162 header("Content-Disposition: $disposition; filename=\"$filename\""); 152 163 164 // handle tiff to jpeg conversion 165 if (!empty($tiff2jpeg)) { 166 $temp_dir = unslashify($RCMAIL->config->get('temp_dir')); 167 $file_path = tempnam($temp_dir, 'rcmAttmnt'); 168 169 // write content to temp file 170 if ($part->body) { 171 $saved = file_put_contents($file_path, $part->body); 172 } 173 else if ($part->size) { 174 $fd = fopen($file_path, 'w'); 175 $saved = $RCMAIL->storage->get_message_part($MESSAGE->uid, $part->mime_id, $part, false, $fd); 176 fclose($fd); 177 } 178 179 // convert image to jpeg and send it to the browser 180 if ($saved) { 181 $image = new rcube_image($file_path); 182 if ($image->convert(rcube_image::TYPE_JPG, $file_path)) { 183 header("Content-Length: " . filesize($file_path)); 184 readfile($file_path); 185 } 186 unlink($file_path); 187 } 188 } 153 189 // do content filtering to avoid XSS through fake images 154 if (!empty($_REQUEST['_embed']) && $browser->ie && $browser->ver <= 8) {190 else if (!empty($_REQUEST['_embed']) && $browser->ie && $browser->ver <= 8) { 155 191 if ($part->body) { 156 192 echo preg_match('/<(script|iframe|object)/i', $part->body) ? '' : $part->body;
Note: See TracChangeset
for help on using the changeset viewer.
