X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Ffolders.php;h=ef7623b6c2c6645fe54020727da3a38d88105d00;hb=c4faef335b2362c81b8ebf026d4066c12d70536c;hp=a78fd0b9ac50a7f5093c52fc5fb5a563160fa0fc;hpb=7536f5fbbc12e10f3c3314348ffcd86626a4f387;p=squirrelmail.git
diff --git a/src/folders.php b/src/folders.php
index a78fd0b9..ef7623b6 100644
--- a/src/folders.php
+++ b/src/folders.php
@@ -1,295 +1,220 @@
assign('note', sm_encode_html_special_chars($td_str));
+ $oTemplate->display('note.tpl');
+}
+
+$boxes = sqimap_mailbox_list($imapConnection,true);
+
+/** CREATING FOLDERS **/
+
+$show_selected = array();
+$skip_folders = array();
+$server_type = strtolower($imap_server_type);
+
+// Special handling for courier
+if ( $server_type == 'courier' ) {
+ if ( $default_folder_prefix == 'INBOX.' ) {
+ // We don't need INBOX, since it is top folder
+ array_push($skip_folders, 'INBOX');
+ }
+} elseif ( $server_type == 'bincimap' ) {
+ if ( $default_folder_prefix == 'INBOX/' ) {
+ // We don't need INBOX, since it is top folder
+ array_push($skip_folders, 'INBOX');
+ }
+}
+
+if ( $default_sub_of_inbox == false ) {
+ $mbx_option_list = '\n";
+} else {
+ $mbx_option_list = '\n";
+ $show_selected = array('inbox');
+}
+
+// Call sqimap_mailbox_option_list, using existing connection to IMAP server,
+// the arrays of folders to include or skip (assembled above),
+// use 'noinferiors' as a mailbox filter to leave out folders that can not contain other folders.
+// use the long format to show subfolders in an intelligible way if parent is missing (special folder)
+$mbx_option_list .= sqimap_mailbox_option_list($imapConnection, $show_selected, $skip_folders, $boxes, 'noinferiors', true);
+
+
+/** count special folders **/
+foreach ($boxes as $index => $aBoxData) {
+ if (isSpecialMailbox($aBoxData['unformatted'],false) &&
+ ! in_array($aBoxData['unformatted'],$skip_folders)) {
+ $skip_folders[] = $aBoxData['unformatted'];
+ }
+}
+
+/**
+ * Retrieve list of folders when special folders are excluded. Special folders
+ * should be unavailable in rename/delete/unsubscribe. Theoretically user can
+ * modify form and perform these operations with special folders, but if user
+ * manages to delete/rename/unsubscribe special folder by hacking form...
+ *
+ * If script or program depends on special folder, they should not assume that
+ * folder is available.
+ *
+ * $filtered_folders contains empty string or html formated option list.
*/
+$rendel_folder_list = sqimap_mailbox_option_list($imapConnection, 0, $skip_folders, $boxes, NULL, true);
-/*****************************************************************/
-/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/
-/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/
-/*** + Base level indent should begin at left margin, as ***/
-/*** the require_once below looks. ***/
-/*** + All identation should consist of four space blocks ***/
-/*** + Tab characters are evil. ***/
-/*** + all comments should use "slash-star ... star-slash" ***/
-/*** style -- no pound characters, no slash-slash style ***/
-/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/
-/*** ALWAYS USE { AND } CHARACTERS!!! ***/
-/*** + Please use ' instead of ", when possible. Note " ***/
-/*** should always be used in _( ) function calls. ***/
-/*** Thank you for your help making the SM code more readable. ***/
-/*****************************************************************/
-require_once('../src/validate.php');
-require_once('../functions/imap.php');
-require_once('../functions/array.php');
-require_once('../functions/plugin.php');
+$subbox_option_list = array();
- displayPageHeader($color, 'None');
+if ($show_only_subscribed_folders && !$no_list_for_subscribe) {
+ // FIXME: fix subscription options when top folder is not subscribed and sub folder is subscribed
-?>
+ // TODO: use checkboxes instead of select options.
+ // DONE Steve Brown 2006-08-08
-
-
-
+ /** SUBSCRIBE TO FOLDERS **/
+ $boxes_all = sqimap_mailbox_list_all ($imapConnection);
-
+ // here we filter out all boxes we're already subscribed to,
+ // so we keep only the unsubscribed ones.
+ foreach ($boxes_all as $box_a) {
-