-$count_special_folders = 0;
-$num_max = 1;
-if (strtolower($imap_server_type) == "courier" || $move_to_trash) {
- $num_max++;
-}
-if ($move_to_sent) {
- $num_max++;
-}
-if ($save_as_draft) {
- $num_max++;
-}
-for ($p = 0, $cnt = count($boxes); $p < $cnt && $count_special_folders < $num_max; $p++) {
- if (strtolower($boxes[$p]['unformatted']) == 'inbox')
- $count_special_folders++;
- else if (strtolower($imap_server_type) == 'courier' &&
- strtolower($boxes[$p]['unformatted']) == 'inbox.trash')
- $count_special_folders++;
- else if ($boxes[$p]['unformatted'] == $trash_folder && $trash_folder)
- $count_special_folders++;
- else if ($boxes[$p]['unformatted'] == $sent_folder && $sent_folder)
- $count_special_folders++;
- else if ($boxes[$p]['unformatted'] == $draft_folder && $draft_folder)
- $count_special_folders++;
-}
-
-
-/** RENAMING FOLDERS **/
-echo html_tag( 'tr',
- html_tag( 'td', '<b>' . _("Rename a Folder") . '</b>', 'center', $color[9] )
- ) .
- html_tag( 'tr' ) .
- html_tag( 'td', '', 'center', $color[0] );
-
-if ($count_special_folders < count($boxes)) {
- echo "<FORM ACTION=\"folders_rename_getname.php\" METHOD=\"POST\">\n"
- . "<TT><SELECT NAME=old>\n"
- . ' <OPTION VALUE="">[ ' . _("Select a folder") . " ]</OPTION>\n";
-
- echo sqimap_mailbox_option_list($imapConnection, 0, $skip_folders, $boxes);
-
- echo "</SELECT></TT>\n".
- "<input type=SUBMIT VALUE=\"".
- _("Rename").
- "\">\n".
- "</FORM></td></tr>\n";
-} else {
- echo _("No folders found") . '<br><br></td></tr>';
+foreach ($boxes as $index => $aBoxData) {
+ if (isSpecialMailbox($aBoxData['unformatted'],false) &&
+ ! in_array($aBoxData['unformatted'],$skip_folders)) {
+ $skip_folders[] = $aBoxData['unformatted'];
+ }