[Svn] r2009 - in trunk/roundcubemail: . program/include program/lib/Mail program/steps/mail

trac at roundcube.net trac at roundcube.net
Sat Oct 25 02:01:45 CEST 2008


Author: estadtherr
Date: 2008-10-24 19:01:45 -0500 (Fri, 24 Oct 2008)
New Revision: 2009

Modified:
   trunk/roundcubemail/index.php
   trunk/roundcubemail/program/include/main.inc
   trunk/roundcubemail/program/include/rcube_imap.php
   trunk/roundcubemail/program/include/rcube_message.php
   trunk/roundcubemail/program/lib/Mail/mime.php
   trunk/roundcubemail/program/steps/mail/show.inc
Log:
added obscure ASCII encoding aliases, added more error checking to RFC2822 date parsing

Modified: trunk/roundcubemail/index.php
===================================================================
--- trunk/roundcubemail/index.php	2008-10-24 08:30:52 UTC (rev 2008)
+++ trunk/roundcubemail/index.php	2008-10-25 00:01:45 UTC (rev 2009)
@@ -49,7 +49,6 @@
   }
 }
 
-
 // check if config files had errors
 if ($err_str = $RCMAIL->config->get_error()) {
   raise_error(array(
@@ -66,7 +65,6 @@
     'message' => $err_str), FALSE, TRUE);
 }
 
