X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fread_body.php;h=f9c22d88823740390a645728e6ee4f4e108e4c22;hp=2d6dc5553f05088dc3a78710fb1c8b8d91775bca;hb=5eb5b57e4c250a5beb6976c9516f1b537b2e0b3c;hpb=32c661f4796c4d3725be5602397faabac6d2dcf2
diff --git a/src/read_body.php b/src/read_body.php
index 2d6dc555..f9c22d88 100644
--- a/src/read_body.php
+++ b/src/read_body.php
@@ -18,6 +18,8 @@ require_once('../functions/mime.php');
require_once('../functions/date.php');
require_once('../functions/url_parser.php');
require_once('../functions/smtp.php');
+require_once('../functions/html.php');
+require_once('../src/view_header.php');
/**
* Given an IMAP message id number, this will look it up in the cached
@@ -156,13 +158,12 @@ function printer_friendly_link() {
if (!$pf_subtle_link) {
/* The link is large, on the bottom of the header panel. */
- $result = '
' .
- '' .
- ' ' .
- ' | '."\n";
+ $result = html_tag( 'tr', '', '', $color[0] ) .
+ html_tag( 'td', ' ', 'right', '', 'class="medText" valign="top"' ) .
+ html_tag( 'td', '', 'left', '', 'class="medText" valign="top" colspan="2"' ) . "\n";
} else {
/* The link is subtle, below "view full header". */
- $result = " \n";
+ $result = " \n";
}
/* Output the link. */
@@ -175,10 +176,10 @@ function printer_friendly_link() {
" }\n" .
"// -->\n" .
"\n" .
- "$print_text\n";
+ "$print_text\n";
} else {
- $result .= '$print_text\n";
+ $result .= '$print_text\n";
}
if (!$pf_subtle_link) {
@@ -259,12 +260,12 @@ function SendMDN ( $recipient , $sender) {
function ToggleMDNflag ( $set ) {
- global $imapConnection, $passed_id, $mailbox;
+ global $imapConnection, $passed_id, $mailbox, $uid;
sqimap_mailbox_select($imapConnection, $mailbox);
$sg = $set?'+':'-';
$cmd = 'STORE ' . $passed_id . ' ' . $sg . 'FLAGS ($MDNSent)';
$read = sqimap_run_command ($imapConnection, $cmd, true, $response,
- $readmessage);
+ $readmessage, $uid);
}
function ClearAttachments() {
@@ -288,82 +289,60 @@ function ClearAttachments() {
function formatRecipientString($recipients, $item ) {
global $base_uri, $passed_id, $urlMailbox, $startMessage, $show_more_cc,
- $echo_more, $echo_less, $show_more, $show_more_bcc, $sort;
+ $echo_more, $echo_less, $show_more, $show_more_bcc, $sort, $passed_ent_id,
+ $PHP_SELF;
$i = 0;
- $url_string = '';
-
- if (isset ($recipients[0]) && trim($recipients[0])) {
+ $url_string = '';
+ if ((is_array($recipients)) && (isset($recipients[0]))) {
$string = '';
$ary = $recipients;
+ $show = false;
+
+ if ($item == 'to') {
+ if ($show_more) {
+ $show = true;
+ $url = set_url_var($PHP_SELF, 'show_more',0);
+ } else {
+ $url = set_url_var($PHP_SELF, 'show_more',1);
+ }
+ } else if ($item == 'cc') {
+ if ($show_more_cc) {
+ $url = set_url_var($PHP_SELF, 'show_more_cc',0);
+ $show = true;
+ } else {
+ $url = set_url_var($PHP_SELF, 'show_more_cc',1);
+ }
+ } else if ($item == 'bcc') {
+ if ($show_more_bcc) {
+ $url = set_url_var($PHP_SELF, 'show_more_bcc',0);
+ $show = true;
+ } else {
+ $url = set_url_var($PHP_SELF, 'show_more_bcc',1);
+ }
+ }
- switch ($item) {
- case 'to':
- $show = "&show_more=1&show_more_cc=$show_more_cc&".
- "show_more_bcc=$show_more_bcc";
- $show_n = "&show_more=0&show_more_cc=$show_more_cc&".
- "show_more_bcc=$show_more_bcc";
- break;
- case 'cc':
- $show = "&show_more=$show_more&show_more_cc=1&".
- "show_more_bcc=$show_more_bcc";
- $show_n = "&show_more=$show_more&show_more_cc=0&".
- "show_more_bcc=$show_more_bcc";
- $show_more = $show_more_cc;
- break;
- case 'bcc':
- $show = "&show_more=$show_more&show_more_cc=$show_more_cc".
- "&show_more_bcc=1";
- $show_n = "&show_more=$show_more&show_more_cc=".
- "$show_more_cc&show_more_bcc=0";
- $show_more = $show_more_bcc;
- break;
- default:
- $break;
- }
-
- while ($i < count($ary)) {
+ $cnt = count($ary);
+ while ($i < $cnt) {
+ $addr_o = $ary[$i];
+ $ary[$i] = $addr_o->getAddress();
$ary[$i] = decodeHeader(htmlspecialchars($ary[$i]));
$url_string .= $ary[$i];
if ($string) {
- $string = "$string $ary[$i]";
+ $string .= ' '.$ary[$i];
} else {
- $string = "$ary[$i]";
+ $string = $ary[$i];
+ if ($cnt>1) {
+ $string .= ' ('.$echo_less.')';
+ } else {
+ $string .= '">'.$echo_more.')';
+ break;
+ }
+ }
}
-
$i++;
- if (count($ary) > 1) {
- if ($show_more == false) {
- if ($i == 1) {
- /* From a search... */
- $string .= ' ($echo_more)";
- } else {
- $string .= "sort=$sort&startMessage=".
- "$startMessage"."$show\">$echo_more)";
- }
- $i = count($ary);
- }
- } else if ($i == 1) {
- /* From a search... */
- $string .= ' ($echo_less)";
- } else {
- $string .= "sort=$sort&startMessage=$startMessage".
- "$show_n\">$echo_less)";
- }
- }
- }
}
}
else {
@@ -388,12 +367,46 @@ function formatRecipientString($recipients, $item ) {
$passed_id
*/
+global $uid_support, $sqimap_capabilities;
+
if (isset($mailbox)){
$mailbox = urldecode( $mailbox );
}
+
$imapConnection = sqimap_login($username, $key, $imapServerAddress,
$imapPort, 0);
-$read = sqimap_mailbox_select($imapConnection, $mailbox, false, false, true);
+
+$mbx_response = sqimap_mailbox_select($imapConnection, $mailbox, false, false, true);
+
+if (!isset($messages)) {
+ $messages = array();
+ session_register('messages');
+}
+
+/**
+ * $message contains all information about the message
+ * including header and body
+ */
+
+$uidvalidity = $mbx_response['UIDVALIDITY'];
+
+if (!isset($messages[$uidvalidity])) {
+ $messages[$uidvalidity] = array();
+}
+if (!isset($messages[$uidvalidity][$passed_id])) {
+ $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
+ $messages[$uidvalidity][$passed_id] = $message;
+ $header = $message->header;
+} else {
+ $message = $messages[$uidvalidity][$passed_id];
+// $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
+ if (isset($passed_ent_id)) {
+ $message = $message->getEntity($passed_ent_id);
+ $message->id = $passed_id;
+ $message->mailbox = $mailbox;
+ }
+ $header = $message->header;
+}
do_hook('html_top');
@@ -403,82 +416,21 @@ do_hook('html_top');
if($default_use_mdn &&
($mdn_user_support = getPref($data_dir, $username, 'mdn_user_support',
$default_use_mdn))) {
-
- $supportMDN = ServerMDNSupport($read["PERMANENTFLAGS"]);
- $flags = sqimap_get_flags ($imapConnection, $passed_id);
- $FirstTimeSee = !(in_array( 'Seen', $flags ));
+ $supportMDN = ServerMDNSupport($mbx_response["PERMANENTFLAGS"]);
+ $FirstTimeSee = !$message->is_seen;
}
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 ' ' .
- '\n".
- "\n".
- '';
-
- $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 "$f$s";
- }
- }
- echo " | \n" .
- ' |