function mp_header($mbox, $messageid) { $header = imap_header($mbox, $messageid); $h = array(); if (isset($header->Msgno)) { $h['Msgno'] = $header->Msgno; } if (isset($header->from[0])) { $h['from'] = mp_decode($header->fromaddress); } if (isset($header->to[0])) { $h['to'] = mp_decode($header->toaddress); } if (isset($header->cc[0])) { $h['cc'] = mp_decode($header->ccaddress); } if (isset($header->subject)) { $h['subject'] = mp_decode($header->subject); } if (isset($header->Date)) { $h['Date'] = $header->Date; } if (isset($header->Size)) { $h['Size'] = $header->Size; } $h['Deleted'] = $header->Deleted == 'D' ? 1 : 0; return $h; }
function full_name($str_name, $highlight = '') { $personal = isset($str_name->personal) ? mp_decode($str_name->personal) : ''; $mailbox = isset($str_name->mailbox) ? $str_name->mailbox : ''; $host = isset($str_name->host) ? $str_name->host : ''; if (is_array($highlight)) { while (list($key, $value) = each($highlight)) { list($hl_mailbox, $hl_host, $color) = $value; if ($hl_mailbox and $hl_host) { if ($mailbox == $hl_mailbox and $host == $hl_host) { $mailbox = "<span style=\"color: {$color}\"><b>{$mailbox}"; $host = $host . '</b></span>'; } // if } elseif (!$hl_host and $mailbox == $hl_mailbox) { $mailbox = "<span style=\"color: {$color}\"><b>{$mailbox}</b></span>"; } elseif (!$hl_mailbox and $host == $hl_host) { $host = "<span style=\"color: {$color}\"><b>{$host}</b></span>"; } } } // while return $personal ? "{$personal}, {$mailbox}@{$host}" : "{$mailbox}@{$host}"; }
if ($mbi) { $r = array(); for ($k = 1; $k <= $nomsgi; $k++) { $header = imap_header($mbi, $k); if (isset($highlight_to[$user])) { $head['to'] = full_name($header->to[0], $highlight_to[$user]); } else { $head['to'] = full_name($header->to[0]); } if (isset($highlight_from[$user])) { $head['from'] = full_name($header->from[0], $highlight_from[$user]); } else { $head['from'] = full_name($header->from[0]); } if (isset($header->subject)) { $head['subject'] = htmlspecialchars(mp_decode($header->subject)); } else { $head['subject'] = '<i>No subject</i>'; } $head['Size'] = $header->Size; $head['no'] = $header->Msgno; $r[$k] = $head; } // for print_rt($r); } // if break; ////////////////////////////////////////////////// ////////////////////////////////////////////////// case 'echo':