thomascube
2010-12-17 db1a87cd6c506f2afbd1a37c64cb56ae11120b49
program/steps/mail/compose.inc
@@ -112,7 +112,8 @@
// add some labels to client
$OUTPUT->add_label('nosubject', 'nosenderwarning', 'norecipientwarning', 'nosubjectwarning', 'cancel',
    'nobodywarning', 'notsentwarning', 'notuploadedwarning', 'savingmessage', 'sendingmessage', 
    'messagesaved', 'converting', 'editorwarning', 'searching', 'uploading', 'fileuploaderror');
    'messagesaved', 'converting', 'editorwarning', 'searching', 'uploading', 'fileuploaderror',
    'autocompletechars');
// add config parameters to client script
if (!empty($CONFIG['drafts_mbox'])) {
@@ -123,6 +124,7 @@
$OUTPUT->set_env('mailbox', $IMAP->get_mailbox_name());
$OUTPUT->set_env('sig_above', $CONFIG['sig_above']);
$OUTPUT->set_env('top_posting', $CONFIG['top_posting']);
$OUTPUT->set_env('autocomplete_min_length', $CONFIG['autocomplete_min_length']);
// get reference message and set compose mode
if ($msg_uid = $_SESSION['compose']['param']['reply_uid'])
@@ -265,20 +267,12 @@
      $param = 'replyto';
      $header = 'reply-to';
    case 'mailreplyto':
    case 'mailreply-to':
    case 'followupto':
    case 'followup-to':
      if (!$fname) {
        $fname = '_mailreplyto';
        $param = 'mailreplyto';
        $header = 'mailreply-to';
      }
    case 'mailfollowupto':
    case 'mailfollowup-to':
      if (!$fname) {
        $fname = '_mailfollowupto';
        $param = 'mailfollowupto';
        $header = 'mailfollowup-to';
        $fname = '_followupto';
        $param = 'followupto';
        $header = 'mail-followup-to';
      }
      $allow_attrib = array('id', 'class', 'style', 'size', 'tabindex');
@@ -352,10 +346,10 @@
      $fvalue = $MESSAGE->get_header('cc');
    else if ($header=='bcc' && !empty($MESSAGE->headers->bcc))
      $fvalue = $MESSAGE->get_header('bcc');
    else if ($header=='reply-to' && !empty($MESSAGE->headers->others['mail-reply-to']))
      $fvalue = $MESSAGE->get_header('mail-reply-to');
    else if ($header=='reply-to' && !empty($MESSAGE->headers->replyto))
      $fvalue = $MESSAGE->get_header('reply-to');
    else if ($header=='mail-reply-to' && !empty($MESSAGE->headers->others['mail-reply-to']))
      $fvalue = $MESSAGE->get_header('followup-to');
    else if ($header=='mail-followup-to' && !empty($MESSAGE->headers->others['mail-followup-to']))
      $fvalue = $MESSAGE->get_header('mail-followup-to');
@@ -470,7 +464,7 @@
      $from_id = get_input_value('_from', RCUBE_INPUT_POST);
    else if (!empty($_SESSION['compose']['param']['from']))
      $from_id = $_SESSION['compose']['param']['from'];
    else if (count($user_identities) > 1) {
    else {
      $return_path = $MESSAGE->headers->others['return-path'];
      // Set identity
@@ -499,8 +493,9 @@
    // add signatures to client
    $OUTPUT->set_env('signatures', $a_signatures);
  }
  else
  {
  // no identities, display text input field
  else {
    $field_attrib['class'] = 'from_address';
    $input_from = new html_inputfield($field_attrib);
    $out = $input_from->show($_POST['_from']);
  }
@@ -644,9 +639,20 @@
  $out .= $msgtype->show();
  // If desired, set this textarea to be editable by TinyMCE
  if ($isHtml) $attrib['class'] = 'mce_editor';
  $textarea = new html_textarea($attrib);
  $out .= $textarea->show($MESSAGE_BODY);
  if ($isHtml) {
    $attrib['class'] = 'mce_editor';
    $textarea = new html_textarea($attrib);
    $out .= $textarea->show($MESSAGE_BODY);
  }
  else {
    $textarea = new html_textarea($attrib);
    $out .= $textarea->show('');
    // quote plain text, inject into textarea
    $table = get_html_translation_table(HTML_SPECIALCHARS);
    $MESSAGE_BODY = strtr($MESSAGE_BODY, $table);
    $out = substr($out, 0, -11) . $MESSAGE_BODY . '</textarea>';
  }
  $out .= $form_end ? "\n$form_end" : '';
  $OUTPUT->set_env('composebody', $attrib['id']);
@@ -728,7 +734,7 @@
  // build reply prefix
  $from = array_pop($RCMAIL->imap->decode_address_list($MESSAGE->get_header('from')));
  $prefix = sprintf("On %s, %s wrote:",
    $MESSAGE->headers->date, $from['name'] ? $from['name'] : idn_to_utf8($from['email']));
    $MESSAGE->headers->date, $from['name'] ? $from['name'] : idn_to_utf8($from['mailto']));
  if (!$bodyIsHtml) {
    $body = preg_replace('/\r?\n/', "\n", $body);