// | This program is distributed in the hope that it will be useful, | // | but WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | // | GNU General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to: | // | | // | Free Software Foundation, Inc. | // | 51 Franklin Street, Suite 330 | // | Boston, MA 02110-1301, USA. | // +----------------------------------------------------------------------+ // | Authors: João Prado Maia <*****@*****.**> | // +----------------------------------------------------------------------+ require_once dirname(__FILE__) . '/../init.php'; Auth::checkAuthentication(APP_COOKIE); if (@$_GET['cat'] == 'blocked_email') { $email = Note::getBlockedMessage($_GET['note_id']); } else { $email = Support::getFullEmail($_GET['sup_id']); } if (!empty($_GET['raw'])) { Attachment::outputDownload($email, 'message.eml', strlen($email), 'message/rfc822'); } else { if (!empty($_GET['cid'])) { list($mimetype, $data) = Mime_Helper::getAttachment($email, $_GET['filename'], $_GET['cid']); } else { list($mimetype, $data) = Mime_Helper::getAttachment($email, $_GET['filename']); } Attachment::outputDownload($data, $_GET['filename'], strlen($data), $mimetype); }
// | GNU General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to: | // | | // | Free Software Foundation, Inc. | // | 59 Temple Place - Suite 330 | // | Boston, MA 02111-1307, USA. | // +----------------------------------------------------------------------+ // | Authors: João Prado Maia <*****@*****.**> | // +----------------------------------------------------------------------+ // // @(#) $Id: s.get_attachment.php 1.5 03/09/30 18:07:03-00:00 jpradomaia $ // include_once "config.inc.php"; include_once APP_INC_PATH . "class.auth.php"; include_once APP_INC_PATH . "class.support.php"; include_once APP_INC_PATH . "class.mime_helper.php"; include_once APP_INC_PATH . "db_access.php"; Auth::checkAuthentication(APP_COOKIE); if (@$HTTP_GET_VARS['cat'] == 'blocked_email') { $email = Note::getBlockedMessage($HTTP_GET_VARS["note_id"]); } else { $email = Support::getFullEmail($HTTP_GET_VARS["sup_id"]); } if (!empty($HTTP_GET_VARS['cid'])) { list($mimetype, $data) = Mime_Helper::getAttachment($email, $HTTP_GET_VARS["filename"], $HTTP_GET_VARS["cid"]); } else { list($mimetype, $data) = Mime_Helper::getAttachment($email, $HTTP_GET_VARS["filename"]); } Attachment::outputDownload($data, $HTTP_GET_VARS["filename"], strlen($data), $mimetype);
// | but WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | // | GNU General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to: | // | | // | Free Software Foundation, Inc. | // | 59 Temple Place - Suite 330 | // | Boston, MA 02111-1307, USA. | // +----------------------------------------------------------------------+ // | Authors: João Prado Maia <*****@*****.**> | // +----------------------------------------------------------------------+ // // @(#) $Id: s.view_headers.php 1.1 03/06/01 03:32:48-00:00 jpm $ // include_once "config.inc.php"; include_once APP_INC_PATH . "class.template.php"; include_once APP_INC_PATH . "class.auth.php"; include_once APP_INC_PATH . "class.support.php"; include_once APP_INC_PATH . "db_access.php"; $tpl = new Template_API(); $tpl->setTemplate("view_headers.tpl.html"); Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true); if (@$HTTP_GET_VARS['cat'] == 'note') { $headers = Note::getBlockedMessage($HTTP_GET_VARS["id"]); } else { $headers = Support::getFullEmail($HTTP_GET_VARS["id"]); } $tpl->assign("headers", $headers); $tpl->displayTemplate();
/** * Converts a note to a draft or an email * * @access public * @param $note_id The id of the note * @param $target What the not should be converted too * @param $authorize_sender If the sender should be added to authorized senders list. */ function convertNote($note_id, $target, $authorize_sender = false) { $note_id = Misc::escapeInteger($note_id); $issue_id = Note::getIssueID($note_id); $email_account_id = Email_Account::getEmailAccount(); $blocked_message = Note::getBlockedMessage($note_id); $unknown_user = Note::getUnknownUser($note_id); $structure = Mime_Helper::decode($blocked_message, true, true); $body = Mime_Helper::getMessageBody($structure); $sender_email = strtolower(Mail_API::getEmailAddress($structure->headers['from'])); if ($target == 'email') { if (Mime_Helper::hasAttachments($blocked_message)) { $has_attachments = 1; } else { $has_attachments = 0; } list($blocked_message, $headers) = Mail_API::rewriteThreadingHeaders($issue_id, $blocked_message, @$structure->headers); $t = array('issue_id' => $issue_id, 'ema_id' => $email_account_id, 'message_id' => @$structure->headers['message-id'], 'date' => Date_API::getCurrentDateGMT(), 'from' => @$structure->headers['from'], 'to' => @$structure->headers['to'], 'cc' => @$structure->headers['cc'], 'subject' => @$structure->headers['subject'], 'body' => @$body, 'full_email' => @$blocked_message, 'has_attachment' => $has_attachments, 'headers' => $headers); // need to check for a possible customer association if (!empty($structure->headers['from'])) { $details = Email_Account::getDetails($email_account_id); // check from the associated project if we need to lookup any customers by this email address if (Customer::hasCustomerIntegration($details['ema_prj_id'])) { // check for any customer contact association list($customer_id, ) = Customer::getCustomerIDByEmails($details['ema_prj_id'], array($sender_email)); if (!empty($customer_id)) { $t['customer_id'] = $customer_id; } } } if (empty($t['customer_id'])) { $update_type = 'staff response'; $t['customer_id'] = "NULL"; } else { $update_type = 'customer action'; } $res = Support::insertEmail($t, $structure, $sup_id); if ($res != -1) { Support::extractAttachments($issue_id, $blocked_message); // notifications about new emails are always external $internal_only = false; // special case when emails are bounced back, so we don't want to notify the customer about those if (Notification::isBounceMessage($sender_email)) { $internal_only = true; } Notification::notifyNewEmail(Auth::getUserID(), $issue_id, $t, $internal_only, false, '', $sup_id); Issue::markAsUpdated($issue_id, $update_type); Note::remove($note_id, false); History::add($issue_id, Auth::getUserID(), History::getTypeID('note_converted_email'), "Note converted to e-mail (from: " . @$structure->headers['from'] . ") by " . User::getFullName(Auth::getUserID())); // now add sender as an authorized replier if ($authorize_sender) { Authorized_Replier::manualInsert($issue_id, @$structure->headers['from']); } } return $res; } else { // save message as a draft $res = Draft::saveEmail($issue_id, $structure->headers['to'], $structure->headers['cc'], $structure->headers['subject'], $body, false, $unknown_user); // remove the note, if the draft was created successfully if ($res) { Note::remove($note_id, false); History::add($issue_id, Auth::getUserID(), History::getTypeID('note_converted_draft'), "Note converted to draft (from: " . @$structure->headers['from'] . ") by " . User::getFullName(Auth::getUserID())); } return $res; } }
// | | // | 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. | // | | // | This program is distributed in the hope that it will be useful, | // | but WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | // | GNU General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to: | // | | // | Free Software Foundation, Inc. | // | 51 Franklin Street, Suite 330 | // | Boston, MA 02110-1301, USA. | // +----------------------------------------------------------------------+ // | Authors: João Prado Maia <*****@*****.**> | // +----------------------------------------------------------------------+ require_once dirname(__FILE__) . '/../init.php'; $tpl = new Template_Helper(); $tpl->setTemplate('view_headers.tpl.html'); Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true); if (@$_GET['cat'] == 'note') { $headers = Note::getBlockedMessage($_GET['id']); } else { $headers = Support::getFullEmail($_GET['id']); } $tpl->assign('headers', $headers); $tpl->displayTemplate();