- // create row for each message
- foreach ($a_headers as $i => $header) //while (list($i, $header) = each($a_headers))
- {
- $message_icon = $attach_icon = '';
- $js_row_arr = array();
- $zebra_class = $i%2 ? 'even' : 'odd';
-
- // set messag attributes to javascript array
- if ($header->deleted)
- $js_row_arr['deleted'] = true;
- if (!$header->seen)
- $js_row_arr['unread'] = true;
- if ($header->answered)
- $js_row_arr['replied'] = true;
- // set message icon
- if ($attrib['deletedicon'] && $header->deleted)
- $message_icon = $attrib['deletedicon'];
- else if ($attrib['unreadicon'] && !$header->seen)
- $message_icon = $attrib['unreadicon'];
- else if ($attrib['repliedicon'] && $header->answered)
- $message_icon = $attrib['repliedicon'];
- else if ($attrib['messageicon'])
- $message_icon = $attrib['messageicon'];
-
- // set attachment icon
- if ($attrib['attachmenticon'] && preg_match("/multipart\/[mr]/i", $header->ctype))
- $attach_icon = $attrib['attachmenticon'];
-
- $out .= sprintf('<tr id="rcmrow%d" class="message%s%s %s">'."\n",
- $header->uid,
- $header->seen ? '' : ' unread',
- $header->deleted ? ' deleted' : '',
- $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, $attrib['addicon']), 'show');
- else if ($col=='subject')
- {
- $action = $mbox==$CONFIG['drafts_mbox'] ? 'compose' : 'show';
- $uid_param = $mbox==$CONFIG['drafts_mbox'] ? '_draft_uid' : '_uid';
- $cont = Q($IMAP->decode_header($header->$col));
- if (empty($cont)) $cont = Q(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))), $cont);
- }
- else if ($col=='size')
- $cont = show_bytes($header->$col);
- else if ($col=='date')
- $cont = format_date($header->date);
- else
- $cont = Q($header->$col);
-
- $out .= '<td class="'.$col.'">' . $cont . "</td>\n";
- }
-
- $out .= sprintf("<td class=\"icon\">%s</td>\n", $attach_icon ? sprintf($image_tag, $skin_path, $attach_icon, '') : '');
- $out .= "</tr>\n";
-
- if (sizeof($js_row_arr))
- $a_js_message_arr[$header->uid] = $js_row_arr;
- }
-
- // complete message table
- $out .= "</tbody></table>\n";
-
-
- $message_count = $IMAP->messagecount();
-