// $ob = reset($cache_entry);
//
// // Add attachment information
-// require_once IMP_BASE . '/lib/UI/Mailbox.php';
-// $imp_ui = new IMP_UI_Mailbox();
+// $imp_ui = new IMP_UI_Mailbox($mailbox);
// if (($attachment = $imp_ui->getAttachmentType($ob->structure))) {
-// $ret['status'] = Horde::img($attachment . '.png', $imp_ui->getAttachmentAlt($attachment), array('title' => $imp_ui->getAttachmentAlt($attachment)));
+// $alt_list = IMP_UI_Mailbox::getAttachmentAltList();
+// $alt_text = (isset($list[$attachment])) ? $list[$attachment] : $list['attachment'];
+// $ret['status'] = Horde::img($attachment . '.png', $alt_text, array('title' => $alt_text));
// }
//
// // Add xpriority information
// $ob = reset($cache_entry);
//
// // Add attachment information
-// require_once IMP_BASE . '/lib/UI/Mailbox.php';
-// $imp_ui = new IMP_UI_Mailbox();
+// $imp_ui = new IMP_UI_Mailbox($mailbox);
// $ret['atc'] = $imp_ui->getAttachmentType($ob->structure);
//
// // Add xpriority information
<?php
/**
- * DIMP portal configuration page.
+ * Dynamic portal configuration page.
*
* Format: An array named $dimp_block_list
- * KEY: Block label text
- * VALUE: An array with the following entries:
- * 'ob' => The Horde_Block object to display
+ * KEY: Block label text
+ * VALUE: An array with the following entries:
+ * 'ob' => The Horde_Block object to display
*
- * These entries are optional and will only be used if you need
- * to customize the portal output:
- * 'class' => A CSS class to assign to the containing block.
- * Defaults to "headerbox".
- * 'domid' => A DOM ID to assign to the containing block
- * 'tag' => A tag name to add to the template array. Allows
- * the use of <if:block.tag> in custom template files.
+ * These entries are optional and will only be used if you need
+ * to customize the portal output:
+ * 'class' => A CSS class to assign to the containing block.
+ * Defaults to "headerbox".
+ * 'domid' => A DOM ID to assign to the containing block
+ * 'tag' => A tag name to add to the template array. Allows
+ * the use of <if:block.tag> in custom template files.
*/
$collection = new Horde_Block_Collection();
// Show a folder summary of the mailbox. All polled folders are displayed.
require_once IMP_BASE . '/lib/Block/foldersummary.php';
$dimp_block_list[_("Folder Summary")] = array(
- 'ob' => new Horde_Block_dimp_foldersummary(array())
+ 'ob' => new Horde_Block_imp_foldersummary(array())
);
// Alternate DIMP block - shows details of 'msgs_shown' number of the most
// recent unseen messages.
//require_once IMP_BASE . '/lib/Block/newmail.php';
//$dimp_block_list[_("Newest Unseen Messages")] = array(
-// 'ob' => new Horde_Block_dimp_newmail(array('msgs_shown' => 3))
+// 'ob' => new Horde_Block_imp_newmail(array('msgs_shown' => 3))
//);
// Show a contact search box.
* @package Horde_Block
*/
-class Horde_Block_dimp_foldersummary extends Horde_Block
+class Horde_Block_imp_foldersummary extends Horde_Block
{
var $_app = 'imp';
<?php
/**
+ * Re
* Copyright 2007-2008 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* @package Horde_Block
* @author Michael Slusarz <slusarz@curecanti.org>
*/
-class Horde_Block_dimp_newmail extends Horde_Block
+class Horde_Block_imp_newmail extends Horde_Block
{
var $_app = 'imp';
function _content()
{
$GLOBALS['authentication'] = 'none';
- require_once $GLOBALS['registry']->get('fileroot', 'imp') . '/lib/base.php';
+ require_once dirname(__FILE__) . '/../base.php';
if (!IMP::checkAuthentication(true)) {
return '';
IMP_Filter::filter('INBOX');
}
- // @todo
- $query = new IMAP_Search_Query();
- $query->seen(false);
- $ids = $GLOBALS['imp_search']->runSearchQuery($query, IMP::serverString('INBOX'), SORTARRIVAL, 1);
+ $query = new Horde_Imap_Client_Search_Query();
+ $query->flag('\\seen', false);
+ $ids = $GLOBALS['imp_search']->runSearchQuery($query, 'INBOX', Horde_Imap_Client::SORT_ARRIVAL, 1);
$html = '<table cellspacing="0" width="100%">';
if (empty($ids)) {
require_once 'Horde/Identity.php';
$charset = NLS::getCharset();
- $identity = &Identity::singleton(array('imp', 'imp'));
- $imp_ui = new IMP_UI_Mailbox('INBOX', $charset, $identity);
+ $imp_ui = new IMP_UI_Mailbox('INBOX');
$shown = empty($this->_params['msgs_shown']) ? 3 : $this->_params['msgs_shown'];
- // @todo
- $msg_cache = &IMP_MessageCache::singleton();
- $overview = $msg_cache->retrieve('INBOX', array_slice($ids, 0, $shown), 1 | 128);
- foreach ($overview as $ob) {
- $date = $imp_ui->getDate((isset($ob->date)) ? $ob->date : null);
- $from_res = $imp_ui->getFrom($ob);
- $subject = (empty($ob->subject)) ? _("[No Subject]") : $imp_ui->getSubject($ob->subject);
+ try {
+ $fetch_ret = $GLOBALS['imp_imap']->ob->fetch('INBOX', array(
+ Horde_Imap_Client::FETCH_ENVELOPE => true
+ ), array('ids' => array_slice($ids, 0, $shown)));
+ reset($fetch_ret);
+ } catch (Horde_Imap_Client_Exception $e) {
+ $fetch_ret = array();
+ }
+
+ while (list($uid, $ob) = each($fetch_ret)) {
+ $date = $imp_ui->getDate($ob['envelope']['date']);
+ $from = $imp_ui->getFrom($ob, false);
+ $subject = $imp_ui->getSubject($ob['envelope']['subject']);
- $html .= '<tr style="cursor:pointer" class="text" onclick="DimpBase.go(\'msg:INBOX:' . $ob->uid . '\');return false;"><td>' .
- '<strong>' . htmlspecialchars($from_res['from'], ENT_QUOTES, $charset) . '</strong><br />' .
+ $html .= '<tr style="cursor:pointer" class="text" onclick="DimpBase.go(\'msg:INBOX:' . $uid . '\');return false;"><td>' .
+ '<strong>' . htmlspecialchars($from['from'], ENT_QUOTES, $charset) . '</strong><br />' .
$subject . '</td>' .
'<td>' . htmlspecialchars($date, ENT_QUOTES, $charset) . '</td></tr>';
}
$more_msgs = count($ids) - $shown;
- if ($more_msgs) {
- $text = sprintf(ngettext("%d more unseen message...", "%d more unseen messages...", $more_msgs), $more_msgs);
- } else {
- $text = _("Go to your Inbox...");
- }
+ $text = $more_msgs
+ ? sprintf(ngettext("%d more unseen message...", "%d more unseen messages...", $more_msgs), $more_msgs)
+ : _("Go to your Inbox...");
$html .= '<tr><td colspan="2" style="cursor:pointer" align="right" onclick="DimpBase.go(\'folder:INBOX\');return false;">' . $text . '</td></tr>';
}
$themes_uri = Horde::url($GLOBALS['registry']->get('themesuri', $app), false, -1);
$css[] = array('u' => $themes_uri . '/screen.css', 'f' => $themes_fs . '/screen.css');
$css[] = array('u' => $themes_uri . '/screen-dimp.css', 'f' => $themes_fs . '/screen-dimp.css');
- if (!empty($theme) &&
- file_exists($themes_fs . '/' . $theme . '/screen-dimp.css')) {
- $css[] = array('u' => $themes_uri . '/' . $theme . '/screen.css', 'f' => $themes_fs . '/' . $theme . '/screen.css');
- $css[] = array('u' => $themes_uri . '/' . $theme . '/screen-dimp.css', 'f' => $themes_fs . '/' . $theme . '/screen-dimp.css');
+ if (!empty($theme)) {
+ if (file_exists($themes_fs . '/' . $theme . '/screen.css')) {
+ $css[] = array('u' => $themes_uri . '/' . $theme . '/screen.css', 'f' => $themes_fs . '/' . $theme . '/screen.css');
+ }
+ if (file_exists($themes_fs . '/' . $theme . '/screen-dimp.css')) {
+ $css[] = array('u' => $themes_uri . '/' . $theme . '/screen-dimp.css', 'f' => $themes_fs . '/' . $theme . '/screen-dimp.css');
+ }
}
if ($rtl) {
<?php
/**
- * The IMP_UI_Mailbox:: class is designed to provide a place to dump common
+ * The IMP_UI_Mailbox:: class is designed to provide a place to store common
* code shared among IMP's various UI views for the mailbox page.
*
* Copyright 2006-2008 The Horde Project (http://www.horde.org/)
* @author Michael Slusarz <slusarz@horde.org>
* @package IMP
*/
-class IMP_UI_Mailbox {
-
- /**
- */
- var $_charset;
-
- /**
- */
- var $_identity;
-
+class IMP_UI_Mailbox
+{
/**
+ * The current mailbox.
+ *
+ * @var string
*/
- var $_mailbox;
+ private $_mailbox;
/**
- * Cache array.
+ * Cached data.
*
* @var array
*/
- var $_c = array();
+ private $_cache = array();
/**
+ * Constructor.
+ *
+ * @param string $mailbox The current mailbox.
*/
- function IMP_UI_Mailbox($mailbox = null, $charset = null, $identity = null)
+ function __construct($mailbox = null)
{
$this->_mailbox = $mailbox;
- $this->_charset = $charset;
- $this->_identity = $identity;
}
/**
- * TODO
+ * Get From address information for display on mailbox page.
+ *
+ * @param array $ob An array of envelope information.
+ * @param boolean $full If true, returns 'fullfrom' information.
+ *
+ * @return array An array of information:
+ * <pre>
+ * 'error' - (boolean)
+ * 'from' - (string)
+ * 'fullfrom' - (string)
+ * 'to' - (boolean)
+ * </pre>
*/
- function getFrom($ob, $need_full = true)
+ public function getFrom($ob, $full = true)
{
$ret = array('error' => false, 'to' => false);
return $ret;
}
- if (!isset($this->_c['drafts_sm_folder'])) {
- $this->_c['drafts_sm_folder'] = IMP::isSpecialFolder($this->_mailbox);
+ if (!isset($this->_cache['drafts_sm_folder'])) {
+ $this->_cache['drafts_sm_folder'] = IMP::isSpecialFolder($this->_mailbox);
}
$from = Horde_Mime_Address::getAddressesFromObject($ob['from']);
- $from = array_shift($from);
+ $from = reset($from);
if (empty($from)) {
$ret['from'] = _("Invalid Address");
$ret['error'] = true;
- } elseif ($this->_identity &&
- $this->_identity->hasAddress($from['inner'])) {
- /* This message was sent by one of the user's identity addresses -
- * show To information instead. */
- if (empty($ob['to'])) {
- $ret['from'] = _("Undisclosed Recipients");
- $ret['error'] = true;
- } else {
- $to = Horde_Mime_Address::getAddressesFromObject($ob['to']);
- $first_to = array_shift($to);
- if (empty($first_to)) {
+ } else {
+ $identity = &Identity::singleton(array('imp', 'imp'));
+ if ($identity->hasAddress($from['inner'])) {
+ /* This message was sent by one of the user's identity
+ * addresses - show To: information instead. */
+ if (empty($ob['to'])) {
$ret['from'] = _("Undisclosed Recipients");
$ret['error'] = true;
} else {
- $ret['from'] = empty($first_to['personal']) ? $first_to['inner'] : $first_to['personal'];
- if ($need_full) {
- $ret['fullfrom'] = $first_to['display'];
+ $to = Horde_Mime_Address::getAddressesFromObject($ob['to']);
+ $first_to = reset($to);
+ if (empty($first_to)) {
+ $ret['from'] = _("Undisclosed Recipients");
+ $ret['error'] = true;
+ } else {
+ $ret['from'] = empty($first_to['personal'])
+ ? $first_to['inner']
+ : $first_to['personal'];
+ if ($full) {
+ $ret['fullfrom'] = $first_to['display'];
+ }
}
}
- }
- if (!$this->_c['drafts_sm_folder']) {
- $ret['from'] = _("To") . ': ' . $ret['from'];
- }
- $ret['to'] = true;
- } else {
- $ret['from'] = empty($from['personal']) ? $from['inner'] : $from['personal'];
- if ($this->_c['drafts_sm_folder']) {
- $ret['from'] = _("From") . ': ' . $ret['from'];
- }
- if ($need_full) {
- $ret['fullfrom'] = $from['display'];
+ if (!$this->_cache['drafts_sm_folder']) {
+ $ret['from'] = _("To") . ': ' . $ret['from'];
+ }
+ $ret['to'] = true;
+ } else {
+ $ret['from'] = empty($from['personal'])
+ ? $from['inner']
+ : $from['personal'];
+ if ($this->_cache['drafts_sm_folder']) {
+ $ret['from'] = _("From") . ': ' . $ret['from'];
+ }
+ if ($full) {
+ $ret['fullfrom'] = $from['display'];
+ }
}
}
- if ($need_full && !isset($ret['fullfrom'])) {
+ if ($full && !isset($ret['fullfrom'])) {
$ret['fullfrom'] = $ret['from'];
}
}
/**
+ * Get size display information.
+ *
+ * @param integer $size The size of the message, in bytes.
+ *
+ * @return string A formatted size string.
*/
- function getSize($size)
+ public function getSize($size)
{
- if ($size > 1024) {
- if (!isset($this->_c['localeinfo'])) {
- $this->_c['localeinfo'] = NLS::getLocaleInfo();
- }
- $size = $size / 1024;
- if ($size > 1024) {
- return sprintf(_("%s MB"), number_format($size / 1024, 1, $this->_c['localeinfo']['decimal_point'], $this->_c['localeinfo']['thousands_sep']));
- } else {
- return sprintf(_("%s KB"), number_format($size, 0, $this->_c['localeinfo']['decimal_point'], $this->_c['localeinfo']['thousands_sep']));
- }
+ if ($size < 1024) {
+ return $size;
+ }
+
+ if (!isset($this->_cache['localeinfo'])) {
+ $this->_cache['localeinfo'] = NLS::getLocaleInfo();
}
- return $size;
+ $size = $size / 1024;
+
+ return ($size > 1024)
+ ? sprintf(_("%s MB"), number_format($size / 1024, 1, $this->_cache['localeinfo']['decimal_point'], $this->_cache['localeinfo']['thousands_sep']))
+ : sprintf(_("%s KB"), number_format($size, 0, $this->_cache['localeinfo']['decimal_point'], $this->_cache['localeinfo']['thousands_sep']));
}
/**
+ * The list of ALT text to use for mailbox display icons.
+ *
+ * @return array Type -> ALT text mappings.
*/
- function getAttachmentAltList()
+ public function getAttachmentAltList()
{
return array(
'signed' => _("Message is signed"),
}
/**
+ * Return the icon to use for a given attachment.
+ *
+ * @return string The mailbox display icon type.
*/
- function getAttachmentAlt($attachment)
- {
- $list = $this->getAttachmentAltList();
- return (isset($list[$attachment])) ? $list[$attachment] : $list['attachment'];
- }
-
- /**
- */
- function getAttachmentType($structure)
+ public function getAttachmentType($type)
{
- if ($structure->getPrimaryType() == 'multipart') {
- switch ($structure->getSubType()) {
+ list($primary, $sub) = explode('/', $type, 2);
+ if ($primary == 'multipart') {
+ switch ($sub) {
case 'signed':
return 'signed';
default:
return 'attachment';
}
- } elseif ($structure->getType() == 'application/pkcs7-mime') {
+ } elseif ($type == 'application/pkcs7-mime') {
return 'encrypted';
}
/**
* Formats the date header.
*
- * @param DateTime $date A DateTime object.
+ * @param integer $date The UNIX timestamp.
*
* @return string The formatted date header.
*/
- function getDate($date)
+ public function getDate($date)
{
- if (!isset($this->_c['today_start'])) {
- $this->_c['today_start'] = strtotime('today');
- $this->_c['today_end'] = strtotime('today + 1 day');
+ if (!isset($this->_cache['today_start'])) {
+ $this->_cache['today_start'] = strtotime('today');
+ $this->_cache['today_end'] = strtotime('today + 1 day');
}
$d = new DateTime($date);
$udate = $d->format('U');
- if (($udate < $this->_c['today_start']) ||
- ($udate > $this->_c['today_end'])) {
+ if (($udate < $this->_cache['today_start']) ||
+ ($udate > $this->_cache['today_end'])) {
/* Not today, use the date. */
return strftime($GLOBALS['prefs']->getValue('date_format'), $udate);
- } else {
- /* Else, it's today, use the time. */
- return strftime($GLOBALS['prefs']->getValue('time_format'), $udate);
}
+
+ /* Else, it's today, use the time. */
+ return strftime($GLOBALS['prefs']->getValue('time_format'), $udate);
}
/**
+ * Formats the subject header.
+ *
+ * @param string $subject The MIME encoded subject header.
+ *
+ * @return string The formatted subject header.
*/
- function getSubject($subject)
+ public function getSubject($subject)
{
- $subject = Horde_Mime::decode($subject, $this->_charset);
+ $subject = Horde_Mime::decode($subject);
$subject = empty($subject)
? _("[No Subject]")
: IMP::filterText(preg_replace("/\s+/", ' ', $subject));
<?php
/**
- * The IMP_UI_Message:: class is designed to provide a place to dump common
+ * The IMP_UI_Message:: class is designed to provide a place to store common
* code shared among IMP's various UI views for the message page.
*
* Copyright 2006-2008 The Horde Project (http://www.horde.org/)
class IMP_UI_Message
{
/**
+ * Return a list of "basic" headers w/gettext translations.
+ *
+ * @return array Header name -> gettext translation mapping.
*/
public function basicHeaders()
{
/**
* Get the list of user-defined headers to display.
*
- * @return array TODO
+ * @return array The list of user-defined headers.
*/
public function getUserHeaders()
{
}
/**
+ * TODO
*/
public function MDNCheck($headers, $confirmed = false)
{
if (!$GLOBALS['prefs']->getValue('disposition_send_mdn')) {
- return;
+ return false;
}
/* Check to see if an MDN has been requested. */
$mdn = new Horde_Mime_Mdn($headers);
- if ($mdn->getMDNReturnAddr()) {
- $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') {
- $sentmail = IMP_Sentmail::factory();
- $sentmail->log('mdn', '', $mdn->getMDNReturnAddr(), !is_a($result, 'PEAR_Error'));
- }
+ $return_addr = $mdn->getMDNReturnAddr();
+ if (!$return_addr) {
+ return false;
+ }
+
+ $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') {
+ $sentmail = IMP_Sentmail::factory();
+ $sentmail->log('mdn', '', $return_addr, !is_a($result, 'PEAR_Error'));
}
}
}
*
* @param string $date The date string.
*
- * @return string The date string with the local time added on. The
- * output has been run through htmlspecialchars().
+ * @return string The date string with the local time added on. If not
+ * in MIMP mode, the output has been run through
+ * htmlspecialchars().
*/
public function addLocalTime($date)
{
$ltime = strtotime($date);
}
- $date = htmlspecialchars($date);
+ if (($ltime === false) || ($ltime === -1)) {
+ return ($_SESSION['imp']['view'] == 'mimp')
+ ? $date
+ : htmlspecialchars($date);
+ }
- if ($ltime !== false && $ltime !== -1) {
- $date_str = strftime($GLOBALS['prefs']->getValue('date_format'), $ltime);
- $time_str = strftime($GLOBALS['prefs']->getValue('time_format'), $ltime);
- $tz = strftime('%Z');
-
- if ((date('Y') != @date('Y', $ltime)) ||
- (date('M') != @date('M', $ltime)) ||
- (date('d') != @date('d', $ltime))) {
- /* Not today, use the date. */
- $local_date = sprintf('[%s %s %s]', $date_str, $time_str, $tz);
- } else {
- /* Else, it's today, use the time only. */
- $local_date = sprintf('[%s %s]', $time_str, $tz);
- }
+ $time_str = strftime($GLOBALS['prefs']->getValue('time_format'), $ltime);
+ $tz = strftime('%Z');
- $date .= ($_SESSION['imp']['view'] == 'mimp')
- ? ' ' . $local_date
- : ' <small>' . htmlspecialchars($local_date) . '</small>';
+ if ((date('Y') != @date('Y', $ltime)) ||
+ (date('M') != @date('M', $ltime)) ||
+ (date('d') != @date('d', $ltime))) {
+ /* Not today, use the date. */
+ $date_str = strftime($GLOBALS['prefs']->getValue('date_format'), $ltime);
+ $local_date = sprintf('[%s %s %s]', $date_str, $time_str, $tz);
+ } else {
+ /* Else, it's today, use the time only. */
+ $local_date = sprintf('[%s %s]', $time_str, $tz);
}
- return $date;
+ return ($_SESSION['imp']['view'] == 'mimp')
+ ? $date . ' ' . $local_date
+ : htmlspecialchars($date) . ' <small>' . htmlspecialchars($local_date) . '</small>';
}
/**
if (isset($ob['groupname'])) {
$group_array = array();
foreach ($ob['addresses'] as $ad) {
- if (empty($ad->address) || empty($ad->inner)) {
+ if (empty($ad['address']) || empty($ad['inner'])) {
continue;
}
$ret = $mimp_view
- ? $ad->display
- : htmlspecialchars($ad->display);
-
- /* If this is an incomplete e-mail address, don't link to
- * anything. */
- if (stristr($ad->host, 'UNKNOWN') === false) {
- if ($link) {
- $ret = Horde::link(IMP::composeLink(array('to' => $ad->address)), sprintf(_("New Message to %s"), $ad->inner)) . htmlspecialchars($ad->display) . '</a>';
- }
-
- /* Append the add address icon to every address if contact
- * manager is available. */
- if ($add_link) {
- $curr_link = Util::addParameter($add_link, array('name' => $ad->personal, 'address' => $ad->inner));
- $ret .= Horde::link($curr_link, sprintf(_("Add %s to my Address Book"), $ad->inner)) .
- Horde::img('addressbook_add.png', sprintf(_("Add %s to my Address Book"), $ad->inner)) . '</a>';
- }
+ ? $ad['display']
+ : htmlspecialchars($ad['display']);
+
+ if ($link) {
+ $ret = Horde::link(IMP::composeLink(array('to' => $ad['address'])), sprintf(_("New Message to %s"), $ad['inner'])) . htmlspecialchars($ad['display']) . '</a>';
+ }
+
+ /* Append the add address icon to every address if contact
+ * manager is available. */
+ if ($add_link) {
+ $curr_link = Util::addParameter($add_link, array('name' => $ad['personal'], 'address' => $ad['inner']));
+ $ret .= Horde::link($curr_link, sprintf(_("Add %s to my Address Book"), $ad['inner'])) .
+ Horde::img('addressbook_add.png', sprintf(_("Add %s to my Address Book"), $ad['inner'])) . '</a>';
}
$group_array[] = $ret;
/* Get mailbox information. */
$overview = $imp_mailbox->getMailboxArray($msglist, false, array('list-post'));
-
$charset = NLS::getCharset();
- $identity = &Identity::singleton(array('imp', 'imp'));
- $imp_ui = new IMP_UI_Mailbox($folder, $charset, $identity);
+ $imp_ui = new IMP_UI_Mailbox($folder);
/* Display message information. */
reset($overview['overview']);
/**
* Builds a list of addresses from header information.
*
- * @param IMP_Headers &$headers The headers object.
- * @param array $addrlist The list of addresses from
- * MIME::parseAddressList().
+ * @param array $addrlist The list of addresses from
+ * Horde_Mime_Address::parseAddressList().
*
* @return array Array with the following keys: address, display, inner,
* personal, raw.
*/
- private function _buildAddressList(&$headers, $addrlist)
+ private function _buildAddressList($addrlist)
{
if (empty($addrlist) || !is_array($addrlist)) {
return;
$call_hook = !empty($GLOBALS['conf']['hooks']['addressformatting']);
foreach (Horde_Mime_Address::getAddressesFromObject($addrlist) as $ob) {
- if (empty($ob->address) || empty($ob->inner)) {
+ if (empty($ob['address']) || empty($ob['inner'])) {
continue;
}
/* If this is an incomplete e-mail address, don't link to
* anything. */
if ($call_hook) {
- $result = Horde::callHook('_dimp_hook_addressformatting', array($ob), 'dimp');
+ $result = Horde::callHook('_dimp_hook_addressformatting', array($ob), 'imp');
if (is_a($result, 'PEAR_Error')) {
Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR);
} else {
$addr_array[] = array('raw' => $result);
}
- } elseif (stristr($ob->host, 'UNKNOWN') !== false) {
- $addr_array[] = array('raw' => htmlspecialchars($ob->address));
} else {
$tmp = array();
foreach (array('address', 'display', 'inner', 'personal') as $val) {
if ($val == 'display') {
- $ob->display = htmlspecialchars($ob->display);
- if ($ob->display == $ob->address) {
+ $ob['display'] = htmlspecialchars($ob['display']);
+ if ($ob['display'] == $ob['address']) {
continue;
}
}
- if (!empty($ob->$val)) {
- $tmp[$val] = $ob->$val;
+ if (!empty($ob[$val])) {
+ $tmp[$val] = $ob[$val];
}
}
$addr_array[] = $tmp;
return $result;
}
+ $envelope = $fetch_ret[$index]['envelope'];
+ $mime_headers = reset($fetch_ret[$index]['headertext']);
+
/* Get the IMP_UI_Message:: object. */
$imp_ui = new IMP_UI_Message();
foreach (array('from', 'to', 'cc', 'bcc', 'reply-to') as $val) {
if (isset($basic_headers[$val]) &&
(!$preview || !in_array($val, array('bcc', 'reply-to')))) {
- $tmp = $this->_buildAddressList($imp_headers, $ob->addrlist[$val]);
+ $tmp = $this->_buildAddressList($envelope[$val]);
if (!empty($tmp)) {
$result[$val] = $tmp;
} elseif ($val == 'to') {
unset($result['reply-to']);
}
$headers[] = array('id' => String::ucfirst($head), 'name' => $str, 'value' => '');
- } elseif ($val = $imp_headers->getValue($head)) {
+ } elseif ($val = $mime_headers->getValue($head)) {
if ($head == 'date') {
/* Add local time to date header. */
- $val = nl2br($imp_headers->addLocalTime(htmlspecialchars($val)));
+ $val = nl2br($imp_ui->addLocalTime($envelope['date']));
if ($preview) {
$result['fulldate'] = $val;
}
if (!$preview) {
$user_hdrs = $imp_ui->getUserHeaders();
if (!empty($user_hdrs)) {
- $full_h = $imp_headers->getAllHeaders();
+ $full_h = $mime_headers->getAllHeaders();
foreach ($user_hdrs as $user_hdr) {
foreach ($full_h as $head => $val) {
if (stristr($head, $user_hdr) !== false) {
}
/* Process the subject. */
- if (($subject = $imp_headers->getValue('subject'))) {
+ if (($subject = $mime_headers->getValue('subject'))) {
require_once 'Horde/Text.php';
$subject = Text::htmlSpaces(IMP::filterText($subject));
} else {
}
$result['subject'] = $subject;
- /* Get X-Priority/ */
- $result['priority'] = $imp_headers->getXpriority();
+ /* Get X-Priority. */
+ $result['priority'] = $imp_ui->getXpriority($mime_headers);
/* Add attachment info. */
$atc_display = $GLOBALS['prefs']->getValue('attachment_display');
$show_parts = (!empty($attachments) && (($atc_display == 'list') || ($atc_display == 'both')));
- $downloadall_link = $imp_contents->getDownloadAllLink();
+// $downloadall_link = $imp_contents->getDownloadAllLink();
if ($attachments && ($show_parts || $downloadall_link)) {
$result['atc_label'] = sprintf(ngettext("%d Attachment", "%d Attachments",
/* Retrieve any history information for this message. */
if (!empty($GLOBALS['conf']['maillog']['use_maillog'])) {
if (!$preview) {
- IMP_Maillog::displayLog($imp_headers->getValue('message-id'));
+ IMP_Maillog::displayLog($mime_headers->getValue('message-id'));
}
/* Do MDN processing now. */
$unseen = $imp_mailbox->unseenMessages(true);
}
-$charset = NLS::getCharset();
$curr_time = time();
$curr_time -= $curr_time % 60;
$msgs = array();
$sortpref = IMP::getSort($imp_mbox['mailbox']);
-$imp_ui = new IMP_UI_Mailbox($imp_mbox['mailbox'], $charset, $identity);
+$imp_ui = new IMP_UI_Mailbox($imp_mbox['mailbox']);
/* Build the array of message information. */
$mbox_info = $imp_mailbox->getMailboxArray(range($pageOb['begin'], $pageOb['end']));
/* Set the current time zone. */
NLS::setTimeZone();
-/* Cache the charset. */
-$charset = NLS::getCharset();
-
/* Initialize the user's identities. */
require_once 'Horde/Identity.php';
$identity = &Identity::singleton(array('imp', 'imp'));
/* Cache some repetitively used variables. */
$fromlinkstyle = $prefs->getValue('from_link');
-
-$imp_ui = new IMP_UI_Mailbox($imp_mbox['mailbox'], $charset, $identity);
+$imp_ui = new IMP_UI_Mailbox($imp_mbox['mailbox']);
/* Display message information. */
require_once 'Horde/Text.php';
$from_message_page = true;
$start = null;
- if ($startIndex !== null) {
+ if (!is_null($startIndex)) {
$start = $startIndex;
}
- if ($actID !== null) {
+ if (!is_null($actID)) {
$actionID = $actID;
}
}
$thread_imgs = IMP_IMAP_Thread::getImageUrls();
// Attachment images
-$imp_ui = new IMP_UI_Mailbox();
+$imp_ui = new IMP_UI_Mailbox('INBOX');
$atc_imgs = array();
foreach ($imp_ui->getAttachmentAltList() as $k => $v) {
$atc_imgs[] = Horde::img($k . '.png', $v, array('id' => 'atc_img_' . $k));