Ver Fonte

- more minor UI tweaks
- added headers to saved text messages

Luke Ehresman há 25 anos atrás
pai
commit
3e34975a84
4 ficheiros alterados com 21 adições e 10 exclusões
  1. 5 5
      functions/mailbox_display.php
  2. 1 0
      functions/mime.php
  3. 12 2
      src/download.php
  4. 3 3
      src/read_body.php

+ 5 - 5
functions/mailbox_display.php

@@ -37,10 +37,11 @@
             continue;
             continue;
          }   
          }   
       }   
       }   
+      
       if (!$hlt_color)
       if (!$hlt_color)
          $hlt_color = $color[4];
          $hlt_color = $color[4];
       
       
-      echo "   <td width=1% bgcolor=$hlt_color align=center><input type=checkbox name=\"msg[$t]\" value=".$msg["ID"]."></TD>\n";
+      echo "   <td width=1% bgcolor=$hlt_color align=center><input type=checkbox name=\"msg[$t]\" value=".$msg["ID"]."$checked></TD>\n";
       echo "   <td width=30% bgcolor=$hlt_color>$italic$bold$flag$senderName$flag_end$bold_end$italic_end</td>\n";
       echo "   <td width=30% bgcolor=$hlt_color>$italic$bold$flag$senderName$flag_end$bold_end$italic_end</td>\n";
       echo "   <td nowrap width=1% bgcolor=$hlt_color><center>$bold$flag".$msg["DATE_STRING"]."$flag_end$bold_end</center></td>\n";
       echo "   <td nowrap width=1% bgcolor=$hlt_color><center>$bold$flag".$msg["DATE_STRING"]."$flag_end$bold_end</center></td>\n";
 		if ($msg["FLAG_ANSWERED"] == true) echo "   <td bgcolor=$hlt_color width=1%><b><small>A</small></b></td>";
 		if ($msg["FLAG_ANSWERED"] == true) echo "   <td bgcolor=$hlt_color width=1%><b><small>A</small></b></td>";
@@ -186,7 +187,7 @@
       $urlMailbox = urlencode($mailbox);
       $urlMailbox = urlencode($mailbox);
 
 
       /** This is the beginning of the message list table.  It wraps around all messages */
       /** This is the beginning of the message list table.  It wraps around all messages */
-      echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1>";
+      echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0>";
 
 
       if ($startMessage < $endMessage) {
       if ($startMessage < $endMessage) {
          echo "<TR BGCOLOR=\"$color[4]\"><TD>";
          echo "<TR BGCOLOR=\"$color[4]\"><TD>";
@@ -217,7 +218,7 @@
       echo "<TR><TD BGCOLOR=\"$color[0]\">";
       echo "<TR><TD BGCOLOR=\"$color[0]\">";
 
 
       echo "\n\n\n<FORM name=messageList method=post action=\"move_messages.php?msg=$msg&mailbox=$urlMailbox&startMessage=$startMessage\">";
       echo "\n\n\n<FORM name=messageList method=post action=\"move_messages.php?msg=$msg&mailbox=$urlMailbox&startMessage=$startMessage\">";
-      echo "<TABLE BGCOLOR=\"$color[0]\" COLS=2 BORDER=0>\n";
+      echo "<TABLE BGCOLOR=\"$color[0]\" COLS=2 BORDER=0 cellpadding=0 cellspacing=0>\n";
       echo "   <TR>\n";
       echo "   <TR>\n";
       echo "      <TD WIDTH=60% ALIGN=LEFT>\n";
       echo "      <TD WIDTH=60% ALIGN=LEFT>\n";
       echo "         <NOBR><SMALL>". _("Move selected to:") ."</SMALL>";
       echo "         <NOBR><SMALL>". _("Move selected to:") ."</SMALL>";
@@ -328,7 +329,6 @@
          echo "<FONT COLOR=\"$color[9]\">Previous</FONT>\n";
          echo "<FONT COLOR=\"$color[9]\">Previous</FONT>\n";
          echo "<A HREF=\"right_main.php?use_mailbox_cache=1&startMessage=$nextGroup&mailbox=$urlMailbox\" TARGET=\"right\">" . _("Next") . "</A>\n";
          echo "<A HREF=\"right_main.php?use_mailbox_cache=1&startMessage=$nextGroup&mailbox=$urlMailbox\" TARGET=\"right\">" . _("Next") . "</A>\n";
       }
       }
-      echo "</TD></TR></TABLE>"; /** End of message-list table */
-
+      echo "</TD></TR></table>"; /** End of message-list table */
    }
    }
 ?>
 ?>

+ 1 - 0
functions/mime.php

