} elseif ($partid == 'text') {
Banana::$page->assign('body', $msg->getFormattedBody());
} elseif ($partid == 'source') {
- Banana::$page->assign('body',
- '<pre>' . banana_htmlentities(Banana::$protocole->getMessageSource($artid)) . '</pre>');
+ $text = Banana::$protocole->getMessageSource($artid);
+ if (!is_utf8($text)) {
+ $text = utf8_encode($text);
+ }
+ Banana::$page->assign('body', '<pre>' . banana_htmlentities($text) . '</pre>');
} else {
Banana::$page->assign('body', $msg->getFormattedBody($partid));
}
*/
public function &getMessage($id)
{
+ $message = null;
if (!is_numeric($id)) {
if (!Banana::$spool) {
- return null;
+ return $message;
}
$id = Banana::$spool->ids[$id];
}
$message = $this->readMessages(array($id));
if (empty($message)) {
- return null;
+ $message = null;
+ return $message;
}
- $msg = new BananaMessage($message[$id]['message']);
- return $msg;
+ return new BananaMessage($message[$id]['message']);
}
/** Return the sources of the given message
*/
public function getMessageSource($id)
{
+ $message = null;
if (!is_numeric($id)) {
if (!Banana::$spool) {
- return null;
+ return $message;
}
$id = Banana::$spool->ids[$id];
- }
+ }
$message = $this->readMessages(array($id));
- return implode("\n", $message);
+ return implode("\n", $message[$id]['message']);
}
/** Compute the number of messages of the box
if ($data !== false) {
return new BananaMessage($data);
}
- return null;
+ $data = null;
+ return $data;
}
/** Return the sources of the message
if ($data !== false) {
return implode("\n", $data);
}
- return null;
+ $data = null;
+ return $data;
}
/** Return the indexes of the messages presents in the Box