fixing a Problem regarding the display of multipart/related parts; this is due to a problem reported by pongracz.istvan TRACKER BUG#2066

This commit is contained in:
Klaus Leithoff 2009-05-22 12:16:46 +00:00
parent f130d16ddd
commit 4bdd3e2772
2 changed files with 25 additions and 20 deletions

View File

@ -870,7 +870,7 @@
$kses->AddHTML(
"a", array(
"href" => array('maxlen' => 145, 'minlen' => 10),
"href" => array('maxlen' => 348, 'minlen' => 10),
"name" => array('minlen' => 2),
'target' => array('maxlen' => 10)
)
@ -959,7 +959,7 @@
$kses->AddHTML(
'img',array(
"src" => array("minlen" => 4, 'maxlen' => 200, $GLOBALS['egw_info']['user']['preferences']['felamimail']['allowExternalIMGs'] ? '' : 'match' => '/^cid:.*/'),
"src" => array("minlen" => 4, 'maxlen' => 384, $GLOBALS['egw_info']['user']['preferences']['felamimail']['allowExternalIMGs'] ? '' : 'match' => '/^cid:.*/'),
"align" => array("minlen" => 1),
"border" => array('maxlen' => 30),
)
@ -1533,7 +1533,9 @@
$partHTML = $mimePart;
} elseif ($mimePart->type == 'MULTIPART' && $mimePart->subType == 'RELATED' && is_array($mimePart->subParts)) {
// in a multipart alternative we treat the multipart/related as html part
$partHTML = array($mimePart);
#$partHTML = array($mimePart);
error_log(__METHOD__." process MULTIPART/RELATED with array as subparts");
$partHTML = $mimePart;
}
}
@ -1584,8 +1586,10 @@
{
if (self::$debug) echo __METHOD__."$_uid, $_htmlMode<br>";
$bodyPart = array();
if (self::$debug) _debug_array($_structure);
if (self::$debug) _debug_array($_structure);
if (!is_array($_structure)) $_structure = array($_structure);
foreach($_structure as $part) {
if (self::$debug) echo $part->type."/".$part->subType."<br>";
switch($part->type) {
case 'MULTIPART':
switch($part->subType) {
@ -1642,9 +1646,10 @@
function getTextPart($_uid, $_structure, $_htmlMode = '')
{
$bodyPart = array();
#_debug_array($_structure);
$partID = $_structure->partID;
$mimePartBody = $this->icServer->getBodyPart($_uid, $partID, true);
#_debug_array($mimePartBody);
#_debug_array(preg_replace('/PropertyFile___$/','',$this->decodeMimePart($mimePartBody, $_structure->encoding)));
if($_structure->subType == 'HTML' && $_htmlMode != 'always_display' && $_htmlMode != 'only_if_no_text') {
$bodyPart = array(

View File

@ -961,6 +961,7 @@
#_debug_array($bodyParts); exit;
foreach($bodyParts as $singleBodyPart) {
if (!isset($singleBodyPart['body'])) $singleBodyPart['body'] = $this->getdisplayableBody($singleBodyPart);
if(!empty($body)) {
$body .= '<hr style="border:dotted 1px silver;">';
}
@ -1000,16 +1001,16 @@
// http://www.php.net/manual/en/function.preg-replace.php
// create links for websites
$newBody = preg_replace("/((http(s?):\/\/)|(www\.))([\w,\-,\/,\?,\=,\.,&amp;,!\n,!&gt;,\%,@,\*,#,:,~,\+]+)/ie",
"'<a href=\"$webserverURL/redirect.php?go='.@htmlentities(urlencode('http$3://$4$5'),ENT_QUOTES,\"$this->displayCharset\").'\" target=\"_blank\"><font color=\"blue\">$2$4$5</font></a>'", $newBody);
#$newBody = preg_replace("/((http(s?):\/\/)|(www\.))([\w,\-,\/,\?,\=,\.,&amp;,!\n,!&gt;,\%,@,\*,#,:,~,\+]+)/ie",
# "'<a href=\"$webserverURL/redirect.php?go='.@htmlentities(urlencode('http$3://$4$5'),ENT_QUOTES,\"$this->displayCharset\").
# '\" target=\"_blank\"><font color=\"blue\">$2$4$5</font></a>'", $newBody);
// create links for ftp sites
$newBody = preg_replace("/((ftp:\/\/)|(ftp\.))([\w\.,-.,\/.,\?.,\=.,&amp;]+)/i",
"<a href=\"ftp://$3$4\" target=\"_blank\"><font color=\"blue\">ftp://$3$4</font></a>", $newBody);
#$newBody = preg_replace("/((ftp:\/\/)|(ftp\.))([\w\.,-.,\/.,\?.,\=.,&amp;]+)/i",
# "<a href=\"ftp://$3$4\" target=\"_blank\"><font color=\"blue\">ftp://$3$4</font></a>", $newBody);
$newBody = html::activate_links($newBody);
// create links for email addresses
$this->parseEmail($newBody);
$newBody = $this->highlightQuotes($newBody);
// to display a mailpart of mimetype plain/text, may be better taged as preformatted
#$newBody = nl2br($newBody);
@ -1024,18 +1025,17 @@
#error_log(print_r($newBody,true));
bofelamimail::getCleanHTML($newBody);
// create links for websites
#$newBody = preg_replace("/(?<!\>)((http(s?):\/\/)|(www\.))([\w,\-,\/,\?,\=,\.,&amp;,!\n,\%,@,\*,#,:,~,\+]+)/ie",
# "'<a href=\"$webserverURL/redirect.php?go='.htmlentities(urlencode('http$3://$4$5'),ENT_QUOTES,\"$this->displayCharset\").'\" target=\"_blank\"><font color=\"blue\">$2$4$5</font></a>'", $newBody);
$newBody = preg_replace("/(?<!>|\/|\")((http(s?):\/\/)|(www\.))([\w,\-,\/,\?,\=,\.,&amp;,!\n,\%,@,\*,#,:,~,\+]+)/ie",
"'<a href=\"$webserverURL/redirect.php?go='.@htmlentities(urlencode('http$3://$4$5'),ENT_QUOTES,\"$this->displayCharset\").'\" target=\"_blank\"><font color=\"blue\">$2$4$5</font></a>'", $newBody);
#$newBody = preg_replace("/(?<!>|\/|\"|href='|href=\")((http(s?):\/\/)|(www\.))([\w,\-,\/,\?,\=,\.,&amp;,!\n,\%,@,\*,#,:,~,\+]+)/ie",
# "'<a href=\"$webserverURL/redirect.php?go='.@htmlentities(urlencode('http$3://$4$5'),ENT_QUOTES,\"$this->displayCharset\").
# '\" target=\"_blank\"><font color=\"blue\">$2$4$5</font></a>'", $newBody);
// create links for websites
$newBody = preg_replace("/href=(\"|\')((http(s?):\/\/)|(www\.))([\w,\-,\/,\?,\=,\.,&amp;,!\n,\%,@,\(,\),\*,#,:,~,\+]+)(\"|\')/ie",
"'href=\"$webserverURL/redirect.php?go='.@htmlentities(urlencode('http$4://$5$6'),ENT_QUOTES,\"$this->displayCharset\").'\" target=\"_blank\"'", $newBody);
#$newBody = preg_replace("/href=(\"|\')((http(s?):\/\/)|(www\.))([\w,\-,\/,\?,\=,\.,&amp;,!\n,\%,@,\(,\),\*,#,:,~,\+]+)(\"|\')/ie",
# "'href=\"$webserverURL/redirect.php?go='.@htmlentities(urlencode('http$4://$5$6'),ENT_QUOTES,\"$this->displayCharset\").'\" target=\"_blank\"'", $newBody);
$newBody = html::activate_links($newBody);
// create links for ftp sites
$newBody = preg_replace("/href=(\"|\')((ftp:\/\/)|(ftp\.))([\w\.,-.,\/.,\?.,\=.,&amp;]+)(\"|\')/i",
"href=\"ftp://$4$5\" target=\"_blank\"", $newBody);
#$newBody = preg_replace("/href=(\"|\')((ftp:\/\/)|(ftp\.))([\w\.,-.,\/.,\?.,\=.,&amp;]+)(\"|\')/i",
# "href=\"ftp://$4$5\" target=\"_blank\"", $newBody);
// create links for inline images
$linkData = array (