Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/TNEFDecoder/TNEFAttachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ function extract_mapi_attrs(TNEFBuffer $buffer)
case TNEF_MAPI_ATTACH_DATA:
if ($this->debug)
tnef_log("MAPI Found nested attachment. Processing new one.");
tnef_getx(16, $buffer); // skip the next 16 bytes (unknown data)
$value = substr($value, 16); // skip the next 16 bytes (unknown data)
$att = new TNEFAttachment($this->debug, $this->validateChecksum);
$att->decodeTnef($value);
$this->attachments[] = $att;
Expand Down
12 changes: 6 additions & 6 deletions src/TNEFDecoder/TNEFFileRTF.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ function decode_crtf(TNEFBuffer $buffer)
if ($this->debug)
tnef_log("CRTF: size comp=$size_compressed, size=$this->size");

$data = tnef_getx($buffer->getRemainingBytes(), $buffer);

switch ($magic) {
case CRTF_COMPRESSED:
$this->uncompress($buffer);
$this->uncompress($data);
break;

case CRTF_UNCOMPRESSED:
$this->content = $buffer;
$this->content = $data;
break;

default:
Expand All @@ -61,10 +63,8 @@ function decode_crtf(TNEFBuffer $buffer)
}
}

function uncompress(TNEFBuffer $buffer)
function uncompress($data)
{
$data = tnef_getx($buffer->getRemainingBytes(), $buffer);

$preload = "{\\rtf1\\ansi\\mac\\deff0\\deftab720{\\fonttbl;}{\\f0\\fnil \\froman \\fswiss \\fmodern \\fscript \\fdecor MS Sans SerifSymbolArialTimes New RomanCourier{\\colortbl\\red0\\green0\\blue0\n\r\\par \\pard\\plain\\f0\\fs20\\b\\i\\u\\tab\\tx";
$length_preload = strlen($preload);
$init_dict = [];
Expand Down Expand Up @@ -110,7 +110,7 @@ function uncompress(TNEFBuffer $buffer)
}
}
}
$this->content = new TNEFBuffer(implode('', $output_buffer));
$this->content = implode('', $output_buffer);
}

}
Expand Down