Further XSS improvements plus a bugfix.
[squirrelmail.git] / functions / imap_messages.php
index cfc49e00e796bbe1695feda2e51b62cbd6b242e8..33b962b6f5f407aa6b1036e85452ac24bb287638 100755 (executable)
@@ -333,7 +333,7 @@ function elapsedTime($start) {
 
 
 function sqimap_get_small_header_list ($imap_stream, $msg_list, $issent) {
-    global $squirrelmail_language, $color, $data_dir, $username;
+    global $squirrelmail_language, $color, $data_dir, $username, $imap_server_type;
     $start = gettimeofday();
     /* Get the small headers for each message in $msg_list */
     $sid = sqimap_session_id();
@@ -420,23 +420,13 @@ 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)) {
-                       if ( ($imap_server_type == 'courier')
-                           || ($imap_server_type == 'macosx')
-                           || ($imap_server_type == 'cyrus') ) {
-                            /** 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];
-                        }
-                }
+                        $tmpdate = trim($reg[1]);
+                        $tmpdate = str_replace('  ',' ',$tmpdate);
+                        $tmpdate = explode(' ',$tmpdate);
+                        $date = str_replace('-',' ',$tmpdate[0]) . " " .
+                                $tmpdate[1] . " " .
+                                $tmpdate[2];
+                    }
                }  
                if (preg_match ("/^.+RFC822.SIZE\s+(\d+).+/iA",$read_part, $reg)) {
                    $size = $reg[1];
@@ -629,7 +619,17 @@ function sqimap_get_entity_header ($imap_stream, &$read, &$type0, &$type1, &$bou
     $charset = $header["CHARSET"];
     $filename = $header["FILENAME"];
 }
-*/
+
+/* function to get the mime headers */
+function sqimap_get_mime_ent_header ($imap_stream, $id, $mailbox, $ent) {
+    $read = sqimap_run_command ($imap_stream, "FETCH $id:$id BODY[$ent.MIME]", true, $response, $message);
+    $header = sqimap_get_header($imap_stream, $read); 
+    $header->id = $id;
+    $header->mailbox = $mailbox;
+    return $header;
+}
+
+
 /* Queries the IMAP server and gets all header information. */
 function sqimap_get_header ($imap_stream, $read) {
     global $where, $what;