$content = "";
if ($with_headers) {
foreach ($this->getHeaders() as $key => $value) {
- $content .= "$key: $value\n";
- }
+ $line = "$key: $value";
+ $line = explode("\n", wordwrap($line, Banana::$msgshow_wrap));
+ for ($i = 1 ; $i < count($line) ; $i++) {
+ $line[$i] = "\t" . $line[$i];
+ }
+ $content .= implode("\n", $line) . "\n";
+ }
$content .= "\n";
}
if ($this->isType('multipart')) {
}
$content .= "\n--{$this->boundary}--";
} else {
- $content .= $this->body;
+ $content .= banana_wordwrap($this->body);
}
return $content;
}
list($type, $subtype) = $this->getType();
if ($type == 'image') {
$part = $this->id ? $this->id : $this->filename;
- return '<img src="'
+ return '<img class="multipart" src="'
. banana_htmlentities(Banana::$page->makeUrl(array('group' => Banana::$group,
'artid' => Banana::$artid,
'part' => $part)))
return array();
}
+ public function getAlternatives()
+ {
+ $types =& Banana::$msgshow_mimeparts;
+ $names =& Banana::$mimeparts;
+ $source = null;
+ if (in_array('source', $types)) {
+ $source = @$names['source'] ? $names['source'] : 'source';
+ }
+ if (!$this->isType('multipart', 'alternative') && !$this->isType('multipart', 'related')) {
+ if ($source) {
+ $parts = array($this);
+ } else {
+ return array();
+ }
+ } else {
+ $parts =& $this->multipart;
+ }
+ $alt = array();
+ foreach ($parts as &$part) {
+ list($type, $subtype) = $part->getType();
+ $ct = $type . '/' . $subtype;
+ if (in_array($ct, $types) || in_array($type, $types)) {
+ if (isset($names[$ct])) {
+ $alt[$ct] = $names[$ct];
+ } elseif (isset($names[$type])) {
+ $alt[$ct] = $names[$type];
+ } else {
+ $alt[$ct] = $ct;
+ }
+ }
+ }
+ if ($source) {
+ $alt['source'] = $source;
+ }
+ return $alt;
+ }
+
public function getPartById($id)
{
if ($this->id == $id) {