Added some folder functionality
[squirrelmail.git] / src / folders.php
CommitLineData
aa42fbfb 1<HTML><BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#0000EE" ALINK="#0000EE">
a044cee3 2<?
aa42fbfb 3 include("../config/config.php");
4 include("../functions/strings.php");
5 include("../functions/page_header.php");
6 include("../functions/imap.php");
7
8 displayPageHeader("None");
9
10 echo "<TABLE WIDTH=100% COLS=1 ALIGN=CENTER>\n";
11 echo " <TR><TD BGCOLOR=DCDCDC ALIGN=CENTER>\n";
12 echo " <FONT FACE=\"Arial,Helvetica\">Folders</FONT>\n";
13 echo " </TD></TR>\n";
14 echo "</TABLE>\n";
15
16 $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString);
17 if (!$imapConnection) {
18 echo "Error connecting to IMAP Server.<br>";
19 echo "$errorNumber : $errorString<br>";
20 exit;
21 }
22 $serverInfo = fgets($imapConnection, 256);
23
24 fputs($imapConnection, "1 login $username $key\n");
25 $read = fgets($imapConnection, 1024);
26
27 fputs($imapConnection, "1 list \"\" *\n");
28 $str = imapReadData($imapConnection);
29
30 for ($i = 0;$i < count($str); $i++) {
31 $mailbox = Chop($str[$i]);
32 // find the quote at the begining of the mailbox name.
33 // i subtract 1 from the strlen so it doesn't find the quote at the end of the mailbox name.
34 $mailbox = findMailboxName($mailbox);
35 $periodCount = countCharInString($mailbox, ".");
36
37 // indent the correct number of spaces.
38 for ($j = 0;$j < $periodCount;$j++)
39 echo "&nbsp;&nbsp;";
40
41 $mailboxURL = urlencode($mailbox);
42 echo "<FONT FACE=\"Arial,Helvetica\">\n";
43 echo readShortMailboxName($mailbox, ".");
44 echo "</FONT><BR>\n";
45 }
46?>
47</BODY></HTML>