Browse Source

Fix for badly formated date string from INTERNALDATE when using courier

Pontus Ullgren 23 years ago
parent
commit
f32c6c8fdd
1 changed files with 15 additions and 2 deletions
  1. 15 2
      functions/imap_messages.php

+ 15 - 2
functions/imap_messages.php

@@ -420,8 +420,21 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $issent) {
 	    if ($read_part{0} == '*') {
 	        if ($internaldate) {
 		    if (preg_match ("/^.+INTERNALDATE\s+\"(.+)\".+/iUA",$read_part, $reg)) {
-			$date = $reg[1];
-		    }
+                       if ($imap_server_type == 'courier') {
+                            /** If we use courier, 
+                              *  We need to reformat the INTERNALDATE-string 
+                              **/
+                            $tmpdate = trim($reg[1]);
+                            $tmpdate = str_replace('  ',' ',$tmpdate);
+                            $tmpdate = explode(' ',$tmpdate);
+                            $date = str_replace('-',' ',$tmpdate[0]) . " " .
+                                    $tmpdate[1] . " " .
+                                    $tmpdate[2];
+                        } 
+                        else {
+                            $date = $reg[1];
+                        }
+                }
 		}  
 		if (preg_match ("/^.+RFC822.SIZE\s+(\d+).+/iA",$read_part, $reg)) {
 		    $size = $reg[1];