Rewrote imap functions
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 21 Feb 2000 12:00:35 +0000 (12:00 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 21 Feb 2000 12:00:35 +0000 (12:00 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@228 7612ce4b-ef26-0410-bec9-ea0150e637f0

15 files changed:
src/compose.php
src/delete_message.php
src/download.php
src/empty_trash.php
src/folders.php
src/folders_create.php
src/folders_delete.php
src/folders_rename_do.php
src/folders_rename_getname.php
src/left_main.php
src/move_messages.php
src/options.php
src/options_submit.php
src/read_body.php
src/right_main.php

index b42a551..6e73f0b 100644 (file)
@@ -11,7 +11,6 @@
    include("../functions/strings.php");
    include("../functions/page_header.php");
    include("../functions/imap.php");
-   include("../functions/mailbox.php");
    include("../functions/date.php");
    include("../functions/mime.php");
    include("../functions/smtp.php");
@@ -20,7 +19,7 @@
    include("../src/load_prefs.php");
 
    echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
-   $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
+   $imapConnection = sqimap_login($username, $key, $imapServerAddress, 0);
    displayPageHeader($color, "None");
 
    // This function is used when not sending or adding attachments
@@ -29,8 +28,8 @@
          $reply_id, $send_to, $send_to_cc, $mailbox;
 
       if ($forward_id) {
-         selectMailbox($imapConnection, $mailbox, $numMessages);
-         $msg = fetchMessage($imapConnection, $forward_id, $mailbox);
+         sqimap_mailbox_select($imapConnection, $mailbox);
+         $msg = sqimap_get_message($imapConnection, $forward_id, $mailbox);
          
          if (containsType($msg, "text", "html", $ent_num)) {
             $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]);
@@ -65,8 +64,8 @@
       }
       
       if ($reply_id) {
-         selectMailbox($imapConnection, $mailbox, $numMessages);
-         $msg = fetchMessage($imapConnection, $reply_id, $mailbox);
+         sqimap_mailbox_select($imapConnection, $mailbox);
+         $msg = sqimap_get_message($imapConnection, $reply_id, $mailbox);
          
          if (containsType($msg, "text", "html", $ent_num)) {
             $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false);
          }
       }
       
-      // Add some decoding information
-      $send_to = encodeEmailAddr($send_to);
-      // parses the field and returns only the email address
-      $send_to = decodeEmailAddr($send_to);
+      $send_to = sqimap_find_displayable_name($send_to);
       
       $send_to = strtolower($send_to);
       $send_to = ereg_replace("\"", "", $send_to);
             if ($sendcc[$i] == "")
                continue;
             
