table definitions.
Remove two cases of </TR></TD></TABLE> in formatBody, moving the </TR></TD>
bit back into src/read_body.php to match the <TABLE><TR><TD> before the
function call, and removing the excessive close tags problem.
The possibly controversial bit: remove all outputting of <BASE> tags within
the message body. I refer you to:
http://www.w3.org/TR/1998/REC-html40-
19980424/struct/links.html#h-12.4
specifically,
When present, the BASE element must appear in the HEAD section of an
HTML document, before any element that refers to an external source.
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2461
7612ce4b-ef26-0410-bec9-
ea0150e637f0
*/
if ( $ret{0} == '<' ) {
$data = sqimap_run_command ($imap_stream, "FETCH $id BODY[$ent_id.MIME]", true, $response, $message);
*/
if ( $ret{0} == '<' ) {
$data = sqimap_run_command ($imap_stream, "FETCH $id BODY[$ent_id.MIME]", true, $response, $message);
- $base = '';
- $k = 10;
- foreach( $data as $d ) {
- if ( substr( $d, 0, 13 ) == 'Content-Base:' ) {
- $j = strlen( $d );
- $i = 13;
- $base = '';
- while ( $i < $j &&
- ( !isNoSep( $d{$i} ) || $d{$i} == '"' ) )
- $i++;
- while ( $i < $j ) {
- if ( isNoSep( $d{$i} ) )
- $base .= $d{$i};
- $i++;
- }
- $k = 0;
- } elseif ( $k == 1 && !isnosep( $d{0} ) ) {
- $base .= substr( $d, 1 );
- }
- $k++;
- }
- if ( $base <> '' ) {
- $ret = "<base href=\"$base\">" . $ret;
- }
+ /* BASE within HTML documents is illegal (see w3 spec)
+* $base = '';
+* $k = 10;
+* foreach( $data as $d ) {
+* if ( substr( $d, 0, 13 ) == 'Content-Base:' ) {
+* $j = strlen( $d );
+* $i = 13;
+* $base = '';
+* while ( $i < $j &&
+* ( !isNoSep( $d{$i} ) || $d{$i} == '"' ) )
+* $i++;
+* while ( $i < $j ) {
+* if ( isNoSep( $d{$i} ) )
+* $base .= $d{$i};
+* $i++;
+* }
+* $k = 0;
+* } elseif ( $k == 1 && !isnosep( $d{0} ) ) {
+* $base .= substr( $d, 1 );
+* }
+* $k++;
+* }
+* if ( $base <> '' ) {
+* $ret = "<base href=\"$base\">" . $ret;
+* }
+* */
}
} else if (ereg('"([^"]*)"', $topline, $regs)) {
$ret = $regs[1];
} else {
global $where, $what, $mailbox, $passed_id, $startMessage;
}
} else if (ereg('"([^"]*)"', $topline, $regs)) {
$ret = $regs[1];
} else {
global $where, $what, $mailbox, $passed_id, $startMessage;
- $par = 'mailbox=' . urlencode($mailbox) . "&passed_id=$passed_id";
+ $par = 'mailbox=' . urlencode($mailbox) . "&passed_id=$passed_id";
if (isset($where) && isset($what)) {
if (isset($where) && isset($what)) {
- $par .= '&where='. urlencode($where) . "&what=" . urlencode($what);
+ $par .= '&where='. urlencode($where) . "&what=" . urlencode($what);
- $par .= "&startMessage=$startMessage&show_more=0";
+ $par .= "&startMessage=$startMessage&show_more=0";
- $par .= '&response=' . urlencode($response) .
- '&message=' . urlencode($message).
- '&topline=' . urlencode($topline);
+ $par .= '&response=' . urlencode($response) .
+ '&message=' . urlencode($message).
+ '&topline=' . urlencode($topline);
echo '<tt><br>' .
'<table width="80%"><tr>' .
echo '<tt><br>' .
'<table width="80%"><tr>' .
translateText($body, $wrap_at, $body_message->header->charset);
}
translateText($body, $wrap_at, $body_message->header->charset);
}
- $body .= "<SMALL><CENTER><A HREF=\"../src/download.php?absolute_dl=true&passed_id=$id&passed_ent_id=$ent_num&mailbox=$urlmailbox&showHeaders=1\">". _("Download this as a file") ."</A></CENTER><BR></SMALL>";
+ $body .= "<CENTER><SMALL><A HREF=\"../src/download.php?absolute_dl=true&passed_id=$id&passed_ent_id=$ent_num&mailbox=$urlmailbox&showHeaders=1\">". _("Download this as a file") ."</A></SMALL></CENTER><BR>";
/** Display the ATTACHMENTS: message if there's more than one part **/
/** Display the ATTACHMENTS: message if there's more than one part **/
- $body .= "</TD></TR></TABLE>";
if (isset($message->entities[0])) {
$body .= formatAttachments ($message, $ent_num, $message->header->mailbox, $id);
}
if (isset($message->entities[0])) {
$body .= formatAttachments ($message, $ent_num, $message->header->mailbox, $id);
}
- $body .= "</TD></TR></TABLE>";
} else {
$body = formatAttachments ($message, -1, $message->header->mailbox, $id);
}
} else {
$body = formatAttachments ($message, -1, $message->header->mailbox, $id);
}
$ent = urlencode($message->header->entity_id);
$DefaultLink =
$ent = urlencode($message->header->entity_id);
$DefaultLink =
- "../src/download.php?startMessage=$startMessage&passed_id=$id&mailbox=$urlMailbox&passed_ent_id=$ent";
+ "../src/download.php?startMessage=$startMessage&passed_id=$id&mailbox=$urlMailbox&passed_ent_id=$ent";
- $DefaultLink .= '&where=' . urlencode($where) . '&what=' . urlencode($what);
+ $DefaultLink .= '&where=' . urlencode($where) . '&what=' . urlencode($what);
}
$Links['download link']['text'] = _("download");
$Links['download link']['href'] =
}
$Links['download link']['text'] = _("download");
$Links['download link']['href'] =
- "../src/download.php?absolute_dl=true&passed_id=$id&mailbox=$urlMailbox&passed_ent_id=$ent";
+ "../src/download.php?absolute_dl=true&passed_id=$id&mailbox=$urlMailbox&passed_ent_id=$ent";
$ImageURL = '';
/* this executes the attachment hook with a specific MIME-type.
$ImageURL = '';
/* this executes the attachment hook with a specific MIME-type.
return( "\n\n<!-- HTML Output ahead -->\n" .
$ret .
return( "\n\n<!-- HTML Output ahead -->\n" .
$ret .
+ /* Base is illegal within HTML
"\n<!-- END of HTML Output --><base href=\"".
get_location() . '/'.
"\">\n\n" );
"\n<!-- END of HTML Output --><base href=\"".
get_location() . '/'.
"\">\n\n" );
+ */
+ "\n<!-- END of HTML Output -->\n\n" );
}
function isNoSep( $char ) {
}
function isNoSep( $char ) {
}
if ( strtolower( substr( $src, 0, 4 ) ) == 'cid:' ) {
$src = substr( $src, 4 );
}
if ( strtolower( substr( $src, 0, 4 ) ) == 'cid:' ) {
$src = substr( $src, 4 );
- $src = "../src/download.php?absolute_dl=true&passed_id=$id&mailbox=" .
+ $src = "../src/download.php?absolute_dl=true&passed_id=$id&mailbox=" .
urlencode( $message->header->mailbox ) .
urlencode( $message->header->mailbox ) .
- "&passed_ent_id=" . find_ent_id( $src, $message );
+ "&passed_ent_id=" . find_ent_id( $src, $message );
} else if ( strtolower( substr( $src, 0, 4 ) ) <> 'http' ||
stristr( $src, $base_uri ) ) {
/* Javascript and local urls goes out */
} else if ( strtolower( substr( $src, 0, 4 ) ) <> 'http' ||
stristr( $src, $base_uri ) ) {
/* Javascript and local urls goes out */
$name .= $body{$i++};
}
if ( $name <> '' ) {
$name .= $body{$i++};
}
if ( $name <> '' ) {
- $ret .= "../src/download.php?absolute_dl=true&passed_id=$id&mailbox=" .
+ $ret .= "../src/download.php?absolute_dl=true&passed_id=$id&mailbox=" .
urlencode( $message->header->mailbox ) .
urlencode( $message->header->mailbox ) .
- "&passed_ent_id=" . find_ent_id( $name, $message );
+ "&passed_ent_id=" . find_ent_id( $name, $message );
if ( $body{$k} == '"' )
$ret .= '" ';
else
if ( $body{$k} == '"' )
$ret .= '" ';
else