|
|
|
@ -30,7 +30,7 @@ define('RCUBE_COMPOSE_DRAFT', 0x0108);
|
|
|
|
|
|
|
|
|
|
// remove an attachment
|
|
|
|
|
if ($_action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_POST['_file'], $regs))
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
$id = $regs[1];
|
|
|
|
|
if (is_array($_SESSION['compose']['attachments'][$id]))
|
|
|
|
|
{
|
|
|
|
@ -40,8 +40,20 @@ if ($_action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_POST['_
|
|
|
|
|
$OUTPUT->send();
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($_action=='display-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_GET['_file'], $regs))
|
|
|
|
|
{
|
|
|
|
|
$id = $regs[1];
|
|
|
|
|
if (is_array($_SESSION['compose']['attachments'][$id]))
|
|
|
|
|
{
|
|
|
|
|
$apath = $_SESSION['compose']['attachments'][$id]['path'];
|
|
|
|
|
header('Content-Type: ' . $_SESSION['compose']['attachments'][$id]['mimetype']);
|
|
|
|
|
header('Content-Length: ' . filesize($apath));
|
|
|
|
|
readfile($apath);
|
|
|
|
|
}
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$MESSAGE_FORM = NULL;
|
|
|
|
|
$MESSAGE = NULL;
|
|
|
|
@ -52,10 +64,10 @@ $MESSAGE = NULL;
|
|
|
|
|
// compose when a "new/forward/reply/draft" is called - otherwise the old session attachments will appear
|
|
|
|
|
|
|
|
|
|
if (!is_array($_SESSION['compose']) || $_SESSION['compose']['id'] != get_input_value('_id', RCUBE_INPUT_GET))
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
rcmail_compose_cleanup();
|
|
|
|
|
$_SESSION['compose'] = array('id' => uniqid(rand()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// add some labels to client
|
|
|
|
|
rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'sendingmessage', 'messagesaved', 'converting');
|
|
|
|
@ -74,7 +86,7 @@ else if ($msg_uid = get_input_value('_draft_uid', RCUBE_INPUT_GET))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($msg_uid))
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
// similar as in program/steps/mail/show.inc
|
|
|
|
|
$MESSAGE = array('UID' => $msg_uid);
|
|
|
|
|
$MESSAGE['headers'] = &$IMAP->get_headers($msg_uid);
|
|
|
|
@ -99,14 +111,13 @@ if (!empty($msg_uid))
|
|
|
|
|
{
|
|
|
|
|
$_SESSION['compose']['draft_uid'] = $msg_uid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****** compose mode functions ********/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rcmail_compose_headers($attrib)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
global $IMAP, $MESSAGE, $DB, $compose_mode;
|
|
|
|
|
static $sa_recipients = array();
|
|
|
|
|
|
|
|
|
@ -153,7 +164,6 @@ function rcmail_compose_headers($attrib)
|
|
|
|
|
$allow_attrib = array('id', 'class', 'style', 'size', 'tabindex');
|
|
|
|
|
$field_type = 'textfield';
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($fname && !empty($_POST[$fname]))
|
|
|
|
@ -224,12 +234,12 @@ function rcmail_compose_headers($attrib)
|
|
|
|
|
$out = $form_start.$out;
|
|
|
|
|
|
|
|
|
|
return $out;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rcmail_compose_header_from($attrib)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
global $IMAP, $MESSAGE, $DB, $USER, $OUTPUT, $compose_mode;
|
|
|
|
|
|
|
|
|
|
// pass the following attributes to the form class
|
|
|
|
@ -321,12 +331,11 @@ function rcmail_compose_header_from($attrib)
|
|
|
|
|
$out = $form_start.$out;
|
|
|
|
|
|
|
|
|
|
return $out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rcmail_compose_body($attrib)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
global $CONFIG, $OUTPUT, $MESSAGE, $compose_mode;
|
|
|
|
|
|
|
|
|
|
list($form_start, $form_end) = get_form_tags($attrib);
|
|
|
|
@ -457,11 +466,11 @@ function rcmail_compose_body($attrib)
|
|
|
|
|
$out .= "\n".'<iframe name="savetarget" src="program/blank.gif" style="width:0;height:0;visibility:hidden;"></iframe>';
|
|
|
|
|
|
|
|
|
|
return $out;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rcmail_create_reply_body($body, $bodyIsHtml)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
global $IMAP, $MESSAGE;
|
|
|
|
|
|
|
|
|
|
if (! $bodyIsHtml)
|
|
|
|
@ -508,11 +517,11 @@ function rcmail_create_reply_body($body, $bodyIsHtml)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $prefix.$body.$suffix;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rcmail_create_forward_body($body, $bodyIsHtml)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
global $IMAP, $MESSAGE;
|
|
|
|
|
|
|
|
|
|
if (! $bodyIsHtml)
|
|
|
|
@ -547,11 +556,11 @@ function rcmail_create_forward_body($body, $bodyIsHtml)
|
|
|
|
|
rcmail_write_compose_attachments($MESSAGE);
|
|
|
|
|
|
|
|
|
|
return $prefix.$body;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rcmail_create_draft_body($body, $bodyIsHtml)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
global $IMAP, $MESSAGE;
|
|
|
|
|
|
|
|
|
|
// add attachments
|
|
|
|
@ -560,11 +569,11 @@ function rcmail_create_draft_body($body, $bodyIsHtml)
|
|
|
|
|
rcmail_write_compose_attachments($MESSAGE);
|
|
|
|
|
|
|
|
|
|
return $body;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rcmail_write_compose_attachments(&$message)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
global $IMAP, $CONFIG;
|
|
|
|
|
|
|
|
|
|
$temp_dir = unslashify($CONFIG['temp_dir']);
|
|
|
|
@ -594,11 +603,11 @@ function rcmail_write_compose_attachments(&$message)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$_SESSION['compose']['forward_attachments'] = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rcmail_compose_subject($attrib)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
global $CONFIG, $MESSAGE, $compose_mode;
|
|
|
|
|
|
|
|
|
|
list($form_start, $form_end) = get_form_tags($attrib);
|
|
|
|
@ -640,11 +649,11 @@ function rcmail_compose_subject($attrib)
|
|
|
|
|
$out .= $form_end ? "\n$form_end" : '';
|
|
|
|
|
|
|
|
|
|
return $out;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rcmail_compose_attachment_list($attrib)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
global $OUTPUT, $CONFIG;
|
|
|
|
|
|
|
|
|
|
// add ID if not given
|
|
|
|
@ -680,12 +689,11 @@ function rcmail_compose_attachment_list($attrib)
|
|
|
|
|
|
|
|
|
|
$out .= '</ul>';
|
|
|
|
|
return $out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rcmail_compose_attachment_form($attrib)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
global $OUTPUT, $SESS_HIDDEN_FIELD;
|
|
|
|
|
|
|
|
|
|
// add ID if not given
|
|
|
|
@ -713,21 +721,21 @@ EOF;
|
|
|
|
|
|
|
|
|
|
$OUTPUT->add_gui_object('uploadbox', $attrib['id']);
|
|
|
|
|
return $out;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rcmail_compose_attachment_field($attrib)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
// allow the following attributes to be added to the <input> tag
|
|
|
|
|
$attrib_str = create_attrib_string($attrib, array('id', 'class', 'style', 'size'));
|
|
|
|
|
|
|
|
|
|
$out = '<input type="file" name="_attachments[]"'. $attrib_str . " />";
|
|
|
|
|
return $out;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rcmail_priority_selector($attrib)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
list($form_start, $form_end) = get_form_tags($attrib);
|
|
|
|
|
unset($attrib['form']);
|
|
|
|
|
|
|
|
|
@ -748,11 +756,11 @@ function rcmail_priority_selector($attrib)
|
|
|
|
|
$out .= $form_end ? "\n$form_end" : '';
|
|
|
|
|
|
|
|
|
|
return $out;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rcmail_receipt_checkbox($attrib)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
list($form_start, $form_end) = get_form_tags($attrib);
|
|
|
|
|
unset($attrib['form']);
|
|
|
|
|
|
|
|
|
@ -768,7 +776,7 @@ function rcmail_receipt_checkbox($attrib)
|
|
|
|
|
$out .= $form_end ? "\n$form_end" : '';
|
|
|
|
|
|
|
|
|
|
return $out;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rcmail_editor_selector($attrib)
|
|
|
|
@ -820,7 +828,7 @@ function rcmail_editor_selector($attrib)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function get_form_tags($attrib)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
global $CONFIG, $OUTPUT, $MESSAGE_FORM, $SESS_HIDDEN_FIELD;
|
|
|
|
|
|
|
|
|
|
$form_start = '';
|
|
|
|
@ -843,7 +851,7 @@ function get_form_tags($attrib)
|
|
|
|
|
$MESSAGE_FORM = $form_name;
|
|
|
|
|
|
|
|
|
|
return array($form_start, $form_end);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// register UI objects
|
|
|
|
@ -859,7 +867,6 @@ $OUTPUT->add_handlers(array(
|
|
|
|
|
'receiptcheckbox' => 'rcmail_receipt_checkbox',
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****** get contacts for this user and add them to client scripts ********/
|
|
|
|
|
|
|
|
|
|
require_once('include/rcube_contacts.inc');
|
|
|
|
@ -868,15 +875,14 @@ $CONTACTS = new rcube_contacts($DB, $USER->ID);
|
|
|
|
|
$CONTACTS->set_pagesize(1000);
|
|
|
|
|
|
|
|
|
|
if ($result = $CONTACTS->list_records())
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
$a_contacts = array();
|
|
|
|
|
while ($sql_arr = $result->iterate())
|
|
|
|
|
if ($sql_arr['email'])
|
|
|
|
|
$a_contacts[] = format_email_recipient($sql_arr['email'], JQ($sql_arr['name']));
|
|
|
|
|
|
|
|
|
|
$OUTPUT->set_env('contacts', $a_contacts);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
parse_template('compose');
|
|
|
|
|
?>
|
|
|
|
|