1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
<?php
/**
* The IMP_UI_Message:: class is designed to provide a place to dump common
* code shared among IMP's various UI views for the message page.
*
* $Horde: imp/lib/UI/Message.php,v 1.10.2.3 2008/03/27 18:54:11 slusarz Exp $
*
* Copyright 2006-2008 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*
* @author Michael Slusarz <slusarz@horde.org>
* @package IMP
* @since IMP 4.2
*/
class IMP_UI_Message {
/**
*/
function basicHeaders()
{
return array(
'date' => _("Date"),
'from' => _("From"),
'to' => _("To"),
'cc' => _("Cc"),
'bcc' => _("Bcc"),
'reply-to' => _("Reply-To"),
'subject' => _("Subject")
);
}
/**
*/
function getUserHeaders()
{
$user_hdrs = $GLOBALS['prefs']->getValue('mail_hdr');
/* Split the list of headers by new lines and sort the list of headers
* to make sure there are no duplicates. */
if (is_array($user_hdrs)) {
$user_hdrs = implode("\n", $user_hdrs);
}
$user_hdrs = trim($user_hdrs);
if (empty($user_hdrs)) {
return $user_hdrs;
}
$user_hdrs = str_replace(':', '', $user_hdrs);
$user_hdrs = preg_split("/[\n\r]+/", $user_hdrs);
$user_hdrs = array_map('trim', $user_hdrs);
$user_hdrs = array_unique(array_filter($user_hdrs));
natcasesort($user_hdrs);
return $user_hdrs;
}
/**
*/
function MDNCheck($headers, $confirmed = false)
{
if (!$GLOBALS['prefs']->getValue('disposition_send_mdn')) {
return;
}
/* Check to see if an MDN has been requested. */
require_once 'Horde/MIME/MDN.php';
$mdn = new MIME_MDN($headers);
if ($mdn->getMDNReturnAddr()) {
require_once IMP_BASE . '/lib/Maillog.php';
$msg_id = $headers->getValue('message-id');
/* See if we have already processed this message. */
if (!IMP_Maillog::sentMDN($msg_id, 'displayed')) {
/* See if we need to query the user. */
if ($mdn->userConfirmationNeeded() && !$confirmed) {
return true;
} else {
/* Send out the MDN now. */
$result = $mdn->generate(false, $confirmed, 'displayed');
if (!is_a($result, 'PEAR_Error')) {
IMP_Maillog::log('mdn', $msg_id, 'displayed');
}
if ($GLOBALS['conf']['sentmail']['driver'] != 'none') {
require_once IMP_BASE . '/lib/Sentmail.php';
$sentmail = IMP_Sentmail::factory();
$sentmail->log('mdn', '', $mdn->getMDNReturnAddr(), !is_a($result, 'PEAR_Error'));
}
}
}
}
return false;
}
}
|