diff options
author | thomascube <thomas@roundcube.net> | 2005-10-21 12:12:23 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2005-10-21 12:12:23 +0000 |
commit | a95e0e174c48b7c5242b8969aef99838a52c41ee (patch) | |
tree | eb87cb9c33433269d2f2376e841e1d6d66eff667 /program/steps | |
parent | 7902df457d3401c83f78a6ddd48df1a7f07f68b1 (diff) |
Improved support for UTF-8 and other charsets
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/error.inc | 1 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 41 | ||||
-rw-r--r-- | program/steps/mail/sendmail.inc | 9 | ||||
-rw-r--r-- | program/steps/settings/manage_folders.inc | 6 |
4 files changed, 39 insertions, 18 deletions
diff --git a/program/steps/error.inc b/program/steps/error.inc index 9e5757d7b..aa8036afe 100644 --- a/program/steps/error.inc +++ b/program/steps/error.inc @@ -34,6 +34,7 @@ if ($ERROR_CODE==409) » Safari 1.2+<br /> <br /> » JavaScript enabled<br /> +» Support for XMLHTTPRequest<br /> <p><i>Your configuration:</i><br /> $user_agent</p> diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 98e0cdbbf..059a8cfcb 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -21,6 +21,8 @@ require_once('lib/html2text.inc'); require_once('lib/enriched.inc'); +require_once('lib/utf8.inc'); +require_once('lib/utf7.inc'); $EMAIL_ADDRESS_PATTERN = '/([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9]\\.[a-z]{2,5})/i'; @@ -157,12 +159,15 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox, $maxlen if (in_array($folder_lc, $special)) $foldername = rcube_label($folder_lc); else - $foldername = $folder['name']; + { + $foldername = UTF7DecodeString($folder['name']); - // shorten the folder name to a given length - if ($maxlength && $maxlength>1) - $foldername = abbrevate_string($foldername, $maxlength); + // shorten the folder name to a given length + if ($maxlength && $maxlength>1) + $foldername = abbrevate_string($foldername, $maxlength); + } + // add unread message count display if ($unread_count = $IMAP->messagecount($folder['id'], 'UNSEEN', ($folder['id']==$mbox))) $foldername .= sprintf(' (%d)', $unread_count); @@ -176,7 +181,7 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox, $maxlen $folder['id'], $JS_OBJECT_NAME, $folder['id'], - rep_specialchars_output($foldername)); + rep_specialchars_output($foldername, 'html', 'all')); if (!empty($folder['folders'])) $out .= '<ul>' . rcmail_render_folder_tree_html($folder['folders'], $special, $mbox, $maxlength, $nestLevel+1) . "</ul>\n"; @@ -202,16 +207,18 @@ function rcmail_render_folder_tree_select(&$arrFolders, &$special, &$mbox, $maxl if (in_array($folder_lc, $special)) $foldername = rcube_label($folder_lc); else - $foldername = $folder['name']; - - // shorten the folder name to a given length - if ($maxlength && $maxlength>1) - $foldername = abbrevate_string($foldername, $maxlength); + { + $foldername = UTF7DecodeString($folder['name']); + + // shorten the folder name to a given length + if ($maxlength && $maxlength>1) + $foldername = abbrevate_string($foldername, $maxlength); + } $out .= sprintf('<option value="%s">%s%s</option>'."\n", $folder['id'], str_repeat(' ', $nestLevel*4), - rep_specialchars_output($foldername)); + rep_specialchars_output($foldername, 'html', 'all')); if (!empty($folder['folders'])) $out .= rcmail_render_folder_tree_select($folder['folders'], $special, $mbox, $maxlength, $nestLevel+1); @@ -600,6 +607,7 @@ function rcmail_parse_message($structure, $arg=array(), $recursive=FALSE) 'body' => $structure->body, 'ctype_primary' => $message_ctype_primary, 'ctype_secondary' => $message_ctype_secondary, + 'parameters' => $structure->ctype_parameters, 'encoding' => $structure->headers['content-transfer-encoding']); } @@ -693,6 +701,7 @@ function rcmail_parse_message($structure, $arg=array(), $recursive=FALSE) 'body' => $mail_part->body, 'ctype_primary' => $primary_type, 'ctype_secondary' => $secondary_type, + 'parameters' => $mail_part->ctype_parameters, 'encoding' => $mail_part->headers['content-transfer-encoding']); } @@ -867,7 +876,9 @@ function rcmail_message_body($attrib) $out .= rcmail_message_headers(sizeof($header_attrib) ? $header_attrib : NULL, $part['headers']); else if ($part['type']=='content') { -// var_dump($part['parameters']); + if (empty($part['parameters']) || empty($part['parameters']['charset'])) + $part['parameters']['charset'] = $MESSAGE['headers']->charset; + // $body = rcmail_print_body($part['body'], $part['ctype_primary'], $part['ctype_secondary'], $part['encoding'], $safe_mode); $body = rcmail_print_body($part, $safe_mode); $out .= '<div class="message-part">'; @@ -1078,7 +1089,7 @@ function rcmail_address_string($input, $max=NULL, $addicon=NULL) { $j++; if ($PRINT_MODE) - $out .= sprintf('%s <%s>', htmlentities($part['name']), $part['mailto']); + $out .= sprintf('%s <%s>', rep_specialchars_output($part['name']), $part['mailto']); else if (preg_match($EMAIL_ADDRESS_PATTERN, $part['mailto'])) { $out .= sprintf('<a href="mailto:%s" onclick="return %s.command(\'compose\',\'%s\',this)" class="rcmContactAddress" title="%s">%s</a>', @@ -1086,7 +1097,7 @@ function rcmail_address_string($input, $max=NULL, $addicon=NULL) $JS_OBJECT_NAME, $part['mailto'], $part['mailto'], - htmlentities($part['name'])); + rep_specialchars_output($part['name'])); if ($addicon) $out .= sprintf(' <a href="#add" onclick="return %s.command(\'add-contact\',\'%s\',this)" title="%s"><img src="%s%s" alt="add" border="0" /></a>', @@ -1099,7 +1110,7 @@ function rcmail_address_string($input, $max=NULL, $addicon=NULL) else { if ($part['name']) - $out .= htmlentities($part['name']); + $out .= rep_specialchars_output($part['name']); if ($part['mailto']) $out .= (strlen($out) ? ' ' : '') . sprintf('<%s>', $part['mailto']); } diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 61821261d..809aed534 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -147,9 +147,16 @@ if (is_array($_FILES['_attachments']['tmp_name'])) foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) $MAIL_MIME->addAttachment($filepath, $files['type'][$i], $files['name'][$i], TRUE); +// encoding settings for mail composing +$message_param = array('text_encoding' => '7bit', + 'html_encoding' => 'quoted-printable', + 'head_encoding' => 'quoted-printable', + 'head_charset' => 'ISO-8859-1', + 'html_charset' => 'UTF-8', + 'text_charset' => 'UTF-8'); // compose message body and get headers -$msg_body = $MAIL_MIME->get(); +$msg_body = $MAIL_MIME->get($message_param); $msg_subject = $headers['Subject']; diff --git a/program/steps/settings/manage_folders.inc b/program/steps/settings/manage_folders.inc index b960561f7..04b2a461e 100644 --- a/program/steps/settings/manage_folders.inc +++ b/program/steps/settings/manage_folders.inc @@ -19,6 +19,8 @@ */ +require_once('lib/utf7.inc'); + // init IAMP connection rcmail_imap_init(TRUE); @@ -47,7 +49,7 @@ else if ($_action=='unsubscribe') else if ($_action=='create-folder') { if (strlen($_GET['_name'])) - $create = $IMAP->create_mailbox(trim($_GET['_name']), TRUE); + $create = $IMAP->create_mailbox(strip_tags(trim($_GET['_name'])), TRUE); if ($create && $_GET['_remote']) { @@ -122,7 +124,7 @@ function rcube_subscription_form($attrib) $out .= sprintf('<tr id="rcmrow%d" class="%s"><td>%s</td><td>%s</td><td><a href="#delete" onclick="%s.command(\'delete-folder\',\'%s\')" title="%s">%s</a></td>', $i+1, $zebra_class, - rep_specialchars_output($folder, 'html'), + rep_specialchars_output(UTF7DecodeString($folder), 'html', 'all'), $checkbox_subscribe->show(in_array($folder, $a_subscribed)?$folder:'', array('value' => $folder)), $JS_OBJECT_NAME, $folder_js, |