pulled out all the login stuff and error checking from each individual php file
[squirrelmail.git] / src / folders_create.php
index 57be1754a9b2db1163366b12d82015ee39bc659e..79b0224cbdaf13a0278265601101be0d90d5da24 100644 (file)
@@ -4,17 +4,7 @@
    include("../functions/page_header.php");
    include("../functions/imap.php");
 
-   $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);
-   echo $read;
+   $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
 
    if ($subfolder == "INBOX")
       fputs($imapConnection, "1 create \"user.$username.$folder_name\"\n");