+ if ((strtolower($boxes[$i]["unformatted"]) != "inbox") &&
+ ($boxes[$i]["unformatted"] != $trash_folder) &&
+ ($boxes[$i]["unformatted"] != $sent_folder))
+ {
+ $box = $boxes[$i]["unformatted-dm"];
+ $box2 = str_replace(' ', ' ', $boxes[$i]["unformatted-disp"]);
+ if (strtolower($imap_server_type) != "courier" || strtolower($box) != "inbox.trash")
+ echo "<OPTION VALUE=\"$box\">$box2\n";
+ }
+ }
+ echo "</SELECT></TT>\n";
+ echo "<INPUT TYPE=SUBMIT VALUE=\"";
+ echo _("Rename");
+ echo "\">\n";
+ echo "</FORM></TD></TR>\n";
+ } else {
+ echo _("No folders found") . "<br><br></td></tr>";
+ }
+ $boxes_sub = $boxes;
+
+ echo "<tr><td bgcolor=\"$color[4]\"> </td></tr></table>\n";
+
+ /** UNSUBSCRIBE FOLDERS **/
+ echo "<TABLE WIDTH=70% COLS=2 ALIGN=CENTER cellpadding=2 cellspacing=1 border=0>\n";
+ echo "<TR><TD BGCOLOR=\"$color[9]\" ALIGN=CENTER colspan=2><B>";
+ echo _("Unsubscribe") . "/" . _("Subscribe");
+ echo "</B></TD></TR>\n";
+ echo "<TR><TD BGCOLOR=\"$color[0]\" width=50% ALIGN=CENTER>\n";
+ if ($count_special_folders < count($boxes)) {
+ echo "<FORM ACTION=\"folders_subscribe.php?method=unsub\" METHOD=\"POST\">\n";
+ echo "<TT><SELECT NAME=mailbox[] multiple size=8>\n";
+ for ($i = 0; $i < count($boxes); $i++) {
+ $use_folder = true;
+ if ((strtolower($boxes[$i]["unformatted"]) != "inbox") &&
+ ($boxes[$i]["unformatted"] != $trash_folder) &&
+ ($boxes[$i]["unformatted"] != $sent_folder))
+ {
+ $box = $boxes[$i]["unformatted-dm"];
+ $box2 = str_replace(' ', ' ', $boxes[$i]["unformatted-disp"]);
+ echo " <OPTION VALUE=\"$box\">$box2\n";
+ }
+ }
+ echo "</SELECT></TT><br>\n";
+ echo "<INPUT TYPE=SUBMIT VALUE=\"";
+ echo _("Unsubscribe");
+ echo "\">\n";
+ echo "</FORM></TD>\n";
+ } else {
+ echo _("No folders were found to unsubscribe from!") . "</td>";
+ }
+ $boxes_sub = $boxes;
+
+ /** SUBSCRIBE TO FOLDERS **/
+ echo "<TD BGCOLOR=\"$color[0]\" width=50% ALIGN=CENTER>";
+ $imap_stream = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 1);
+ $boxes_all = sqimap_mailbox_list_all ($imap_stream);
+
+ $box = "";
+ $box2 = "";
+ for ($i = 0, $q = 0; $i < count($boxes_all); $i++) {
+ $use_folder = true;
+ for ($p = 0; $p < count ($boxes); $p++) {
+ if ($boxes_all[$i]["unformatted"] == $boxes[$p]["unformatted"]) {
+ $use_folder = false;
+ continue;
+ } else if ($boxes_all[$i]["unformatted-dm"] == $folder_prefix) {
+ $use_folder = false;
+ }
+ }
+ if ($use_folder == true) {
+ $box[$q] = $boxes_all[$i]["unformatted-dm"];
+ $box2[$q] = $boxes_all[$i]["unformatted-disp"];
+ $q++;
+ }
+ }
+ sqimap_logout($imap_stream);
+
+ if ($box && $box2) {
+ echo "<FORM ACTION=\"folders_subscribe.php?method=sub\" METHOD=\"POST\">\n";
+ echo "<tt><select name=mailbox[] multiple size=8>";
+
+ for ($q = 0; $q < count($box); $q++) {
+ echo " <OPTION VALUE=\"$box[$q]\">".$box2[$q]."\n";
+ }
+ echo "</select></tt><br>";
+ echo "<INPUT TYPE=SUBMIT VALUE=\"". _("Subscribe") . "\">\n";
+ echo "</FORM></TD></TR></TABLE><BR>\n";
+ } else {
+ echo _("No folders were found to subscribe to!") . "</td></tr></table>";