- function formatMailboxName($imapConnection, $box_array, $delimeter) {
- global $folder_prefix, $trash_folder, $sent_folder;
- global $color, $move_to_sent, $move_to_trash;
- global $unseen_notify, $unseen_type, $collapse_folders;
- global $draft_folder, $save_as_draft;
- global $use_special_folder_color;
-
- $real_box = $box_array['unformatted'];
- $mailbox = str_replace(' ','',$box_array['formatted']);
- $mailboxURL = urlencode($real_box);
-
- /* Strip down the mailbox name. */
- if (ereg("^( *)([^ ]*)$", $mailbox, $regs)) {
- $mailbox = $regs[2];
- }
-
- $unseen = 0;
-
- if (($unseen_notify == 2 && $real_box == 'INBOX') ||
- $unseen_notify == 3) {
- $unseen = sqimap_unseen_messages($imapConnection, $real_box);
- if ($unseen_type == 1 && $unseen > 0) {
- $unseen_string = "($unseen)";
- $unseen_found = true;
- } else if ($unseen_type == 2) {
- $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
- $unseen_string = "<font color=\"$color[11]\">($unseen/$numMessages)</font>";
- $unseen_found = true;
- }
- }
-
- $special_color = false;
- if ($use_special_folder_color) {
- if ((strtolower($real_box) == 'inbox')
- || (($real_box == $trash_folder) && ($move_to_trash))
- || (($real_box == $sent_folder) && ($move_to_sent))
- || (($real_box == $draft_folder) && ($save_as_draft))) {
- $special_color = true;
- }
- }
-
- /* Start off with a blank line. */
- $line = '';
-
- /* If there are unseen message, bold the line. */
- if ($unseen > 0) { $line .= '<B>'; }
-
- /* Crate the link for this folder. */
- $line .= "<A HREF=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" TARGET=\"right\" STYLE=\"text-decoration:none\">";
- if ($special_color == true)
- $line .= "<FONT COLOR=\"$color[11]\">";
- $line .= str_replace(' ',' ',$mailbox);
- if ($special_color == true)
- $line .= "</FONT>";
- $line .= '</A>';
-
- /* If there are unseen message, close bolding. */
- if ($unseen > 0) { $line .= "</B>"; }
-
- /* Print unseen information. */
- if (isset($unseen_found) && $unseen_found) {
- $line .= " <SMALL>$unseen_string</SMALL>";
- }
-
- if (($move_to_trash == true) && ($real_box == $trash_folder)) {
- if (! isset($numMessages)) {
- $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
- }
-
- if ($numMessages > 0) {
- $urlMailbox = urlencode($real_box);
- $line .= "\n<small>\n";
- $line .= " (<A HREF=\"empty_trash.php\" style=\"text-decoration:none\">"._("empty")."</A>)";
- $line .= "\n</small>\n";
- }
- }
-
- /* Return the final product. */
- return ($line);
- }
-
- /**********************************/
- /* END OF FUNCTION - BACK TO MAIN */
- /**********************************/
-
- if (isset($left_refresh) && ($left_refresh != 'None') && ($left_refresh != '')) {
- echo "<META HTTP-EQUIV=\"Expires\" CONTENT=\"Thu, 01 Dec 1994 16:00:00 GMT\">\n";
- echo "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n";
- echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"$left_refresh;URL=left_main.php\">\n";
- }
-
- echo "\n<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">\n";