Aleksander Machniak
2014-12-16 8ccfc271d7e84972d5a72405e7523875f7990a0f
program/steps/mail/compose.inc
@@ -131,8 +131,10 @@
    $compose_mode = RCUBE_COMPOSE_EDIT;
}
$COMPOSE['mode'] = $compose_mode;
$OUTPUT->set_env('compose_mode', $compose_mode);
if ($compose_mode) {
    $COMPOSE['mode'] = $compose_mode;
    $OUTPUT->set_env('compose_mode', $compose_mode);
}
if ($compose_mode == RCUBE_COMPOSE_EDIT || $compose_mode == RCUBE_COMPOSE_DRAFT) {
    // don't add signature in draft/edit mode, we'll also not remove the old-one
@@ -949,7 +951,7 @@
            "googie.setCurrentLanguage('%s');\n".
            "googie.setDecoration(false);\n".
            "googie.decorateTextarea('%s');\n",
            $RCMAIL->output->get_skin_path(),
            $RCMAIL->output->asset_url($RCMAIL->output->get_skin_path()),
            $RCMAIL->url(array('_task' => 'utils', '_action' => 'spell', '_remote' => 1)),
                !empty($dictionary) ? 'true' : 'false',
            rcube::JQ(rcube::Q($RCMAIL->gettext('checkspelling'))),
@@ -986,6 +988,8 @@
        )
    ));
    $reply_mode = intval($RCMAIL->config->get('reply_mode'));
    if (!$bodyIsHtml) {
        $body = preg_replace('/\r?\n/', "\n", $body);
        $body = trim($body, "\n");
@@ -994,10 +998,13 @@
        $body = rcmail_wrap_and_quote($body, $LINE_LENGTH);
        $prefix .= "\n";
        $suffix = '';
        if (intval($RCMAIL->config->get('reply_mode')) > 0) { // top-posting
        if ($reply_mode > 0) { // top-posting
            $prefix = "\n\n\n" . $prefix;
            $suffix = '';
        }
        else {
            $suffix = "\n";
        }
    }
    else {
@@ -1012,7 +1019,7 @@
        $prefix = '<p>' . rcube::Q($prefix) . "</p>\n";
        $prefix .= '<blockquote>';
        if (intval($RCMAIL->config->get('reply_mode')) > 0) { // top-posting
        if ($reply_mode > 0) { // top-posting
            $prefix = '<br>' . $prefix;
            $suffix = '</blockquote>';
        }
@@ -1304,7 +1311,6 @@
        }
        else {
            $data = $storage->get_raw_body($message->uid);
            $curr_mem += $message->size;
        }
        $attachment = array(
@@ -1377,6 +1383,7 @@
        'data'       => $data,
        'path'       => $path,
        'size'       => $path ? filesize($path) : strlen($data),
        'charset'    => $part->charset,
    );
    $attachment = $rcmail->plugins->exec_hook('attachment_save', $attachment);
@@ -1446,6 +1453,9 @@
    if (isset($_POST['_subject'])) {
        $subject = rcube_utils::get_input_value('_subject', rcube_utils::INPUT_POST, TRUE);
    }
    else if (!empty($COMPOSE['param']['subject'])) {
        $subject = $COMPOSE['param']['subject'];
    }
    // create a reply-subject
    else if ($compose_mode == RCUBE_COMPOSE_REPLY) {
        if (preg_match('/^re:/i', $MESSAGE->subject))
@@ -1467,9 +1477,6 @@
    else if ($compose_mode == RCUBE_COMPOSE_DRAFT || $compose_mode == RCUBE_COMPOSE_EDIT) {
        $subject = $MESSAGE->subject;
    }
    else if (!empty($COMPOSE['param']['subject'])) {
        $subject = $COMPOSE['param']['subject'];
    }
    $out = $form_start ? "$form_start\n" : '';
    $out .= $textfield->show($subject);
@@ -1487,15 +1494,14 @@
    if (!$attrib['id'])
        $attrib['id'] = 'rcmAttachmentList';
    $out       = "\n";
    $jslist    = array();
    $button    = '';
    $skin_path = $RCMAIL->config->get('skin_path');
    $out    = "\n";
    $jslist = array();
    $button = '';
    if (is_array($COMPOSE['attachments'])) {
        if ($attrib['deleteicon']) {
            $button = html::img(array(
                'src' => $skin_path . $attrib['deleteicon'],
                'src' => $RCMAIL->output->abs_url($attrib['deleteicon'], true),
                'alt' => $RCMAIL->gettext('delete')
            ));
        }
@@ -1534,13 +1540,13 @@
    }
    if ($attrib['deleteicon'])
        $COMPOSE['deleteicon'] = $skin_path . $attrib['deleteicon'];
        $COMPOSE['deleteicon'] = $RCMAIL->output->abs_url($attrib['deleteicon'], true);
    else if (rcube_utils::get_boolean($attrib['textbuttons']))
        $COMPOSE['textbuttons'] = true;
    if ($attrib['cancelicon'])
        $OUTPUT->set_env('cancelicon', $skin_path . $attrib['cancelicon']);
        $OUTPUT->set_env('cancelicon', $RCMAIL->output->abs_url($attrib['cancelicon'], true));
    if ($attrib['loadingicon'])
        $OUTPUT->set_env('loadingicon', $skin_path . $attrib['loadingicon']);
        $OUTPUT->set_env('loadingicon', $RCMAIL->output->abs_url($attrib['loadingicon'], true));
    $OUTPUT->set_env('attachments', $jslist);
    $OUTPUT->add_gui_object('attachmentlist', $attrib['id']);