alignment modifications. You can't see the difference on IE6.
[squirrelmail.git] / src / left_main.php
index af9b6c2dd77209612b7a909cbbc5aeed7cc549bf..8cd03bcd1b75c43b35bb54b9c4999d3c72a3f78e 100644 (file)
  * $Id$
  */
 
-require_once('../src/validate.php');
-require_once('../functions/array.php');
-require_once('../functions/imap.php');
-require_once('../functions/plugin.php');
-require_once('../functions/page_header.php');
-require_once('../functions/html.php');
+/* Path for SquirrelMail required files. */
+define('SM_PATH','../');
+
+/* SquirrelMail required files. */
+require_once(SM_PATH . 'include/validate.php');
+require_once(SM_PATH . 'functions/array.php');
+require_once(SM_PATH . 'functions/imap.php');
+require_once(SM_PATH . 'functions/plugin.php');
+require_once(SM_PATH . 'functions/page_header.php');
+require_once(SM_PATH . 'functions/html.php');
 
 /* These constants are used for folder stuff. */
 define('SM_BOX_UNCOLLAPSED', 0);
@@ -181,7 +185,7 @@ function create_unseen_string($boxName, $boxArray, $imapConnection) {
     global $boxes, $unseen_type, $color;
 
     /* Initialize the return value. */
-    $result = array();
+    $result = array(0,0);
 
     /* Initialize the counts for this folder. */
     $boxUnseenCount = 0;
@@ -195,10 +199,13 @@ function create_unseen_string($boxName, $boxArray, $imapConnection) {
         $boxMessageCount = sqimap_get_num_messages($imapConnection, $boxName);
     }
 
+    /* Initialize the total counts. */
+
     if ($boxArray['collapse'] == SM_BOX_COLLAPSED) {
         /* Collect the counts for this boxes subfolders. */
         $curBoxLength = strlen($boxName);
         $boxCount = count($boxes);
+
         for ($i = 0; $i < $boxCount; ++$i) {
             /* Initialize the counts for this subfolder. */
             $subUnseenCount = 0;
@@ -212,38 +219,29 @@ function create_unseen_string($boxName, $boxArray, $imapConnection) {
                 if ($unseen_type == 2) {
                     $subMessageCount = sqimap_get_num_messages($imapConnection, $boxes[$i]['unformatted']);
                 }
-            }
 
-            /* Add the counts for this subfolder to the total. */
-            $totalUnseenCount += $subUnseenCount;
-            $totalMessageCount += $subMessageCount;
+                /* Add the counts for this subfolder to the total. */
+                $totalUnseenCount += $subUnseenCount;
+                $totalMessageCount += $subMessageCount;
+            }
         }
+
+        /* Add the counts for all subfolders to that of the box. */
+        $boxUnseenCount += $totalUnseenCount;
+        $boxMessageCount += $totalMessageCount;
     }
 
     /* And create the magic unseen count string.     */
     /* Really a lot more then just the unseen count. */
     if (($unseen_type == 1) && ($boxUnseenCount > 0)) {
-        if ($totalUnseenCount == 0) {
-            $result[0] = "($boxUnseenCount)";
-        } else {
-            $result[0] = "($boxUnseenCount:$totalUnseenCount)";
-        }
+        $result[0] = "($boxUnseenCount)";
     } else if ($unseen_type == 2) {
-        if ($totalMessageCount == 0) {
-            $result[0] = "($boxUnseenCount/$boxMessageCount)";
-        } else {
-            $result[0] = "($boxUnseenCount/$boxMessageCount"
-                       . '&nbsp;:&nbsp;'
-                       . "$totalUnseenCount/$totalMessageCount)";
-        }
+        $result[0] = "($boxUnseenCount/$boxMessageCount)";
         $result[0] = "<font color=\"$color[11]\">$result[0]</font>";
     }
 
-    /* Decide on an unseen count to return to the outside world. */
+    /* Set the unseen count to return to the outside world. */
     $result[1] = $boxUnseenCount;
-    if ($boxArray['collapse'] == SM_BOX_COLLAPSED) {
-        $result[1] += $totalUnseenCount;
-    }
 
     /* Return our happy result. */
     return ($result);
@@ -491,7 +489,17 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) {
 
 /* -------------------- MAIN ------------------------ */
 
-global $delimiter, $default_folder_prefix, $left_size;
+$key = $_COOKIE['key'];
+$onetimepad = $_SESSION['onetimepad'];
+$username = $_SESSION['username'];
+$delimiter = $_SESSION['delimiter'];
+
+if (isset($_GET['fold'])) {
+    $fold = $_GET['fold'];
+}
+if (isset($_GET['unfold'])) {
+    $unfold = $_GET['unfold'];
+}
 
 // open a connection on the imap port (143)
 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output
@@ -786,7 +794,7 @@ if ($auto_create_special && !isset($auto_create_done)) {
 
     /* Let the world know that autocreation is complete! Hurrah! */
     $auto_create_done = TRUE;
-    session_register('auto_create_done');
+    sqsession_register($auto_create_done, 'auto_create_done');
 }
 
 echo "\n<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">\n";
@@ -802,7 +810,7 @@ if ($advanced_tree) {
    echo '<div ID="leftframe"><br><br>';
 }
 
-echo "\n\n" . html_tag( 'table', '', '', '', 'border="0" cellspacing="0" cellpadding="0" width="100%"' ) . 
+echo "\n\n" . html_tag( 'table', '', 'left', '', 'border="0" cellspacing="0" cellpadding="0" width="99%"' ) . 
     html_tag( 'tr' ) . 
     html_tag( 'td', '', 'left' ) . 
     '<center><font size="4"><b>'. _("Folders") . "</b><br></font>\n\n";