- // set message icon
- if ($attrib['deletedicon'] && $header->deleted)
- $message_icon = $attrib['deletedicon'];
- else if ($attrib['repliedicon'] && $header->answered)
- {
- if ($attrib['forwardedrepliedicon'] && $header->forwarded)
- $message_icon = $attrib['forwardedrepliedicon'];
- else
- $message_icon = $attrib['repliedicon'];
- }
- else if ($attrib['forwardedicon'] && $header->forwarded)
- $message_icon = $attrib['forwardedicon'];
- else if ($attrib['unreadicon'] && !$header->seen)
- $message_icon = $attrib['unreadicon'];
- else if ($attrib['messageicon'])
- $message_icon = $attrib['messageicon'];
-
- if ($attrib['flaggedicon'] && $header->flagged)
- $flagged_icon = $attrib['flaggedicon'];
- else if ($attrib['unflaggedicon'] && !$header->flagged)
- $flagged_icon = $attrib['unflaggedicon'];
-
- // set attachment icon
- if ($attrib['attachmenticon'] && preg_match("/multipart\/m/i", $header->ctype))
- $attach_icon = $attrib['attachmenticon'];
-
- $out .= sprintf('<tr id="rcmrow%d" class="message%s%s%s%s">'."\n",
- $header->uid,
- $header->seen ? '' : ' unread',
- $header->deleted ? ' deleted' : '',
- $header->flagged ? ' flagged' : '',
- $zebra_class);
-
- $out .= sprintf("<td class=\"icon\">%s</td>\n", $message_icon ? sprintf($image_tag, $skin_path, $message_icon, '') : '');
-
-
- if (!empty($header->charset))
- $IMAP->set_charset($header->charset);
-
- // format each col
- foreach ($a_show_cols as $col)
- {
- if ($col=='from' || $col=='to')
- $cont = Q(rcmail_address_string($header->$col, 3, false, $attrib['addicon']), 'show');
- else if ($col=='subject')
- {
- $action = $mbox==$CONFIG['drafts_mbox'] ? 'compose' : 'show';
- $uid_param = $mbox==$CONFIG['drafts_mbox'] ? '_draft_uid' : '_uid';
- $cont = abbreviate_string(trim($IMAP->decode_header($header->$col)), 160);
- if (empty($cont)) $cont = rcube_label('nosubject');
- $cont = sprintf('<a href="%s" onclick="return rcube_event.cancel(event)">%s</a>', Q(rcmail_url($action, array($uid_param=>$header->uid, '_mbox'=>$mbox))), Q($cont));
- }
- else if ($col=='flag')
- $cont = $flagged_icon ? sprintf($image_tag, $skin_path, $flagged_icon, '') : '';
- else if ($col=='size')
- $cont = show_bytes($header->$col);
- else if ($col=='date')
- $cont = format_date($header->date);
- else
- $cont = Q($header->$col);
-
- if ($col!='attachment')
- $out .= '<td class="'.$col.'">' . $cont . "</td>\n";
- else
- $out .= sprintf("<td class=\"icon\">%s</td>\n", $attach_icon ? sprintf($image_tag, $skin_path, $attach_icon, '') : ' ');
- }