Exemple #1
0
function imap_list_messages($folder)
{
    $imap = new IMAP();
    if ($imap->open('david.touzeau', '180872', '127.0.0.1', '143')) {
        $hash = $imap->ListMessagesInFolder($folder);
        if (count($hash) > 10) {
            $max = 10;
        } else {
            $max = count($hash);
        }
        if (!isset($_GET["FolderPanTab"])) {
            $_GET["FolderPanTab"] = 1;
        }
        $count = count($hash);
        $start = $_GET["FolderPanTab"] - 1;
        $start = $start * $max;
        $end = $start + $max;
        $html = imap_list_messages_tabs(count($hash), $max, $folder) . "<br><table style='width:100%;border:1px solid #005447'>\n\t\t<tr>\n\t\t<th>&nbsp;</th>\n\t\t<th>{from}</th>\n\t\t<th>{subject}</th>\n\t\t<th>{date}</th>\n\t\t</tr>\n\t\t";
        if (is_array($hash)) {
            for ($i = $start; $i <= $start + $max; $i++) {
                $msg_array = $hash[$i];
                $msg_id = $msg_array["msg_id"];
                $link = "LoadAjax('webmail_view','imap.index.php?ShowMessageByID={$msg_id}&f={$folder}');";
                $style = 'style="border-bottom:1px solid #CCCCCC;padding:2px"';
                if ($msg_id != null) {
                    $html = $html . "\n\t\t\t\t<tr " . CellRollOver($link) . ">\n\t\t\t\t<td width=1% {$style}><img src='img/spamailbox_storage.gif'></td>\n\t\t\t\t<td {$style} width=1% ><strong>{$msg_array["from"]}</strong></td>\n\t\t\t\t<td {$style}><strong>{$msg_array["subject"]}</strong></td>\n\t\t\t\t<td width=5% nowrap {$style}><strong>{$msg_array["date"]}</strong></td>\n\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t";
                }
            }
        }
        $html = $html . "</table>";
    }
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html);
}