Changeset 4295 in subversion
- Timestamp:
- Dec 1, 2010 5:49:20 AM (3 years ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 5 edited
-
CHANGELOG (modified) (1 diff)
-
INSTALL (modified) (1 diff)
-
program/lib/Mail/mime.php (modified) (8 diffs)
-
program/lib/Mail/mimePart.php (modified) (4 diffs)
-
program/steps/mail/sendmail.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/CHANGELOG
r4293 r4295 7 7 - Fix window is blur'ed in IE when selecting a message (#1487316) 8 8 - Fix cursor position on compose form in Webkit browsers (#1486674) 9 - Fix setting charset of attachment filenames (#1487122) 9 10 10 11 RELEASE 0.5-BETA -
trunk/roundcubemail/INSTALL
r4282 r4295 18 18 * PEAR packages distributed with Roundcube or external: 19 19 - MDB2 2.5.0 or newer 20 - Mail_Mime 1. 7.0or newer20 - Mail_Mime 1.8.1 or newer 21 21 - Net_SMTP 1.4.2 or newer 22 22 - Auth_SASL 1.0.3 or newer -
trunk/roundcubemail/program/lib/Mail/mime.php
r3837 r4295 366 366 * 367 367 * @param string $file The file name of the file to attach 368 * ORthe file contents itself368 * or the file contents itself 369 369 * @param string $c_type The content type 370 370 * @param string $name The filename of the attachment 371 371 * Only use if $file is the contents 372 * @param bool $isfile Whether $file is a filename or not 373 * Defaults to true 374 * @param string $encoding The type of encoding to use. 375 * Defaults to base64. 376 * Possible values: 7bit, 8bit, base64, 377 * or quoted-printable. 372 * @param bool $isfile Whether $file is a filename or not. Defaults to true 373 * @param string $encoding The type of encoding to use. Defaults to base64. 374 * Possible values: 7bit, 8bit, base64 or quoted-printable. 378 375 * @param string $disposition The content-disposition of this file 379 376 * Defaults to attachment. 380 377 * Possible values: attachment, inline. 381 * @param string $charset The character set used in the filename 382 * of this attachment. 378 * @param string $charset The character set of attachment's content. 383 379 * @param string $language The language of the attachment 384 380 * @param string $location The RFC 2557.4 location of the attachment 385 * @param string $n_encoding Encoding for attachment name (Content-Type)381 * @param string $n_encoding Encoding of the attachment's name in Content-Type 386 382 * By default filenames are encoded using RFC2231 method 387 383 * Here you can set RFC2047 encoding (quoted-printable 388 384 * or base64) instead 389 * @param string $f_encoding Encoding for attachment filename (Content-Disposition)390 * See $n_encoding description385 * @param string $f_encoding Encoding of the attachment's filename 386 * in Content-Disposition header. 391 387 * @param string $description Content-Description header 388 * @param string $h_charset The character set of the headers e.g. filename 389 * If not specified, $charset will be used 392 390 * 393 391 * @return mixed True on success or PEAR_Error object … … 405 403 $n_encoding = null, 406 404 $f_encoding = null, 407 $description = '' 405 $description = '', 406 $h_charset = null 408 407 ) { 409 408 $bodyfile = null; … … 438 437 'name' => $filename, 439 438 'c_type' => $c_type, 439 'charset' => $charset, 440 440 'encoding' => $encoding, 441 'charset' => $charset,442 441 'language' => $language, 443 442 'location' => $location, … … 445 444 'description' => $description, 446 445 'name_encoding' => $n_encoding, 447 'filename_encoding' => $f_encoding 446 'filename_encoding' => $f_encoding, 447 'headers_charset' => $h_charset, 448 448 ); 449 449 … … 622 622 $params['encoding'] = 'base64'; 623 623 $params['disposition'] = 'inline'; 624 $params[' dfilename']= $value['name'];624 $params['filename'] = $value['name']; 625 625 $params['cid'] = $value['cid']; 626 626 $params['body_file'] = $value['body_file']; … … 651 651 { 652 652 $params['eol'] = $this->_build_params['eol']; 653 $params[' dfilename']= $value['name'];653 $params['filename'] = $value['name']; 654 654 $params['encoding'] = $value['encoding']; 655 655 $params['content_type'] = $value['c_type']; … … 657 657 $params['disposition'] = isset($value['disposition']) ? 658 658 $value['disposition'] : 'attachment'; 659 if ($value['charset']) { 659 660 // content charset 661 if (!empty($value['charset'])) { 660 662 $params['charset'] = $value['charset']; 661 663 } 662 if ($value['language']) { 664 // headers charset (filename, description) 665 if (!empty($value['headers_charset'])) { 666 $params['headers_charset'] = $value['headers_charset']; 667 } 668 if (!empty($value['language'])) { 663 669 $params['language'] = $value['language']; 664 670 } 665 if ( $value['location']) {671 if (!empty($value['location'])) { 666 672 $params['location'] = $value['location']; 667 673 } … … 1388 1394 if ($headers['Content-Type'] == 'text/plain') { 1389 1395 // single-part message: add charset and encoding 1396 $charset = 'charset=' . $this->_build_params['text_charset']; 1397 // place charset parameter in the same line, if possible 1398 // 26 = strlen("Content-Type: text/plain; ") 1390 1399 $headers['Content-Type'] 1391 .= ";$eol charset=" . $this->_build_params['text_charset'];1400 .= (strlen($charset) + 26 <= 76) ? "; $charset" : ";$eol $charset"; 1392 1401 $headers['Content-Transfer-Encoding'] 1393 1402 = $this->_build_params['text_encoding']; 1394 1403 } else if ($headers['Content-Type'] == 'text/html') { 1395 1404 // single-part message: add charset and encoding 1405 $charset = 'charset=' . $this->_build_params['html_charset']; 1406 // place charset parameter in the same line, if possible 1396 1407 $headers['Content-Type'] 1397 .= ";$eol charset=" . $this->_build_params['html_charset'];1408 .= (strlen($charset) + 25 <= 76) ? "; $charset" : ";$eol $charset"; 1398 1409 $headers['Content-Transfer-Encoding'] 1399 1410 = $this->_build_params['html_encoding']; 1400 1411 } else { 1401 // multipart message: a dd charset and boundary1412 // multipart message: and boundary 1402 1413 if (!empty($this->_build_params['boundary'])) { 1403 1414 $boundary = $this->_build_params['boundary']; -
trunk/roundcubemail/program/lib/Mail/mimePart.php
r3837 r4295 142 142 * encoding - The encoding to use, 7bit, 8bit, 143 143 * base64, or quoted-printable 144 * charset - Content character set 144 145 * cid - Content ID to apply 145 146 * disposition - Content disposition, inline or attachment 146 147 * dfilename - Filename parameter for content disposition 147 148 * description - Content description 148 * charset - Character set to use 149 * name_encoding - Encoding for attachment name (Content-Type) 149 * name_encoding - Encoding of the attachment name (Content-Type) 150 150 * By default filenames are encoded using RFC2231 151 151 * Here you can set RFC2047 encoding (quoted-printable 152 152 * or base64) instead 153 * filename_encoding - Encoding forattachment filename (Content-Disposition)153 * filename_encoding - Encoding of the attachment filename (Content-Disposition) 154 154 * See 'name_encoding' 155 * headers_charset - Charset of the headers e.g. filename, description. 156 * If not set, 'charset' will be used 155 157 * eol - End of line sequence. Default: "\r\n" 156 158 * body_file - Location of file with part's body (instead of $body) … … 166 168 } 167 169 168 $c_type = array();169 $c_disp = array();170 170 foreach ($params as $key => $value) { 171 171 switch ($key) { 172 case 'content_type':173 $c_type['type'] = $value;174 break;175 176 172 case 'encoding': 177 173 $this->_encoding = $value; … … 183 179 break; 184 180 185 case 'disposition':186 $c_disp['disp'] = $value;187 break;188 189 case 'dfilename':190 $c_disp['filename'] = $value;191 $c_type['name'] = $value;192 break;193 194 case 'description':195 $headers['Content-Description'] = $value;196 break;197 198 case 'charset':199 $c_type['charset'] = $value;200 $c_disp['charset'] = $value;201 break;202 203 case 'language':204 $c_type['language'] = $value;205 $c_disp['language'] = $value;206 break;207 208 181 case 'location': 209 182 $headers['Content-Location'] = $value; … … 217 190 218 191 // Default content-type 219 if (empty($ c_type['type'])) {220 $ c_type['type'] = 'text/plain';192 if (empty($params['content_type'])) { 193 $params['content_type'] = 'text/plain'; 221 194 } 222 195 223 196 // Content-Type 224 if (!empty($c_type['type'])) { 225 $headers['Content-Type'] = $c_type['type']; 226 if (!empty($c_type['charset'])) { 227 $charset = "charset={$c_type['charset']}"; 228 // place charset parameter in the same line, if possible 229 if ((strlen($headers['Content-Type']) + strlen($charset) + 16) <= 76) { 230 $headers['Content-Type'] .= '; '; 231 } else { 232 $headers['Content-Type'] .= ';' . $this->_eol . ' '; 233 } 234 $headers['Content-Type'] .= $charset; 235 } 236 if (!empty($c_type['name'])) { 237 $headers['Content-Type'] .= ';' . $this->_eol; 238 $headers['Content-Type'] .= $this->_buildHeaderParam( 239 'name', $c_type['name'], 240 isset($c_type['charset']) ? $c_type['charset'] : 'US-ASCII', 241 isset($c_type['language']) ? $c_type['language'] : null, 242 isset($params['name_encoding']) ? $params['name_encoding'] : null 243 ); 244 } 197 $headers['Content-Type'] = $params['content_type']; 198 if (!empty($params['charset'])) { 199 $charset = "charset={$params['charset']}"; 200 // place charset parameter in the same line, if possible 201 if ((strlen($headers['Content-Type']) + strlen($charset) + 16) <= 76) { 202 $headers['Content-Type'] .= '; '; 203 } else { 204 $headers['Content-Type'] .= ';' . $this->_eol . ' '; 205 } 206 $headers['Content-Type'] .= $charset; 207 208 // Default headers charset 209 if (!isset($params['headers_charset'])) { 210 $params['headers_charset'] = $params['charset']; 211 } 212 } 213 if (!empty($params['filename'])) { 214 $headers['Content-Type'] .= ';' . $this->_eol; 215 $headers['Content-Type'] .= $this->_buildHeaderParam( 216 'name', $params['filename'], 217 !empty($params['headers_charset']) ? $params['headers_charset'] : 'US-ASCII', 218 !empty($params['language']) ? $params['language'] : null, 219 !empty($params['name_encoding']) ? $params['name_encoding'] : null 220 ); 245 221 } 246 222 247 223 // Content-Disposition 248 if (!empty($ c_disp['disp'])) {249 $headers['Content-Disposition'] = $ c_disp['disp'];250 if (!empty($ c_disp['filename'])) {224 if (!empty($params['disposition'])) { 225 $headers['Content-Disposition'] = $params['disposition']; 226 if (!empty($params['filename'])) { 251 227 $headers['Content-Disposition'] .= ';' . $this->_eol; 252 228 $headers['Content-Disposition'] .= $this->_buildHeaderParam( 253 'filename', $ c_disp['filename'],254 isset($c_disp['charset']) ? $c_disp['charset'] : 'US-ASCII',255 isset($c_disp['language']) ? $c_disp['language'] : null,256 isset($params['filename_encoding']) ?$params['filename_encoding'] : null229 'filename', $params['filename'], 230 !empty($params['headers_charset']) ? $params['headers_charset'] : 'US-ASCII', 231 !empty($params['language']) ? $params['language'] : null, 232 !empty($params['filename_encoding']) ? $params['filename_encoding'] : null 257 233 ); 258 234 } 259 235 } 260 236 261 if (!empty($ headers['Content-Description'])) {237 if (!empty($params['description'])) { 262 238 $headers['Content-Description'] = $this->encodeHeader( 263 'Content-Description', $ headers['Content-Description'],264 isset($c_type['charset']) ? $c_type['charset'] : 'US-ASCII',265 isset($params['name_encoding']) ?$params['name_encoding'] : 'quoted-printable',239 'Content-Description', $params['description'], 240 !empty($params['headers_charset']) ? $params['headers_charset'] : 'US-ASCII', 241 !empty($params['name_encoding']) ? $params['name_encoding'] : 'quoted-printable', 266 242 $this->_eol 267 243 ); -
trunk/roundcubemail/program/steps/mail/sendmail.inc
r4249 r4295 514 514 ($ctype == 'message/rfc822' ? '8bit' : 'base64'), 515 515 ($ctype == 'message/rfc822' ? 'inline' : 'attachment'), 516 $message_charset, '', '',516 '', '', '', 517 517 $CONFIG['mime_param_folding'] ? 'quoted-printable' : NULL, 518 $CONFIG['mime_param_folding'] == 2 ? 'quoted-printable' : NULL 518 $CONFIG['mime_param_folding'] == 2 ? 'quoted-printable' : NULL, 519 '', RCMAIL_CHARSET 519 520 ); 520 521 }
Note: See TracChangeset
for help on using the changeset viewer.
