This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the 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']);
} $_SESSION['notified_new_mail'] = isset($_SESSION['notified_new_mail']) ? $_SESSION['notified_new_mail'] : 0; $_SESSION['new_mail'] = 0; //check for email $email_module = $GO_MODULES->get_module('email'); if ($email_module && ($GO_SECURITY->has_permission($GO_SECURITY->user_id, $email_module['acl_read']) || $GO_SECURITY->has_permission($GO_SECURITY->user_id, $email_module['acl_write']))) { require_once $email_module['class_path'] . 'email.class.inc'; require_once $GO_CONFIG->class_path . 'imap.class.inc'; $imap = new imap(); $email1 = new email(); $email2 = new email(); $email1->get_accounts($GO_SECURITY->user_id); while ($email1->next_record()) { if ($email1->f('auto_check') == '1') { $account = $email1->Record; if ($imap->open($account['host'], $account['type'], $account['port'], $account['username'], $GO_CRYPTO->decrypt($account['password']))) { if ($account['type'] == 'imap') { $status = $imap->status('INBOX'); if ($status->unseen > 0) { $_SESSION['new_mail'] += $status->unseen; } $email2->get_folders($email1->f('id')); while ($email2->next_record()) { if ($email2->f('name') != 'INBOX') { $status = $imap->status($email2->f('name')); if ($status->unseen > 0) { $_SESSION['new_mail'] += $status->unseen; } } } } else {
$images = ''; $account_id = isset($_REQUEST['account_id']) ? $_REQUEST['account_id'] : 0; $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : ''; $mailbox = isset($_REQUEST['mailbox']) ? $_REQUEST['mailbox'] : "INBOX"; $uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : 0; $max_rows = isset($_REQUEST['max_rows']) ? $_REQUEST['max_rows'] : $_SESSION['GO_SESSION']['max_rows_list']; $first_row = isset($_REQUEST['first_row']) ? $_REQUEST['first_row'] : 0; $table_tabindex = isset($_REQUEST['table_tabindex']) ? $_REQUEST['table_tabindex'] : null; $return_to = isset($_REQUEST['return_to']) && $_REQUEST['return_to'] != '' ? $_REQUEST['return_to'] : null; $link_back = isset($_REQUEST['link_back']) && $_REQUEST['link_back'] != '' ? $_REQUEST['link_back'] : $_SERVER['REQUEST_URI']; $task = isset($_REQUEST['task']) && $_REQUEST['task'] != '' ? $_REQUEST['task'] : ''; $print = isset($_REQUEST['print']) ? true : false; $part = isset($_REQUEST['part']) ? $_REQUEST['part'] : ''; $query = isset($_REQUEST['query']) ? $_REQUEST['query'] : ''; $account = $email->get_account($account_id); if ($account && $mail->open($account['host'], $account['type'], $account['port'], $account['username'], $GO_CRYPTO->decrypt($account['password']), $mailbox)) { if ($task == 'move_mail') { $messages = array($uid); $move_to_mailbox = smartstrip($_REQUEST['move_to_mailbox']); if ($mail->move($move_to_mailbox, $messages) && $mail->reopen($move_to_mailbox)) { header('Location: ' . $GO_MODULES->url . 'index.php?account_id=' . $account_id . '&mailbox=' . $mailbox); exit; } } //sort messages for determination of previous and next message if ($query != '') { $mail->search($em_settings['sort_field'], $em_settings['sort_order'], base64_decode($query)); } else { $mail->sort($em_settings['sort_field'], $em_settings['sort_order']); } $content = $mail->get_message($uid, 'html', $part);
$mail->LE = "\r\n"; $mime = $mail->GetMime(); if (isset($_SESSION['attach_array'])) { while ($attachment = array_shift($_SESSION['attach_array'])) { @unlink($attachment->tmp_file); } } // 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';
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_LANGUAGE->get_language_file('email'); $mail = new imap(); $email = new email(); $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : ''; $return_to = isset($_REQUEST['return_to']) && $_REQUEST['return_to'] != '' ? $_REQUEST['return_to'] : $_SERVER['HTTP_REFERER']; $link_back = isset($_REQUEST['link_back']) && $_REQUEST['link_back'] != '' ? $_REQUEST['link_back'] : $_SERVER['REQUEST_URI']; $account_id = isset($_REQUEST['account_id']) ? $_REQUEST['account_id'] : 0; $account = $email->get_account($account_id); if ($account && $mail->open($account['host'], $account['type'], $account['port'], $account['username'], $GO_CRYPTO->decrypt($account['password']), 'INBOX', 0, $account['use_ssl'], $account['novalidate_cert'])) { if ($task == 'create_folder') { $name = smartstrip(trim($_POST['name'])); if ($name == '') { $feedback = '<p class="Error">' . $error_missing_field . '</p>'; } else { $parent_folder_name = isset($_POST['parent_folder_name']) ? smartstrip($_POST['parent_folder_name']) : ''; if ($parent_folder_name != '' && substr($parent_folder_name, -1) != $_POST['delimiter']) { $parent_folder_name .= $_POST['delimiter']; } $mail->create_folder($parent_folder_name . $name); } } if (isset($_REQUEST['delete_folder'])) { $delete_folder = smartstrip($_REQUEST['delete_folder']); if ($mail->delete_folder($delete_folder, $account['mbroot'])) {
$mail->LE = "\r\n"; $mime = $mail->GetMime(); if (isset($_SESSION['attach_array'])) { while ($attachment = array_shift($_SESSION['attach_array'])) { @unlink($attachment->tmp_file); } } // We need to unregister the attachments array and num_attach unset($_SESSION['num_attach']); unset($_SESSION['attach_array']); if ($profile["type"] == "imap") { $draft_folder = $profile['draft']; if ($draft_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"]), $draft_folder, 0, $profile['use_ssl'], $profile['novalidate_cert'])) { if ($imap_stream->append_message($draft_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_draft_items_fail . "');\r\nwindow.close();\r\n</script>\r\n"; require $GO_THEME->theme_path . 'footer.inc';