浏览代码

- made the date like Netscape Messenger: if today show time, if this week
show day and time, else show month day year.
- Fixed error in the way we send the "from" header -- had been sending:
Luke Ehresman <luke@squirrelmail.org> without the quites.. needed them!
- Fixed error when parsing url messages. If it is longer than the word
wrap length, it doesn't wrap it.
- fixed bug reported to list about next/prev not working (needed urlMailbox)

Luke Ehresman 25 年之前
父节点
当前提交
323a7118d1
共有 7 个文件被更改,包括 53 次插入27 次删除
  1. 3 0
      ChangeLog
  2. 3 0
      INSTALL
  3. 13 1
      functions/date.php
  4. 2 2
      functions/page_header.php
  5. 23 19
      functions/strings.php
  6. 2 2
      src/compose.php
  7. 7 3
      src/read_body.php

+ 3 - 0
ChangeLog

@@ -1,5 +1,8 @@
 Version 0.5pre1 -- DEVELOPMENT
 ------------------------------
+- Date display now is similar to Netscape Messenger
+- Many bugs have been reported to the list, and been squashed
+- Help system developed 
 - Folder list now shows configurable details about messages
 - It is now possible to select multiple subscribes/unsubscribes
 - Removed a bunch of annoying "success" screens, improved navigation

+ 3 - 0
INSTALL

@@ -1,3 +1,6 @@
+Installing SquirrelMail
+=======================
+
 Table of Contents:
   1.  (PHP4)     Configure your webserver to work with PHP4
   2.  (IMAP)     Setting up IMAP (not covered)

+ 13 - 1
functions/date.php

@@ -181,7 +181,19 @@
    }
 
    function getDateString($stamp) {
-      return date("M j, Y", $stamp);
+      $now = time();
+      $midnight = $now - ($now % 86400) + 14400;
+
+      if ($midnight < $stamp) {
+         // Today
+         return date("g:i a", $stamp);
+      } else if ($midnight - 604800 < $stamp) {
+         // This week
+         return date("D, g:i a", $stamp);
+      } else {
+         // before this week 
+         return date("M j, Y", $stamp);
+      }
    }
 
    function getTimeStamp($dateParts) {

+ 2 - 2
functions/page_header.php

@@ -62,7 +62,7 @@
 
       if ($target != "")
          $target = " target=\"$target\"";
-
+      
       echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
    }
 
@@ -97,7 +97,7 @@
       echo "&nbsp;&nbsp;\n";
       displayInternalLink ("src/options.php", _("Options"), "right");
       echo "&nbsp;&nbsp;\n";
-      displayInternalLink ("src/webmail.php?right_frame=help.php", _("Help"), "Help Me!");
+      displayInternalLink ("src/help.php", _("Help"), "right");
       echo "&nbsp;&nbsp;\n";
 
       do_hook("menuline");

+ 23 - 19
functions/strings.php

@@ -53,27 +53,31 @@
       $i = 0;
       $line_len = strlen($words[$i])+1;
       $line = "";
