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