- added a hook at beginning of left_main
[squirrelmail.git] / src / left_main.php
index 5ec8a4f3e4dabef9cf80c99e8db201ea11e53e5d..91d2bcc0717ef59972d4c8a61b1e8b41efcc7488 100644 (file)
       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);
 ?>
 </BODY></HTML>