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