fix: not displayed messages when MIME MIXED was in RFC822 Container with PartID 1 (Thanks Lars)

fix: not displayed images, when PartID of Attachment was > 1
fix: broken addresses after ajaxsearch when for some reason an rfc formated address is in the addressbook
This commit is contained in:
Cornelius Weiß 2007-09-03 20:21:45 +00:00
parent 7308e918a6
commit fe80186ba2
3 changed files with 28 additions and 7 deletions

View File

@ -50,10 +50,12 @@
foreach($contacts as $contact) {
foreach(array($contact['email'],$contact['email_home']) as $email) {
// avoid wrong addresses, if an rfc822 encoded address is in addressbook
$email = preg_replace("/(^.*<)([a-zA-Z0-9_\-]+@[a-zA-Z0-9_\-\.]+)(.*)/",'$2',$email);
if(!empty($email) && !isset($jsArray[$email])) {
$i++;
$str = $GLOBALS['egw']->translation->convert(trim($contact['n_fn'] ? $contact['n_fn'] : $contact['fn']) .' <'. trim($email) .'>', $this->charset, 'utf-8');
$innerHTML .= '<div class="inactiveResultRow" onclick="selectSuggestion($i)">'.
$innerHTML .= '<div class="inactiveResultRow" onclick="selectSuggestion('. $i .')">'.
htmlentities($str, ENT_QUOTES, 'utf-8') .'</div>';
$jsArray[$email] = addslashes(trim($contact['n_fn'] ? $contact['n_fn'] : $contact['fn']) .' <'. trim($email) .'>');
}

View File

@ -602,8 +602,26 @@
}
if($structure->partID != $_partID) {
error_log("bofelamimail::_getSubStructure(". __LINE__ .") partID's don't match");
return false;
foreach($imapPartIDs as $imapPartID) {
if(!empty($tempID)) {
$tempID .= '.';
}
$tempID .= $imapPartID;
//print "TEMPID: $tempID<br>";
//_debug_array($structure);
if($structure->subParts[$tempID]->type == 'MESSAGE' && $structure->subParts[$tempID]->subType == 'RFC822' &&
count($structure->subParts[$tempID]->subParts) == 1 &&
$structure->subParts[$tempID]->subParts[$tempID]->type == 'MULTIPART' &&
($structure->subParts[$tempID]->subParts[$tempID]->subType == 'MIXED' || $structure->subParts[$tempID]->subParts[$tempID]->subType == 'REPORT')) {
$structure = $structure->subParts[$tempID]->subParts[$tempID];
} else {
$structure = $structure->subParts[$tempID];
}
}
if($structure->partID != $_partID) {
error_log("bofelamimail::_getSubStructure(". __LINE__ .") partID's don't match");
return false;
}
}
return $structure;
@ -660,11 +678,11 @@
// this function is based on a on "Building A PHP-Based Mail Client"
// http://www.devshed.com
// fetch a specific attachment from a message
function getAttachmentByCID($_uid, $_cid)
function getAttachmentByCID($_uid, $_cid, $_part)
{
$partID = false;
$attachments = $this->getMessageAttachments($_uid);
$attachments = $this->getMessageAttachments($_uid, $_part);
foreach($attachments as $attachment) {
if(strpos($attachment['cid'], $_cid) !== false) {
$partID = $attachment['partID'];

View File

@ -596,10 +596,11 @@
function displayImage()
{
$cid = base64_decode($_GET['cid']);
$partID = urldecode($_GET['partID']);
$this->bofelamimail->reopen($this->mailbox);
$attachment = $this->bofelamimail->getAttachmentByCID($this->uid, $cid);
$attachment = $this->bofelamimail->getAttachmentByCID($this->uid, $cid, $partID);
$this->bofelamimail->closeConnection();
@ -1027,7 +1028,7 @@
);
$imageURL = $GLOBALS['egw']->link('/index.php', $linkData);
$newBody = preg_replace("/(\"|\')cid:(.*)(\"|\')/iUe",
"'\"$imageURL&cid='.base64_encode('$2').'\"'", $newBody);
"'\"$imageURL&cid='.base64_encode('$2').'&partID='.urlencode($this->partID).'\"'", $newBody);
// create links for email addresses
$linkData = array