- Fixed bug when one message left in message index, displayed wrong one
[squirrelmail.git] / src / left_main.php
index d86a4fe695a793a4b6d61b0e96fb127f2bdce9d0..112ad87b7aca3dc1a961b526acf28b002e0a17f4 100644 (file)
@@ -1,6 +1,8 @@
 <?php
    /**
     **  left_main.php
+    **  Copyright (c) 1999-2000 The SquirrelMail development 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
     **  available, and has cookie information.
@@ -14,6 +16,7 @@
       exit;
    }
 
+
    if (!isset($config_php))
       include("../config/config.php");
    if (!isset($array_php))
       include("../functions/page_header.php");
    if (!isset($i18n_php))
       include("../functions/i18n.php");
-
+   if (!isset($plugin_php))
+      include("../functions/plugin.php");
 
    displayHtmlHeader();
 
    function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, $unseen) {
                global $folder_prefix, $trash_folder, $sent_folder;
                global $color, $move_to_sent, $move_to_trash;
+      global $unseen_notify, $unseen_type;
 
       $mailboxURL = urlencode($real_box);
-               if($real_box=="INBOX") {
+
+      if ($unseen_notify == 2 && $real_box == "INBOX") {
+             $unseen = sqimap_unseen_messages($imapConnection, $numUnseen, $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;
+         }
+      } else if ($unseen_notify == 3) {
              $unseen = sqimap_unseen_messages($imapConnection, $numUnseen, $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;
+         }
+      }
 
       $line .= "<NOBR>";
       if ($unseen > 0)
       if ($unseen > 0)
          $line .= "</B>";
 
-      if ($unseen > 0) {
-         $line .= "&nbsp;<small>($unseen)</small>";
+      if ($unseen_found) {
+         $line .= "&nbsp;<small>$unseen_string</small>";
       }
 
       if (($move_to_trash == true) && ($real_box == $trash_folder)) {
          $urlMailbox = urlencode($real_box);
          $line .= "\n<small>\n";
-         $line .= "  &nbsp;&nbsp;&nbsp;&nbsp;(<B><A HREF=\"empty_trash.php?numMessages=$numMessages&mailbox=$urlMailbox\" TARGET=right style=\"text-decoration:none\">"._("purge")."</A></B>)";
+         $line .= "  &nbsp;&nbsp;(<B><A HREF=\"empty_trash.php\" style=\"text-decoration:none\">"._("purge")."</A></B>)";
          $line .= "\n</small>\n";
       }
       $line .= "</NOBR>";
    
    echo "\n<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">\n\n";
 
+   do_hook("left_main_before");
+
    $boxes = sqimap_mailbox_list($imapConnection);
 
    echo "<CENTER><FONT SIZE=4><B>";
       }
       echo "\n$line<BR>\n";
    }
-
-
-   fclose($imapConnection);
-                                  
+   sqimap_logout($imapConnection);
+   do_hook("left_main_after");
 ?>
 </BODY></HTML>