@@ -494,6 +494,7 @@
 
 
    /** this function decodes the body depending on the encoding type. **/
    /** this function decodes the body depending on the encoding type. **/
    function decodeBody($body, $encoding) {
    function decodeBody($body, $encoding) {
+      $body = str_replace("\r\n", "\n", $body);
       $encoding = strtolower($encoding);
       $encoding = strtolower($encoding);
 
 
       if ($encoding == "quoted-printable") {
       if ($encoding == "quoted-printable") {

+ 12 - 2
src/download.php

@@ -95,15 +95,19 @@
       switch($type0) {
       switch($type0) {
          case "text":
          case "text":
             $body = decodeBody($body, $header->encoding);
             $body = decodeBody($body, $header->encoding);
-            #header("Content-type: $type0/$type1; name=\"$filename\"");
             header("Content-type: application/octet-stream; name=\"$filename\"");
             header("Content-type: application/octet-stream; name=\"$filename\"");
             header("Content-Disposition: attachment; filename=\"$filename\"");
             header("Content-Disposition: attachment; filename=\"$filename\"");
+            if ($type1 == "plain") {
+               echo _("Subject") . ": " . decodeHeader(stripslashes($header->subject)) . "\n";
+               echo "   " . _("From") . ": " . decodeHeader(stripslashes($header->from)) . "\n";
+               echo "     " . _("To") . ": " . decodeHeader(stripslashes(getLineOfAddrs($header->to))) . "\n";
+               echo "   " . _("Date") . ": " . getLongDateString($header->date) . "\n\n";
+            }
             echo trim($body);
             echo trim($body);
             break;
             break;
          default:
          default:
             $body = decodeBody($body, $header->encoding);
             $body = decodeBody($body, $header->encoding);
             header("Content-type: application/octet-stream; name=\"$filename\"");
             header("Content-type: application/octet-stream; name=\"$filename\"");
-            #header("Content-type: $type0/$type1; name=\"$filename\"");
             header("Content-Disposition: attachment; filename=\"$filename\"");
             header("Content-Disposition: attachment; filename=\"$filename\"");
             echo $body;
             echo $body;
             break;
             break;
@@ -112,6 +116,12 @@
       $body = decodeBody ($body, $header->encoding);
       $body = decodeBody ($body, $header->encoding);
       header("Content-type: $type0/$type1; name=\"$filename\"");
       header("Content-type: $type0/$type1; name=\"$filename\"");
       header("Content-disposition: attachment; filename=\"$filename\"");
       header("Content-disposition: attachment; filename=\"$filename\"");
+      if ($type0 == "text" && $type1 == "plain") {
+         echo _("Subject") . ": " . decodeHeader(stripslashes($header->subject)) . "\n";
+         echo "   " . _("From") . ": " . decodeHeader(stripslashes($header->from)) . "\n";
+         echo "     " . _("To") . ": " . decodeHeader(stripslashes(getLineOfAddrs($header->to))) . "\n";
+         echo "   " . _("Date") . ": " . getLongDateString($header->date) . "\n\n";
+      }
       echo $body;
       echo $body;
    } else {
    } else {
       switch ($type0) {
       switch ($type0) {

+ 3 - 3
src/read_body.php

@@ -39,7 +39,7 @@
       echo "<a href=\"read_body.php?mailbox=".urlencode($mailbox)."&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more\">";
       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";
       echo ""._("View message") . "</a></b></center></td></tr></table>\n";
       echo "<table width=99% cellpadding=2 cellspacing=0 border=0 align=center>\n";
       echo "<table width=99% cellpadding=2 cellspacing=0 border=0 align=center>\n";
-      echo "<tr><td><tt>";
+      echo "<tr><td><pre>";
       for ($i=1; $i < count($read)-1; $i++) {
       for ($i=1; $i < count($read)-1; $i++) {
          $read[$i] = htmlspecialchars($read[$i]);
          $read[$i] = htmlspecialchars($read[$i]);
          if (substr($read[$i], 0, 1) != "\t" && 
          if (substr($read[$i], 0, 1) != "\t" && 
@@ -47,11 +47,11 @@
              substr($read[$i], 0, 1) != "&" && 
              substr($read[$i], 0, 1) != "&" && 
              trim($read[$i])) {
              trim($read[$i])) {
             $pre = substr($read[$i], 0, strpos($read[$i], ":"));
             $pre = substr($read[$i], 0, strpos($read[$i], ":"));
-            $read[$i] = str_replace("$pre", "<b>$pre</b>", $read[$i]);
+            $read[$i] = str_replace("$pre", "<b>$pre</b>", decodeHeader($read[$i]));
          }
          }
          echo "$read[$i]";
          echo "$read[$i]";
       }
       }
-      echo "</tt></td></tr></table>\n";
+      echo "</pre></td></tr></table>\n";
       echo "</body></html>";
       echo "</body></html>";
       exit;
       exit;
    }
    }