7dc1947d8198259084b6b62324cbb5f65587a7bb
1 <HTML
><BODY TEXT
="#000000" BGCOLOR
="#FFFFFF" LINK
="#0000EE" VLINK
="#0000EE" ALINK
="#0000EE">
3 function getBoxForCreate($mailbox) {
4 if (substr($mailbox, 0, 6) == "INBOX.")
5 $box = substr($mailbox, 6, strlen($mailbox));
12 include("../config/config.php");
13 include("../functions/strings.php");
14 include("../functions/page_header.php");
15 include("../functions/imap.php");
17 displayPageHeader("None");
19 echo "<TABLE WIDTH=100% COLS=1 ALIGN=CENTER>\n";
20 echo " <TR><TD BGCOLOR=DCDCDC ALIGN=CENTER>\n";
21 echo " <FONT FACE=\"Arial,Helvetica\">Folders</FONT>\n";
25 $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString);
26 if (!$imapConnection) {
27 echo "Error connecting to IMAP Server.<br>";
28 echo "$errorNumber : $errorString<br>";
31 $serverInfo = fgets($imapConnection, 256);
33 fputs($imapConnection, "1 login $username $key\n");
34 $read = fgets($imapConnection, 1024);
36 fputs($imapConnection, "1 list \"\" *\n");
37 $str = imapReadData($imapConnection);
39 for ($i = 0;$i < count($str); $i++
) {
40 $mailbox = Chop($str[$i]);
41 // find the quote at the begining of the mailbox name.
42 // i subtract 1 from the strlen so it doesn't find the quote at the end of the mailbox name.
43 $mailbox = findMailboxName($mailbox);
44 $periodCount = countCharInString($mailbox, ".");
46 // indent the correct number of spaces.
47 for ($j = 0;$j < $periodCount;$j++
)
48 $boxes[$i] = "$boxes[$i] ";
50 $boxes[$i] = $boxes[$i] . readShortMailboxName($mailbox, ".");
51 $long_name_boxes[$i] = $mailbox;
54 /** DELETING FOLDERS **/
55 echo "<FORM ACTION=folders_delete.php METHOD=POST>\n";
56 echo "<SELECT NAME=folder_list><FONT FACE=\"Arial,Helvetica\">\n";
57 for ($i = 0; $i < count($str); $i++
) {
59 for ($p = 0; $p < count($special_folders); $p++
) {
60 if ($special_folders[$p] == $long_name_boxes[$i])
63 if ($use_folder == true)
64 echo " <OPTION>$boxes[$i]\n";
67 echo "<INPUT TYPE=SUBMIT VALUE=Delete>\n";
70 /** CREATING FOLDERS **/
71 echo "<FORM ACTION=folders_create.php METHOD=POST>\n";
72 echo "<INPUT TYPE=TEXT SIZE=25 NAME=folder_name>\n";
73 echo " as a subfolder of ";
74 echo "<SELECT NAME=subfolder><FONT FACE=\"Arial,Helvetica\">\n";
75 for ($i = 0;$i < count($str); $i++
) {
76 $thisbox = Chop($str[$i]);
77 $thisbox = findMailboxName($thisbox);
78 $thisbox = getBoxForCreate($thisbox);
79 echo "<OPTION>$thisbox\n";
82 echo "<INPUT TYPE=SUBMIT VALUE=Create>\n";
85 /** RENAMING FOLDERS **/
86 echo "<FORM ACTION=folders_rename.php METHOD=POST>\n";
87 echo "<SELECT NAME=folder_list><FONT FACE=\"Arial,Helvetica\">\n";
88 for ($i = 0; $i < count($str); $i++
) {
90 for ($p = 0; $p < count($special_folders); $p++
) {
91 if ($special_folders[$p] == $long_name_boxes[$i])
94 if ($use_folder == true)
95 echo " <OPTION>$boxes[$i]\n";
98 echo "<INPUT TYPE=TEXT SIZE=25 NAME=new_folder_name>\n";
99 echo "<INPUT TYPE=SUBMIT VALUE=Rename>\n";
100 echo "</FORM><BR>\n";