Added a constat to all files in functions/ to be able to chech whether the
[squirrelmail.git] / src / folders.php
CommitLineData
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 " <FONT FACE=\"Arial,Helvetica\">";
22 echo _("Folders");
23 echo "</FONT>\n";
aa42fbfb 24 echo " </TD></TR>\n";
25 echo "</TABLE>\n";
26
813eba2f 27 $imapConnection = sqimap_login ($username, $key, $imapServerAddress, 0);
28 $boxes = sqimap_mailbox_list($imapConnection);
60573cd9 29
30 /** DELETING FOLDERS **/
907165ca 31 echo "<TABLE WIDTH=70% COLS=1 ALIGN=CENTER>\n";
036a8a9d 32 echo "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER><FONT FACE=\"Arial,Helvetica\"><B>";
33 echo _("Delete Folder");
34 echo "</B></FONT></TD></TR>";
f8f9bed9 35 echo "<TR><TD BGCOLOR=\"$color[4]\" ALIGN=CENTER>";
8467bf00 36 echo "<FORM ACTION=folders_delete.php METHOD=SUBMIT>\n";
7ce342dc 37 echo "<TT><SELECT NAME=mailbox>\n";
38 for ($i = 0; $i < count($boxes); $i++) {
60573cd9 39 $use_folder = true;
40 for ($p = 0; $p < count($special_folders); $p++) {
813eba2f 41 if ($boxes[$i]["unformatted"] == $special_folders[$p]) {
60573cd9 42 $use_folder = false;
813eba2f 43 } else if (substr($boxes[$i]["unformatted"], 0, strlen($trash_folder)) == $trash_folder) {
907165ca 44 $use_folder = false;
e457e585 45 }
60573cd9 46 }
7ce342dc 47 if ($use_folder == true) {
813eba2f 48 $box = $boxes[$i]["unformatted"];
49 $box2 = replace_spaces($boxes[$i]["formatted"]);
7ce342dc 50 echo " <OPTION VALUE=\"$box\">$box2\n";
51 }
60573cd9 52 }
7ce342dc 53
54 echo "</SELECT></TT>\n";
036a8a9d 55 echo "<FONT FACE=\"Arial,Helvetica\"><INPUT TYPE=SUBMIT VALUE=\"";
56 echo _("Delete");
57 echo "\"></FONT>\n";
907165ca 58 echo "</FORM><BR></TD></TR><BR>\n";
60573cd9 59
60 /** CREATING FOLDERS **/
036a8a9d 61 echo "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER><FONT FACE=\"Arial,Helvetica\"><B>";
62 echo _("Create Folder");
63 echo "</B></FONT></TD></TR>";
f8f9bed9 64 echo "<TR><TD BGCOLOR=\"$color[4]\" ALIGN=CENTER>";
60573cd9 65 echo "<FORM ACTION=folders_create.php METHOD=POST>\n";
907165ca 66 echo "<INPUT TYPE=TEXT SIZE=25 NAME=folder_name><BR>\n";
036a8a9d 67 echo "<FONT FACE=\"Arial,Helvetica\">";
68 echo _("as a subfolder of");
69 echo "</FONT><BR>";
7ce342dc 70 echo "<TT><SELECT NAME=subfolder><FONT FACE=\"Arial,Helvetica\">\n";
d92b6f31 71 if ($default_sub_of_inbox == false)
72 echo "<OPTION SELECTED>[ None ]\n";
73 else
74 echo "<OPTION>[ None ]\n";
75
7ce342dc 76 for ($i = 0; $i < count($boxes); $i++) {
36695509 77 for ($j = 0; $j < count($boxes[$i]["flags"]); $j++) {
78 if ($boxes[$i]["flags"][$j] == "noinferiors") {
79 if (($boxes[$i]["unformatted"] == $special_folders[0]) && ($default_sub_of_inbox == true)) {
80 $box = $boxes[$i]["unformatted"];
81 $box2 = replace_spaces($boxes[$i]["formatted"]);
82 echo "<OPTION SELECTED VALUE=\"$box\">$box2\n";
83 } else {
84 $box = $boxes[$i]["unformatted"];
85 $box2 = replace_spaces($boxes[$i]["formatted"]);
86 echo "<OPTION VALUE=\"$box\">$box2\n";
87 }
88 }
7ce342dc 89 }
60573cd9 90 }
7ce342dc 91 echo "</SELECT></TT><BR>\n";
92 echo "<FONT FACE=\"Arial,Helvetica\">";
813eba2f 93 if ($show_contain_subfolders_option) {
036a8a9d 94 echo "<INPUT TYPE=CHECKBOX NAME=\"contain_subs\"><FONT FACE=\"Arial,Helvetica\"> &nbsp;";
95 echo _("Let this folder contain subfolders");
96 echo "</FONT><BR>";
813eba2f 97 }
7ce342dc 98 echo "<INPUT TYPE=SUBMIT VALUE=Create></FONT>\n";
907165ca 99 echo "</FORM><BR></TD></TR><BR>\n";
60573cd9 100
101 /** RENAMING FOLDERS **/
036a8a9d 102 echo "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER><FONT FACE=\"Arial,Helvetica\"><B>";
103 echo _("Rename a Folder");
104 echo "</B></FONT></TD></TR>";
f8f9bed9 105 echo "<TR><TD BGCOLOR=\"$color[4]\" ALIGN=CENTER>";
3e054c43 106 echo "<FORM ACTION=folders_rename_getname.php METHOD=POST>\n";
7ce342dc 107 echo "<TT><SELECT NAME=old><FONT FACE=\"Arial,Helvetica\">\n";
108 for ($i = 0; $i < count($boxes); $i++) {
60573cd9 109 $use_folder = true;
110 for ($p = 0; $p < count($special_folders); $p++) {
813eba2f 111 if ($boxes[$i]["unformatted"] == $special_folders[$p]) {
7ce342dc 112 $use_folder = false;
813eba2f 113 } else if (substr($boxes[$i]["unformatted"], 0, strlen($trash_folder)) == $trash_folder) {
60573cd9 114 $use_folder = false;
907165ca 115 }
60573cd9 116 }
7ce342dc 117 if ($use_folder == true) {
813eba2f 118 $box = $boxes[$i]["unformatted"];
119 $box2 = replace_spaces($boxes[$i]["formatted"]);
7ce342dc 120 echo " <OPTION VALUE=\"$box\">$box2\n";
121 }
60573cd9 122 }
7ce342dc 123 echo "</SELECT></TT>\n";
036a8a9d 124 echo "<FONT FACE=\"Arial,Helvetica\"><INPUT TYPE=SUBMIT VALUE=\"";
125 echo _("Rename");
126 echo "\"></FONT>\n";
907165ca 127 echo "</FORM></TD></TR></TABLE><BR>\n";
60573cd9 128
aa42fbfb 129?>
2aa12d5e 130</BODY></HTML>