- session_start();
-
- if (!isset($config_php))
- include("../config/config.php");
- if (!isset($strings_php))
- include("../functions/strings.php");
- if (!isset($page_header_php))
- include("../functions/page_header.php");
- if (!isset($imap_php))
- include("../functions/imap.php");
- if (!isset($mime_php))
- include("../functions/mime.php");
- if (!isset($date_php))
- include("../functions/date.php");
+ /**
+ ** read_body.php
+ **
+ ** Copyright (c) 1999-2000 The SquirrelMail development team
+ ** Licensed under the GNU GPL. For full terms see the file COPYING.
+ **
+ ** This file is used for reading the msgs array and displaying
+ ** the resulting emails in the right frame.
+ **
+ ** $Id$
+ **/
+
+ require_once('../src/validate.php');
+ require_once('../functions/imap.php');
+ require_once('../functions/mime.php');
+ require_once('../functions/date.php');
+ require_once('../functions/url_parser.php');
+
+ $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+ sqimap_mailbox_select($imapConnection, $mailbox);
+ 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).'">';
+ } else {
+ echo "<a href=\"read_body.php?mailbox=".urlencode($mailbox)."&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++;
+ } else {
+ $second[$i] = trim($line);
+ $first[$i] = '';
+ }
+ }
+ for ($i=0; $i < count($second); $i = $j) {
+ if (isset($first[$i]))
+ $f = $first[$i];
+ if (isset($second[$i]))
+ $s = nl2br($second[$i]);
+ $j = $i + 1;
+ while ($first[$j] == '' && $j < count($first)) {
+ $s .= ' ' . nl2br($second[$j]);
+ $j++;
+ }
+ parseEmail($s);
+ if (isset($f)) echo "<nobr><tt><b>$f</b>$s</tt></nobr>";
+ }
+ echo "</td></tr></table>\n";
+ echo '</body></html>';
+ sqimap_logout($imapConnection);
+ exit;
+ }