New function: sqimap_create_stream(). Returns an IMAP stream.
[squirrelmail.git] / src / left_main.php
index eb1b0995a2d54d9c55cfd183fd4282283dd0126b..0f13c1d5ccf9c4d24559113cee1f04fcaaa8ee53 100644 (file)
@@ -287,18 +287,13 @@ function is_parent_box($curbox_name, $parbox_name) {
 
 function ListBoxes ($boxes, $j=0 ) {
     global $data_dir, $username, $startmessage, $color, $unseen_notify, $unseen_type,
-    $move_to_trash, $trash_folder, $collapse_folders, $imapConnection;
+           $move_to_trash, $trash_folder, $collapse_folders, $imapConnection;
+
     $pre = '<nobr>';
     $end = '';
     $collapse = false;
-    $unseen_type = 1;
-    $unseen_notify = 0;
     $unseen = 0;
 
-    /* Get unseen/total display prefs */
-    $unseen_type = getPref( $data_dir , $username , 'unseen_type' );
-    $unseen_notify = getPref( $data_dir , $username , 'unseen_notify' );
-
     if (isset($boxes) && !empty($boxes)) {
         $mailbox = $boxes->mailboxname_full;
         $leader = '<tt>';
@@ -431,7 +426,7 @@ function ListBoxes ($boxes, $j=0 ) {
 
 function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) {
     global $data_dir, $username, $startmessage, $color, $unseen_notify, $unseen_type,
-    $move_to_trash, $trash_folder, $collapse_folders;
+           $move_to_trash, $trash_folder, $collapse_folders;
 
     if (!$boxes)
        return;
@@ -627,8 +622,12 @@ if (isset($left_refresh) && ($left_refresh != '') &&
  * to marc@its-projects.nl
  **/
 
-$advanced_tree = false;  /* set this to true if you want to see a nicer mailboxtree */
-$oldway = false;        /* default SM behaviour */
+/* set this to true if you want to see a nicer mailboxtree */
+if (! isset($advanced_tree) || $advanced_tree=="" ) {
+         $advanced_tree=false; }
+/* default SM behaviour */
+if (! isset($oldway) || $oldway=="" ) {
+         $oldway=false; }
 
 if ($advanced_tree) {
 $xtra .= <<<ECHO
@@ -987,6 +986,26 @@ if ( $collapse_folders ) {
     }
 }
 
+/* Get unseen/total display prefs */
+$unseen_type = getPref( $data_dir , $username , 'unseen_type' );
+$unseen_notify = getPref( $data_dir , $username , 'unseen_notify' );
+
+if (!isset($unseen_type) || empty($unseen_type)) {
+    if (isset($default_unseen_type) && !empty($default_unseen_type)) {
+        $unseen_type = $default_unseen_type;
+    } else {
+        $unseen_type = 1;
+    }
+}
+
+if (!isset($unseen_notify) || empty($unseen_notify)) {
+    if (isset($default_unseen_notify) && !empty($default_unseen_notify)) {
+        $unseen_notify = $default_unseen_notify;
+    } else {
+        $unseen_notify = 0;
+    }
+}
+
 if ($oldway) {  /* normal behaviour SM */
 
 $boxes = sqimap_mailbox_list($imapConnection);