+ if (isset($left_refresh) && ($left_refresh != "None") && ($left_refresh != "")) {
+ echo "<META HTTP-EQUIV=\"Expires\" CONTENT=\"Thu, 01 Dec 1994 16:00:00 GMT\">\n";
+ echo "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n";
+ echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"$left_refresh;URL=left_main.php\">\n";
+ }
+
+ echo "\n<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">\n";
+
+ do_hook("left_main_before");
+
+ $boxes = sqimap_mailbox_list($imapConnection);
+
+ echo "<CENTER><FONT SIZE=4><B>";
+ echo _("Folders") . "</B><BR></FONT>\n\n";
+
+ echo "<small>(<A HREF=\"../src/left_main.php\" TARGET=\"left\">";
+ echo _("refresh folder list");
+ echo "</A>)</small></CENTER><BR>";
+ $delimeter = sqimap_get_delimiter($imapConnection);
+
+ if (isset($collapse_folders) && $collapse_folders) {
+ if (isset($fold))
+ setPref($data_dir, $username, 'collapse_folder_' . $fold, 1);
+ if (isset($unfold))
+ setPref($data_dir, $username, 'collapse_folder_' . $unfold, 0);
+ $IAmAParent = array();
+ for ($i = 0; $i < count($boxes); $i ++) {
+ $parts = explode($delimeter, $boxes[$i]['unformatted']);
+ $box_name = array_pop($parts);
+ $box_parent = implode($delimeter, $parts);
+ $hidden = 0;
+ if (isset($box_parent)) {
+ $hidden = getPref($data_dir, $username,
+ 'collapse_folder_' . $box_parent);
+ $IAmAParent[$box_parent] = $hidden;
+ }
+ $boxes[$i]['folded'] = $hidden;
+ }
+ }
+
+ for ($i = 0;$i < count($boxes); $i++) {
+ if (! isset($boxes[$i]['folded']) || ! $boxes[$i]['folded'])
+ {
+ $line = "";
+ $mailbox = $boxes[$i]["formatted"];
+
+ if (isset($collapse_folders) && $collapse_folders && isset($IAmAParent[$boxes[$i]['unformatted']])) {
+ $boxes[$i]['parent'] = $IAmAParent[$boxes[$i]['unformatted']];
+ }
+
+ if (in_array('noselect', $boxes[$i]['flags'])) {
+ $line .= "<FONT COLOR=\"$color[10]\">";
+ if (ereg("^( *)([^ ]*)", $mailbox, $regs)) {
+ $line .= str_replace(' ', ' ', $mailbox);
+ if (isset($boxes[$i]['parent']))
+ $line .= FoldLink($boxes[$i]['unformatted'], $boxes[$i]['parent']);
+ elseif ($collapse_folders)
+ $line .= '<tt> </tt> ';
+ }
+ $line .= '</FONT>';
+ } else {
+ $line .= formatMailboxName($imapConnection, $boxes[$i], $delimeter);
+ }
+ echo "$line<BR>\n";
+ }
+ }
+ sqimap_logout($imapConnection);
+ do_hook("left_main_after");
+
+ function FoldLink($mailbox, $folded) {
+ $mailbox = urlencode($mailbox);
+ echo '<tt><a target="left" style="text-decoration:none" ';
+ echo 'href="left_main.php?';
+ if ($folded)
+ echo "unfold=$mailbox\">+";
+ else
+ echo "fold=$mailbox\">-";
+ echo '</a></tt> ';
+ }
+