X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fimap.php;h=ffaf11a65dbb2c40282de052e32160c4a298cc53;hb=15e6162eacc97158393bc75aed3afeb7b19c24a6;hp=62bfe30b96ffdd112a4c92e5fddecfa23363fdbb;hpb=d92b6f319c3ca67ff701db9da869b42c298ef9a4;p=squirrelmail.git
diff --git a/functions/imap.php b/functions/imap.php
index 62bfe30b..ffaf11a6 100644
--- a/functions/imap.php
+++ b/functions/imap.php
@@ -1,222 +1,22 @@
-
- /**
- ** imap.php
- **
- ** Functions for the IMAP connection
- **
- **/
+ERROR: Could not complete request.
Reason given: $message
";
- exit;
- } else if ($response == "BAD") {
- echo "ERROR: Bad or malformed request.
Server responded: $message
";
- exit;
- }
- }
-
- return $data;
- }
-
- /** Parse the incoming mailbox name and return a string that is the FOLDER.MAILBOX **/
- function findMailboxName($mailbox) {
- $mailbox = trim($mailbox);
- if (substr($mailbox, strlen($mailbox)-1, strlen($mailbox)) == "\"") {
- $mailbox = substr($mailbox, 0, strlen($mailbox) - 1);
- $pos = strrpos($mailbox, "\"") + 1;
- $box = substr($mailbox, $pos, strlen($mailbox));
- } else {
- $box = substr($mailbox, strrpos($mailbox, " ")+1, strlen($mailbox));
- }
- return $box;
- }
-
- /** Finds the delimeter between mailboxes **/
- function findMailboxDelimeter($imapConnection) {
- fputs($imapConnection, ". list \"\" \"\"\n");
- $read = fgets($imapConnection, 1024);
-
- $pos = strrpos($read, "\"");
- $read = substr($read, 0, $pos);
-
- $pos = strrpos($read, "\"");
- $read = substr($read, 0, $pos);
-
- $pos = strrpos($read, "\"");
- $read = substr($read, 0, $pos);
-
- $pos = strrpos($read, "\"");
- $read = substr($read, $pos+1, strlen($read));
-
- $tmp = fgets($imapConnection, 1024);
- return $read;
- }
-
- function getMailboxFlags($mailbox) {
- $mailbox = trim($mailbox);
- $mailbox = substr($mailbox, strpos($mailbox, "(")+1, strlen($mailbox));
- $mailbox = substr($mailbox, 0, strpos($mailbox, ")"));
- $mailbox = str_replace("\\", "", $mailbox);
- $mailbox = strtolower($mailbox);
- $mailbox = explode(" ", $mailbox);
- return $mailbox;
- }
-
- // handles logging onto an imap server.
- function loginToImapServer($username, $key, $imapServerAddress, $hide) {
- require("../config/config.php");
-
- $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString);
- if (!$imapConnection) {
- echo "Error connecting to IMAP Server.
";
- echo "$errorNumber : $errorString
";
- exit;
- }
- $serverInfo = fgets($imapConnection, 256);
-
- // login
- fputs($imapConnection, "a001 LOGIN $username $key\n");
- $read = fgets($imapConnection, 1024);
- if ($debug_login == true) {
- echo "SERVER SAYS: $read
";
- }
-
- if (substr($read, 0, 7) != "a001 OK") {
- if (!$hide) {
- if (substr($read, 0, 8) == "a001 BAD") {
- echo "Bad request: $read
";
- exit;
- }
- else if (substr($read, 0, 7) == "a001 NO") {
- echo "
";
- echo "
";
- echo " |
";
- echo " Unknown user or password incorrect. Click here to try again. |