Fixed the position of the + or - for collapsable folders.
[squirrelmail.git] / src / left_main.php
index e2b6872c1f1123a029c700ec835c6dcef172efb7..db51de2777a7b6365bf573e870d6a6d6859a560b 100644 (file)
    include('../src/validate.php');
    include("../functions/array.php");
    include("../functions/imap.php");
-   include("../functions/page_header.php");
    include("../functions/plugin.php");
-   include("../src/load_prefs.php");
 
    // open a connection on the imap port (143)
    $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output
-
+   
    displayHtmlHeader();
 
+   if ($auto_create_special && ! isset($auto_create_done)) {
+         if (isset ($sent_folder) && $sent_folder != "none") {
+                if (!sqimap_mailbox_exists ($imapConnection, $sent_folder)) {
+                       sqimap_mailbox_create ($imapConnection, $sent_folder, "");
+                } else if (! sqimap_mailbox_is_subscribed($imapConnection, $sent_folder)) {
+                   sqimap_subscribe($imapConnection, $sent_folder);
+                }
+         }
+         if (isset ($trash_folder) && $trash_folder != "none") {
+                if (!sqimap_mailbox_exists ($imapConnection, $trash_folder)) {
+                       sqimap_mailbox_create ($imapConnection, $trash_folder, "");
+                } else if (! sqimap_mailbox_is_subscribed($imapConnection, $trash_folder)) {
+                   sqimap_subscribe($imapConnection, $trash_folder);
+                }
+   }
+         $auto_create_done = true;
+         session_register('auto_create_done');
+   }
+
    function formatMailboxName($imapConnection, $box_array, $delimeter) {
       global $folder_prefix, $trash_folder, $sent_folder;
       global $color, $move_to_sent, $move_to_trash;
       global $unseen_notify, $unseen_type, $collapse_folders;
 
       $real_box = $box_array['unformatted'];
-      $mailbox = $box_array['formatted'];
+      $mailbox = str_replace(' ',' ',$box_array['formatted']);
       $mailboxURL = urlencode($real_box);
       
       $unseen = 0;
          else
             $line .= '<tt>&nbsp;</tt>&nbsp;';
       }
-          
+      
       $line .= "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\">";
       if ($special_color == true)
          $line .= "<FONT COLOR=\"$color[11]\">";
-      $line .= str_replace(' ', '&nbsp;', $mailbox);
+      $line .= str_replace(' ','&nbsp;',$mailbox);
       if ($special_color == true)
          $line .= "</font>";
       $line .= "</a>";
 
    function FoldLink($mailbox, $folded) {
        $mailbox = urlencode($mailbox);
-       echo '<tt><a target="left" style="text-decoration:none" ';
-       echo 'href="left_main.php?';
+       $link = '<tt><a target="left" style="text-decoration:none" ';
+       $link .= 'href="left_main.php?';
        if ($folded)
-           echo "unfold=$mailbox\">+";
+           $link .= "unfold=$mailbox\">+";
        else
-           echo "fold=$mailbox\">-";
-       echo '</a></tt>&nbsp;';
+           $link .= "fold=$mailbox\">-";
+       $link .= '</a></tt>&nbsp;';
+       return ($link);
    }
    
 ?>