Folder manipulation stuff
[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");
597d8f1d 7 include("../functions/mailbox.php");
aa42fbfb 8
9 displayPageHeader("None");
10
11 echo "<TABLE WIDTH=100% COLS=1 ALIGN=CENTER>\n";
12 echo " <TR><TD BGCOLOR=DCDCDC ALIGN=CENTER>\n";
13 echo " <FONT FACE=\"Arial,Helvetica\">Folders</FONT>\n";
14 echo " </TD></TR>\n";
15 echo "</TABLE>\n";
16
2aa12d5e 17 $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
aa42fbfb 18
19 fputs($imapConnection, "1 list \"\" *\n");
20 $str = imapReadData($imapConnection);
21
22 for ($i = 0;$i < count($str); $i++) {
23 $mailbox = Chop($str[$i]);
24 // find the quote at the begining of the mailbox name.
25 // i subtract 1 from the strlen so it doesn't find the quote at the end of the mailbox name.
26 $mailbox = findMailboxName($mailbox);
27 $periodCount = countCharInString($mailbox, ".");
28
29 // indent the correct number of spaces.
30 for ($j = 0;$j < $periodCount;$j++)
60573cd9 31 $boxes[$i] = "$boxes[$i]&nbsp;&nbsp;&nbsp;";
aa42fbfb 32
60573cd9 33 $boxes[$i] = $boxes[$i] . readShortMailboxName($mailbox, ".");
34 $long_name_boxes[$i] = $mailbox;
aa42fbfb 35 }
60573cd9 36
37 /** DELETING FOLDERS **/
38 echo "<FORM ACTION=folders_delete.php METHOD=POST>\n";
597d8f1d 39 echo "<SELECT NAME=mailbox><FONT FACE=\"Arial,Helvetica\">\n";
60573cd9 40 for ($i = 0; $i < count($str); $i++) {
597d8f1d 41 $thisbox = Chop($str[$i]);
42 $thisbox = findMailboxName($thisbox);
43 $thisbox = getFolderNameMinuxINBOX($thisbox);
44
60573cd9 45 $use_folder = true;
46 for ($p = 0; $p < count($special_folders); $p++) {
47 if ($special_folders[$p] == $long_name_boxes[$i])
48 $use_folder = false;
49 }
50 if ($use_folder == true)
597d8f1d 51 echo " <OPTION>$thisbox\n";
60573cd9 52 }
53 echo "</SELECT>\n";
54 echo "<INPUT TYPE=SUBMIT VALUE=Delete>\n";
55 echo "</FORM><BR>\n";
56
57 /** CREATING FOLDERS **/
58 echo "<FORM ACTION=folders_create.php METHOD=POST>\n";
59 echo "<INPUT TYPE=TEXT SIZE=25 NAME=folder_name>\n";
60 echo "&nbsp;&nbsp;as a subfolder of&nbsp;&nbsp;";
61 echo "<SELECT NAME=subfolder><FONT FACE=\"Arial,Helvetica\">\n";
62 for ($i = 0;$i < count($str); $i++) {
63 $thisbox = Chop($str[$i]);
64 $thisbox = findMailboxName($thisbox);
597d8f1d 65 $thisbox = getFolderNameMinusINBOX($thisbox);
60573cd9 66 echo "<OPTION>$thisbox\n";
67 }
68 echo "</SELECT>\n";
69 echo "<INPUT TYPE=SUBMIT VALUE=Create>\n";
70 echo "</FORM><BR>\n";
71
72 /** RENAMING FOLDERS **/
73 echo "<FORM ACTION=folders_rename.php METHOD=POST>\n";
74 echo "<SELECT NAME=folder_list><FONT FACE=\"Arial,Helvetica\">\n";
75 for ($i = 0; $i < count($str); $i++) {
76 $use_folder = true;
77 for ($p = 0; $p < count($special_folders); $p++) {
78 if ($special_folders[$p] == $long_name_boxes[$i])
79 $use_folder = false;
80 }
81 if ($use_folder == true)
82 echo " <OPTION>$boxes[$i]\n";
83 }
84 echo "</SELECT>\n";
85 echo "<INPUT TYPE=TEXT SIZE=25 NAME=new_folder_name>\n";
86 echo "<INPUT TYPE=SUBMIT VALUE=Rename>\n";
87 echo "</FORM><BR>\n";
88
aa42fbfb 89?>
2aa12d5e 90</BODY></HTML>