-
 // error steps
 if ($RCMAIL->action=='error' && !empty($_GET['_code'])) {
   raise_error(array('code' => hexdec($_GET['_code'])), FALSE, TRUE);

Modified: trunk/roundcubemail/program/include/main.inc
===================================================================
--- trunk/roundcubemail/program/include/main.inc	2008-10-24 08:30:52 UTC (rev 2008)
+++ trunk/roundcubemail/program/include/main.inc	2008-10-25 00:01:45 UTC (rev 2009)
@@ -188,12 +188,14 @@
     return $str;
     
   $aliases = array(
-    'US-ASCII'       => 'ISO-8859-1',
-    'UNKNOWN-8BIT'   => 'ISO-8859-15',
-    'X-UNKNOWN'      => 'ISO-8859-15',
-    'X-USER-DEFINED' => 'ISO-8859-15',
-    'ISO-8859-8-I'   => 'ISO-8859-8',
-    'KS_C_5601-1987' => 'EUC-KR',
+    'US-ASCII'         => 'ISO-8859-1',
+    'ANSI_X3.110-1983' => 'ISO-8859-1',
+    'ANSI_X3.4-1968'   => 'ISO-8859-1',
+    'UNKNOWN-8BIT'     => 'ISO-8859-15',
+    'X-UNKNOWN'        => 'ISO-8859-15',
+    'X-USER-DEFINED'   => 'ISO-8859-15',
+    'ISO-8859-8-I'     => 'ISO-8859-8',
+    'KS_C_5601-1987'   => 'EUC-KR',
   );
 
   // convert charset using iconv module  
@@ -684,10 +686,10 @@
     $ts = $date;
   else if (!empty($date))
     {
-    while (($ts = @strtotime($date))===false)
+    // if date parsing fails, we have a date in non-rfc format.
+    // remove token from the end and try again
+    while ((($ts = @strtotime($date))===false) || ($ts < 0))
       {
-        // if we have a date in non-rfc format
-        // remove token from the end and try again
         $d = explode(' ', $date);
         array_pop($d);
         if (!$d) break;
@@ -825,7 +827,7 @@
   $log_entry = sprintf("[%s]: %s\n",
                  date("d-M-Y H:i:s O", mktime()),
                  $line);
-                 
+
   if ($CONFIG['log_driver'] == 'syslog') {
     if ($name == 'errors')
       $prio = LOG_ERR;
@@ -836,10 +838,11 @@
     // log_driver == 'file' is assumed here
     if (empty($CONFIG['log_dir']))
       $CONFIG['log_dir'] = INSTALL_PATH.'logs';
-      
+
     // try to open specific log file for writing
     if ($fp = @fopen($CONFIG['log_dir'].'/'.$name, 'a')) {
       fwrite($fp, $log_entry);
+      fflush($fp);
       fclose($fp);
     }
   }

Modified: trunk/roundcubemail/program/include/rcube_imap.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_imap.php	2008-10-24 08:30:52 UTC (rev 2008)
+++ trunk/roundcubemail/program/include/rcube_imap.php	2008-10-25 00:01:45 UTC (rev 2009)
@@ -1025,14 +1025,16 @@
     $headers = &$this->get_cached_message($cache_key, $uid, true);
 
     // return cached message structure
-    if (is_object($headers) && is_object($headers->structure))
+    if (is_object($headers) && is_object($headers->structure)) {
       return $headers->structure;
-    
+    }
+
     // resolve message sequence number
-    if (!($msg_id = $this->_uid2id($uid)))
+    if (!($msg_id = $this->_uid2id($uid))) {
       return FALSE;
+    }
 
-    $structure_str = iil_C_FetchStructureString($this->conn, $this->mailbox, $msg_id); 
+    $structure_str = iil_C_FetchStructureString($this->conn, $this->mailbox, $msg_id);
     $structure = iml_GetRawStructureArray($structure_str);
     $struct = false;
 

Modified: trunk/roundcubemail/program/include/rcube_message.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_message.php	2008-10-24 08:30:52 UTC (rev 2008)
+++ trunk/roundcubemail/program/include/rcube_message.php	2008-10-25 00:01:45 UTC (rev 2009)
@@ -63,7 +63,7 @@
       'prefer_html' => $this->app->config->get('prefer_html'),
       'get_url' => rcmail_url('get', array('_mbox' => $this->imap->get_mailbox_name(), '_uid' => $uid))
     );
-    
+
     if ($this->structure = $this->imap->get_structure($uid)) {
       $this->get_mime_numbers($this->structure);
       $this->parse_structure($this->structure);

Modified: trunk/roundcubemail/program/lib/Mail/mime.php
===================================================================
--- trunk/roundcubemail/program/lib/Mail/mime.php	2008-10-24 08:30:52 UTC (rev 2008)
+++ trunk/roundcubemail/program/lib/Mail/mime.php	2008-10-25 00:01:45 UTC (rev 2009)
@@ -1068,7 +1068,6 @@
                     //Concat the double quotes and encoded string together
                     $hdr_value = $quotePrefix . $hdr_value . $quoteSuffix;
                     
-
                     $hdr_value_out = $hdr_value;
                     $realMax = $maxLength1stLine + strlen($prefix . $suffix);
                     if (strlen($hdr_value_out) >= $realMax) {

Modified: trunk/roundcubemail/program/steps/mail/show.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/show.inc	2008-10-24 08:30:52 UTC (rev 2008)
+++ trunk/roundcubemail/program/steps/mail/show.inc	2008-10-25 00:01:45 UTC (rev 2009)
@@ -24,7 +24,7 @@
 // similar code as in program/steps/mail/get.inc
 if ($_GET['_uid']) {
   $MESSAGE = new rcube_message(get_input_value('_uid', RCUBE_INPUT_GET));
-  
+
   // set message charset as default
   if (!empty($MESSAGE->headers->charset))
     $IMAP->set_charset($MESSAGE->headers->charset);
@@ -217,7 +217,7 @@
 if ($RCMAIL->action=='print' && $OUTPUT->template_exists('printmessage'))
   $OUTPUT->send('printmessage');
 else if ($RCMAIL->action=='preview' && $OUTPUT->template_exists('messagepreview'))
-    $OUTPUT->send('messagepreview');
+  $OUTPUT->send('messagepreview');
 else
   $OUTPUT->send('message');
 ?>

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list