Remove that "Not Available" message in the folder count, since it seems
[squirrelmail.git] / src / left_main.php
index 1b8afaae5d4c7b009a290246838a24a1f812141d..af7b5a4fd2c930ed477c61f8b611803bd1f45a9e 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * left_main.php
  *
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This is the code for the left bar. The left bar shows the folders
@@ -35,7 +35,6 @@ function formatMailboxName($imapConnection, $box_array) {
            $unseen_notify, $unseen_type, $collapse_folders,
            $draft_folder, $save_as_draft,
            $use_special_folder_color;
-
     $real_box = $box_array['unformatted'];
     $mailbox = str_replace(' ','',$box_array['formatted']);
     $mailboxURL = urlencode($real_box);
@@ -45,18 +44,15 @@ function formatMailboxName($imapConnection, $box_array) {
         $mailbox = $regs[2];
     }
     $unseen = 0;
-    $status = array();
+    $status = array('','');
     if (($unseen_notify == 2 && $real_box == 'INBOX') ||
         $unseen_notify == 3) {
-       $status = create_unseen_string($real_box, $box_array, $imapConnection, $unseen_type );
+       $tmp_status = create_unseen_string($real_box, $box_array, $imapConnection, $unseen_type );
        if ($status !== false) {
-           list($unseen_string, $unseen) = $status;
-       } else {
-           list($unseen_string, $unseen) = array(_("Not available"),'');
-       }
-    } else {
-       list($unseen_string, $unseen) = array('','');
+           $status = $tmp_status;
+       } 
     }
+    list($unseen_string, $unseen) = $status;
     $special_color = ($use_special_folder_color && isSpecialMailbox($real_box));
 
     /* Start off with a blank line. */
@@ -92,12 +88,13 @@ function formatMailboxName($imapConnection, $box_array) {
         $line .= "&nbsp;<SMALL>$unseen_string</SMALL>";
     }
 
+       /* If it's the trash folder, show a purge link when needed */
     if (($move_to_trash) && ($real_box == $trash_folder)) {
         if (! isset($numMessages)) {
             $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
         }
 
-        if ($numMessages > 0) {
+        if (($numMessages > 0) or ($box_array['parent'] == 1)) {
             $urlMailbox = urlencode($real_box);
             $line .= "\n<small>\n" .
                     "&nbsp;&nbsp;(<A HREF=\"empty_trash.php\" style=\"text-decoration:none\">"._("purge")."</A>)" .