-            $sendcc[$i] = encodeEmailAddr($sendcc[$i]);
-            $sendcc[$i] = decodeEmailAddr($sendcc[$i]);
-            
-            $whofrom = encodeEmailAddr($msg["HEADER"]["FROM"]);
-            $whofrom = decodeEmailAddr($whofrom);
-            
-            $whoreplyto = encodeEmailAddr($msg["HEADER"]["REPLYTO"]);
-            $whoreplyto = decodeEmailAddr($whoreplyto);
+            $sendcc[$i] = sqimap_find_displayable_name($sendcc[$i]);
+            $whofrom = sqimap_find_displayable_name($msg["HEADER"]["FROM"]);
+            $whoreplyto = sqimap_find_email($msg["HEADER"]["REPLYTO"]);
          
             if ((strtolower(trim($sendcc[$i])) != strtolower(trim($whofrom))) &&
                 (strtolower(trim($sendcc[$i])) != strtolower(trim($whoreplyto))) &&
       echo "   <TR>\n";
       echo "      <TD BGCOLOR=\"$color[4]\" COLSPAN=2>\n";
       if ($use_signature == true)
-         echo "         &nbsp;&nbsp;<TEXTAREA NAME=body ROWS=20 COLS=\"$editor_size\" WRAP=HARD>". $body . "\n\n-- \n".$signature."</TEXTAREA><BR>";
+         echo "         &nbsp;&nbsp;<TEXTAREA NAME=body ROWS=20 COLS=\"$editor_size\" WRAP=HARD>". $body . "\n\n".$signature."</TEXTAREA><BR>";
       else
          echo "         &nbsp;&nbsp;<TEXTAREA NAME=body ROWS=20 COLS=\"$editor_size\" WRAP=HARD>".$body."</TEXTAREA><BR>\n";
       echo "      </TD>\n";
index cf6a365..8c1a12d 100644 (file)
@@ -1,6 +1,5 @@
 <?
    include("../config/config.php");
-   include("../functions/mailbox.php");
    include("../functions/strings.php");
    include("../functions/page_header.php");
    include("../functions/display_messages.php");
 
    echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
 
-   $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
-   selectMailbox($imapConnection, $mailbox, $numMessages, $imapServerAddress);
+   $imapConnection = sqimap_login($username, $key, $imapServerAddress, 0);
+   sqimap_mailbox_select($imapConnection, $mailbox);
 
    displayPageHeader($color, $mailbox);
 
-   deleteMessages($imapConnection, $message, $message, $numMessages, $trash_folder, $move_to_trash, $auto_expunge, $mailbox);
+   sqimap_message_delete($imapConnection, $message, $message, $mailbox);
    messages_deleted_message($mailbox, $sort, $startMessage, $color);
 ?>
 </BODY></HTML>
index 6aa7a89..2a5b1a6 100644 (file)
@@ -4,7 +4,6 @@
    include("../functions/page_header.php");
    include("../functions/imap.php");
    include("../functions/mime.php");
-   include("../functions/mailbox.php");
    include("../functions/date.php");
 
    include("../src/load_prefs.php");
       echo "</TT></TD></TR></TABLE>";
    }
 
-   $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
-   selectMailbox($imapConnection, $mailbox, $numMessages);
+   $imapConnection = sqimap_login($username, $key, $imapServerAddress, 0);
+   sqimap_mailbox_select($imapConnection, $mailbox);
 
    // $message contains all information about the message
    // including header and body
-   $message = fetchMessage($imapConnection, $passed_id, $mailbox);
+   $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
 
    $type0 = $message["ENTITIES"][$passed_ent_id]["TYPE0"];
    $type1 = $message["ENTITIES"][$passed_ent_id]["TYPE1"];
@@ -79,5 +78,5 @@
       }
    }
 
-   fputs($imapConnection, "1 logout\n");
+   sqimap_logout($imapConnection);
 ?>
index 4e63c85..a5f39ea 100644 (file)
@@ -1,6 +1,5 @@
 <?
    include("../config/config.php");
-   include("../functions/mailbox.php");
    include("../functions/strings.php");
    include("../functions/page_header.php");
    include("../functions/display_messages.php");
@@ -9,15 +8,15 @@
 
    include("../src/load_prefs.php");
 
-   $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
+   $imapConnection = sqimap_login($username, $key, $imapServerAddress, 0);
 
-   getFolderList($imapConnection, $boxes);
+   sqimap_mailbox_list($imapConnection, $boxes);
 
    $mailbox = $trash_folder;
    fputs($imapConnection, "1 LIST \"$mailbox\" *\n");
-   $data = imapReadData($imapConnection , "1", false, $response, $message);
+   $data = sqimap_read_data($imapConnection , "1", false, $response, $message);
       
-   $dm = findMailboxDelimeter($imapConnection);
+   $dm = sqimap_get_delimiter($imapConnection);
    
    // According to RFC2060, a DELETE command should NOT remove inferiors (sub folders)
    //    so lets go through the list of subfolders and remove them before removing the
 //   }
 
    // lets remove the trash folder
-   removeFolder($imapConnection, $mailbox, $dm);
+//   sqimap_mailbox_delete($imapConnection, $mailbox, $dm);
+   sqimap_mailbox_create($imapConnection, "$trash_folder", "");
 
