Changeset 2766 in subversion
- Timestamp:
- Jul 19, 2009 5:28:30 AM (4 years ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 3 edited
-
plugins/database_attachments/database_attachments.php (modified) (1 diff)
-
plugins/filesystem_attachments/filesystem_attachments.php (modified) (1 diff)
-
program/steps/mail/compose.inc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/plugins/database_attachments/database_attachments.php
r2401 r2766 64 64 65 65 $key = $this->_key($args['name']); 66 67 if ($args['path']) 68 $args['data'] = file_get_contents($args['path']); 69 66 70 $data = base64_encode($args['data']); 67 71 -
trunk/roundcubemail/plugins/filesystem_attachments/filesystem_attachments.php
r2401 r2766 74 74 { 75 75 $args['status'] = false; 76 $rcmail = rcmail::get_instance(); 77 $temp_dir = unslashify($rcmail->config->get('temp_dir')); 78 $tmp_path = tempnam($temp_dir, 'rcmAttmnt'); 76 77 if (!$args['path']) { 78 $rcmail = rcmail::get_instance(); 79 $temp_dir = unslashify($rcmail->config->get('temp_dir')); 80 $tmp_path = tempnam($temp_dir, 'rcmAttmnt'); 79 81 80 if ($fp = fopen($tmp_path, 'w')) { 81 fwrite($fp, $args['data']); 82 fclose($fp); 82 if ($fp = fopen($tmp_path, 'w')) { 83 fwrite($fp, $args['data']); 84 fclose($fp); 85 $args['path'] = $tmp_path; 86 } else 87 return $args; 88 } 89 90 $args['id'] = count($_SESSION['plugins']['filesystem_attachments']['tmp_files'])+1; 91 $args['status'] = true; 83 92 84 $args['id'] = count($_SESSION['plugins']['filesystem_attachments']['tmp_files'])+1; 85 $args['path'] = $tmp_path; 86 $args['status'] = true; 87 88 // Note the file for later cleanup 89 $_SESSION['plugins']['filesystem_attachments']['tmp_files'][] = $tmp_path; 90 } 93 // Note the file for later cleanup 94 $_SESSION['plugins']['filesystem_attachments']['tmp_files'][] = $args['path']; 91 95 92 96 return $args; -
trunk/roundcubemail/program/steps/mail/compose.inc
r2731 r2766 602 602 { 603 603 global $OUTPUT; 604 604 echo "^^^^^"; 605 605 $cid_map = array(); 606 606 foreach ((array)$message->mime_parts as $pid => $part) … … 644 644 { 645 645 $part = $message->mime_parts[$pid]; 646 646 $mem_limit = parse_bytes(ini_get('memory_limit')); 647 $curr_mem = function_exists('memory_get_usage') ? memory_get_usage() : 16*1024*1024; // safe value: 16MB 648 $data = $path = null; 649 650 // don't load too big attachments into memory 651 if ($mem_limit > 0 && $part->size > $mem_limit - $curr_mem) { 652 $rcmail = rcmail::get_instance(); 653 $temp_dir = unslashify($rcmail->config->get('temp_dir')); 654 $path = tempnam($temp_dir, 'rcmAttmnt'); 655 if ($fp = fopen($path, 'w')) { 656 $message->get_part_content($pid, $fp); 657 fclose($fp); 658 } else 659 return false; 660 } else { 661 $data = $message->get_part_content($pid); 662 } 663 647 664 $attachment = array( 648 665 'name' => $part->filename ? $part->filename : 'Part_'.$pid.'.'.$part->ctype_secondary, 649 666 'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary, 650 667 'content_id' => $part->content_id, 651 'data' => $message->get_part_content($pid), 668 'data' => $data, 669 'path' => $path 652 670 ); 653 671 654 672 $attachment = rcmail::get_instance()->plugins->exec_hook('save_attachment', $attachment); 673 655 674 if ($attachment['status']) { 656 675 unset($attachment['data'], $attachment['status']); 657 676 return $attachment; 658 } 659 677 } else if ($path) { 678 @unlink($path); 679 } 680 660 681 return false; 661 682 }
Note: See TracChangeset
for help on using the changeset viewer.
