Bug fix
[squirrelmail.git] / src / folders.php
index 5ce49644ae9e93fab82b478f3bff2d34ce588559..7b7ec043a66d59175e1a7d9f9e476b01b75ac8bd 100644 (file)
@@ -4,6 +4,7 @@
    include("../functions/strings.php");
    include("../functions/page_header.php");
    include("../functions/imap.php");
+   include("../functions/mailbox.php");
 
    displayPageHeader("None");
 
    echo "   </TD></TR>\n";
    echo "</TABLE>\n";
 
-   $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString);
-   if (!$imapConnection) {
-      echo "Error connecting to IMAP Server.<br>";
-      echo "$errorNumber : $errorString<br>";
-      exit;
-   }
-   $serverInfo = fgets($imapConnection, 256);
-
-   fputs($imapConnection, "1 login $username $key\n");
-   $read = fgets($imapConnection, 1024);
+   $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
 
    fputs($imapConnection, "1 list \"\" *\n");
    $str = imapReadData($imapConnection);
    }
 
    /** DELETING FOLDERS **/
+
    echo "<FORM ACTION=folders_delete.php METHOD=POST>\n";
-   echo "<SELECT NAME=folder_list><FONT FACE=\"Arial,Helvetica\">\n";
+   echo "<SELECT NAME=mailbox><FONT FACE=\"Arial,Helvetica\">\n";
    for ($i = 0; $i < count($str); $i++) {
+      $thisbox = Chop($str[$i]);
+      $thisbox = findMailboxName($thisbox);
       $use_folder = true;
       for ($p = 0; $p < count($special_folders); $p++) {
          if ($special_folders[$p] == $long_name_boxes[$i])
             $use_folder = false;
       }
       if ($use_folder == true)
-         echo "   <OPTION>$boxes[$i]\n";
+         echo "   <OPTION>$thisbox\n";
    }
    echo "</SELECT>\n";
    echo "<INPUT TYPE=SUBMIT VALUE=Delete>\n";
@@ -66,7 +61,7 @@
    for ($i = 0;$i < count($str); $i++) {
       $thisbox = Chop($str[$i]);
       $thisbox = findMailboxName($thisbox);
-      $thisbox = getBoxForCreate($thisbox);
+      $thisbox = getFolderNameMinusINBOX($thisbox);
       echo "<OPTION>$thisbox\n";
    }
    echo "</SELECT>\n";
@@ -91,4 +86,4 @@
    echo "</FORM><BR>\n";
 
 ?>
-</BODY></HTML>
\ No newline at end of file
+</BODY></HTML>