$mime_drivers['imp']['plain'] = array(
'inline' => true,
'handles' => array('text/plain', 'text/rfc822-headers', 'application/pgp'),
- /* If you want to scan ALL incoming messages for UUencoded data, set the
- * following to true. This is very performance intensive and can take a
- * long time for large messages. It is not recommended and is disabled by
- * default. */
- 'uuencode' => false,
/* If you want to limit the display of message data inline for large
* messages, set the maximum size of the displayed message here (in
* bytes). If exceeded, the user will only be able to download the part.
*/
protected function _render()
{
+ $render = $this->_IMPrender(false);
+
return array(
- 'data' => $this->_IMPrender(false),
+ 'data' => $render['html'],
+ 'status' => $render['status'],
'type' => $this->_mimepart->getType(true)
);
}
*/
protected function _renderInline()
{
- return $this->_IMPrender(true);
+ $render = $this->_IMPrender(true);
+
+ return array(
+ 'data' => $render['html'],
+ 'status' => $render['status']
+ );
}
/**
*
* @param boolean $inline Are we viewing inline?
*
- * @return string The rendered text in HTML.
+ * @return array Two elements: html and status.
*/
protected function _IMPrender($inline)
{
}
/* Sanitize the HTML. */
- $data = $this->_cleanHTML($data, $inline);
+ $cleanhtml = $this->_cleanHTML($data, $inline);
+ $data = $cleanhtml['html'];
/* Reset absolutely positioned elements. */
if ($inline) {
/* If we are viewing inline, give option to view in separate window. */
if ($inline && $this->getConfigParam('external')) {
- if ($msg) {
- $msg = str_replace('</span>', ' | </span>', $msg);
- }
- $msg .= $this->_params['contents']->linkViewJS($this->mime_part, 'view_attach', _("Show this HTML in a new window?"));
+ $cleanhtml['status'][] = array(
+ 'data' => $this->_params['contents']->linkViewJS($this->mime_part, 'view_attach', _("Show this HTML in a new window?")),
+ 'type' => 'info'
+ );
}
- $msg = $this->formatStatusMsg($msg, null, false);
-
- return (stristr($data, '<body') === false)
- ? $script . $msg . $data
- : preg_replace('/(<body.*?>)/is', '$1' . $script . $msg, $data);
+ return array(
+ 'html' => $data,
+ 'status' => $cleanhtml['status']
+ );
}
/**
*/
protected function _mailtoCallback($m)
{
- return 'href="' . $GLOBALS['registry']->call('mail/compose', array(String::convertCharset(html_entity_decode($m[2]), 'iso-8859-1', NLS::getCharset()))) . '"';
+ return 'href="' . $GLOBALS['registry']->call('mail/compose', array(String::convertCharset(html_entity_decode($m[2]), 'ISO-8859-1', NLS::getCharset()))) . '"';
}
/**
// Trim extra whitespace in the text.
$text = rtrim($this->_mimepart->getContents());
if ($text == '') {
- return '';
+ return array(
+ 'data' => '',
+ 'status' => array()
+ );
}
// If requested, scan the message for PGP data.
require_once IMP_BASE . '/lib/Crypt/PGP.php';
$imp_pgp = new IMP_PGP();
if (($out = $imp_pgp->parseMessageOutput($this->_mimepart, $this->_params['contents']))) {
- return $out;
+ return array(
+ 'data' => $out,
+ 'status' => array()
+ );
}
}
- // If requested, scan the message for UUencoded data.
- if ($this->getConfigParam('uuencode')) {
- // Don't want to use convert_uudecode() here as there may be
- // multiple files residing in the text.
- require_once 'Mail/mimeDecode.php';
- $files = &Mail_mimeDecode::uudecode($text);
- }
-
// Check for 'flowed' text data.
if ($this->_mimepart->getContentTypeParameter('format') == 'flowed') {
$text = $this->_formatFlowed($text, $this->_mimepart->getContentTypeParameter('delsp'));
}
// Build filter stack. Starts with HTML markup and tab expansion.
+ require_once 'Horde/Text/Filter.php';
$filters = array(
'text2html' => array(
'parselevel' => TEXT_HTML_MICRO,
}
// Run filters.
- require_once 'Horde/Text/Filter.php';
$text = Text_Filter::filter($text, array_keys($filters), array_values($filters));
// Wordwrap.
if (!strncmp($text, ' ', 1)) {
$text = ' ' . substr($text, 1);
}
- $text = '<div class="fixed leftAlign">' . "\n" . $text . '</div>';
- // Replace UUencoded data with links now.
- if ($this->getConfigParam('uuencode') && !empty($files)) {
- foreach ($files as $file) {
- $uupart = new Horde_MIME_Part();
- $uupart->setContents($file['filedata']);
- $uupart->setName(strip_tags($file['filename']));
-
- $uumessage = Horde_MIME_Message::convertMIMEPart($uupart);
- $mc = new IMP_Contents($uumessage);
- //$text = preg_replace("/begin ([0-7]{3}) (.+)\r?\n(.+)\r?\nend/Us", '<table>' . $mc->getMessage(true) . '</table>', $text, 1);
- }
- }
-
- return $text;
+ return array(
+ 'data' => '<div class="fixed leftAlign">' . "\n" . $text . '</div>',
+ 'status' => array()
+ );
}
}