<?php
session_start();
if ($_SESSION[mailbox] =="")
{
header("Location: ./logoff.php");
}
//get timeout information
//This will be passed to a javascript varaible used to set a
//countdown timer
$tmp = session_get_cookie_params();
$countdown = $tmp[lifetime];
//Include class files
include ("mailbox.class.php");
include ("message.class.php");
include ("folder.class.php");
//make the folders
$Inbox = new Folder($_SESSION[mailbox],INBOX);
$Old = new Folder($_SESSION[mailbox],Old);
$Work = new Folder($_SESSION[mailbox],Work);
$Family = new Folder($_SESSION[mailbox],Family);
$Friends = new Folder($_SESSION[mailbox],Friends);
$Research = new Folder($_SESSION[mailbox],Research);
$School = new Folder($_SESSION[mailbox],School);
//Array of folder objects
$Folders = array($Inbox,$Old,$Work,$Family,$Friends,$Research,$School);
$Mbox = new Mailbox("$_SESSION[mailbox]");
//Set the current folder
switch ($_GET[folder])
{
case "INBOX":
$Mbox->currentFolder = $Inbox;
break;
case "Old":
$Mbox->currentFolder = $Old;
break;
case "Work":
$Mbox->currentFolder = $Work;
break;
case "Family":
$Mbox->currentFolder = $Family;
break;
case "Friends":
$Mbox->currentFolder = $Friends;
break;
case "Research":
$Mbox->currentFolder = $Research;
break;
case "School":
$Mbox->currentFolder = $School;
break;
default:
$Mbox->currentFolder = $Inbox;
break;
}
?>
<html>
<head>
<title><?php print $page_title;?></title>
<link rel='stylesheet' type='text/css' href='vmail2.css' />
<script src="vmail.js">
</script>
</head>
<?php print "<body onLoad=\"countDown(".$countdown.")\">"; ?>
<div id="container">
<div id="logo">
<?php print "<a href=\"$logo_url\"><img src=\"$logo\" border=0></a>";?>
</div>
<div class="top">
<?php
print "<h1 id='welcome'>Welcome $_SESSION[name]</h1>";
?>
</div>
<div id="toolbar">
<?php
include("toptools.php");
?>
</div>
<div id="alert">
<?php
if ($_GET[info]=="")
{
print "<h2 class='info'>".$Mbox->currentFolder->name."</h2>";
}
else
{
print "<h2 class='info'>$_GET[info]</h2>";
}
?>
</div>
<div id="leftnav">
<h3 class="label">Folders</h3>
<ul id="navlist">
<?php
print "
<li><a href='vmail.php?folder=Inbox'>INBOX ($Inbox->numMsgs)</a></li>
<li><a href='vmail.php?folder=Old'>Old ($Old->numMsgs)</a></li>
<li><a href='vmail.php?folder=Work'>Work ($Work->numMsgs)</a></li>
<li><a href='vmail.php?folder=Family'>Family ($Family->numMsgs)</a></li>
<li><a href='vmail.php?folder=Friends'>Friends ($Friends->numMsgs)</a></li>
<li><a href='vmail.php?folder=Research'>Research ($Research->numMsgs)</a></li>
<li><a href='vmail.php?folder=School'>School ($School->numMsgs)</a></li>
</ul>
</div>
<form name='myMsgs' method='POST' action=''>";
?>
<div id="content">
<div class ="msghead">
<table>
<tr>
<th width="5%"><input type="checkbox" alt="Check All" title="Check All" id="checkall" onchange="checker(<?php print"".$Mbox->currentFolder->numMsgs; ?>)"></th>
<th width="10%">#</th>
<th width ="35%">From</th>
<th width ="30%">Date</th>
<th width ="10%">Duration</th>
<th width="10%">Listen</th></tr>
<?php
if ($Mbox->currentFolder->numMsgs == 0)
{
print "<tr><td colspan='6' width='90%' align='center'>No messages</td></tr>";
}
else
{
for ($i=0;$i<$Mbox->currentFolder->numMsgs;$i++)
{
$message = new Message($Mbox->number,$Mbox->currentFolder->name,$Mbox->currentFolder->msgs[$i]);
$duration = floor(($message->length)/60).":".sprintf("%02d",(($message->length)%60));
$sender = $message->sender;
$date = $message->datesent;
$number = $Mbox->currentFolder->msgs[$i];
$folder = $Mbox->currentFolder->name;
print "
<tr>
<td width='5%' align='center'><input type='checkbox' name='messages[]' id='checkbox$i' value='$number'></td>
<td width='5%' align='center'>".($i+1)."</td>
<td width ='35%'>$sender </td>
<td width ='35%' align='center'>$date</td>
<td width ='10%' align='center'>$duration</td>
<td width='10%'>
<a href='play.php?folder=$folder&message=$number'><img src='images/play.gif' border=0></a></td></tr>
";
}
}
?>
</table>
</div>
<div class='play_placekeeper'></div>
</div>
<input id="msgaction" name="msgaction" type="hidden">
</form>
<div id="placeholder"></div>
<div id="leftbottom"> </div>
<div id="rightbottom"> </div>
<div id="bottom"></div>
</div>
<div class="footer"><?php include("footer.php")?></div>
</body>
</html>