Added refreshing of left folder list using META tags. Editeded HTML for
[squirrelmail.git] / src / read_body.php
CommitLineData
be69e508 1<?
2 include("../config/config.php");
3 include("../functions/strings.php");
4 include("../functions/page_header.php");
5 include("../functions/imap.php");
f7fb20fe 6 include("../functions/mime.php");
be69e508 7 include("../functions/mailbox.php");
8 include("../functions/date.php");
9
d3cdb279 10 include("../src/load_prefs.php");
11
b235d629 12 $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
be69e508 13 selectMailbox($imapConnection, $mailbox, $numMessages);
14
f7fb20fe 15 // $message contains all information about the message
16 // including header and body
97be2168 17 $message = fetchMessage($imapConnection, $passed_id, $mailbox);
31f3d7c0 18
d4467150 19 echo "<HTML>";
f8f9bed9 20 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
21 displayPageHeader($color, $mailbox);
d4467150 22
f7fb20fe 23 /** translate the subject and mailbox into url-able text **/
e39d73e5 24 $url_subj = urlencode(trim(stripslashes($message["HEADER"]["SUBJECT"])));
8467bf00 25 $urlMailbox = urlencode($mailbox);
5c55c295 26 $url_replyto = urlencode($message["HEADER"]["REPLYTO"]);
be69e508 27
4bfed9f3 28 $url_replytoall = urlencode($message["HEADER"]["REPLYTO"]);
29 $url_replytoallcc = urlencode(getLineOfAddrs($message["HEADER"]["TO"]) . ", " . getLineOfAddrs($message["HEADER"]["CC"]));
30
f7fb20fe 31 $dateString = getLongDateString($message["HEADER"]["DATE"]);
31f3d7c0 32
b581fa60 33 /** TEXT STRINGS DEFINITIONS **/
34 $echo_more = _("more");
35 $echo_less = _("less");
36
078a40a4 37 /** FORMAT THE TO STRING **/
2844086d 38 $i = 0;
39 $to_string = "";
f7fb20fe 40 $to_ary = $message["HEADER"]["TO"];
2844086d 41 while ($i < count($to_ary)) {
f7fb20fe 42 $to_ary[$i] = htmlspecialchars($to_ary[$i]);
2844086d 43 if ($to_string)
44 $to_string = "$to_string<BR>$to_ary[$i]";
45 else
46 $to_string = "$to_ary[$i]";
47
48 $i++;
49 if (count($to_ary) > 1) {
50 if ($show_more == false) {
51 if ($i == 1) {
b581fa60 52 $to_string = "$to_string&nbsp;(<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>)";
2844086d 53 $i = count($to_ary);
54 }
55 } else if ($i == 1) {
b581fa60 56 $to_string = "$to_string&nbsp;(<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>)";
2844086d 57 }
58 }
59 }
60
078a40a4 61 /** FORMAT THE CC STRING **/
62 $i = 0;
63 $cc_string = "";
f7fb20fe 64 $cc_ary = $message["HEADER"]["CC"];
078a40a4 65 while ($i < count($cc_ary)) {
f7fb20fe 66 $cc_ary[$i] = htmlspecialchars($cc_ary[$i]);
078a40a4 67 if ($cc_string)
68 $cc_string = "$cc_string<BR>$cc_ary[$i]";
69 else
70 $cc_string = "$cc_ary[$i]";
71
72 $i++;
73 if (count($cc_ary) > 1) {
74 if ($show_more_cc == false) {
75 if ($i == 1) {
b581fa60 76 $cc_string = "$cc_string&nbsp;(<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>)";
078a40a4 77 $i = count($cc_ary);
78 }
79 } else if ($i == 1) {
b581fa60 80 $cc_string = "$cc_string&nbsp;(<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>)";
078a40a4 81 }
82 }
83 }
84
f7fb20fe 85 /** make sure everything will display in HTML format **/
86 $from_name = htmlspecialchars($message["HEADER"]["FROM"]);
e39d73e5 87 $subject = htmlspecialchars(stripslashes($message["HEADER"]["SUBJECT"]));
078a40a4 88
8467bf00 89 echo "<BR>";
4809f489 90 echo "<TABLE COLS=1 CELLSPACING=0 WIDTH=98% BORDER=0 ALIGN=CENTER CELLPADDING=0>\n";
f8f9bed9 91 echo " <TR><TD BGCOLOR=\"$color[0]\" WIDTH=100%>";
4809f489 92 echo " <TABLE WIDTH=100% CELLSPACING=0 BORDER=0 COLS=2 CELLPADDING=3>";
31f3d7c0 93 echo " <TR>";
94 echo " <TD ALIGN=LEFT WIDTH=50%>";
95 echo " <FONT FACE=\"Arial,Helvetica\" SIZE=2>";
b581fa60 96 echo " <A HREF=\"right_main.php?sort=$sort&startMessage=$startMessage&mailbox=$urlMailbox\">";
97 echo _("Message List");
98 echo "</A>&nbsp;|&nbsp;";
99 echo " <A HREF=\"delete_message.php?mailbox=$urlMailbox&message=$passed_id&sort=$sort&startMessage=1\">";
100 echo _("Delete");
101 echo "</A>&nbsp;&nbsp;";
31f3d7c0 102 echo " </FONT>";
103 echo " </TD><TD WIDTH=50% ALIGN=RIGHT>";
104 echo " <FONT FACE=\"Arial,Helvetica\" SIZE=2>";
b581fa60 105 echo " <A HREF=\"compose.php?forward_id=$passed_id&forward_subj=$url_subj&mailbox=$urlMailbox\">";
106 echo _("Forward");
107 echo "</A>&nbsp;|&nbsp;";
108 echo " <A HREF=\"compose.php?send_to=$url_replyto&reply_subj=$url_subj&reply_id=$passed_id&mailbox=$urlMailbox\">";
109 echo _("Reply");
110 echo "</A>&nbsp;|&nbsp;";
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\">";
112 echo _("Reply All");
113 echo "</A>&nbsp;&nbsp;";
31f3d7c0 114 echo " </FONT>";
115 echo " </TD>";
116 echo " </TR>";
117 echo " </TABLE>";
8467bf00 118 echo " </TD></TR>";
4809f489 119 echo " <TR><TD CELLSPACING=0 WIDTH=100%>";
97afcee9 120 echo " <TABLE COLS=2 WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=3>\n";
be69e508 121 echo " <TR>\n";
122 /** subject **/
4809f489 123 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT>\n";
b581fa60 124 echo " <FONT FACE=\"Arial,Helvetica\">";
125 echo _("Subject:");
126 echo "</FONT>\n";
f8f9bed9 127 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85%>\n";
be69e508 128 echo " <FONT FACE=\"Arial,Helvetica\"><B>$subject</B></FONT>\n";
129 echo " </TD>\n";
130 echo " </TR>\n";
131 /** from **/
132 echo " <TR>\n";
4809f489 133 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT>\n";
b581fa60 134 echo " <FONT FACE=\"Arial,Helvetica\">";
135 echo _("From:");
136 echo "</FONT>\n";
f8f9bed9 137 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85%>\n";
be69e508 138 echo " <FONT FACE=\"Arial,Helvetica\"><B>$from_name</B></FONT>\n";
139 echo " </TD>\n";
140 echo " </TR>\n";
141 /** date **/
142 echo " <TR>\n";
4809f489 143 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT>\n";
b581fa60 144 echo " <FONT FACE=\"Arial,Helvetica\">";
32c7898c 145 echo _("Date:");
b581fa60 146 echo "</FONT>\n";
f8f9bed9 147 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85%>\n";
9774bdef 148 echo " <FONT FACE=\"Arial,Helvetica\"><B>$dateString</B></FONT>\n";
be69e508 149 echo " </TD>\n";
150 echo " </TR>\n";
2844086d 151 /** to **/
152 echo " <TR>\n";
4809f489 153 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT VALIGN=TOP>\n";
a054feae 154 echo " <FONT FACE=\"Arial,Helvetica\">";
b581fa60 155 echo _("To:");
156 echo "</FONT>\n";
f8f9bed9 157 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85% VALIGN=TOP>\n";
2844086d 158 echo " <FONT FACE=\"Arial,Helvetica\"><B>$to_string</B></FONT>\n";
159 echo " </TD>\n";
160 echo " </TR>\n";
078a40a4 161 /** cc **/
f7fb20fe 162 if ($message["HEADER"]["CC"][0]) {
078a40a4 163 echo " <TR>\n";
4809f489 164 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT VALIGN=TOP>\n";
078a40a4 165 echo " <FONT FACE=\"Arial,Helvetica\">Cc:</FONT>\n";
f8f9bed9 166 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85% VALIGN=TOP>\n";
078a40a4 167 echo " <FONT FACE=\"Arial,Helvetica\"><B>$cc_string</B></FONT>\n";
168 echo " </TD>\n";
169 echo " </TR>\n";
170 }
4809f489 171 echo "</TABLE>";
172 echo " </TD></TR>";
be69e508 173
f8f9bed9 174 echo " <TR><TD BGCOLOR=\"$color[4]\" WIDTH=100%>\n";
11307a4c 175 $body = formatBody($message, $color, $wrap_at);
4809f489 176 echo "<BR>";
5c55c295 177
7831268e 178 echo "$body";
d4467150 179
7831268e 180 echo " </TD></TR>\n";
181 echo " <TR><TD BGCOLOR=\"$color[9]\">&nbsp;</TD></TR>";
be69e508 182 echo "</TABLE>\n";
183
b581fa60 184?>