[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squirrelmail-cvs
Subject:    [SM-CVS] SF.net SVN: squirrelmail: [12283] trunk/squirrelmail
From:       kink () users ! sourceforge ! net
Date:       2007-02-27 18:57:19
Message-ID: E1HM7Vm-0004xt-Vt () sc8-pr-svn2 ! sourceforge ! net
[Download RAW message or body]

Revision: 12283
          http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=12283&view=rev
Author:   kink
Date:     2007-02-27 10:57:18 -0800 (Tue, 27 Feb 2007)

Log Message:
-----------
also store the unparsed date, and display it when we
failed to parse a Date. This allows RFC-incompatible
dates to still be seen in e.g. read_body in their
original form, better than nothing. For safety split
any "<",">" out, something might rely on the date being
completely safe to print.

Modified Paths:
--------------
    trunk/squirrelmail/class/mime/Message.class.php
    trunk/squirrelmail/class/mime/Rfc822Header.class.php
    trunk/squirrelmail/functions/date.php
    trunk/squirrelmail/src/compose.php
    trunk/squirrelmail/src/printer_friendly_bottom.php
    trunk/squirrelmail/src/read_body.php

Modified: trunk/squirrelmail/class/mime/Message.class.php
===================================================================
--- trunk/squirrelmail/class/mime/Message.class.php	2007-02-27 18:22:00 UTC (rev \
                12282)
+++ trunk/squirrelmail/class/mime/Message.class.php	2007-02-27 18:57:18 UTC (rev \
12283) @@ -618,6 +618,7 @@
             if (!$arg_a[1]) $arg_a[1] = _("(no subject)");
 
             $hdr->date = getTimeStamp($d); /* argument 1: date */
+            $hdr->date_unparsed = strtr($d,'<>','  '); /* original date */
             $hdr->subject = $arg_a[1];     /* argument 2: subject */
             $hdr->from = is_array($arg_a[2]) ? $arg_a[2][0] : '';     /* argument 3: \
                from        */
             $hdr->sender = is_array($arg_a[3]) ? $arg_a[3][0] : '';   /* argument 4: \
sender      */

Modified: trunk/squirrelmail/class/mime/Rfc822Header.class.php
===================================================================
--- trunk/squirrelmail/class/mime/Rfc822Header.class.php	2007-02-27 18:22:00 UTC (rev \
                12282)
+++ trunk/squirrelmail/class/mime/Rfc822Header.class.php	2007-02-27 18:57:18 UTC (rev \
12283) @@ -30,6 +30,11 @@
      */
     var $date = -1;
     /**
+     * Date_original header
+     * @var mixed
+     */
+    var $date_unparsed = '';
+    /**
      * Subject header
      * @var string
      */
@@ -234,6 +239,7 @@
                 $d = strtr($value, array('  ' => ' '));
                 $d = explode(' ', $d);
                 $this->date = getTimeStamp($d);
+                $this->date_unparsed = strtr($value,'<>','  ');
                 break;
             case 'subject':
                 $this->subject = $value;
@@ -343,7 +349,7 @@
                 $value = $this->stripComments($value);
                 $this->mlist('id', $value);
                 break;
-	    case 'x-spam-status':
+            case 'x-spam-status':
                 $this->x_spam_status = $this->parseSpamStatus($value);
                 break;
             default:

Modified: trunk/squirrelmail/functions/date.php
===================================================================
--- trunk/squirrelmail/functions/date.php	2007-02-27 18:22:00 UTC (rev 12282)
+++ trunk/squirrelmail/functions/date.php	2007-02-27 18:57:18 UTC (rev 12283)
@@ -305,14 +305,15 @@
  * and taking localization into accout.
  *
  * @param int stamp the timestamp
+ * @param string fallback string to use when stamp not valid
  * @return string the long date string
  */
-function getLongDateString( $stamp ) {
+function getLongDateString( $stamp, $fallback = '' ) {
 
     global $hour_format;
 
     if ($stamp == -1) {
-        return '';
+        return $fallback;
     }
 
     if ( $hour_format == SMPREF_TIME_12HR ) {

Modified: trunk/squirrelmail/src/compose.php
===================================================================
--- trunk/squirrelmail/src/compose.php	2007-02-27 18:22:00 UTC (rev 12282)
+++ trunk/squirrelmail/src/compose.php	2007-02-27 18:57:18 UTC (rev 12283)
@@ -285,7 +285,7 @@
     $bodyTop =  sq_str_pad(' '._("Original Message").' ',$editor_size \
-2,'-',STR_PAD_BOTH,$default_charset) .  "\n". $display[_("Subject")] . $subject . \
"\n" .  $display[_("From")] . $from . "\n" .
-        $display[_("Date")] . getLongDateString( $orig_header->date ). "\n" .
+        $display[_("Date")] . getLongDateString( $orig_header->date, \
$orig_header->date_unparsed ). "\n" .  $display[_("To")] . $to . "\n";
     if ($orig_header->cc != array() && $orig_header->cc !='') {
         $cc = decodeHeader($orig_header->getAddr_s('cc',"\n$indent"),false,false,true);
 @@ -928,7 +928,7 @@
                 }
                 /* this corrects some wrapping/quoting problems on replies */
                 $rewrap_body = explode("\n", $body);
-                $from =  (is_array($orig_header->from)) ? $orig_header->from[0] : \
$orig_header->from; +                $from = (is_array($orig_header->from) && \
!empty($orig_header->from)) ? $orig_header->from[0] : $orig_header->from;  $body = \
                '';
                 $strip_sigs = getPref($data_dir, $username, 'strip_sigs');
                 foreach ($rewrap_body as $line) {

Modified: trunk/squirrelmail/src/printer_friendly_bottom.php
===================================================================
--- trunk/squirrelmail/src/printer_friendly_bottom.php	2007-02-27 18:22:00 UTC (rev \
                12282)
+++ trunk/squirrelmail/src/printer_friendly_bottom.php	2007-02-27 18:57:18 UTC (rev \
12283) @@ -52,7 +52,7 @@
 $rfc822_header = $message->rfc822_header;
 /* From and Date are usually fine as they are... */
 $from = $rfc822_header->getAddr_s('from');
-$date = getLongDateString($rfc822_header->date);
+$date = getLongDateString($rfc822_header->date, $rfc822_header->date_unparsed);
 $subject = trim($rfc822_header->subject);
 
 /* we can clean these up if the list is too long... */

Modified: trunk/squirrelmail/src/read_body.php
===================================================================
--- trunk/squirrelmail/src/read_body.php	2007-02-27 18:22:00 UTC (rev 12282)
+++ trunk/squirrelmail/src/read_body.php	2007-02-27 18:57:18 UTC (rev 12283)
@@ -174,7 +174,7 @@
     }
 
     // part 1 (RFC2298)
-    $senton = getLongDateString( $header->date );
+    $senton = getLongDateString( $header->date, $header->date_unparsed );
     $to_array = $header->to;
     $to = '';
     foreach ($to_array as $line) {
@@ -372,7 +372,7 @@
         $env[_("From")] = _("Unknown sender");
     else
         $env[_("From")] = decodeHeader($from_name);
-    $env[_("Date")] = getLongDateString($header->date);
+    $env[_("Date")] = getLongDateString($header->date, $header->date_unparsed);
     $env[_("To")] = formatRecipientString($header->to, "to");
     $env[_("Cc")] = formatRecipientString($header->cc, "cc");
     $env[_("Bcc")] = formatRecipientString($header->bcc, "bcc");


This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
--
squirrelmail-cvs mailing list
List Address: squirrelmail-cvs@lists.sourceforge.net
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
http://squirrelmail.org/cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic