Minor HTML change to make Opera see the message list like Netscape
[squirrelmail.git] / functions / imap_messages.php
index fe7e7cbcfb7975351f8e02cf79ea9cf5ad85ca7e..3d6c8f0bb97122f4de742dabf163a80c2a6afe17 100755 (executable)
@@ -5,7 +5,7 @@
     **  This implements functions that manipulate messages 
     **/
 
-   if (!$mime_php) include "../functions/mime.php";
+   if (!isset($mime_php)) include "../functions/mime.php";
 
    /******************************************************************************
     **  Copies specified messages to specified folder
@@ -21,7 +21,7 @@
    function sqimap_messages_delete ($imap_stream, $start, $end, $mailbox) {
       global $move_to_trash, $trash_folder, $auto_expunge;
 
-      if (($move_to_trash == true) && (sqimap_mailbox_exists($imap_stream, $trash_folder))) {
+      if (($move_to_trash == true) && (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder))) {
          sqimap_messages_copy ($imap_stream, $start, $end, $trash_folder);
          sqimap_messages_flag ($imap_stream, $start, $end, "Deleted");
       } else {
@@ -45,7 +45,6 @@
    }
         
    function sqimap_get_small_header ($imap_stream, $id, $sent) {
-      global $where, $what;
 
       fputs ($imap_stream, "a001 FETCH $id BODY.PEEK[HEADER.FIELDS (Date To From Cc Subject Message-Id X-Priority)]\r\n");
       $read = sqimap_read_data ($imap_stream, "a001", true, $response, $message);
          }
       }
 
-      if ($where == "SUBJECT") {
-         $subject = eregi_replace($what, "<b>\\0</b>", $subject);
+      // If there isn't a date, it takes the internal date and uses
+      // that as the normal date.
+      if (trim($date) == "") {
+         fputs ($imap_stream, "a002 FETCH $id INTERNALDATE\r\n");
+         $internal_read = sqimap_read_data ($imap_stream, "a002", true, $r, $m);
+
+         // * 22 FETCH (INTERNALDATE " 8-Sep-2000 13:17:07 -0500")
+         $date = $internal_read[0];
+         $date = eregi_replace(".*internaldate \"", "", $date);
+         $date = eregi_replace("\".*", "", $date);
+         $date_ary = explode(" ", trim($date));
+         $date_ary[0] = str_replace("-", " ", $date_ary[0]);
+         $date = implode (" ", $date_ary);
       }
-      
+
       $header = new small_header;
       if ($sent == true)
          $header->from = $to;