Fixed a glich that caused the 'Viewing message' line to show a strange colour when...
[squirrelmail.git] / functions / imap_general.php
index d2812bdfb0bdb43c4215a9eb42f513ac920fc831..5ee384040a778464b571ddb0ee95dcf67d10facd 100755 (executable)
@@ -1,4 +1,4 @@
-<?
+<?php
    /**
     **  imap.php
     **
@@ -97,7 +97,7 @@
                               <td bgcolor=dcdcdc>
                                  <font color=cc0000>
                                  <center>
-                                 <? echo _("ERROR") ?>
+                                 <?php echo _("ERROR") ?>
                                  </center>
                                  </font>
                               </td>
                            <tr>
                               <td>
                                  <center>
-                                 <? echo _("Unknown user or password incorrect.") ?><br>
-                                 <a href="login.php"><? echo _("Click here to try again") ?></a>
+                                 <?php echo _("Unknown user or password incorrect.") ?><br>
+                                 <a href="login.php"><?php echo _("Click here to try again") ?></a>
                                  </center>
                               </td>
                            </tr>
                         </center>
                      </body>
                   </html>
-               <?
+               <?php
+               session_destroy();
                exit;
             } else {
                echo "Unknown error: $read<br>";
     **  Returns the delimeter between mailboxes:  INBOX/Test, or INBOX.Test... 
     ******************************************************************************/
    function sqimap_get_delimiter ($imap_stream) {
-      fputs ($imap_stream, ". LIST \"\" *\r\n");
+      fputs ($imap_stream, ". LIST \"INBOX\" \"\"\r\n");
       $read = sqimap_read_data($imap_stream, ".", true, $a, $b);
       $quote_position = strpos ($read[0], "\"");
       $delim = substr ($read[0], $quote_position+1, 1);
          if (strpos($string, "<") == 1) {
             $string = sqimap_find_email($string);
          } else {
+            $string = trim($string);
             $string = substr($string, 0, strpos($string, "<"));
+            $string = ereg_replace ("\"", "", $string);   
          }   
       }
       return $string; 
    /******************************************************************************
     **  Saves a message to a given folder -- used for saving sent messages
     ******************************************************************************/
-   function sqimap_append ($imap_stream, $mailbox, $body, $to, $cc, $bcc, $subject, $data_dir, $username, $domain, $version) {
-      global $sent_folder, $data_dir;
-
-      $from = getPref($data_dir, $username, "full_name");
-      $from_addr = getPref($data_dir, $username, "email_address");
-      if ($from_addr == "")
-         $from_addr = "$username@$domain";
-
-      if ($from == "")
-         $from = "<$from_addr>";
-      else
-         $from = $from . " <$from_addr>";
-
-      $message  = "Date: ".date("D, j M Y H:i:s ", mktime()) . timezone() . "\r\n";
-      $message .= "Subject: ". $subject."\r\n";
-      $message .= "From: ".$from."\r\n";
-      $message .= "To: ".$to."\r\n";
-      if ($cc_list) {
-         $message .= "Cc: ".$cc."\r\n"; // Who the CCs are
-      }
-      $message .= "Content-Type: text/plain; charset=ISO-8859-1\r\n";
-      $message .= "Content-Transfer-Encoding: 8bit\r\n";
-      $message .= "\r\n";
-      $message .= stripslashes($body) . "\r\n";
-      $message .= "\r\n";
-      
-      $size = count_chars($message);
-      fputs ($imap_stream, "a001 APPEND $sent_folder (\\Seen) \{$size}\r\n");
-      fputs ($imap_stream, "$message");
-
-      $read_ary = sqimap_read_data ($imap_stream, "a001", true, $result, $message);
+   function sqimap_append ($imap_stream, $sent_folder, $length) {
+      fputs ($imap_stream, "a001 APPEND \"$sent_folder\" (\\Seen) \{$length}\r\n");
+      $tmp = fgets ($imap_stream, 1024);
    } 
+
+   function sqimap_append_done ($imap_stream) {
+      fputs ($imap_stream, "\r\n");
+      $tmp = fgets ($imap_stream, 1024);
+   }
 ?>