var $hdecode = array('from','name','organization','subject');
var $parse_hdr = array('content-disposition', 'content-transfer-encoding', 'content-type', 'date', 'followup-to', 'from',
'message-id', 'newsgroups', 'organization', 'references', 'subject', 'x-face');
- var $show_hdr = array('from', 'subject', 'newsgroups', 'followup', 'date', 'organization', 'references', 'x-face');
+ var $show_hdr = array('from', 'newsgroups', 'followup', 'date', 'organization', 'references', 'x-face');
/** Favorites MIMEtypes to use, by order for reading multipart messages
*/
return $res;
}
+/** Match **, // and __ to format plain text
+ */
+function formatPlainText($text)
+{
+ $formatting = Array('\*' => 'strong',
+ '_' => 'u',
+ '/' => 'em');
+ foreach ($formatting as $limit=>$mark) {
+ $text = preg_replace('@(^|\W)' . $limit . '(\w+)' . $limit . '(\W|$)@'
+ ,'\1<' . $mark . '>\2</' . $mark . '>\3'
+ , $text);
+ }
+ return $text;
+}
+
/********************************************************************************
* RICHTEXT STUFF
*/
function formatDisplayHeader($_header,$_text) {
global $banana;
+ if (function_exists('hook_formatDisplayHeader')
+ && $res = hook_formatDisplayHeader($_header, $_text)) {
+ return $res;
+ }
+
switch ($_header) {
case "date":
return formatDate($_text);
case "x-face":
return '<img src="' . makeLink(Array('xface' => urlencode(base64_encode($_text)))) .'" alt="x-face" />';
-
+
+ case "subject":
+ return formatPlainText($_text);
+
default:
- if (function_exists('hook_formatDisplayHeader')
- && $res = hook_formatDisplayHeader($_header, $_text))
- {
- return $res;
- }
return htmlentities($_text);
}
}
$res = '<br/>'.html_entity_decode(to_entities(richtextToHtml($_text))).'<br/>';
} else {
$res = "\n\n" . to_entities(wrap($_text, "", $flowed))."\n\n";
- $formatting = Array('\*' => 'strong',
- '_' => 'u',
- '/' => 'em');
- foreach ($formatting as $limit=>$mark) {
- $res = preg_replace('@(\W)' . $limit . '(\w+)' . $limit . '(\W)@'
- ,'\1<' . $mark . '>\2</' . $mark . '>\3'
- , $res);
- }
+ $res = formatPlainText($res);
}
if ($format != 'html') {
}
$res = '<table class="bicol banana_msg" cellpadding="0" cellspacing="0">';
- $res .= '<tr><th colspan="2">'._b_('En-tĂȘtes').'</th></tr>';
+ $res .= '<tr><th colspan="2">' . formatdisplayheader('subject', $this->headers['subject']) . '</th></tr>';
$res .= '<tr><td class="headers"><table cellpadding="0" cellspacing="0">';
foreach ($banana->show_hdr as $hdr) {
if (function_exists('hook_getSubject')) {
$link = hook_getSubject($subject);
}
- $subject = htmlentities($subject);
+ $subject = formatPlainText(htmlentities($subject));
if ($_index == $_ref) {
$res .= '<span class="cur">' . $subject . $link . '</span>';
} else {