Move -1 to first section of for loop.
[squirrelmail.git] / src / printer_friendly_bottom.php
index c7c5ed861032de48aeade5a50ebc4842ece3a9a2..9e8aba7d62ef665b523030f14f3b98c242201c45 100644 (file)
@@ -45,7 +45,11 @@ $subject = trim(decodeHeader($rfc822_header->subject));
 $cc = decodeHeader($rfc822_header->getAddr_s('cc'));
 $to = decodeHeader($rfc822_header->getAddr_s('to'));
 
-$ent_ar = $message->findDisplayEntity();
+if ($show_html_default == 1) {
+    $ent_ar = $message->findDisplayEntity(array());
+} else {
+    $ent_ar = $message->findDisplayEntity(array(), array('text/plain'));
+}
 $body = '';
 if ($ent_ar[0] != '') {
   for ($i = 0; $i < count($ent_ar); $i++) {
@@ -88,27 +92,27 @@ displayHtmlHeader( _("Printer Friendly"), '', FALSE );
 
 echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\">\n" .
      /* headers (we use table because translations are not all the same width) */
-     html_tag( 'table', '', '', '', 'width="100%" cellspacing="0" cellpadding="0" border="0"' ) .
+     html_tag( 'table', '', 'center', '', 'cellspacing="0" cellpadding="0" border="0"' ) .
      html_tag( 'tr',
          html_tag( 'td', _("From").'&nbsp;', 'left' ,'','valign="top"') .
-         html_tag( 'td', htmlentities($from), 'left' )
+         html_tag( 'td', htmlspecialchars($from), 'left' )
      ) . "\n" .
      html_tag( 'tr',
          html_tag( 'td', _("Subject").'&nbsp;', 'left','','valign="top"' ) .
-         html_tag( 'td', htmlentities($subject), 'left' )
+         html_tag( 'td', htmlspecialchars($subject), 'left' )
      ) . "\n" .
      html_tag( 'tr',
          html_tag( 'td', _("Date").'&nbsp;', 'left' ) .
-         html_tag( 'td', htmlentities($date), 'left' )
+         html_tag( 'td', htmlspecialchars($date), 'left' )
      ) . "\n" .
      html_tag( 'tr',
          html_tag( 'td', _("To").'&nbsp;', 'left','','valign="top"' ) .
-         html_tag( 'td', htmlentities($to), 'left' )
+         html_tag( 'td', htmlspecialchars($to), 'left' )
      ) . "\n";
     if ( strlen($cc) > 0 ) { /* only show CC: if it's there... */
          echo html_tag( 'tr',
              html_tag( 'td', _("CC").'&nbsp;', 'left','','valign="top"' ) .
-             html_tag( 'td', htmlentities($cc), 'left' )
+             html_tag( 'td', htmlspecialchars($cc), 'left' )
          );
      }
      /* body */