2 include("../config/config.php");
3 include("../functions/strings.php");
4 include("../functions/page_header.php");
5 include("../functions/imap.php");
6 include("../functions/mime.php");
7 include("../functions/mailbox.php");
8 include("../functions/date.php");
10 include("../src/load_prefs.php");
12 $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
13 selectMailbox($imapConnection, $mailbox, $numMessages);
15 // $message contains all information about the message
16 // including header and body
17 $message = fetchMessage($imapConnection, $passed_id, $mailbox);
20 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
21 displayPageHeader($color, $mailbox);
23 /** translate the subject and mailbox into url-able text **/
24 $url_subj = urlencode(trim(stripslashes($message["HEADER"]["SUBJECT"])));
25 $urlMailbox = urlencode($mailbox);
26 $url_replyto = urlencode($message["HEADER"]["REPLYTO"]);
28 $url_replytoall = urlencode($message["HEADER"]["REPLYTO"]);
29 $url_replytoallcc = urlencode(getLineOfAddrs($message["HEADER"]["TO"]) . ", " . getLineOfAddrs($message["HEADER"]["CC"]));
31 $dateString = getLongDateString($message["HEADER"]["DATE"]);
33 /** TEXT STRINGS DEFINITIONS **/
34 $echo_more = _("more");
35 $echo_less = _("less");
37 /** FORMAT THE TO STRING **/
40 $to_ary = $message["HEADER"]["TO"];
41 while ($i < count($to_ary)) {
42 $to_ary[$i] = htmlspecialchars($to_ary[$i]);
44 $to_string = "$to_string<BR>$to_ary[$i]";
46 $to_string = "$to_ary[$i]";
49 if (count($to_ary) > 1) {
50 if ($show_more == false) {
52 $to_string = "$to_string (<A HREF=\"read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&sort=$sort&startMessage=$startMessage&show_more=1&show_more_cc=$show_more_cc\">$echo_more</A>)";
56 $to_string = "$to_string (<A HREF=\"read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&sort=$sort&startMessage=$startMessage&show_more=0&show_more_cc=$show_more_cc\">$echo_less</A>)";
61 /** FORMAT THE CC STRING **/
64 $cc_ary = $message["HEADER"]["CC"];
65 while ($i < count($cc_ary)) {
66 $cc_ary[$i] = htmlspecialchars($cc_ary[$i]);
68 $cc_string = "$cc_string<BR>$cc_ary[$i]";
70 $cc_string = "$cc_ary[$i]";
73 if (count($cc_ary) > 1) {
74 if ($show_more_cc == false) {
76 $cc_string = "$cc_string (<A HREF=\"read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&sort=$sort&startMessage=$startMessage&show_more_cc=1&show_more=$show_more\">$echo_more</A>)";
80 $cc_string = "$cc_string (<A HREF=\"read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&sort=$sort&startMessage=$startMessage&show_more_cc=0&show_more=$show_more\">$echo_less</A>)";
85 /** make sure everything will display in HTML format **/
86 $from_name = htmlspecialchars($message["HEADER"]["FROM"]);
87 $subject = htmlspecialchars(stripslashes($message["HEADER"]["SUBJECT"]));
90 echo "<TABLE COLS=1 CELLSPACING=0 WIDTH=98% BORDER=0 ALIGN=CENTER CELLPADDING=0>\n";
91 echo " <TR><TD BGCOLOR=\"$color[0]\" WIDTH=100%>";
92 echo " <TABLE WIDTH=100% CELLSPACING=0 BORDER=0 COLS=2 CELLPADDING=3>";
94 echo " <TD ALIGN=LEFT WIDTH=50%>";
95 echo " <FONT FACE=\"Arial,Helvetica\" SIZE=2>";
96 echo " <A HREF=\"right_main.php?sort=$sort&startMessage=$startMessage&mailbox=$urlMailbox\">";
97 echo _("Message List");
98 echo "</A> | ";
99 echo " <A HREF=\"delete_message.php?mailbox=$urlMailbox&message=$passed_id&sort=$sort&startMessage=1\">";
101 echo "</A> ";
103 echo " </TD><TD WIDTH=50% ALIGN=RIGHT>";
104 echo " <FONT FACE=\"Arial,Helvetica\" SIZE=2>";
105 echo " <A HREF=\"compose.php?forward_id=$passed_id&forward_subj=$url_subj&mailbox=$urlMailbox\">";
107 echo "</A> | ";
108 echo " <A HREF=\"compose.php?send_to=$url_replyto&reply_subj=$url_subj&reply_id=$passed_id&mailbox=$urlMailbox\">";
110 echo "</A> | ";
111 echo " <A HREF=\"compose.php?send_to=$url_replytoall&send_to_cc=$url_replytoallcc&reply_subj=$url_subj&reply_id=$passed_id&mailbox=$urlMailbox\">";
113 echo "</A> ";
119 echo " <TR><TD CELLSPACING=0 WIDTH=100%>";
120 echo " <TABLE COLS=2 WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=3>\n";
123 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT>\n";
124 echo " <FONT FACE=\"Arial,Helvetica\">";
127 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85%>\n";
128 echo " <FONT FACE=\"Arial,Helvetica\"><B>$subject</B></FONT>\n";
133 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT>\n";
134 echo " <FONT FACE=\"Arial,Helvetica\">";
137 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85%>\n";
138 echo " <FONT FACE=\"Arial,Helvetica\"><B>$from_name</B></FONT>\n";
143 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT>\n";
144 echo " <FONT FACE=\"Arial,Helvetica\">";
147 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85%>\n";
148 echo " <FONT FACE=\"Arial,Helvetica\"><B>$dateString</B></FONT>\n";
153 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT VALIGN=TOP>\n";
154 echo " <FONT FACE=\"Arial,Helvetica\">";
157 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85% VALIGN=TOP>\n";
158 echo " <FONT FACE=\"Arial,Helvetica\"><B>$to_string</B></FONT>\n";
162 if ($message["HEADER"]["CC"][0]) {
164 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT VALIGN=TOP>\n";
165 echo " <FONT FACE=\"Arial,Helvetica\">Cc:</FONT>\n";
166 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85% VALIGN=TOP>\n";
167 echo " <FONT FACE=\"Arial,Helvetica\"><B>$cc_string</B></FONT>\n";
174 echo " <TR><TD BGCOLOR=\"$color[4]\" WIDTH=100%>\n";
175 $body = formatBody($message, $color, $wrap_at);
180 echo " </TD></TR>\n";
181 echo " <TR><TD BGCOLOR=\"$color[9]\"> </TD></TR>";