- do_hook('html_top');
- displayPageHeader($color, $mailbox);
-
- if (isset($view_hdr)) {
- fputs ($imapConnection, sqimap_session_id() . " FETCH $passed_id BODY[HEADER]\r\n");
- $read = sqimap_read_data ($imapConnection, sqimap_session_id(), true, $a, $b);
-
- echo '<BR>' .
- '<TABLE WIDTH="100%" CELLPADDING="2" CELLSPACING="0" BORDER="0" ALIGN="CENTER">' . "\n" .
- " <TR><TD BGCOLOR=\"$color[9]\" WIDTH=\"100%\"><CENTER><B>" . _("Viewing Full Header") . '</B> - ';
- if (isset($where) && isset($what)) {
- // Got here from a search
- echo "<a href=\"read_body.php?mailbox=".urlencode($mailbox)."&passed_id=$passed_id&where=".urlencode($where)."&what=".urlencode($what).'">';
+ $read = sqimap_run_command ($imapConnection, $cmd, true, $response, $readmessage);
+
+}
+
+function ClearAttachments() {
+ global $username, $attachments, $attachment_dir;
+
+ $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
+
+ foreach ($attachments as $info) {
+ $attached_file = "$hashed_attachment_dir/$info[localfilename]";
+ if (file_exists($attached_file)) {
+ unlink($attached_file);
+ }
+ }
+
+ $attachments = array();
+}
+
+
+/*
+ * Main of read_boby.php --------------------------------------------------
+ */
+
+/*
+ Urled vars
+ ----------
+ $passed_id
+*/
+
+$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+$read = sqimap_mailbox_select($imapConnection, $mailbox);
+
+do_hook('html_top');
+
+/*
+ * The following code sets necesarry stuff for the MDN thing
+ */
+if( $default_use_mdn &&
+ ( $mdn_user_support = getPref($data_dir, $username, 'mdn_user_support', $default_use_mdn) ) ) {
+
+ $supportMDN = ServerMDNSupport($read);
+ $flags = sqimap_get_flags ($imapConnection, $passed_id);
+ $FirstTimeSee = !(in_array( 'Seen', $flags ));
+}
+
+displayPageHeader($color, $mailbox);
+
+
+/*
+ * The following code shows the header of the message and then exit
+ */
+if (isset($view_hdr)) {
+ $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY[HEADER]", true, $a, $b);
+
+ echo '<BR>' .
+ '<TABLE WIDTH="100%" CELLPADDING="2" CELLSPACING="0" BORDER="0" ALIGN="CENTER">' . "\n" .
+ " <TR><TD BGCOLOR=\"$color[9]\" WIDTH=\"100%\"><CENTER><B>" . _("Viewing Full Header") . '</B> - '.
+ '<a href="' . $base_uri . "src/read_body.php?mailbox=".urlencode($mailbox);
+ if (isset($where) && isset($what)) {
+ // Got here from a search
+ echo "&passed_id=$passed_id&where=".urlencode($where)."&what=".urlencode($what).'">';
+ } else {
+ echo "&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more\">";
+ }
+ echo _("View message") . "</a></b></center></td></tr></table>\n" .
+ "<table width=\"99%\" cellpadding=2 cellspacing=0 border=0 align=center>\n" .
+ '<tr><td>';
+
+ $cnum = 0;
+ for ($i=1; $i < count($read); $i++) {
+ $line = htmlspecialchars($read[$i]);
+ if (eregi("^>", $line)) {
+ $second[$i] = $line;
+ $first[$i] = ' ';
+ $cnum++;
+ } else if (eregi("^[ |\t]", $line)) {
+ $second[$i] = $line;
+ $first[$i] = '';
+ } else if (eregi("^([^:]+):(.+)", $line, $regs)) {
+ $first[$i] = $regs[1] . ':';
+ $second[$i] = $regs[2];
+ $cnum++;