/* This is displayed right after they log in */
$motd = " Welcome to OM's webmail system, SquirrelMail. We are currently in beta, and have not yet released a full version of SquirrelMail. Please feel free to look around, and please report any bugs to <A HREF=\"mailto:nathan@usa.om.org\">Nathan</A> or <A HREF=\"mailto:luke@usa.om.org\">Luke</A>.";
-/* SquirrelMail version number */
+/* SquirrelMail version number -- DO NOT CHANGE */
$version = "0.0.1";
+
+/* The following are related to deleting messages.
+ * $move_to_trash
+ * - if this is set to "true", when "delete" is pressed, it will attempt
+ * to move the selected messages to the folder named $trash_folder. If
+ * it's set to "false", we won't even attempt to move the messages, just
+ * delete them.
+ * $trash_folder
+ * - This is the path to the default trash folder. For Cyrus IMAP, it
+ * would be "INBOX.Trash", but for UW it would be "Trash". We need the
+ * full path name here.
+ */
+
+$move_to_trash = true;
+$trash_folder = "INBOX.Trash";
+
?>
}
}
+ function setMessageFlag($imapConnection, $i, $flag) {
+ fputs($imapConnection, "messageStore STORE $i:$i +FLAGS (\\$flag)\n");
+ }
+
function getMessageFlags($imapConnection, $i, &$flags) {
/** * 2 FETCH (FLAGS (\Answered \Seen)) */
fputs($imapConnection, "messageFetch FETCH $i:$i FLAGS\n");
+ $read = fgets($imapConnection, 1024);
while ((substr($read, 0, 15) != "messageFetch OK") && (substr($read, 0, 16) != "messageFetch BAD")) {
if (strpos($read, "FLAGS")) {
$read = ereg_replace("\(", "", $read);
return $from;
}
+
+ /** returns "true" if the copy was completed successfully.
+ ** returns "false" with an error message if unsuccessful.
+ **/
+ function copyMessages($imapConnection, $from_id, $to_id, $folder) {
+ fputs($imapConnection, "mailboxStore COPY $from_id:$to_id \"$folder\"\n");
+ $read = fgets($imapConnection, 1024);
+ while ((substr($read, 0, 15) != "mailboxStore OK") && (substr($read, 0, 15) != "mailboxStore NO")) {
+ $read = fgets($imapConnection, 1024);
+ }
+
+ if (substr($read, 0, 15) == "mailboxStore NO") {
+ echo "ERROR... $read<BR>";
+ return false;
+ } else if (substr($read, 0, 15) == "mailboxStore OK") {
+ return true;
+ }
+
+ echo "UNKNOWN ERROR copying messages $from_id to $to_id to folder $folder.<BR>";
+ return false;
+ }
?>
**
**/
- function printMessageInfo($imapConnection, $i, $from, $subject, $dateString, $answered, $seen) {
+ function printMessageInfo($imapConnection, $t, $i, $from, $subject, $dateString, $answered, $seen) {
$senderName = getSenderName($from);
if (strlen(Chop($subject)) == 0)
$subject = "(no subject)";
echo "<TR>\n";
if ($seen == false) {
- echo " <TD><FONT FACE=\"Arial,Helvetica\"><B>$i</B></FONT></TD>\n";
+ echo " <TD><FONT FACE=\"Arial,Helvetica\"><B><input type=checkbox name=\"msg[$t]\" value=$i></B></FONT></TD>\n";
echo " <TD><FONT FACE=\"Arial,Helvetica\"><B>$senderName</B></FONT></TD>\n";
echo " <TD><CENTER><B><FONT FACE=\"Arial,Helvetica\">$dateString</FONT></B></CENTER></TD>\n";
echo " <TD><FONT FACE=\"Arial,Helvetica\"><B>$subject</B></FONT></TD>\n";
} else {
- echo " <TD><FONT FACE=\"Arial,Helvetica\">$i</FONT></TD>\n";
+ echo " <TD><FONT FACE=\"Arial,Helvetica\"><input type=checkbox name=\"msg[$t]\" value=$i></FONT></TD>\n";
echo " <TD><FONT FACE=\"Arial,Helvetica\">$senderName</FONT></TD>\n";
echo " <TD><FONT FACE=\"Arial,Helvetica\"><CENTER>$dateString</CENTER></FONT></TD>\n";
echo " <TD><FONT FACE=\"Arial,Helvetica\">$subject</FONT></TD>\n";
}
else if (($nextGroup > $numMessages) && ($prevGroup >= 0)) {
echo "<A HREF=\"right_main.php?sort=$sort&startMessage=$prevGroup&mailbox=$urlMailbox\" TARGET=\"right\"><FONT FACE=\"Arial,Helvetica\">Previous</FONT></A>\n";
+ echo "<FONT FACE=\"Arial,Helvetica\" COLOR=ACACAC>Next</FONT>\n";
}
else if (($nextGroup <= $numMessages) && ($prevGroup < 0)) {
+ echo "<FONT FACE=\"Arial,Helvetica\" COLOR=ACACAC>Previous</FONT>\n";
echo "<A HREF=\"right_main.php?sort=$sort&startMessage=$nextGroup&mailbox=$urlMailbox\" TARGET=\"right\"><FONT FACE=\"Arial,Helvetica\">Next</FONT></A>\n";
}
echo "</TD></TR>\n";
+ /** The "DELETE" button */
+ echo "<TR><TD BGCOLOR=DCDCDC>";
+ echo "<FORM name=messageList method=post action=\"move_messages.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage\">";
+ echo "<INPUT TYPE=SUBMIT VALUE=\"Delete\"> selected messages";
+ echo "</TD></TR>";
+
echo "<TR><TD BGCOLOR=DCDCDC>";
echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=FFFFFF>";
echo "<TR BGCOLOR=FFFFCC ALIGN=\"center\">";
echo "</TR>";
// loop through and display the info for each message.
+ $t = 0; // $t is used for the checkbox number
for ($i = $startMessage - 1;$i <= $endMessage - 1; $i++) {
- printMessageInfo($imapConnection, $msgs[$i]["ID"], $msgs[$i]["FROM"], $msgs[$i]["SUBJECT"], $msgs[$i]["DATE_STRING"], $msgs[$i]["FLAG_ANSWERED"], $msgs[$i]["FLAG_SEEN"]);
+ printMessageInfo($imapConnection, $t, $msgs[$i]["ID"], $msgs[$i]["FROM"], $msgs[$i]["SUBJECT"], $msgs[$i]["DATE_STRING"], $msgs[$i]["FLAG_ANSWERED"], $msgs[$i]["FLAG_SEEN"]);
+ $t++;
}
- echo "</TABLE>\n";
-
+ echo "</FORM></TABLE>\n";
echo "</TD></TR>\n";
+
+ /** The "DELETE" button */
+ echo "<TR><TD BGCOLOR=DCDCDC>";
+ echo "<FORM name=messageList method=post action=\"move_messages.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage\">";
+ echo "<INPUT TYPE=SUBMIT VALUE=\"Delete\"> selected messages";
+ echo "</TD></TR>";
+
echo "<TR BGCOLOR=FFFFFF><TD>";
if (($nextGroup <= $numMessages) && ($prevGroup >= 0)) {
echo "<A HREF=\"right_main.php?sort=$sort&startMessage=$prevGroup&mailbox=$urlMailbox\" TARGET=\"right\"><FONT FACE=\"Arial,Helvetica\">Previous</FONT></A>\n";
}
else if (($nextGroup > $numMessages) && ($prevGroup >= 0)) {
echo "<A HREF=\"right_main.php?sort=$sort&startMessage=$prevGroup&mailbox=$urlMailbox\" TARGET=\"right\"><FONT FACE=\"Arial,Helvetica\">Previous</FONT></A>\n";
+ echo "<FONT FACE=\"Arial,Helvetica\" COLOR=ACACAC>Next</FONT>\n";
}
else if (($nextGroup <= $numMessages) && ($prevGroup < 0)) {
+ echo "<FONT FACE=\"Arial,Helvetica\" COLOR=ACACAC>Previous</FONT>\n";
echo "<A HREF=\"right_main.php?sort=$sort&startMessage=$nextGroup&mailbox=$urlMailbox\" TARGET=\"right\"><FONT FACE=\"Arial,Helvetica\">Next</FONT></A>\n";
}
echo "</TD></TR></TABLE>"; /** End of message-list table */