6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This is the code for the left bar. The left bar shows the folders
10 * available, and has cookie information.
15 require_once('../src/validate.php');
16 require_once('../functions/array.php');
17 require_once('../functions/imap.php');
18 require_once('../functions/plugin.php');
19 require_once('../functions/page_header.php');
20 require_once('../functions/html.php');
22 /* These constants are used for folder stuff. */
23 define('SM_BOX_UNCOLLAPSED', 0);
24 define('SM_BOX_COLLAPSED', 1);
26 /* --------------------- FUNCTIONS ------------------------- */
28 function formatMailboxName($imapConnection, $box_array) {
30 global $folder_prefix, $trash_folder, $sent_folder,
31 $color, $move_to_sent, $move_to_trash,
32 $unseen_notify, $unseen_type, $collapse_folders,
33 $draft_folder, $save_as_draft,
34 $use_special_folder_color;
36 $real_box = $box_array['unformatted'];
37 $mailbox = str_replace(' ','',$box_array['formatted']);
38 $mailboxURL = urlencode($real_box);
40 /* Strip down the mailbox name. */
41 if (ereg("^( *)([^ ]*)$", $mailbox, $regs)) {
47 if (($unseen_notify == 2 && $real_box == 'INBOX') ||
48 $unseen_notify == 3) {
49 $unseen = sqimap_unseen_messages($imapConnection, $real_box);
50 if ($unseen_type == 1 && $unseen > 0) {
51 $unseen_string = "($unseen)";
53 } else if ($unseen_type == 2) {
54 $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
55 $unseen_string = "<font color=\"$color[11]\">($unseen/$numMessages)</font>";
60 $special_color = ($use_special_folder_color && isSpecialMailbox( $real_box ) );
62 /* Start off with a blank line. */
65 /* If there are unseen message, bold the line. */
66 if ($unseen > 0) { $line .= '<B>'; }
68 /* Create the link for this folder. */
69 $line .= '<a href="right_main.php?PG_SHOWALL=0&sort=0&startMessage=1&mailbox='.
70 $mailboxURL.'" TARGET="right" STYLE="text-decoration:none">';
73 $line .= "<font color=\"$color[11]\">";
75 if ( $mailbox == 'INBOX' ) {
78 $line .= str_replace(' ',' ',$mailbox);
80 if ($special_color == TRUE)
84 /* If there are unseen message, close bolding. */
85 if ($unseen > 0) { $line .= "</B>"; }
87 /* Print unseen information. */
88 if (isset($unseen_found) && $unseen_found) {
89 $line .= " <SMALL>$unseen_string</SMALL>";
92 if (($move_to_trash) && ($real_box == $trash_folder)) {
93 if (! isset($numMessages)) {
94 $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
97 if ($numMessages > 0) {
98 $urlMailbox = urlencode($real_box);
99 $line .= "\n<small>\n" .
100 " (<A HREF=\"empty_trash.php\" style=\"text-decoration:none\">"._("purge")."</A>)" .
105 /* Return the final product. */
110 * Recursive function that computes the collapsed status and parent
111 * (or not parent) status of this box, and the visiblity and collapsed
112 * status and parent (or not parent) status for all children boxes.
114 function compute_folder_children(&$parbox, $boxcount) {
115 global $boxes, $data_dir, $username, $collapse_folders;
116 $nextbox = $parbox +
1;
118 /* Retreive the name for the parent box. */
119 $parbox_name = $boxes[$parbox]['unformatted'];
121 /* 'Initialize' this parent box to childless. */
122 $boxes[$parbox]['parent'] = FALSE;
124 /* Compute the collapse status for this box. */
125 if( isset($collapse_folders) && $collapse_folders ) {
126 $collapse = getPref($data_dir, $username, 'collapse_folder_' . $parbox_name);
127 $collapse = ($collapse == '' ? SM_BOX_UNCOLLAPSED
: $collapse);
129 $collapse = SM_BOX_UNCOLLAPSED
;
131 $boxes[$parbox]['collapse'] = $collapse;
133 /* Otherwise, get the name of the next box. */
134 if (isset($boxes[$nextbox]['unformatted'])) {
135 $nextbox_name = $boxes[$nextbox]['unformatted'];
140 /* Compute any children boxes for this box. */
141 while (($nextbox < $boxcount) &&
142 (is_parent_box($boxes[$nextbox]['unformatted'], $parbox_name))) {
144 /* Note that this 'parent' box has at least one child. */
145 $boxes[$parbox]['parent'] = TRUE;
147 /* Compute the visiblity of this box. */
148 $boxes[$nextbox]['visible'] = ($boxes[$parbox]['visible'] &&
149 ($boxes[$parbox]['collapse'] != SM_BOX_COLLAPSED
));
151 /* Compute the visibility of any child boxes. */
152 compute_folder_children($nextbox, $boxcount);
155 /* Set the parent box to the current next box. */
160 * Create the link for a parent folder that will allow that
161 * parent folder to either be collapsed or expaned, as is
162 * currently appropriate.
164 function create_collapse_link($boxnum) {
165 global $boxes, $imapConnection, $unseen_notify, $color;
166 $mailbox = urlencode($boxes[$boxnum]['unformatted']);
168 /* Create the link for this collapse link. */
169 $link = '<a target="left" style="text-decoration:none" ' .
170 'href="left_main.php?';
171 if ($boxes[$boxnum]['collapse'] == SM_BOX_COLLAPSED
) {
173 /* this code checks unseen_notify settings and displays
174 * a total next to a colapsed folder for the amount of
175 * unread mail in its sunfolders
177 $box_count = count($boxes);
178 $cur_box = $boxes[$boxnum]['unformatted'];
180 $length = strlen($cur_box);
181 if (($unseen_notify == 2 && $cur_box == 'INBOX') ||
$unseen_notify == 3) {
182 for ($i=0;$i<$box_count;$i++
) {
184 if ($cur_box != $boxes[$i]['unformatted']) {
185 if (substr($boxes[$i]['unformatted'], 0, $length) == $cur_box) {
186 if (!in_array('noselect', $boxes[$i]['flags'])) {
187 $this_unseen = sqimap_unseen_messages($imapConnection,
188 $boxes[$i]['unformatted']);
192 $parent_unseen +
= $this_unseen;
195 if ($parent_unseen > 0) {
196 $link .= "unfold=$mailbox\">+<font color=\"$color[11]\">($parent_unseen)</font>";
199 $link .= "unfold=$mailbox\">+";
203 $link .= "fold=$mailbox\">-";
207 /* Return the finished product. */
212 * This simple function checks if a box is another box's parent.
214 function is_parent_box($curbox_name, $parbox_name) {
217 /* Extract the name of the parent of the current box. */
218 $curparts = explode($delimiter, $curbox_name);
219 $curname = array_pop($curparts);
220 $actual_parname = implode($delimiter, $curparts);
221 $actual_parname = substr($actual_parname,0,strlen($parbox_name));
223 /* Compare the actual with the given parent name. */
224 return ($parbox_name == $actual_parname);
227 function listBoxes ($boxes, $j=0 ) {
228 global $data_dir, $username, $startmessage, $color, $unseen_notify, $unseen_type,
229 $move_to_trash, $trash_folder, $collapse_folders;
234 $mailbox = $boxes->mailboxname_full
;
236 for ($k = 0; $k < $j; $k++
) {
237 $leader.= '   ';
239 $mailboxURL = urlencode($mailbox);
241 /* get unseen/total messages information */
242 if ($boxes->unseen
) {
243 $unseen = $boxes->unseen
;
244 $unseen_string = "($unseen)";
245 if ($unseen>0) $unseen_found = TRUE;
247 $numMessages = $boxes->total
;
248 $unseen_string = "<font color=\"$color[11]\">($unseen/$numMessages)</font>";
254 if (isset($boxes->mbxs
[0]) && $collapse_folders) {
255 $collapse = getPref($data_dir, $username, 'collapse_folder_' . $mailbox);
256 $collapse = ($collapse == '' ? SM_BOX_UNCOLLAPSED
: $collapse);
258 $link = '<a target="left" style="text-decoration:none" ' .'href="left_main.php?';
260 $link .= "unfold=$mailboxURL\">$leader + ";
262 $link .= "fold=$mailboxURL\">$leader - ";
267 $pre.= $leader . '   ';
271 /* If there are unseen message, bold the line. */
272 if ($unseen > 0) { $pre .= '<B>'; }
274 if (($move_to_trash) && ($mailbox == $trash_folder)) {
275 if (! isset($numMessages)) {
276 $numMessages = sqimap_get_num_messages($imapConnection, $mailbox);
279 if ($numMessages > 0) {
280 $urlMailbox = urlencode($mailbox);
281 $pre .= "\n<small>\n" .
282 " (<A HREF=\"empty_trash.php\" style=\"text-decoration:none\">"._("purge")."</A>)" .
286 if (!$boxes->is_noselect
) {
287 $pre .= "<a HREF=\"right_main.php?PG_SHOWALL=0&sort=0&startMessage=1&mailbox=$mailboxURL\" TARGET=\"right\">";
292 /* If there are unseen message, close bolding. */
293 if ($unseen > 0) { $end .= "</B>"; }
295 /* Print unseen information. */
296 if (isset($unseen_found) && $unseen_found) {
297 $end .= " <SMALL>$unseen_string</SMALL>";
302 if ($boxes->is_special
) {
303 $font = "<FONT COLOR=\"$color[11]\">";
304 $fontend = "</FONT>";
307 if (!$boxes->is_root
) {
308 echo "" . $pre .$font. $boxes->mailboxname_sub
.$fontend . $end. '<br>';
311 if (!$collapse ||
$boxes->is_root
) {
312 for ($i = 0; $i <count($boxes->mbxs
); $i++
) {
313 listBoxes($boxes->mbxs
[$i],$j);
320 function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) {
321 global $data_dir, $username, $startmessage, $color, $unseen_notify, $unseen_type,
322 $move_to_trash, $trash_folder, $collapse_folders;
324 /* use_folder_images only works if the images exist in ../images */
325 $use_folder_images = true;
332 $mailbox = $boxes->mailboxname_full
;
333 $mailboxURL = urlencode($mailbox);
335 /* get unseen/total messages information */
336 if ($boxes->unseen
) {
337 $unseen = $boxes->unseen
;
338 $unseen_string = "($unseen)";
339 if ($unseen>0) $unseen_found = TRUE;
341 $numMessages = $boxes->total
;
342 $unseen_string = "<font color=\"$color[11]\">($unseen/$numMessages)</font>";
346 /* If there are unseen message, bold the line. */
347 if ($unseen > 0) { $pre .= '<B>'; }
349 /* color special boxes */
350 if ($boxes->is_special
) {
351 $pre .= "<FONT COLOR=\"$color[11]\">";
355 /* If there are unseen message, close bolding. */
356 if ($unseen > 0) { $end .= "</B>"; }
358 /* Print unseen information. */
359 if (isset($unseen_found) && $unseen_found) {
360 $end .= " $unseen_string";
363 if (($move_to_trash) && ($mailbox == $trash_folder)) {
364 if (! isset($numMessages)) {
365 $numMessages = $boxes->total
;
367 if ($numMessages > 0) {
368 $urlMailbox = urlencode($mailbox);
369 $pre .= "\n<small>\n" .
370 " (<a class=\"mbx_link\" HREF=\"empty_trash.php\">"._("purge")."</a>)" .
374 if (!$boxes->is_noselect
) { /* \Noselect boxes can't be selected */
375 $pre .= "<a class=\"mbx_link\" HREF=\"right_main.php?PG_SHOWALL=0&sort=0&startMessage=1&mailbox=$mailboxURL\" TARGET=\"right\">";
380 if (!$boxes->is_root
) {
381 if ($use_folder_images) {
382 if ($boxes->is_inbox
) {
383 $folder_img = '../images/inbox.gif';
384 } else if ($boxes->is_sent
) {
385 $folder_img = '../images/senti.gif';
386 } else if ($boxes->is_trash
) {
387 $folder_img = '../images/delitem.gif';
388 } else if ($boxes->is_draft
) {
389 $folder_img = '../images/draft.gif';
390 } else $folder_img = '../images/folder.gif';
391 $folder_img = ' <img src="'.$folder_img.'" height="15" valign="center"> ';
392 } else $folder_img = '';
393 if (!isset($boxes->mbxs
[0])) {
394 echo ' ' . html_tag( 'div',
395 $pre . $folder_img . $boxes->mailboxname_sub
. $end ,
396 'left', '', 'class="mbx_sub" id="' .$j. '"' )
399 /* get collapse information */
400 if ($collapse_folders) {
401 $link = '<a target="left" style="text-decoration:none" ' .'href="left_main.php?';
402 $form_entry = $j.'F';
403 if (isset($mbx) && isset($mbx[$form_entry])) {
404 $collapse = $mbx[$form_entry];
406 setPref($data_dir, $username, 'collapse_folder_'.$boxes->mailboxname_full
, SM_BOX_COLLAPSED
);
408 setPref($data_dir, $username, 'collapse_folder_'.$boxes->mailboxname_full
, SM_BOX_UNCOLLAPSED
);
411 $collapse = getPref($data_dir, $username, 'collapse_folder_' . $mailbox);
412 $collapse = ($collapse == '' ? SM_BOX_UNCOLLAPSED
: $collapse);
415 $link = '<a href="javascript:void(0)">'." <img src=\"../images/plus.gif\" border=\"1\" id=$j onclick=\"hidechilds(this)\"></A>";
417 $link = '<a href="javascript:void(0)">'."<img src=\"../images/minus.gif\" border=\"1\" id=$j onclick=\"hidechilds(this)\"></a>";
419 $collapse_link = $link;
420 } else $collapse_link='';
421 echo ' ' . html_tag( 'div',
422 $collapse_link . $pre . $folder_img . ' '. $boxes->mailboxname_sub
. $end ,
423 'left', '', 'class="mbx_par" id="' .$j. 'P"' )
425 echo ' <INPUT TYPE="hidden" name=mbx['.$j. 'F] value="'.$collapse.'" id="mbx['.$j.'F]">'."\n";
429 $visible = ' STYLE="display:none;"';
431 $visible = ' STYLE="display:block;"';
434 if (isset($boxes->mbxs
[0]) && !$boxes->is_root
) /* mailbox contains childs */
435 echo html_tag( 'div', '', 'left', '', 'class="par_area" id='.$j.'.0000 '. $visible ) . "\n";
437 if ($j !='ID.0000') {
440 for ($i = 0; $i <count($boxes->mbxs
); $i++
) {
442 listAdvancedBoxes($boxes->mbxs
[$i],$mbx,$j);
444 if (isset($boxes->mbxs
[0]) && !$boxes->is_root
) echo '</div>'."\n\n";
451 /* -------------------- MAIN ------------------------ */
453 global $delimiter, $default_folder_prefix, $left_size;
455 // open a connection on the imap port (143)
456 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output
459 * Using stristr since older preferences may contain "None" and "none".
461 if (isset($left_refresh) && ($left_refresh != '') &&
462 !stristr($left_refresh, "none")){
463 $xtra = "\n<META HTTP-EQUIV=\"Expires\" CONTENT=\"Thu, 01 Dec 1994 16:00:00 GMT\">\n" .
464 "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n".
465 "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"$left_refresh;URL=left_main.php\">\n";
471 * $advanced_tree and $oldway are boolean vars which are default set to default
473 * Setting $oldway to false causes left_main.php to use the new experimental
474 * way of getting the mailbox-tree.
475 * Setting $advanced tree to true causes SM to display a experimental
476 * mailbox-tree with dhtml behaviour.
477 * It only works on browsers which supports css and javascript. The used
478 * javascript is experimental and doesn't support all browsers. It is tested on
479 * IE6 an Konquerer 3.0.0-2.
480 * In the function ListAdvancedBoxes there is another var $use_folder_images.
481 * setting this to true is only usefull if the images exists in ../images.
483 * Feel free to experiment with the code and report bugs and enhancements
484 * to marc@its-projects.nl
487 $advanced_tree = false; /* set this to true if you want to see a nicer mailboxtree */
488 $oldway = true; /* default SM behaviour */
490 if ($advanced_tree) {
492 <script language="Javascript" TYPE="text/javascript">
496 function hidechilds(el) {
498 form_id = "mbx[" + el.id +"F]";
500 ele = document.all[id];
502 if(ele.style.display == "none") {
503 ele.style.display = "block";
504 ele.style.visibility = "visible"
505 el.src="../images/minus.gif";
506 document.all[form_id].value=0;
508 ele.style.display = "none";
509 ele.style.visibility = "hidden"
510 el.src="../images/plus.gif";
511 document.all[form_id].value=1;
514 } else if (document.getElementById) {
515 ele = document.getElementById(id);
517 if(ele.style.display == "none") {
518 ele.style.display = "block";
519 ele.style.visibility = "visible"
520 el.src="../images/minus.gif";
521 document.getElementById(form_id).value=0;
523 ele.style.display = "none";
524 ele.style.visibility = "hidden"
525 el.src="../images/plus.gif";
526 document.getElementById(form_id).value=1;
533 if (!document.images) return;
534 var ar = new Array();
535 var arguments = preload.arguments;
536 for (var i = 0; i<arguments.length; i++) {
538 ar[i].src = arguments[i];
542 function buttonover(el,on) {
544 el.style.borderColor="blue";}
546 el.style.borderColor="orange";}
549 function buttonclick(el,on) {
551 el.style.border="groove"}
553 el.style.border="ridge";}
556 function hideframe(hide) {
559 $xtra .= " left_size = \"$left_size\";\n";
562 masterf = window.parent.document.all["fs1"];
563 leftf = window.parent.document.all["left"];
564 leftcontent = document.all["leftframe"];
565 leftbutton = document.all["showf"];
566 } else if (document.getElementById) {
567 masterf = window.parent.document.getElementById("fs1");
568 leftf = window.parent.document.getElementById("left");
569 leftcontent = document.getElementById("leftframe");
570 leftbutton = document.getElementById("showf");
575 new_col = calc_col("20");
576 masterf.cols = new_col;
577 document.body.scrollLeft=0;
578 document.body.style.overflow='hidden';
579 leftcontent.style.display = 'none';
580 leftbutton.style.display='block';
582 masterf.cols = calc_col(left_size);
583 document.body.style.overflow='';
584 leftbutton.style.display='none';
585 leftcontent.style.display='block';
590 function calc_col(c_w) {
593 if ($location_of_bar == 'right') {
594 $xtra .= ' right=true;';
596 $xtra .= ' right=false;';
608 function resizeframe(direction) {
610 masterf = window.parent.document.all["fs1"];
611 } else if (document.getElementById) {
612 window.parent.document.getElementById("fs1");
618 if ($location_of_bar == 'right') {
619 $xtra .= ' colPat=/^\*,(\d+)$/;';
621 $xtra .= ' colPat=/^(\d+),.*$/;';
626 old_col = masterf.cols;
627 colPat.exec(old_col);
630 new_col_width = parseInt(RegExp.$1) + 25;
633 if (parseInt(RegExp.$1) > 35) {
634 new_col_width = parseInt(RegExp.$1) - 25;
637 masterf.cols = calc_col(new_col_width);
646 /* style definitions */
650 <STYLE TYPE="text/css">
653 margin: 0px 0px 0px 0px;
654 padding: 5px 5px 5px 5px;
672 text-decoration: none;
673 background-color: $color[0];
678 background-color: $color[9];
700 border-left-width:0.1em;
701 border-left-color:blue;
702 border-bottom: solid;
703 border-bottom-width:0.1em;
704 border-bottom-color:blue;
717 background: $color[0];
731 displayHtmlHeader( 'SquirrelMail', $xtra );
733 /* If requested and not yet complete, attempt to autocreate folders. */
734 if ($auto_create_special && !isset($auto_create_done)) {
735 $autocreate = array($sent_folder, $trash_folder, $draft_folder);
736 foreach( $autocreate as $folder ) {
737 if (($folder != '') && ($folder != 'none')) {
738 if ( !sqimap_mailbox_exists($imapConnection, $folder)) {
739 sqimap_mailbox_create($imapConnection, $folder, '');
740 } else if (!sqimap_mailbox_is_subscribed($imapConnection, $folder)) {
741 sqimap_subscribe($imapConnection, $folder);
746 /* Let the world know that autocreation is complete! Hurrah! */
747 $auto_create_done = TRUE;
748 session_register('auto_create_done');
751 echo "\n<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">\n";
753 do_hook('left_main_before');
754 if ($advanced_tree) {
755 /* nice future feature, needs layout !! volunteers? */
756 $right_pos = $left_size - 20;
757 echo '<div style="position:absolute;top:0;border=solid;border-width:0.1em;border-color:blue;"><div ID="hidef" style="width=20;font-size:12"><A HREF="javascript:hideframe(true)"><b><<</b></a></div>';
758 echo '<div ID="showf" style="width=20;font-size:12;display:none;"><A HREF="javascript:hideframe(false)"><b>>></b></a></div>';
759 echo '<div ID="incrf" style="width=20;font-size:12"><A HREF="javascript:resizeframe(true)"><b>></b></a></div>';
760 echo '<div ID="decrf" style="width=20;font-size:12"><A HREF="javascript:resizeframe(false)"><b><</b></a></div></div>';
761 echo '<div ID="leftframe"><br><br>';
764 echo "\n\n" . html_tag( 'table', '', '', '', 'border="0" cellspacing="0" cellpadding="0" width="100%"' ) .
766 html_tag( 'td', '', 'left' ) .
767 '<center><font size="4"><b>'. _("Folders") . "</b><br></font>\n\n";
769 if ($date_format != 6) {
770 /* First, display the clock. */
771 if ($hour_format == 1) {
773 if ($date_format == 4) {
777 if ($date_format == 4) {
784 switch( $date_format ) {
786 $clk = date('m/d/y '.$hr, time());
789 $clk = date('d/m/y '.$hr, time());
793 $clk = date($hr, time());
796 $clk = substr( getDayName( date( 'w', time() ) ), 0, 3 ) . date( ', ' . $hr, time() );
798 $clk = str_replace(' ',' ',$clk);
800 echo '<center><small>' . str_replace(' ',' ',_("Last Refresh")) .
801 ": $clk</small></center>";
804 /* Next, display the refresh button. */
805 echo '<small>(<a href="../src/left_main.php" target="left">'.
806 _("refresh folder list") . '</a>)</small></center><br>';
808 /* Lastly, display the folder list. */
809 if ( $collapse_folders ) {
810 /* If directed, collapse or uncollapse a folder. */
812 setPref($data_dir, $username, 'collapse_folder_' . $fold, SM_BOX_COLLAPSED
);
813 } else if (isset($unfold)) {
814 setPref($data_dir, $username, 'collapse_folder_' . $unfold, SM_BOX_UNCOLLAPSED
);
818 if ($oldway) { /* normal behaviour SM */
820 $boxes = sqimap_mailbox_list($imapConnection);
821 /* Prepare do do out collapsedness and visibility computation. */
823 $boxcount = count($boxes);
825 /* Compute the collapsedness and visibility of each box. */
827 while ($curbox < $boxcount) {
828 $boxes[$curbox]['visible'] = TRUE;
829 compute_folder_children($curbox, $boxcount);
833 for ($i = 0; $i < count($boxes); $i++
) {
834 if ( $boxes[$i]['visible'] ) {
835 $mailbox = $boxes[$i]['formatted'];
836 $mblevel = substr_count($boxes[$i]['unformatted'], $delimiter) +
1;
838 /* Create the prefix for the folder name and link. */
839 $prefix = str_repeat(' ',$mblevel);
840 if (isset($collapse_folders) && $collapse_folders && $boxes[$i]['parent']) {
841 $prefix = str_replace(' ',' ',substr($prefix,0,strlen($prefix)-2)).
842 create_collapse_link($i) . ' ';
844 $prefix = str_replace(' ',' ',$prefix);
846 $line = "<NOBR><TT>$prefix</TT>";
848 /* Add the folder name and link. */
849 if (! isset($color[15])) {
850 $color[15] = $color[6];
853 if (in_array('noselect', $boxes[$i]['flags'])) {
854 if( isSpecialMailbox( $boxes[$i]['unformatted']) ) {
855 $line .= "<FONT COLOR=\"$color[11]\">";
857 $line .= "<FONT COLOR=\"$color[15]\">";
859 if (ereg("^( *)([^ ]*)", $mailbox, $regs)) {
860 $mailbox = str_replace(' ','',$mailbox);
861 $line .= str_replace(' ', ' ', $mailbox);
865 $line .= formatMailboxName($imapConnection, $boxes[$i]);
868 /* Put the final touches on our folder line. */
869 $line .= "</NOBR><BR>\n";
871 /* Output the line for this folder. */
875 } else { /* expiremental code */
876 $boxes = sqimap_mailbox_tree($imapConnection);
877 if (isset($advanced_tree) && $advanced_tree) {
878 echo '<FORM name=collapse action="left_main.php" METHOD=POST' .
879 'ENCTYPE="multipart/form-data"'."\n";
880 echo '<small><button type="submit" class="button" onmouseover="buttonover(this,true)" onmouseout="buttonover(this,false)" onmousedown="buttonclick(this,true)" onmouseup="buttonclick(this,false)">'. _("Save folder tree") .'</button><br><br>';
881 echo '<DIV ID=mailboxes CLASS=mailboxes>'."\n\n";
882 if (!isset($mbx)) $mbx=NULL;
883 ListAdvancedBoxes($boxes, $mbx);
884 echo '</div></small>'."\n";
889 } /* if ($oldway) else ... */
890 do_hook('left_main_after');
891 sqimap_logout($imapConnection);
893 echo '</td></tr></table>' . "\n".
894 "</div></body></html>\n";