From 0b17277eaeebdee278230d7cd2550a1a9e2fcf9f Mon Sep 17 00:00:00 2001 From: till <till@php.net> Date: Mon, 24 Mar 2008 20:52:33 -0400 Subject: [PATCH] * committing patch from #1484783 --- program/steps/mail/compose.inc | 93 ++++++++++++++++++++++++++-------------------- 1 files changed, 52 insertions(+), 41 deletions(-) diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index c3063e3..fd3743e 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -90,7 +90,11 @@ // similar as in program/steps/mail/show.inc $MESSAGE = array('UID' => $msg_uid); $MESSAGE['headers'] = &$IMAP->get_headers($msg_uid); - $MESSAGE['structure'] = &$IMAP->get_structure($msg_uid); + $MESSAGE['structure'] = &$IMAP->get_structure($msg_uid); + + if (!empty($MESSAGE['headers']->charset)) + $IMAP->set_charset($MESSAGE['headers']->charset); + $MESSAGE['subject'] = $IMAP->decode_header($MESSAGE['headers']->subject); $MESSAGE['parts'] = $IMAP->get_mime_numbers($MESSAGE['structure']); @@ -562,10 +566,14 @@ function rcmail_create_draft_body($body, $bodyIsHtml) { global $IMAP, $MESSAGE; - - // add attachments - if (!isset($_SESSION['compose']['forward_attachments']) && - is_array($MESSAGE['parts']) && sizeof($MESSAGE['parts'])>1) + + /** + * add attachments + * sizeof($MESSAGE['parts'] can be 1 - e.g. attachment, but no text! + */ + if (!isset($_SESSION['compose']['forward_attachments']) + && is_array($MESSAGE['parts']) + && count($MESSAGE['parts']) > 0) rcmail_write_compose_attachments($MESSAGE); return $body; @@ -583,7 +591,7 @@ foreach ($message['parts'] as $pid => $part) { - if ($part->ctype_primary != 'message' && $part->ctype_primary != 'text' && + if ($part->ctype_primary != 'message' && ($part->disposition=='attachment' || $part->disposition=='inline' || $part->headers['content-id'] || (empty($part->disposition) && $part->filename))) { @@ -736,6 +744,8 @@ function rcmail_priority_selector($attrib) { + global $MESSAGE; + list($form_start, $form_end) = get_form_tags($attrib); unset($attrib['form']); @@ -749,7 +759,7 @@ rcube_label('highest')), array(5, 4, 0, 2, 1)); - $sel = isset($_POST['_priority']) ? $_POST['_priority'] : 0; + $sel = isset($_POST['_priority']) ? $_POST['_priority'] : intval($MESSAGE['headers']->priority); $out = $form_start ? "$form_start\n" : ''; $out .= $selector->show($sel); @@ -761,6 +771,8 @@ function rcmail_receipt_checkbox($attrib) { + global $MESSAGE; + list($form_start, $form_end) = get_form_tags($attrib); unset($attrib['form']); @@ -772,7 +784,7 @@ $checkbox = new checkbox($attrib); $out = $form_start ? "$form_start\n" : ''; - $out .= $checkbox->show(0); + $out .= $checkbox->show($MESSAGE['headers']->mdn_to ? 1 : 0); $out .= $form_end ? "\n$form_end" : ''; return $out; @@ -878,44 +890,43 @@ $a_contacts = array(); if ($result = $CONTACTS->list_records()) -{ + { while ($sql_arr = $result->iterate()) if ($sql_arr['email']) - $a_contacts[] = format_email_recipient($sql_arr['email'], JQ($sql_arr['name'])); -} - -/* LDAP autocompletion */ -foreach ($CONFIG['ldap_public'] as $ldapserv_config) - { - if ($ldapserv_config['fuzzy_search'] != 1) + $a_contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']); + } +if (isset($CONFIG['ldap_public'])) + { + /* LDAP autocompletion */ + foreach ($CONFIG['ldap_public'] as $ldapserv_config) { - continue; - } - - $LDAP = new rcube_ldap($ldapserv_config); - $LDAP->connect(); - $LDAP->set_pagesize(1000); - - $results = $LDAP->search($ldapserv_config['mail_field'], ""); - - for ($i = 0; $i < $results->count; $i++) - { - if ($results->records[$i]['email'] != '') - { - $email = $results->records[$i]['email']; - $name = $results->records[$i]['name']; - - $a_contacts[] = format_email_recipient($email, JQ($name)); + if ($ldapserv_config['fuzzy_search'] != 1) + { + continue; } - } + + $LDAP = new rcube_ldap($ldapserv_config); + $LDAP->connect(); + $LDAP->set_pagesize(1000); + + $results = $LDAP->search($ldapserv_config['mail_field'], ""); + + for ($i = 0; $i < $results->count; $i++) + { + if ($results->records[$i]['email'] != '') + { + $email = $results->records[$i]['email']; + $name = $results->records[$i]['name']; - $LDAP->close(); - } - - if ($a_contacts) - { + $a_contacts[] = format_email_recipient($email, $name); + } + } + $LDAP->close(); + } + } +if ($a_contacts) + { $OUTPUT->set_env('contacts', $a_contacts); - } - + } parse_template('compose'); ?> \ No newline at end of file -- Gitblit v1.9.1