a044cee3 |
1 | <? |
d068c0ec |
2 | if (!isset($config_php)) |
3 | include("../config/config.php"); |
4 | if (!isset($strings_php)) |
5 | include("../functions/strings.php"); |
6 | if (!isset($page_header_php)) |
7 | include("../functions/page_header.php"); |
8 | if (!isset($imap_php)) |
9 | include("../functions/imap.php"); |
10 | if (!isset($array_php)) |
11 | include("../functions/array.php"); |
aa42fbfb |
12 | |
d3cdb279 |
13 | include("../src/load_prefs.php"); |
14 | |
f8f9bed9 |
15 | echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n"; |
16 | |
17 | displayPageHeader($color, "None"); |
aa42fbfb |
18 | |
19 | echo "<TABLE WIDTH=100% COLS=1 ALIGN=CENTER>\n"; |
f8f9bed9 |
20 | echo " <TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER>\n"; |
036a8a9d |
21 | echo _("Folders"); |
aa42fbfb |
22 | echo " </TD></TR>\n"; |
23 | echo "</TABLE>\n"; |
24 | |
e1469126 |
25 | $imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0); |
813eba2f |
26 | $boxes = sqimap_mailbox_list($imapConnection); |
60573cd9 |
27 | |
28 | /** DELETING FOLDERS **/ |
907165ca |
29 | echo "<TABLE WIDTH=70% COLS=1 ALIGN=CENTER>\n"; |
aae41ae9 |
30 | echo "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER><B>"; |
036a8a9d |
31 | echo _("Delete Folder"); |
aae41ae9 |
32 | echo "</B></TD></TR>"; |
f8f9bed9 |
33 | echo "<TR><TD BGCOLOR=\"$color[4]\" ALIGN=CENTER>"; |
225ce239 |
34 | $count_special_folders = 0; |
35 | for ($i = 0; $i < count($special_folders); $i++) { |
60573cd9 |
36 | for ($p = 0; $p < count($special_folders); $p++) { |
813eba2f |
37 | if ($boxes[$i]["unformatted"] == $special_folders[$p]) { |
225ce239 |
38 | $count_special_folders++; |
39 | } |
40 | } |
41 | } |
42 | |
43 | if ($count_special_folders < count($boxes)) { |
44 | echo "<FORM ACTION=folders_delete.php METHOD=SUBMIT>\n"; |
45 | echo "<TT><SELECT NAME=mailbox>\n"; |
46 | for ($i = 0; $i < count($boxes); $i++) { |
47 | $use_folder = true; |
48 | for ($p = 0; $p < count($special_folders); $p++) { |
49 | if ($boxes[$i]["unformatted"] == $special_folders[$p]) { |
50 | $use_folder = false; |
51 | } else if (substr($boxes[$i]["unformatted"], 0, strlen($trash_folder)) == $trash_folder) { |
52 | $use_folder = false; |
53 | } |
54 | } |
55 | if ($use_folder == true) { |
56 | $box = $boxes[$i]["unformatted-dm"]; |
57 | $box2 = replace_spaces($boxes[$i]["formatted"]); |
58 | echo " <OPTION VALUE=\"$box\">$box2\n"; |
e457e585 |
59 | } |
60573cd9 |
60 | } |
225ce239 |
61 | echo "</SELECT></TT>\n"; |
62 | echo "<INPUT TYPE=SUBMIT VALUE=\""; |
63 | echo _("Delete"); |
64 | echo "\">\n"; |
65 | echo "</FORM><BR></TD></TR>\n"; |
66 | } else { |
67 | echo _("No mailboxes found") . "<br><br></td><tr>"; |
60573cd9 |
68 | } |
7ce342dc |
69 | |
60573cd9 |
70 | |
71 | /** CREATING FOLDERS **/ |
aae41ae9 |
72 | echo "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER><B>"; |
036a8a9d |
73 | echo _("Create Folder"); |
aae41ae9 |
74 | echo "</B></TD></TR>"; |
f8f9bed9 |
75 | echo "<TR><TD BGCOLOR=\"$color[4]\" ALIGN=CENTER>"; |
60573cd9 |
76 | echo "<FORM ACTION=folders_create.php METHOD=POST>\n"; |
907165ca |
77 | echo "<INPUT TYPE=TEXT SIZE=25 NAME=folder_name><BR>\n"; |
036a8a9d |
78 | echo _("as a subfolder of"); |
aae41ae9 |
79 | echo "<BR>"; |
80 | echo "<TT><SELECT NAME=subfolder>\n"; |
d92b6f31 |
81 | if ($default_sub_of_inbox == false) |
82 | echo "<OPTION SELECTED>[ None ]\n"; |
83 | else |
84 | echo "<OPTION>[ None ]\n"; |
85 | |
7ce342dc |
86 | for ($i = 0; $i < count($boxes); $i++) { |
1f97f59a |
87 | if (count($boxes[$i]["flags"]) > 0) { |
88 | for ($j = 0; $j < count($boxes[$i]["flags"]); $j++) { |
89 | if ($boxes[$i]["flags"][$j] != "noinferiors") { |
90 | if (($boxes[$i]["unformatted"] == $special_folders[0]) && ($default_sub_of_inbox == true)) { |
91 | $box = $boxes[$i]["unformatted"]; |
92 | $box2 = replace_spaces($boxes[$i]["formatted"]); |
93 | echo "<OPTION SELECTED VALUE=\"$box\">$box2\n"; |
94 | } else { |
95 | $box = $boxes[$i]["unformatted"]; |
96 | $box2 = replace_spaces($boxes[$i]["formatted"]); |
97 | echo "<OPTION VALUE=\"$box\">$box2\n"; |
98 | } |
99 | } |
100 | } |
101 | } else { |
102 | if (($boxes[$i]["unformatted"] == $special_folders[0]) && ($default_sub_of_inbox == true)) { |
103 | $box = $boxes[$i]["unformatted"]; |
104 | $box2 = replace_spaces($boxes[$i]["formatted"]); |
105 | echo "<OPTION SELECTED VALUE=\"$box\">$box2\n"; |
106 | } else { |
107 | $box = $boxes[$i]["unformatted"]; |
108 | $box2 = replace_spaces($boxes[$i]["formatted"]); |
109 | echo "<OPTION VALUE=\"$box\">$box2\n"; |
110 | } |
111 | } |
60573cd9 |
112 | } |
7ce342dc |
113 | echo "</SELECT></TT><BR>\n"; |
813eba2f |
114 | if ($show_contain_subfolders_option) { |
aae41ae9 |
115 | echo "<INPUT TYPE=CHECKBOX NAME=\"contain_subs\"> "; |
036a8a9d |
116 | echo _("Let this folder contain subfolders"); |
aae41ae9 |
117 | echo "<BR>"; |
813eba2f |
118 | } |
aae41ae9 |
119 | echo "<INPUT TYPE=SUBMIT VALUE=Create>\n"; |
907165ca |
120 | echo "</FORM><BR></TD></TR><BR>\n"; |
60573cd9 |
121 | |
122 | /** RENAMING FOLDERS **/ |
aae41ae9 |
123 | echo "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER><B>"; |
036a8a9d |
124 | echo _("Rename a Folder"); |
aae41ae9 |
125 | echo "</B></TD></TR>"; |
f8f9bed9 |
126 | echo "<TR><TD BGCOLOR=\"$color[4]\" ALIGN=CENTER>"; |
225ce239 |
127 | if ($count_special_folders < count($boxes)) { |
128 | echo "<FORM ACTION=folders_rename_getname.php METHOD=POST>\n"; |
129 | echo "<TT><SELECT NAME=old>\n"; |
130 | for ($i = 0; $i < count($boxes); $i++) { |
131 | $use_folder = true; |
132 | for ($p = 0; $p < count($special_folders); $p++) { |
133 | if ($boxes[$i]["unformatted"] == $special_folders[$p]) { |
134 | $use_folder = false; |
135 | } else if (substr($boxes[$i]["unformatted"], 0, strlen($trash_folder)) == $trash_folder) { |
136 | $use_folder = false; |
137 | } |
138 | } |
139 | if ($use_folder == true) { |
693ccbc9 |
140 | $box = $boxes[$i]["unformatted-dm"]; |
225ce239 |
141 | $box2 = replace_spaces($boxes[$i]["formatted"]); |
142 | echo " <OPTION VALUE=\"$box\">$box2\n"; |
907165ca |
143 | } |
60573cd9 |
144 | } |
225ce239 |
145 | echo "</SELECT></TT>\n"; |
146 | echo "<INPUT TYPE=SUBMIT VALUE=\""; |
147 | echo _("Rename"); |
148 | echo "\">\n"; |
37578167 |
149 | echo "</FORM></TD></TR>\n"; |
150 | } else { |
151 | echo _("No mailboxes found") . "<br><br></td></tr>"; |
152 | } |
153 | $boxes_sub = $boxes; |
154 | |
155 | /** UNSUBSCRIBE FOLDERS **/ |
156 | echo "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER><B>"; |
157 | echo _("Unsubscribe/Subscribe"); |
158 | echo "</B></TD></TR>"; |
159 | echo "<TR><TD BGCOLOR=\"$color[4]\" ALIGN=CENTER>"; |
160 | if ($count_special_folders < count($boxes)) { |
161 | echo "<FORM ACTION=\"folders_subscribe.php?method=unsub\" METHOD=POST>\n"; |
162 | echo "<TT><SELECT NAME=mailbox>\n"; |
163 | for ($i = 0; $i < count($boxes); $i++) { |
164 | $use_folder = true; |
165 | for ($p = 0; $p < count($special_folders); $p++) { |
166 | if ($boxes[$i]["unformatted"] == $special_folders[$p]) { |
167 | $use_folder = false; |
168 | } else if (substr($boxes[$i]["unformatted"], 0, strlen($trash_folder)) == $trash_folder) { |
169 | $use_folder = false; |
170 | } |
171 | } |
172 | if ($use_folder == true) { |
173 | $box = $boxes[$i]["unformatted-dm"]; |
174 | $box2 = replace_spaces($boxes[$i]["formatted"]); |
175 | echo " <OPTION VALUE=\"$box\">$box2\n"; |
176 | } |
177 | } |
178 | echo "</SELECT></TT>\n"; |
179 | echo "<INPUT TYPE=SUBMIT VALUE=\""; |
180 | echo _("Unsubscribe"); |
181 | echo "\">\n"; |
182 | echo "</FORM></TD></TR>\n"; |
183 | } else { |
184 | echo _("No mailboxes found") . "<br><br></td></tr>"; |
185 | } |
186 | $boxes_sub = $boxes; |
187 | |
188 | /** SUBSCRIBE TO FOLDERS **/ |
189 | |
190 | echo "<TR><TD BGCOLOR=\"$color[4]\" ALIGN=CENTER>"; |
191 | if ($count_special_folders < count($boxes)) { |
192 | $imap_stream = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 1); |
193 | $boxes = sqimap_mailbox_list_all ($imap_stream); |
194 | |
195 | echo "<FORM ACTION=\"folders_subscribe.php?method=sub\" METHOD=POST>\n"; |
81a897dc |
196 | echo "<tt><input type=text size=32 name=mailbox></tt>"; |
37578167 |
197 | echo "<INPUT TYPE=SUBMIT VALUE=\""; |
198 | echo _("Subscribe"); |
199 | echo "\">\n"; |
225ce239 |
200 | echo "</FORM></TD></TR></TABLE><BR>\n"; |
201 | } else { |
202 | echo _("No mailboxes found") . "<br><br></td></tr></table>"; |
60573cd9 |
203 | } |
60573cd9 |
204 | |
aa42fbfb |
205 | ?> |
2aa12d5e |
206 | </BODY></HTML> |