Размер файла: 5.11Kb
<?
#####################################################################
# Copyright (c) 2002 Pau Oliva Fora <[email protected]> #
# Licensed under the GNU GPL. For full terms see the file COPYING. #
#####################################################################
require("config.php");
wmlheader();
wmlmeta();
$mbox = imap_open ("\{$IMAPSERVER:143}$F", "$U", "$P") or die ("can't connect: " . imap_last_error());
print "<card id=\"maillist\" title=\"$U's $F\">\n";
$mailnr = imap_num_msg ($mbox);
$mail_page = $page - 1;
$pages = ceil($mailnr / $MAILSBYPAGE);
if ($page == 0 or $page > $pages) {
echo "<p>$S_NOMORE</p>\n";
echo "<p><anchor><go href=\"index.php\"/>$S_RETURN</anchor></p>\n";
}
elseif ($pages == 1)
{
for ($count = $mailnr - $mail_page * $MAILSBYPAGE, $countstop = 0; $count > $countstop; $count--){
$header = imap_header ($mbox, $count, 100, 100, 0);
$msgsubject = trim(htmlspecialchars(decode($header->fetchsubject)));
if (empty($msgsubject)) $msgsubject="(No Subject)";
echo "<p mode=\"nowrap\">\n";
echo "<small>";
if ( $header->Unseen == "U" || $header->Recent =="N" ) echo "<b>";
echo "<anchor title=\"$S_SUBMIT\">$msgsubject
<go href=\"mailview.php?msgid=$count\" method=\"post\">
<postfield name=\"F\" value=\"$F\"/>
<postfield name=\"U\" value=\"$U\"/>
<postfield name=\"P\" value=\"$P\"/>
</go></anchor>";
if ( $header->Unseen == "U" || $header->Recent =="N" ) echo "</b>";
echo "</small>";
echo "</p>\n";
}
echo "<p>$S_NOMORE</p>\n";
echo "<p><anchor><go href=\"index.php\"/>$S_RETURN</anchor></p>\n";
}
elseif ($page == 1) {
#previous
echo "<p align=\"center\">";
echo "<anchor title=\"$S_SUBMIT\">$S_PREVIOUS
<go href=\"maillist.php?page=2\" method=\"post\">
<postfield name=\"F\" value=\"$F\"/>
<postfield name=\"U\" value=\"$U\"/>
<postfield name=\"P\" value=\"$P\"/>
</go></anchor>";
echo "</p>\n";
for ($count = $mailnr - $mail_page * $MAILSBYPAGE, $countstop = $mailnr - $page * $MAILSBYPAGE; $count > $countstop; $count--){
$header = imap_header ($mbox, $count, 100, 100, 0);
$msgsubject = trim(htmlspecialchars(decode($header->fetchsubject)));
if (empty($msgsubject)) $msgsubject="(No Subject)";
echo "<p mode=\"nowrap\">\n";
echo "<small>";
if ( $header->Unseen == "U" || $header->Recent =="N" ) echo "<b>";
echo "<anchor title=\"$S_SUBMIT\">$msgsubject
<go href=\"mailview.php?msgid=$count\" method=\"post\">
<postfield name=\"F\" value=\"$F\"/>
<postfield name=\"U\" value=\"$U\"/>
<postfield name=\"P\" value=\"$P\"/>
</go></anchor>";
if ( $header->Unseen == "U" || $header->Recent =="N" ) echo "</b>";
echo "</small>";
echo "</p>\n";
}
}
elseif ($page < $pages and $page != 1){
#next and previous
echo "<p align=\"center\">";
echo "<anchor title=\"$S_SUBMIT\">$S_NEXT
<go href=\"maillist.php?page=";
echo $page - 1;
echo "\" method=\"post\">
<postfield name=\"F\" value=\"$F\"/>
<postfield name=\"U\" value=\"$U\"/>
<postfield name=\"P\" value=\"$P\"/>
</go></anchor>";
echo "<anchor title=\"$S_SUBMIT\">$S_PREVIOUS
<go href=\"maillist.php?page=";
echo $page + 1;
echo "\" method=\"post\">
<postfield name=\"F\" value=\"$F\"/>
<postfield name=\"U\" value=\"$U\"/>
<postfield name=\"P\" value=\"$P\"/>
</go></anchor>";
echo "</p>\n";
for ($count = $mailnr - $mail_page * $MAILSBYPAGE, $countstop = $mailnr - $page * $MAILSBYPAGE; $count > $countstop; $count--){
$header = imap_header ($mbox, $count, 100, 100, 0);
$msgsubject = trim(htmlspecialchars(decode($header->fetchsubject)));
if (empty($msgsubject)) $msgsubject="(No Subject)";
echo "<p mode=\"nowrap\">\n";
echo "<small>";
if ( $header->Unseen == "U" || $header->Recent =="N" ) echo "<b>";
echo "<anchor title=\"$S_SUBMIT\">$msgsubject
<go href=\"mailview.php?msgid=$count\" method=\"post\">
<postfield name=\"F\" value=\"$F\"/>
<postfield name=\"U\" value=\"$U\"/>
<postfield name=\"P\" value=\"$P\"/>
</go></anchor>";
if ( $header->Unseen == "U" || $header->Recent =="N" ) echo "</b>";
echo "</small>";
echo "</p>\n";
}
}
elseif($page = $pages and $pages != 1 ){
#next
echo "<p align=\"center\">";
echo "<anchor title=\"$S_SUBMIT\">$S_NEXT
<go href=\"maillist.php?page=";
echo $page - 1;
echo "\" method=\"post\">
<postfield name=\"F\" value=\"$F\"/>
<postfield name=\"U\" value=\"$U\"/>
<postfield name=\"P\" value=\"$P\"/>
</go></anchor>";
echo "</p>\n";
for ($count = $mailnr - $mail_page * $MAILSBYPAGE, $countstop = 0; $count > $countstop; $count--){
$header = imap_header ($mbox, $count, 100, 100, 0);
$msgsubject = trim(htmlspecialchars(decode($header->fetchsubject)));
if (empty($msgsubject)) $msgsubject="(No Subject)";
echo "<p mode=\"nowrap\">\n";
echo "<small>";
if ( $header->Unseen == "U" || $header->Recent =="N" ) echo "<b>";
echo "<anchor title=\"$S_SUBMIT\">$msgsubject
<go href=\"mailview.php?msgid=$count\" method=\"post\">
<postfield name=\"F\" value=\"$F\"/>
<postfield name=\"U\" value=\"$U\"/>
<postfield name=\"P\" value=\"$P\"/>
</go></anchor>";
if ( $header->Unseen == "U" || $header->Recent =="N" ) echo "</b>";
echo "</small>";
echo "</p>\n";
}
}
imap_close($mbox);
wmlfooter();
?>