-      while ($i < count($words)) {
-         while ($line_len < $wrap) {
-            $line = "$line$words[$i] ";
-            $i++;
-            $line_len = $line_len + strlen($words[$i])+1;
-         }
-         $line_len = strlen($words[$i])+1;
-         if ($line_len < $wrap) {
-            if ($i < count($words)) // don't <BR> the last line
-               $line = "$line\n";
-         } else {
-            $endline = $words[$i];
-            while ($line_len >= $wrap) {
-               $bigline = substr($endline, 0, $wrap);
-               $endline = substr($endline, $wrap, strlen($endline));
-               $line_len = strlen($endline);
-               $line = "$line$bigline<BR>";
+      if (count($words) > 1) {   
+         while ($i < count($words)-1) {
+            while ($line_len < $wrap) {
+               $line = "$line$words[$i] ";
+               $i++;
+               $line_len = $line_len + strlen($words[$i])+1;
+            }
+            $line_len = strlen($words[$i])+1;
+            if ($line_len < $wrap) {
+               if ($i < count($words)) // don't <BR> the last line
+                  $line = "$line\n";
+            } else {
+               $endline = $words[$i];
+               while ($line_len >= $wrap) {
+                  $bigline = substr($endline, 0, $wrap);
+                  $endline = substr($endline, $wrap, strlen($endline));
+                  $line_len = strlen($endline);
+                  $line = "$line$bigline<BR>";
+               }
+               $line = "$line$endline<BR>";
+               $i++;
             }
-            $line = "$line$endline<BR>";
-            $i++;
          }
+      } else {
+         $line = $words[0];
       }
 
       $line = str_replace(">", "&gt;", $line);

+ 2 - 2
src/compose.php

@@ -75,7 +75,7 @@
          $body = "";
          for ($i=0; $i < count($body_ary); $i++) {
             if ($i==0 && $forward_id) {
-               $tmp = "-------- " . _("Original Message") . " --------";
+               $tmp = "-------- " . _("Original Message") . " --------\n";
                $tmp .= _("Subject") . ": " . $orig_header->subject . "\n"; 
                $tmp .= "   " . _("From") . ": " . $orig_header->from . "\n"; 
                $tmp .= "     " . _("To") . ": " . $orig_header->to[0] . "\n"; 
@@ -151,7 +151,7 @@
          echo "// --></SCRIPT>\n\n";
       }
 
-      echo "\n<FORM name=compose action=\"compose.php\" METHOD=POST>\n";
+      echo "\n<FORM name=compose action=\"compose.php\" METHOD=POST ENCTYPE=\"multipart/form-data\">\n";
       if ($reply_id) {
          echo "<input type=hidden name=reply_id value=$reply_id>\n";
       }		 

+ 7 - 3
src/read_body.php

@@ -179,7 +179,7 @@
    $subject = decodeHeader(htmlspecialchars(stripslashes($message->header->subject)));
 
    echo "<BR>";
-   echo "<TABLE COLS=1 CELLSPACING=0 WIDTH=98% BORDER=0 ALIGN=CENTER CELLPADDING=0>\n";
+   echo "<TABLE COLS=1 CELLSPACING=0 WIDTH=100% BORDER=0 ALIGN=CENTER CELLPADDING=0>\n";
    echo "   <TR><TD BGCOLOR=\"$color[9]\" WIDTH=100%>";
    echo "      <TABLE WIDTH=100% CELLSPACING=0 BORDER=0 COLS=2 CELLPADDING=3>";
    echo "         <TR>";
@@ -200,11 +200,11 @@
       $prev = findPreviousMessage();
       $next = findNextMessage();
       if ($prev != -1)
-         echo "<a href=\"read_body.php?passed_id=$prev&mailbox=$mailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Previous") . "</A>&nbsp;|&nbsp;";
+         echo "<a href=\"read_body.php?passed_id=$prev&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Previous") . "</A>&nbsp;|&nbsp;";
       else
          echo _("Previous") . "&nbsp;|&nbsp;";
       if ($next != -1)
-         echo "<a href=\"read_body.php?passed_id=$next&mailbox=$mailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Next") . "</A>";
+         echo "<a href=\"read_body.php?passed_id=$next&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Next") . "</A>";
       else
          echo _("Next");
    }
@@ -272,6 +272,8 @@
    }
    echo "</TABLE>";
    echo "   </TD></TR>";
+   echo "</table>";
+   echo "<TABLE COLS=1 CELLSPACING=0 WIDTH=100% BORDER=0 ALIGN=CENTER CELLPADDING=0>\n";
 
    echo "   <TR><TD BGCOLOR=\"$color[4]\" WIDTH=100%>\n";
    $body = formatBody($imapConnection, $message, $color, $wrap_at);
@@ -280,6 +282,8 @@
    echo "$body";
 
    echo "   </TD></TR>\n";
+   echo "</table>";
+   echo "<TABLE COLS=1 CELLSPACING=0 WIDTH=100% BORDER=0 ALIGN=CENTER CELLPADDING=0>\n";
    echo "   <TR><TD BGCOLOR=\"$color[9]\">&nbsp;</TD></TR>";
    echo "</TABLE>\n";