| | |
| | | |
| | | require_once('Mail/mimeDecode.php'); |
| | | |
| | | // remove an attachment |
| | | if ($_action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_GET['_file'], $regs)) |
| | | { |
| | | $id = $regs[1]; |
| | | if (is_array($_SESSION['compose']['attachments'][$id])) |
| | | { |
| | | @unlink($_SESSION['compose']['attachments'][$id]['path']); |
| | | $_SESSION['compose']['attachments'][$id] = NULL; |
| | | $commands = sprintf("parent.%s.remove_from_attachment_list('rcmfile%d');\n", $JS_OBJECT_NAME, $id); |
| | | rcube_remote_response($commands); |
| | | exit; |
| | | } |
| | | } |
| | | |
| | | |
| | | $MESSAGE_FORM = NULL; |
| | | $REPLY_MESSAGE = NULL; |
| | | $FORWARD_MESSAGE = NULL; |
| | | $DRAFT_MESSAGE = NULL; |
| | | |
| | | // nothing below is called during message composition, only at "new/forward/reply/draft" initialization |
| | | // since there are many ways to leave the compose page improperly, it seems necessary to clean-up an old |
| | | // compose when a "new/forward/reply/draft" is called - otherwise the old session attachments will appear |
| | | |
| | | if (!is_array($_SESSION['compose'])) |
| | | $_SESSION['compose'] = array('id' => uniqid(rand())); |
| | | |
| | | // remove an attachment |
| | | if ($_action=='remove-attachment' && !empty($_GET['_filename'])) |
| | | { |
| | | if (is_array($_SESSION['compose']['attachments'])) |
| | | foreach ($_SESSION['compose']['attachments'] as $i => $attachment) |
| | | if ($attachment['name'] == $_GET['_filename']) |
| | | { |
| | | @unlink($attachment['path']); |
| | | unset($_SESSION['compose']['attachments'][$i]); |
| | | $commands = sprintf("parent.%s.remove_from_attachment_list('%s');\n", $JS_OBJECT_NAME, $_GET['_filename']); |
| | | rcube_remote_response($commands); |
| | | exit; |
| | | } |
| | | } |
| | | rcmail_compose_cleanup(); |
| | | $_SESSION['compose'] = array('id' => uniqid(rand())); |
| | | |
| | | // add some labels to client |
| | | rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'savingmessage', 'messagesaved'); |
| | | rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'sendingmessage', 'messagesaved'); |
| | | |
| | | |
| | | if ($_GET['_reply_uid'] || $_GET['_forward_uid'] || $_GET['_draft_uid']) |
| | |
| | | |
| | | $out = $form_start ? "$form_start\n" : ''; |
| | | |
| | | // Check if a previous save was done so we can delete it upon the next save |
| | | if (!empty($_POST['_draft_newsaveid'])) |
| | | $saveid = new hiddenfield(array('name' => '_draft_saveid', 'value' => $_POST['_draft_newsaveid'])); |
| | | else if (strlen($DRAFT_MESSAGE['headers']->messageID) > 6) |
| | | $saveid = new hiddenfield(array('name' => '_draft_saveid', 'value' => str_replace(array('<','>'),"",$DRAFT_MESSAGE['headers']->messageID) )); |
| | | $saveid = new hiddenfield(array('name' => '_draft_saveid', 'value' => str_replace(array('<','>'),"",$DRAFT_MESSAGE['headers']->messageID) )); |
| | | $out .= $saveid->show(); |
| | | |
| | | if ($saveid) |
| | | $out .= $saveid->show(); |
| | | |
| | | $newsaveid = new hiddenfield(array('name' => '_draft_newsaveid', 'value' => sprintf('%s@%s', md5(uniqid('rcmail'.rand(),true)), $_SESSION['imap_host']) )); |
| | | $out .= $newsaveid->show(); |
| | | |
| | | $drafttoggle = new hiddenfield(array('name' => '_draft', 'value' => 'yes')); |
| | | $out .= $drafttoggle->show(); |
| | | |
| | |
| | | |
| | | rcube_add_label('checking'); |
| | | } |
| | | |
| | | |
| | | $out .= "\n".'<iframe name="savetarget" src="program/blank.gif" style="width:0;height:0;visibility:hidden;"></iframe>'; |
| | | |
| | | return $out; |
| | | } |
| | | |
| | |
| | | { |
| | | if ($part->disposition=='attachment' || $part->disposition=='inline' || $part->headers['content-id'] || |
| | | (empty($part->disposition) && ($part->d_parameters['filename'] || $part->ctype_parameters['name']))) |
| | | { |
| | | { |
| | | $tmp_path = tempnam($temp_dir, 'rcmAttmnt'); |
| | | if ($fp = fopen($tmp_path, 'w')) |
| | | { |
| | |
| | | if (is_array($_SESSION['compose']['attachments'])) |
| | | { |
| | | if ($attrib['deleteicon']) |
| | | $button = sprintf('<img src="%s%s" alt="%s" border="0" / style="padding-right:2px;vertical-align:middle">', |
| | | $button = sprintf('<img src="%s%s" alt="%s" border="0" style="padding-right:2px;vertical-align:middle" />', |
| | | $CONFIG['skin_path'], |
| | | $attrib['deleteicon'], |
| | | rcube_label('delete')); |
| | | else |
| | | $button = rcube_label('delete'); |
| | | |
| | | foreach ($_SESSION['compose']['attachments'] as $i => $a_prop) |
| | | $out .= sprintf('<li id="%s"><a href="#" onclick="%s.command(\'remove-attachment\',\'%s\')" title="%s">%s</a>%s</li>', |
| | | $a_prop['name'], |
| | | foreach ($_SESSION['compose']['attachments'] as $id => $a_prop) |
| | | $out .= sprintf('<li id="rcmfile%d"><a href="#delete" onclick="return %s.command(\'remove-attachment\',\'rcmfile%d\', this)" title="%s">%s</a>%s</li>', |
| | | $id, |
| | | $JS_OBJECT_NAME, |
| | | $a_prop['name'], |
| | | $id, |
| | | rcube_label('delete'), |
| | | $button, $a_prop['name']); |
| | | $button, |
| | | rep_specialchars_output($a_prop['name'])); |
| | | } |
| | | |
| | | $OUTPUT->add_script(sprintf("%s.gui_object('attachmentlist', '%s');", $JS_OBJECT_NAME, $attrib['id'])); |
| | |
| | | |
| | | $OUTPUT->add_script(sprintf("$JS_OBJECT_NAME.set_env('contacts', %s);", array2js($a_contacts))); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | parse_template('compose'); |