forked from extern/egroupware
improvement of the import of eMails if bodystructure is cascaded deeper than expected
This commit is contained in:
parent
88687148cd
commit
46b0a0ea98
@ -1450,32 +1450,8 @@ class infolog_ui
|
||||
|
||||
$subject = $bofelamimail->decode_header($headers['SUBJECT']);
|
||||
|
||||
for($i=0; $i<count($bodyParts); $i++)
|
||||
{
|
||||
// add line breaks to $bodyParts
|
||||
$newBody = $GLOBALS['egw']->translation->convert($bodyParts[$i]['body'], $bodyParts[$i]['charSet']);
|
||||
if ($bodyParts[$i]['mimeType'] == 'text/html') {
|
||||
// convert HTML to text, as we dont want HTML in infologs
|
||||
$newBody = $bofelamimail->convertHTMLToText($newBody,true);
|
||||
$bofelamimail->getCleanHTML($newBody); // new Body passed by reference
|
||||
$message .= $newBody;
|
||||
continue;
|
||||
}
|
||||
$newBody = strip_tags($newBody);
|
||||
$newBody = explode("\n",$newBody);
|
||||
// create it new, with good line breaks
|
||||
reset($newBody);
|
||||
while(list($key,$value) = @each($newBody))
|
||||
{
|
||||
if (trim($value) != '') {
|
||||
#if ($value != "\r") $value .= "\n";
|
||||
} else {
|
||||
// if you want to strip all empty lines uncomment the following
|
||||
#continue;
|
||||
}
|
||||
$message .= $bofelamimail->wordwrap($value,75,"\n");
|
||||
}
|
||||
}
|
||||
$message = self::getdisplayableBody($bofelamimail, $bodyParts);
|
||||
|
||||
//_debug_array($attachments);
|
||||
if (is_array($attachments))
|
||||
{
|
||||
@ -1544,6 +1520,44 @@ class infolog_ui
|
||||
);
|
||||
}
|
||||
|
||||
static function &getdisplayableBody(&$bofelamimail, $bodyParts)
|
||||
{
|
||||
for($i=0; $i<count($bodyParts); $i++)
|
||||
{
|
||||
if (!isset($bodyParts[$i]['body'])) {
|
||||
$bodyParts[$i]['body'] = self::getdisplayableBody($bofelamimail, $bodyParts[$i]);
|
||||
$message .= $bodyParts[$i]['body'];
|
||||
continue;
|
||||
}
|
||||
|
||||
// add line breaks to $bodyParts
|
||||
$newBody = $GLOBALS['egw']->translation->convert($bodyParts[$i]['body'], $bodyParts[$i]['charSet']);
|
||||
|
||||
if ($bodyParts[$i]['mimeType'] == 'text/html') {
|
||||
// convert HTML to text, as we dont want HTML in infologs
|
||||
$newBody = $bofelamimail->convertHTMLToText($newBody,true);
|
||||
$bofelamimail->getCleanHTML($newBody); // new Body passed by reference
|
||||
$message .= $newBody;
|
||||
continue;
|
||||
}
|
||||
$newBody = strip_tags($newBody);
|
||||
$newBody = explode("\n",$newBody);
|
||||
// create it new, with good line breaks
|
||||
reset($newBody);
|
||||
while(list($key,$value) = @each($newBody))
|
||||
{
|
||||
if (trim($value) != '') {
|
||||
#if ($value != "\r") $value .= "\n";
|
||||
} else {
|
||||
// if you want to strip all empty lines uncomment the following
|
||||
#continue;
|
||||
}
|
||||
$message .= $bofelamimail->wordwrap($value,75,"\n");
|
||||
}
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* shows infolog in other applications
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user