| | |
| | | if (!is_array($_SESSION['compose']) || $_SESSION['compose']['id'] != get_input_value('_id', RCUBE_INPUT_GET)) |
| | | { |
| | | rcmail_compose_cleanup(); |
| | | $_SESSION['compose'] = array('id' => uniqid(rand())); |
| | | $_SESSION['compose'] = array('id' => uniqid(rand()), 'param' => array_map('strip_tags', $_GET)); |
| | | |
| | | // redirect to a unique URL with all parameters stored in session |
| | | $OUTPUT->redirect(array('_action' => 'compose', '_id' => $_SESSION['compose']['id'])); |
| | | } |
| | | |
| | | // add some labels to client |
| | |
| | | |
| | | |
| | | // get reference message and set compose mode |
| | | if ($msg_uid = get_input_value('_reply_uid', RCUBE_INPUT_GET)) |
| | | if ($msg_uid = $_SESSION['compose']['param']['_reply_uid']) |
| | | $compose_mode = RCUBE_COMPOSE_REPLY; |
| | | else if ($msg_uid = get_input_value('_forward_uid', RCUBE_INPUT_GET)) |
| | | else if ($msg_uid = $_SESSION['compose']['param']['_forward_uid']) |
| | | $compose_mode = RCUBE_COMPOSE_FORWARD; |
| | | else if ($msg_uid = get_input_value('_draft_uid', RCUBE_INPUT_GET)) |
| | | else if ($msg_uid = $_SESSION['compose']['param']['_draft_uid']) |
| | | $compose_mode = RCUBE_COMPOSE_DRAFT; |
| | | |
| | | if (!empty($msg_uid)) |
| | |
| | | $_SESSION['compose']['reply_msgid'] = $MESSAGE->headers->messageID; |
| | | $_SESSION['compose']['references'] = trim($MESSAGE->headers->references . " " . $MESSAGE->headers->messageID); |
| | | |
| | | if (!empty($_GET['_all'])) |
| | | if (!empty($_SESSION['compose']['param']['_all'])) |
| | | $MESSAGE->reply_all = 1; |
| | | } |
| | | else if ($compose_mode == RCUBE_COMPOSE_FORWARD) |
| | | { |
| | | $_SESSION['compose']['forward_uid'] = $msg_uid; |
| | | } |
| | | else if ($compose_mode == RCUBE_COMPOSE_DRAFT) |
| | | { |
| | | $_SESSION['compose']['draft_uid'] = $msg_uid; |
| | | } |
| | | } |
| | | |
| | |
| | | $header = 'to'; |
| | | |
| | | // we have a set of recipients stored is session |
| | | if (($mailto_id = get_input_value('_mailto', RCUBE_INPUT_GET)) && $_SESSION['mailto'][$mailto_id]) |
| | | $fvalue = $_SESSION['mailto'][$mailto_id]; |
| | | else if (!empty($_GET['_to'])) |
| | | $fvalue = get_input_value('_to', RCUBE_INPUT_GET); |
| | | if (($mailto_id = $_SESSION['compose']['param']['_mailto']) && $_SESSION['mailto'][$mailto_id]) |
| | | $fvalue = urldecode($_SESSION['mailto'][$mailto_id]); |
| | | else if (!empty($_SESSION['compose']['param']['_to'])) |
| | | $fvalue = $_SESSION['compose']['param']['_to']; |
| | | |
| | | case 'cc': |
| | | if (!$fname) |
| | |
| | | |
| | | $OUTPUT->include_script('tiny_mce/tiny_mce.js'); |
| | | $OUTPUT->include_script("editor.js"); |
| | | $OUTPUT->add_script('rcmail_editor_init("$__skin_path", "'.$tinylang.'");'); |
| | | $OUTPUT->add_script('rcmail_editor_init("$__skin_path", "'.JQ($tinylang).'", '.intval($CONFIG['enable_spellcheck']).');'); |
| | | |
| | | $out = $form_start ? "$form_start\n" : ''; |
| | | |
| | |
| | | $out .= $form_end ? "\n$form_end" : ''; |
| | | |
| | | // include GoogieSpell |
| | | if (!empty($CONFIG['enable_spellcheck']) && !$isHtml) |
| | | { |
| | | $lang_set = ''; |
| | | if (!empty($CONFIG['spellcheck_languages']) && is_array($CONFIG['spellcheck_languages'])) |
| | | $lang_set = "googie.setLanguages(".array2js($CONFIG['spellcheck_languages']).");\n"; |
| | | if (!empty($CONFIG['enable_spellcheck'])) { |
| | | $googie_lang_set = $editor_lang_set = ''; |
| | | if (!empty($CONFIG['spellcheck_languages']) && is_array($CONFIG['spellcheck_languages'])) { |
| | | $googie_lang_set = "googie.setLanguages(".json_serialize($CONFIG['spellcheck_languages']).");\n"; |
| | | foreach ($CONFIG['spellcheck_languages'] as $key => $name) |
| | | $editor_lang_set .= ($editor_lang_set ? ',' : '') . ($key == $tinylang ? '+' : '') . JQ($name).'='.JQ($key); |
| | | } |
| | | |
| | | $OUTPUT->include_script('googiespell.js'); |
| | | $OUTPUT->add_script(sprintf( |
| | |
| | | JQ(Q(rcube_label('close'))), |
| | | JQ(Q(rcube_label('revertto'))), |
| | | JQ(Q(rcube_label('nospellerrors'))), |
| | | $lang_set, |
| | | $googie_lang_set, |
| | | substr($_SESSION['language'], 0, 2), |
| | | $attrib['id'], |
| | | JS_OBJECT_NAME), 'foot'); |
| | | |
| | | rcube_add_label('checking'); |
| | | } |
| | | $OUTPUT->set_env('spellcheck_langs', $editor_lang_set); |
| | | } |
| | | |
| | | $out .= "\n".'<iframe name="savetarget" src="program/blank.gif" style="width:0;height:0;border:none;visibility:hidden;"></iframe>'; |
| | | |
| | |
| | | $button = Q(rcube_label('delete')); |
| | | |
| | | foreach ($_SESSION['compose']['attachments'] as $id => $a_prop) |
| | | { |
| | | if (empty($a_prop)) |
| | | continue; |
| | | |
| | | $out .= html::tag('li', array('id' => "rcmfile".$id), |
| | | html::a(array( |
| | | 'href' => "#delete", |
| | | 'title' => rcube_label('delete'), |
| | | 'onclick' => sprintf("return %s.command(\'remove-attachment\',\'rcmfile%d\', this)", JS_OBJECT_NAME, $id)), |
| | | 'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%d', this)", JS_OBJECT_NAME, $id)), |
| | | $button) . Q($a_prop['name'])); |
| | | } |
| | | } |
| | | |
| | | $OUTPUT->add_gui_object('attachmentlist', $attrib['id']); |
| | |
| | | } |
| | | |
| | | |
| | | function rcmail_store_target_selection($attrib) |
| | | { |
| | | $attrib['name'] = '_store_target'; |
| | | $select = rcmail_mailbox_select(array('noselection' => '- '.rcube_label('dontsave').' -')); |
| | | return $select->show(rcmail::get_instance()->config->get('sent_mbox'), $attrib); |
| | | } |
| | | |
| | | |
| | | function get_form_tags($attrib) |
| | | { |
| | | global $RCMAIL, $MESSAGE_FORM; |
| | |
| | | 'priorityselector' => 'rcmail_priority_selector', |
| | | 'editorselector' => 'rcmail_editor_selector', |
| | | 'receiptcheckbox' => 'rcmail_receipt_checkbox', |
| | | 'storetarget' => 'rcmail_store_target_selection', |
| | | )); |
| | | |
| | | /****** get contacts for this user and add them to client scripts ********/ |
| | |
| | | if ($sql_arr['email']) |
| | | $a_contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']); |
| | | } |
| | | if (isset($CONFIG['ldap_public'])) |
| | | if (!empty($CONFIG['ldap_public']) && is_array($CONFIG['ldap_public'])) |
| | | { |
| | | /* LDAP autocompletion */ |
| | | foreach ($CONFIG['ldap_public'] as $ldapserv_config) |