Free Software Foundation; either version 2 of the License, or (at your option) any later version. */ require "../../Group-Office.php"; $GO_SECURITY->authenticate(); $GO_MODULES->authenticate('email'); require $GO_CONFIG->class_path . "imap.class.inc"; require $GO_MODULES->class_path . "email.class.inc"; require $GO_CONFIG->class_path . 'filetypes.class.inc'; $filetypes = new filetypes(); $mail = new imap(); $email = new email(); $account = $email->get_account($_REQUEST['account_id']); if ($mail->open($account['host'], $account['type'], $account['port'], $account['username'], $GO_CRYPTO->decrypt($account['password']), $_REQUEST['mailbox'], 0, $account['use_ssl'], $account['novalidate_cert'])) { $file = $mail->view_part($_REQUEST['uid'], $_REQUEST['part'], $_REQUEST['transfer'], $_REQUEST['mime']); $mail->close(); $filename = smartstrip($_REQUEST['filename']); $extension = get_extension($filename); $type = $filetypes->get_type($extension); $browser = detect_browser(); //header('Content-Length: '.strlen($file)); header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); if ($browser['name'] == 'MSIE') { header('Content-Type: application/download'); header('Content-Disposition: attachment; filename="' . $filename . '"'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); } else { header('Content-Type: ' . $type['mime']); header('Pragma: no-cache'); header('Content-Disposition: attachment; filename="' . $filename . '"');
} // We need to unregister the attachments array and num_attach unset($_SESSION['num_attach']); unset($_SESSION['attach_array']); if ($profile["type"] == "imap") { $sent_folder = $profile['sent']; if ($sent_folder != '') { require $GO_CONFIG->class_path . "imap.class.inc"; $imap_stream = new imap(); if ($imap_stream->open($profile["host"], "imap", $profile["port"], $profile["username"], $GO_CRYPTO->decrypt($profile["password"]), $sent_folder)) { if ($imap_stream->append_message($sent_folder, $mime, "\\Seen")) { if (isset($_REQUEST['action']) && ($_REQUEST['action'] == "reply" || $_REQUEST['action'] == "reply_all")) { $uid = array($_REQUEST['uid']); $imap_stream->set_message_flag($_POST['mailbox'], $uid, "\\Answered"); } $imap_stream->close(); require $GO_THEME->theme_path . "header.inc"; echo "<script type=\"text/javascript\">\r\nwindow.close();\r\n</script>\r\n"; require $GO_THEME->theme_path . "footer.inc"; exit; } } require $GO_THEME->theme_path . "header.inc"; echo "<script type=\"text/javascript\">\r\nalert('" . $ml_sent_items_fail . "');\r\nwindow.close();\r\n</script>\r\n"; require $GO_THEME->theme_path . 'footer.inc'; exit; } else { require $GO_THEME->theme_path . "header.inc"; echo "<script type=\"text/javascript\">\r\nwindow.close();\r\n</script>\r\n"; require $GO_THEME->theme_path . 'footer.inc'; exit;