-   createFolder($imapConnection, "$trash_folder", "");
-
-   selectMailbox($imapConnection, $trash_folder, $numMessages);
+   sqimap_mailbox_select($imapConnection, $trash_folder, $numMessages);
    echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
    displayPageHeader($color, $mailbox);
    messages_deleted_message($trash_folder, $sort, $startMessage, $color);
-   fputs($imapConnection, "1 logout");
+   sqimap_logout($imapConnection);
 ?>
index 4718e76..e51d47e 100644 (file)
@@ -3,7 +3,6 @@
    include("../functions/strings.php");
    include("../functions/page_header.php");
    include("../functions/imap.php");
-   include("../functions/mailbox.php");
    include("../functions/array.php");
 
    include("../src/load_prefs.php");
@@ -20,8 +19,8 @@
    echo "   </TD></TR>\n";
    echo "</TABLE>\n";
 
-   $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
-   getFolderList($imapConnection, $boxes);
+   $imapConnection = sqimap_login ($username, $key, $imapServerAddress, 0);
+   $boxes = sqimap_mailbox_list($imapConnection);
 
    /** DELETING FOLDERS **/
    echo "<TABLE WIDTH=70% COLS=1 ALIGN=CENTER>\n";
    for ($i = 0; $i < count($boxes); $i++) {
       $use_folder = true;
       for ($p = 0; $p < count($special_folders); $p++) {
-         if ($boxes[$i]["UNFORMATTED"] == $special_folders[$p]) {
+         if ($boxes[$i]["unformatted"] == $special_folders[$p]) {
             $use_folder = false;
-         } else if (substr($boxes[$i]["UNFORMATTED"], 0, strlen($trash_folder)) == $trash_folder) {
+         } else if (substr($boxes[$i]["unformatted"], 0, strlen($trash_folder)) == $trash_folder) {
             $use_folder = false;
          }
       }
       if ($use_folder == true) {
-         $box = $boxes[$i]["UNFORMATTED"];
-         $box2 = $boxes[$i]["FORMATTED"];
+         $box = $boxes[$i]["unformatted"];
+         $box2 = replace_spaces($boxes[$i]["formatted"]);
          echo "         <OPTION VALUE=\"$box\">$box2\n";
       }
    }
       echo "<OPTION>[ None ]\n";
 
    for ($i = 0; $i < count($boxes); $i++) {
-      if (($boxes[$i]["UNFORMATTED"] == $special_folders[0]) && ($default_sub_of_inbox == true)) {
-         $box = $boxes[$i]["UNFORMATTED"];
-         $box2 = $boxes[$i]["FORMATTED"];
+      if (($boxes[$i]["unformatted"] == $special_folders[0]) && ($default_sub_of_inbox == true)) {
+         $box = $boxes[$i]["unformatted"];
+         $box2 = replace_spaces($boxes[$i]["formatted"]);
          echo "<OPTION SELECTED VALUE=\"$box\">$box2\n";
       } else {
-         $box = $boxes[$i]["UNFORMATTED"];
-         $box2 = $boxes[$i]["FORMATTED"];
+         $box = $boxes[$i]["unformatted"];
+         $box2 = replace_spaces($boxes[$i]["formatted"]);
          echo "<OPTION VALUE=\"$box\">$box2\n";
       }
    }
    echo "</SELECT></TT><BR>\n";
    echo "<FONT FACE=\"Arial,Helvetica\">";
-   if ($show_contain_subfolders_option)
+   if ($show_contain_subfolders_option) {
       echo "<INPUT TYPE=CHECKBOX NAME=\"contain_subs\"><FONT FACE=\"Arial,Helvetica\"> &nbsp;";
       echo _("Let this folder contain subfolders");
       echo "</FONT><BR>";
+   }   
    echo "<INPUT TYPE=SUBMIT VALUE=Create></FONT>\n";
    echo "</FORM><BR></TD></TR><BR>\n";
 
    for ($i = 0; $i < count($boxes); $i++) {
       $use_folder = true;
       for ($p = 0; $p < count($special_folders); $p++) {
-         if ($boxes[$i]["UNFORMATTED"] == $special_folders[$p]) {
+         if ($boxes[$i]["unformatted"] == $special_folders[$p]) {
             $use_folder = false;
-         } else if (substr($boxes[$i]["UNFORMATTED"], 0, strlen($trash_folder)) == $trash_folder) {
+         } else if (substr($boxes[$i]["unformatted"], 0, strlen($trash_folder)) == $trash_folder) {
             $use_folder = false;
          }
       }
       if ($use_folder == true) {
-         $box = $boxes[$i]["UNFORMATTED"];
-         $box2 = $boxes[$i]["FORMATTED"];
+         $box = $boxes[$i]["unformatted"];
+         $box2 = replace_spaces($boxes[$i]["formatted"]);
          echo "         <OPTION VALUE=\"$box\">$box2\n";
       }
    }
index 0c3fc9d..3c95663 100644 (file)
@@ -1,4 +1,3 @@
-<HTML>
 <?
    include("../config/config.php");
    include("../functions/strings.php");
@@ -8,11 +7,8 @@
 
    include("../src/load_prefs.php");
 
-   echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
-   displayPageHeader($color, "None");
-
-   $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
-   $dm = findMailboxDelimeter($imapConnection);
+   $imapConnection = sqimap_login($username, $key, $imapServerAddress, 0);
+   $dm = sqimap_get_delimiter($imapConnection);
 
    if (strpos($folder_name, "\"") || strpos($folder_name, ".") ||
        strpos($folder_name, "/") || strpos($folder_name, "\\") ||
       $folder_name = "$folder_name$dm";
 
    if (trim($subfolder) == "[ None ]") {
-      createFolder($imapConnection, "$folder_name");
+      sqimap_mailbox_create ($imapConnection, $folder_name, "");
    } else {
-      createFolder($imapConnection, "$subfolder$dm$folder_name");
+      sqimap_mailbox_create ($imapConnection, $subfolder.$dm.$folder_name, "");
    }
    fputs($imapConnection, "1 logout\n");
 
-   echo "<FONT FACE=\"Arial,Helvetica\">";
-   echo "<BR><BR><BR><CENTER><B>";
-   echo _("Folder Created!");
-   echo "</B><BR><BR>";
-   echo _("The folder has been successfully created.");
-   echo "<BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
-   echo _("Click here");
-   echo "</A> ";
-   echo _("to continue.");
-   echo "</CENTER></FONT>";
+//   if ($auto_forward == true) {
+//      header ("Location: webmail.php?right_frame=folders.php");
+//   } else {
+      echo "<html><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
+      displayPageHeader($color, "None");
+      echo "<FONT FACE=\"Arial,Helvetica\">";
+      echo "<BR><BR><BR><CENTER><B>";
+      echo _("Folder Created!");
+      echo "</B><BR><BR>";
+      echo _("The folder has been successfully created.");
+      echo "<BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
+      echo _("Click here");
+      echo "</A> ";
+      echo _("to continue.");
+      echo "</CENTER></FONT>";
+      echo "</BODY></HTML>";
+//   }
 ?>
-</BODY></HTML>
 
index 43ef5ad..e22f8c2 100644 (file)
@@ -3,7 +3,6 @@
    include("../functions/strings.php");
    include("../functions/page_header.php");
    include("../functions/imap.php");
-   include("../functions/mailbox.php");
    include("../functions/array.php");
 
    include("../src/load_prefs.php");
    echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
    displayPageHeader($color, "None");  
    
-   $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
-   getFolderList($imapConnection, $boxes);
+   $imapConnection = sqimap_login($username, $key, $imapServerAddress, 0);
+   $boxes = sqimap_mailbox_list ($imapConnection);
+   $dm = sqimap_get_delimiter($imapConnection);
 
-   $dm = findMailboxDelimeter($imapConnection);
    /** lets see if we CAN move folders to the trash.. otherwise, just delete them **/
-   for ($i = 0; $i < count($boxes[$i]["UNFORMATTED"]); $i++) {
-      if ($boxes[$i]["UNFORMATTED"] == $trash_folder)
-         $tmp_trash_folder = $boxes[$i]["RAW"];
-   }
-
-   $tmpflags = getMailboxFlags($imapConnection, $tmp_trash_folder);
-   $can_move_to_trash = true;
-   for ($i = 0; $i < count($tmpflags); $i++) {
-      if (strtolower($tmpflags[$i]) == "noinferiors")
-         $can_move_to_trash = false;
+   for ($i = 0; $i < count($boxes[$i]["unformatted"]); $i++) {
+      if ($boxes[$i]["unformatted"] == $trash_folder) {
+         $can_move_to_trash = true;
+         for ($i = 0; $i < count($tmpflags); $i++) {
+            if (strtolower($tmpflags[$i]) == "noinferiors")
+               $can_move_to_trash = false;
+         }
+      }
    }
 
    /** Lets start removing the folders and messages **/
    if (($move_to_trash == true) && ($can_move_to_trash == true)) { /** if they wish to move messages to the trash **/
       /** Creates the subfolders under $trash_folder **/
       for ($i = 0; $i < count($boxes); $i++) {
-         if (($boxes[$i]["UNFORMATTED"] == $mailbox) ||
-             (substr($boxes[$i]["UNFORMATTED"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) {
-            $folderWithoutINBOX = getFolderNameMinusINBOX($boxes[$i]["UNFORMATTED"], $dm);
-            $flags = getMailboxFlags($imapConnection, $boxes[$i]["RAW"]);
+         if (($boxes[$i]["unformatted"] == $mailbox) ||
+             (substr($boxes[$i]["unformatted"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) {
+            $folderWithoutINBOX = getFolderNameMinusINBOX($boxes[$i]["unformatted"], $dm);
+            $flags = getMailboxFlags($imapConnection, $boxes[$i]["raw"]);
             for ($b = 0; $b < count($flags); $b++) {
                $type = $flags[$b];
             }
          }
       }
       for ($i = 0; $i < count($boxes); $i++) {
-         if (($boxes[$i]["UNFORMATTED"] == $mailbox) ||
-             (substr($boxes[$i]["UNFORMATTED"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) {
-            selectMailbox($imapConnection, $boxes[$i]["UNFORMATTED"], $numMessages);
-            $folder = getFolderNameMinusINBOX($boxes[$i]["UNFORMATTED"]);
+         if (($boxes[$i]["unformatted"] == $mailbox) ||
+             (substr($boxes[$i]["unformatted"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) {
+            sqimap_mailbox_create($imapConnection, $boxes[$i]["unformatted"], $numMessages);
+            $folder = $boxes[$i]["unformatted"];
 
             if ($numMessages > 0)
-               $success = copyMessages($imapConnection, 1, $numMessages, "$trash_folder" . $dm . "$folder");
+               $success = sqimap_messages_copy($imapConnection, 1, $folder);
             else
                $success = true;
 
             if ($success == true)
-               removeFolder($imapConnection, $boxes[$i]["UNFORMATTED"], $dm);
+               sqimap_mailbox_delete($imapConnection, $boxes[$i]["unformatted"]);
          }
       }
    } else { /** if they do NOT wish to move messages to the trash (or cannot)**/
       fputs($imapConnection, "1 LIST \"$mailbox\" *\n");
-      $data = imapReadData($imapConnection , "1", false, $response, $message);
+      $data = sqimap_read_data($imapConnection, "1", false, $response, $message);
       while (substr($data[0], strpos($data[0], " ")+1, 4) == "LIST") {
          for ($i = 0; $i < count($boxes); $i++) {
-            if (($boxes[$i]["UNFORMATTED"] == $mailbox) ||
-                (substr($boxes[$i]["UNFORMATTED"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) {
-               removeFolder($imapConnection, $boxes[$i]["UNFORMATTED"], $dm);
+            if (($boxes[$i]["unformatted"] == $mailbox) ||
+                (substr($boxes[$i]["unformatted"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) {
+               sqimap_mailbox_delete($imapConnection, $boxes[$i]["unformatted"], $dm);
             }
          }
          fputs($imapConnection, "1 LIST \"$mailbox\" *\n");
-         $data = imapReadData($imapConnection , "1", false, $response, $message);
+         $data = sqimap_read_data($imapConnection , "1", false, $response, $message);
       }
    }
 
index feb2a83..b5d04d0 100644 (file)
@@ -3,12 +3,11 @@
    include("../functions/strings.php");
    include("../functions/page_header.php");
    include("../functions/imap.php");
-   include("../functions/mailbox.php");
 
    include("../src/load_prefs.php");
 
-   $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
-   $dm = findMailboxDelimeter($imapConnection);
+   $imapConnection = sqimap_login($username, $key, $imapServerAddress, 0);
+   $dm = sqimap_get_delimiter($imapConnection);
 
    if (strpos($orig, $dm))
       $old_dir = substr($orig, 0, strrpos($orig, $dm));
       $newone = "$new_name";
 
    fputs ($imapConnection, ". RENAME \"$orig\" \"$newone\"\n");
-   $data = imapReadData($imapConnection, ".", true, $a, $b);
+   $data = sqimap_read_data($imapConnection, ".", true, $a, $b);
 
    // Renaming a folder doesn't renames the folder but leaves you unsubscribed
    //    at least on Cyrus IMAP servers.
+   fputs ($imapConnection, "sub UNSUBSCRIBE \"$orig\"\n");
    fputs ($imapConnection, "sub SUBSCRIBE \"$newone\"\n");
-   $data = imapReadData($imapConnection, "sub", true, $a, $b);
+   $data = sqimap_read_data($imapConnection, "sub", true, $a, $b);
 
    /** Log out this session **/
    fputs($imapConnection, "1 logout");
index 1b00a8e..d5fb288 100644 (file)
@@ -3,14 +3,13 @@
    include("../functions/strings.php");
    include("../functions/page_header.php");
    include("../functions/imap.php");
-   include("../functions/mailbox.php");
 
    include("../src/load_prefs.php");
 
-   $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
-   selectMailbox($imapConnection, $old, $numMessages);
+   $imapConnection = sqimap_login($username, $key, $imapServerAddress, 0);
+   sqimap_mailbox_select($imapConnection, $old);
 
-   $dm = findMailboxDelimeter($imapConnection);
+   $dm = sqimap_get_delimiter($imapConnection);
    if (strpos($old, $dm)) {
       $old_name = substr($old, strrpos($old, $dm)+1, strlen($old));
       $old_parent = substr($old, 0, strrpos($old, $dm));
@@ -37,7 +36,7 @@
    echo "</TABLE>";
 
    /** Log out this session **/
-   fputs($imapConnection, "1 logout");
+   sqimap_logout($imapConnection);
 ?>
 
 
index b29729f..a674eaa 100644 (file)
    include("../functions/array.php");
    include("../functions/strings.php");
    include("../functions/imap.php");
-   include("../functions/mailbox.php");
 
    function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, $color, $move_to_trash) {
       require ("../config/config.php");
 
       $mailboxURL = urlencode($real_box);
-      selectMailbox($imapConnection, $real_box, $numNessages);
-      $unseen = unseenMessages($imapConnection, $numUnseen);
+      sqimap_mailbox_select ($imapConnection, $real_box);
+      $unseen = sqimap_unseen_messages($imapConnection, $numUnseen);
 
       echo "<NOBR>";
       if ($unseen)
 
       if ($special_color == true) {
          $line .= "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT FACE=\"Arial,Helvetica\"  COLOR=\"$color[11]\">";
-         $line .= readShortMailboxName($mailbox, $delimeter);
+         $line .= replace_spaces($mailbox);
          $line .= "</font></a>";
       } else {
          $line .= "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT FACE=\"Arial,Helvetica\">";
-         $line .= readShortMailboxName($mailbox, $delimeter);
+         $line .= replace_spaces($mailbox);
          $line .= "</font></a>";
       }
 
@@ -66,7 +65,7 @@
    }
 
    // open a connection on the imap port (143)
-   $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 10); // the 10 is to hide the output
+   $imapConnection = sqimap_login($username, $key, $imapServerAddress, 10); // the 10 is to hide the output
 
    /** If it was a successful login, lets load their preferences **/
    include("../src/load_prefs.php");
       echo "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">"; 
       echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"$left_refresh;URL=left_main.php\">";
    }
+   
    echo "<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">";
    echo "<FONT FACE=\"Arial,Helvetica\">";
 
-   getFolderList($imapConnection, $boxes);
+   $boxes = sqimap_mailbox_list($imapConnection);
 
    echo "<FONT FACE=\"Arial,Helvetica\" SIZE=4><B><CENTER>";
-   echo "Folders</B><BR></FONT>";
+   echo _("Folders") . "</B><BR></FONT>";
 
    echo "<FONT FACE=\"Arial,Helvetica\" SIZE=2>(<A HREF=\"../src/left_main.php\" TARGET=\"left\">";
    echo _("refresh folder list");
    echo "</A>)</FONT></CENTER><BR>";
    echo "<FONT FACE=\"Arial,Helvetica\">\n";
-   $delimeter = findMailboxDelimeter($imapConnection);
+   $delimeter = sqimap_get_delimiter($imapConnection);
 
    for ($i = 0;$i < count($boxes); $i++) {
       $line = "";
-      $mailbox = $boxes[$i]["FORMATTED"];
-      $boxFlags = getMailboxFlags($imapConnection, $boxes[$i]["RAW"]);
+      $mailbox = $boxes[$i]["formatted"];
 
-      if (trim($boxFlags[0]) != "") {
+      if ($boxes[$i]["flags"]) {
          $noselect = false;
-         for ($h = 0; $h < count($boxFlags); $h++) {
-            if (strtolower($boxFlags[$h]) == "noselect")
+         for ($h = 0; $h < count($boxes[$i]["flags"]); $h++) {
+            if (strtolower($boxes[$i]["flags"][$h]) == "noselect")
                $noselect = true;
          }
          if ($noselect == true) {
             $line .= "<FONT COLOR=\"$color[10]\" FACE=\"Arial,Helvetica\">";
-            $line .= readShortMailboxName($mailbox, $delimeter);
+            $line .= replace_spaces(readShortMailboxName($mailbox, $delimeter));
             $line .= "</FONT><FONT FACE=\"Arial,Helvetica\">";
          } else {
-            $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["UNFORMATTED"], $delimeter, $color, $move_to_trash);
+            $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $color, $move_to_trash);
          }
       } else {
-         $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["UNFORMATTED"], $delimeter, $color, $move_to_trash);
+         $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $color, $move_to_trash);
       }
       echo "$line<BR>";
    }
index 1ca5788..da8d670 100644 (file)
@@ -1,6 +1,5 @@
 <?
    include("../config/config.php");
-   include("../functions/mailbox.php");
    include("../functions/strings.php");
    include("../functions/page_header.php");
    include("../functions/display_messages.php");
       }
    }
 
-   $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
-
-   // switch to the mailbox, and get the number of messages in it.
-   selectMailbox($imapConnection, $mailbox, $numMessages, $imapServerAddress);
+   $imapConnection = sqimap_login($username, $key, $imapServerAddress, 0);
+   sqimap_mailbox_select($imapConnection, $mailbox);
 
    // If the delete button was pressed, the moveButton variable will not be set.
    if (!$moveButton) {
@@ -49,7 +46,7 @@
          //    loop because we never increment j.  so check to see if msg[0] is set or not to fix this.
          while ($j < count($msg)) {
             if ($msg[$i]) {
-               deleteMessages($imapConnection, $msg[$i], $msg[$i], $numMessages, $trash_folder, $move_to_trash, $auto_expunge, $mailbox);
+               sqimap_messages_delete($imapConnection, $msg[$i], $msg[$i], $mailbox);
                $j++;
             }
             $i++;
          while ($j < count($msg)) {
             if ($msg[$i]) {
                /** check if they would like to move it to the trash folder or not */
-               $success = copyMessages($imapConnection, $msg[$i], $msg[$i], $targetMailbox);
+               $success = sqimap_messages_copy($imapConnection, $msg[$i], $msg[$i], $targetMailbox);
                if ($success == true)
-                  setMessageFlag($imapConnection, $msg[$i], $msg[$i], "Deleted");
+                  sqimap_messages_flag($imapConnection, $msg[$i], $msg[$i], "Deleted");
                $j++;
             }
             $i++;
          }
          if ($auto_expunge == true)
-            expungeBox($imapConnection, $mailbox, $numMessages);
+            sqimap_mailbox_expunge($imapConnection, $mailbox, $numMessages);
 
          messages_moved_message($mailbox, $sort, $startMessage, $color);
       } else {
@@ -87,7 +84,7 @@
    }
 
    // Log out this session
-   fputs($imapConnection, "1 logout");
+   sqimap_logout($imapConnection);
 
 ?>
 </BODY></HTML>
index 6adb81e..600ab71 100644 (file)
@@ -1,6 +1,5 @@
 <?
    include("../config/config.php");
-   include("../functions/mailbox.php");
    include("../functions/strings.php");
    include("../functions/page_header.php");
    include("../functions/display_messages.php");
@@ -10,8 +9,8 @@
    include("../src/load_prefs.php");
 
 
-   $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
-   getFolderList($imapConnection, $boxes);
+   $imapConnection = sqimap_login($username, $key, $imapServerAddress);
+   $boxes = sqimap_mailbox_list($imapConnection, $boxes);
    fputs($imapConnection, "1 logout\n");
 
    echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
index ca5ba4d..b123a99 100644 (file)
@@ -1,6 +1,5 @@
 <?
    include("../config/config.php");
-   include("../functions/mailbox.php");
    include("../functions/strings.php");
    include("../functions/page_header.php");
    include("../functions/display_messages.php");
index 3c13148..59c4e4c 100644 (file)
@@ -4,17 +4,16 @@
    include("../functions/page_header.php");
    include("../functions/imap.php");
    include("../functions/mime.php");
-   include("../functions/mailbox.php");
    include("../functions/date.php");
 
    include("../src/load_prefs.php");
 
-   $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
-   selectMailbox($imapConnection, $mailbox, $numMessages);
+   $imapConnection = sqimap_login($username, $key, $imapServerAddress, 0);
+   sqimap_mailbox_select($imapConnection, $mailbox);
 
    // $message contains all information about the message
    // including header and body
-   $message = fetchMessage($imapConnection, $passed_id, $mailbox);
+   $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
 
    echo "<HTML>";
    echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
index 11710fa..40f01c0 100644 (file)
@@ -29,7 +29,6 @@
    include("../functions/date.php");
    include("../functions/page_header.php");
    include("../functions/array.php");
-   include("../functions/mailbox.php");
    include("../functions/mailbox_display.php");
    include("../functions/display_messages.php");
 
@@ -49,7 +48,7 @@
    /////////////////////////////////////////////////////////////////////////////////
 
    // open a connection on the imap port (143)
-   $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
+   $imapConnection = sqimap_login($username, $key, $imapServerAddress, 0);
 
    /** If it was a successful login, lets load their preferences **/
    include("../src/load_prefs.php");
       exit;
    }
 
-   // switch to the mailbox, and get the number of messages in it.
-   selectMailbox($imapConnection, $mailbox, $numMessages);
-
-   // Display the header at the top of the page
+   sqimap_mailbox_select($imapConnection, $mailbox);
+   $numMessages = sqimap_get_num_messages ($imapConnection, $mailbox);
    displayPageHeader($color, $mailbox);
 
-   // Get the list of messages for this mailbox
    showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color);
 
    // close the connection
-   fputs($imapConnection, "1 logout\n");
-   fclose($imapConnection);
+   sqimap_logout ($imapConnection);
 ?>
 </FONT>
 </BODY>