From: lkehresman Date: Sun, 28 Nov 1999 22:03:13 +0000 (+0000) Subject: Added some folder functionality X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=aa42fbfb4a9b641bf58178697707dca5638ee1dd Added some folder functionality git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@29 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/imap.php b/functions/imap.php index c757cf7a..2121271f 100644 --- a/functions/imap.php +++ b/functions/imap.php @@ -17,4 +17,17 @@ } return $data; } + + /** Parse the incoming mailbox name and return a string that is the FOLDER.MAILBOX **/ + function findMailboxName($mailbox) { + // start at -2 so that we skip the initial quote at the end of the mailbox name + $i = -2; + $char = substr($mailbox, $i, 1); + while ($char != "\"") { + $i--; + $temp .= $char; + $char = substr($mailbox, $i, 1); + } + return strrev($temp); + } ?> diff --git a/src/folders.php b/src/folders.php index 5133e229..a3abbf5b 100644 --- a/src/folders.php +++ b/src/folders.php @@ -1,2 +1,47 @@ + \ No newline at end of file + include("../config/config.php"); + include("../functions/strings.php"); + include("../functions/page_header.php"); + include("../functions/imap.php"); + + displayPageHeader("None"); + + echo "\n"; + echo " \n"; + echo "
\n"; + echo " Folders\n"; + echo "
\n"; + + $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString); + if (!$imapConnection) { + echo "Error connecting to IMAP Server.
"; + echo "$errorNumber : $errorString
"; + exit; + } + $serverInfo = fgets($imapConnection, 256); + + fputs($imapConnection, "1 login $username $key\n"); + $read = fgets($imapConnection, 1024); + + fputs($imapConnection, "1 list \"\" *\n"); + $str = imapReadData($imapConnection); + + for ($i = 0;$i < count($str); $i++) { + $mailbox = Chop($str[$i]); + // find the quote at the begining of the mailbox name. + // i subtract 1 from the strlen so it doesn't find the quote at the end of the mailbox name. + $mailbox = findMailboxName($mailbox); + $periodCount = countCharInString($mailbox, "."); + + // indent the correct number of spaces. + for ($j = 0;$j < $periodCount;$j++) + echo "  "; + + $mailboxURL = urlencode($mailbox); + echo "\n"; + echo readShortMailboxName($mailbox, "."); + echo "
\n"; + } +?> + \ No newline at end of file diff --git a/src/left_main.php b/src/left_main.php index 568de7ee..3bf51e59 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -38,21 +38,6 @@ include("../functions/strings.php"); include("../functions/imap.php"); - // ***************************************** - // Parse the incoming mailbox name and return a string that is the FOLDER.MAILBOX - // ***************************************** - function findMailboxName($mailbox) { - // start at -2 so that we skip the initial quote at the end of the mailbox name - $i = -2; - $char = substr($mailbox, $i, 1); - while ($char != "\"") { - $i--; - $temp .= $char; - $char = substr($mailbox, $i, 1); - } - return strrev($temp); - } - // open a connection on the imap port (143) $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString); if (!$imapConnection) {