Changeset 12871
- Timestamp:
- 06/11/09 00:20:53 (1 year ago)
- Files:
-
- vtigercrm/branches/5.1/modules/Webmails/Save.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
vtigercrm/branches/5.1/modules/Webmails/Save.php
r12842 r12871 102 102 function add_attachment_to_contact($cid,$email,$emailid) { 103 103 // add vtiger_attachments to contact 104 global $adb,$current_user ;104 global $adb,$current_user,$default_charset; 105 105 for($j=0;$j<2;$j++) { 106 106 if($j==0) … … 116 116 117 117 $filename = ereg_replace("[ ()-]+", "_",$attachments[$i]["filename"]); 118 preg_match_all('/=\?([^\?]+)\?([^\?]+)\?([^\?]+)\?=/', $filename, $matches); 119 $totalmatches = count($matches[0]); 120 121 for($index = 0; $index < $totalmatches; ++$index) { 122 $charset = $matches[1][$index]; 123 $encoding= strtoupper($matches[2][$index]); 124 $data = $matches[3][$index]; 125 126 if($encoding == 'B') { 127 $filename = base64_decode($data); 128 } else if($encoding == 'Q') { 129 $filename = quoted_printable_decode($data); 130 } 131 $filename = iconv(str_replace('_','-',$charset),$default_charset,$filename); 132 } 133 118 134 $saveasfile = $upload_filepath.'/'.$current_id.'_'.$filename; 119 135 $filetype = MailAttachmentMIME::detect($saveasfile); … … 134 150 $document->column_fields['notes_title'] = $filename; 135 151 $document->column_fields['filename'] = $filename; 152 $document->column_fields['filesize'] = $filesize; 153 $document->column_fields['filetype'] = $filetype; 136 154 $document->column_fields['filestatus'] = 1; 137 155 $document->column_fields['filelocationtype'] = 'I';
