pulled out all the login stuff and error checking from each individual php file
[squirrelmail.git] / src / folders.php
index 7dc1947d8198259084b6b62324cbb5f65587a7bb..0942ddbf19626a718d620892c6365cbee9fd63d3 100644 (file)
@@ -1,14 +1,5 @@
 <HTML><BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#0000EE" ALINK="#0000EE">
 <?
-   function getBoxForCreate($mailbox) {
-      if (substr($mailbox, 0, 6) == "INBOX.")
-         $box = substr($mailbox, 6, strlen($mailbox));
-      else
-         $box = $mailbox;
-
-      return $box;
-   }
-
    include("../config/config.php");
    include("../functions/strings.php");
    include("../functions/page_header.php");
    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);
    echo "</FORM><BR>\n";
 
 ?>
-</BODY></HTML>
\ No newline at end of file
+</BODY></HTML>