$senderName = sqimap_find_displayable_name($msg['FROM']);
}
- $subject = processSubject($msg['SUBJECT']);
+ $subject = processSubject($msg['SUBJECT'], $indent_array[$msg['ID']]);
echo html_tag( 'tr','','','','VALIGN="top"') . "\n";
break;
case 2: /* from */
echo html_tag( 'td',
- $italic . $bold . $flag . $fontstr . $senderName .
+ $italic . $bold . $flag . $fontstr . htmlentities($senderName) .
$fontstr_end . $flag_end . $bold_end . $italic_end,
'left',
$hlt_color );
case 4: /* subject */
$td_str = $bold;
if ($thread_sort_messages == 1) {
- if (isset($indent_array[$msg["ID"]])) {
+ if (isset($indent_array[$msg['ID']])) {
$td_str .= str_repeat(" ",$indent_array[$msg['ID']]);
}
}
return ($result);
}
-function processSubject($subject) {
+function processSubject($subject, $threadlevel = 0) {
global $languages, $squirrelmail_language;
/* Shouldn't ever happen -- caught too many times in the IMAP functions */
if ($subject == '')
return _("(no subject)");
- if (strlen($subject) <= 55)
+ $trim_at = 55;
+
+ /* if this is threaded, substract two chars per indentlevel */
+ if($threadlevel > 0 && $threadlevel <= 10)
+ $trim_at -= (2*$threadlevel);
+
+ if (strlen($subject) <= $trim_at)
return $subject;
$ent_strlen = strlen($subject);
- $trim_val=50;
- $ent_offset=0;
+ $trim_val = $trim_at - 5;
+ $ent_offset = 0;
/*
* see if this is entities-encoded string
* If so, Iterate through the whole string, find out
$ent_offset = $ent_loc_end+1;
}
- if ($ent_strlen <= 55){
+ if ($ent_strlen <= $trim_at){
return $subject;
}
}
function handleAsSent($mailbox) {
- global $sent_folder, $draft_folder, $handleAsSent_result;
-
+ global $handleAsSent_result;
+
/* First check if this is the sent or draft folder. */
- $handleAsSent_result = (($mailbox == $sent_folder)
- || ($mailbox == $draft_folder));
+ $handleAsSent_result = isSentMailbox($mailbox) || isDraftMailbox($mailbox);
/* Then check the result of the handleAsSent hook. */
do_hook('check_handleAsSent_result', $mailbox);
/* And return the result. */
- return ($handleAsSent_result);
+ return $handleAsSent_result;
}
?>