Always show Purge link next to Trash, so one doesn't have to reload left_main
[squirrelmail.git] / src / left_main.php
CommitLineData
59177427 1<?php
895905c0 2
35586184 3/**
4 * left_main.php
5 *
6c84ba1e 6 * Copyright (c) 1999-2005 The SquirrelMail Project Team
35586184 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * This is the code for the left bar. The left bar shows the folders
10 * available, and has cookie information.
11 *
30967a1e 12 * @version $Id$
8f6f9ba5 13 * @package squirrelmail
1c52ba77 14 */
35586184 15
30967a1e 16/**
17 * Path for SquirrelMail required files.
18 * @ignore
19 */
dcc1cc82 20define('SM_PATH','../');
86725763 21
22/* SquirrelMail required files. */
08185f2a 23require_once(SM_PATH . 'include/validate.php');
86725763 24require_once(SM_PATH . 'functions/imap.php');
25require_once(SM_PATH . 'functions/plugin.php');
26require_once(SM_PATH . 'functions/page_header.php');
27require_once(SM_PATH . 'functions/html.php');
b6d26135 28require_once(SM_PATH . 'functions/date.php');
142499d4 29
95e93571 30/* These constants are used for folder stuff. */
31define('SM_BOX_UNCOLLAPSED', 0);
32define('SM_BOX_COLLAPSED', 1);
a6d2e0de 33
2d367c68 34/* --------------------- FUNCTIONS ------------------------- */
525b7ae6 35
95e93571 36function formatMailboxName($imapConnection, $box_array) {
1c52ba77 37
ce68b76b 38 global $trash_folder, $color, $move_to_trash,
39 $unseen_notify, $unseen_type, $use_special_folder_color;
95e93571 40 $real_box = $box_array['unformatted'];
41 $mailbox = str_replace('&nbsp;','',$box_array['formatted']);
42 $mailboxURL = urlencode($real_box);
dcc1cc82 43
95e93571 44 /* Strip down the mailbox name. */
45 if (ereg("^( *)([^ ]*)$", $mailbox, $regs)) {
46 $mailbox = $regs[2];
47 }
ae012102 48 $unseen = 0;
ae37633c 49 $status = array('','');
ae012102 50 if (($unseen_notify == 2 && $real_box == 'INBOX') ||
51 $unseen_notify == 3) {
134e4174 52 $tmp_status = create_unseen_string($real_box, $box_array, $imapConnection, $unseen_type );
53 if ($status !== false) {
54 $status = $tmp_status;
55 }
474fc5fa 56 }
ae37633c 57 list($unseen_string, $unseen) = $status;
ffb1a3d9 58 $special_color = ($use_special_folder_color && isSpecialMailbox($real_box));
f7b1b3b1 59
95e93571 60 /* Start off with a blank line. */
61 $line = '';
235a65d5 62
95e93571 63 /* If there are unseen message, bold the line. */
6fd95361 64 if ($unseen > 0) { $line .= '<b>'; }
a6d2e0de 65
fb0ca797 66 /* Create the link for this folder. */
474fc5fa 67 if ($status !== false) {
134e4174 68 $line .= '<a href="right_main.php?PG_SHOWALL=0&amp;startMessage=1&amp;mailbox='.
69 $mailboxURL.'" target="right" style="text-decoration:none">';
a6172cd5 70 }
1c52ba77 71 if ($special_color) {
3fde693b 72 $line .= "<font color=\"$color[11]\">";
1c52ba77 73 }
a551489c 74 if ( $mailbox == 'INBOX' ) {
75 $line .= _("INBOX");
76 } else {
91727f6a 77 $line .= str_replace(array(' ','<','>'),array('&nbsp;','&lt;','&gt;'),$mailbox);
a551489c 78 }
90de1755 79 if ($special_color == TRUE)
3fde693b 80 $line .= '</font>';
474fc5fa 81 if ($status !== false) {
134e4174 82 $line .= '</a>';
474fc5fa 83 }
a6d2e0de 84
95e93571 85 /* If there are unseen message, close bolding. */
6fd95361 86 if ($unseen > 0) { $line .= "</b>"; }
2d367c68 87
95e93571 88 /* Print unseen information. */
ffb1a3d9 89 if ($unseen_string != '') {
796f91d9 90 $line .= "&nbsp;<small>$unseen_string</small>";
2016e645 91 }
92
dea5ef88 93 /* If it's the trash folder, show a purge link */
1c52ba77 94 if (($move_to_trash) && ($real_box == $trash_folder)) {
dea5ef88 95 $urlMailbox = urlencode($real_box);
96 $line .= "\n<small>\n" .
97 '&nbsp;&nbsp;[<a href="empty_trash.php">'._("Purge").'</a>]' .
98 '</small>';
a6d2e0de 99 }
a6d2e0de 100
8fc208f8 101
102 // let plugins fiddle with end of line
103 $line .= concat_hook_function('left_main_after_each_folder',
104 array(isset($numMessages) ? $numMessages : '', $real_box, $imapConnection));
105
106
95e93571 107 /* Return the final product. */
108 return ($line);
109}
a6d2e0de 110
95e93571 111/**
112 * Recursive function that computes the collapsed status and parent
113 * (or not parent) status of this box, and the visiblity and collapsed
114 * status and parent (or not parent) status for all children boxes.
115 */
116function compute_folder_children(&$parbox, $boxcount) {
117 global $boxes, $data_dir, $username, $collapse_folders;
118 $nextbox = $parbox + 1;
119
120 /* Retreive the name for the parent box. */
121 $parbox_name = $boxes[$parbox]['unformatted'];
122
123 /* 'Initialize' this parent box to childless. */
1c52ba77 124 $boxes[$parbox]['parent'] = FALSE;
95e93571 125
126 /* Compute the collapse status for this box. */
127 if( isset($collapse_folders) && $collapse_folders ) {
128 $collapse = getPref($data_dir, $username, 'collapse_folder_' . $parbox_name);
129 $collapse = ($collapse == '' ? SM_BOX_UNCOLLAPSED : $collapse);
130 } else {
131 $collapse = SM_BOX_UNCOLLAPSED;
a6d2e0de 132 }
95e93571 133 $boxes[$parbox]['collapse'] = $collapse;
2d367c68 134
95e93571 135 /* Otherwise, get the name of the next box. */
1c52ba77 136 if (isset($boxes[$nextbox]['unformatted'])) {
95e93571 137 $nextbox_name = $boxes[$nextbox]['unformatted'];
1c52ba77 138 } else {
95e93571 139 $nextbox_name = '';
1c52ba77 140 }
a6d2e0de 141
95e93571 142 /* Compute any children boxes for this box. */
143 while (($nextbox < $boxcount) &&
144 (is_parent_box($boxes[$nextbox]['unformatted'], $parbox_name))) {
a6d2e0de 145
95e93571 146 /* Note that this 'parent' box has at least one child. */
1c52ba77 147 $boxes[$parbox]['parent'] = TRUE;
a6d2e0de 148
95e93571 149 /* Compute the visiblity of this box. */
1c52ba77 150 $boxes[$nextbox]['visible'] = ($boxes[$parbox]['visible'] &&
151 ($boxes[$parbox]['collapse'] != SM_BOX_COLLAPSED));
a6d2e0de 152
95e93571 153 /* Compute the visibility of any child boxes. */
154 compute_folder_children($nextbox, $boxcount);
155 }
2d367c68 156
95e93571 157 /* Set the parent box to the current next box. */
158 $parbox = $nextbox;
159}
2d367c68 160
95e93571 161/**
162 * Create the link for a parent folder that will allow that
163 * parent folder to either be collapsed or expaned, as is
164 * currently appropriate.
165 */
166function create_collapse_link($boxnum) {
ce68b76b 167 global $boxes, $unseen_notify, $color, $use_icons, $icon_theme;
95e93571 168 $mailbox = urlencode($boxes[$boxnum]['unformatted']);
a6172cd5 169
95e93571 170 /* Create the link for this collapse link. */
90de1755 171 $link = '<a target="left" style="text-decoration:none" ' .
dcc1cc82 172 'href="left_main.php?';
95e93571 173 if ($boxes[$boxnum]['collapse'] == SM_BOX_COLLAPSED) {
6395c46d 174 if ($use_icons && $icon_theme != 'none') {
796f91d9 175 $link .= "unfold=$mailbox\"><img src=\"" . SM_PATH . 'images/plus.png" border="0" height="7" width="7" />';
6395c46d 176 } else {
177 $link .= "unfold=$mailbox\">+";
178 }
ffb1a3d9 179 } else {
6395c46d 180 if ($use_icons && $icon_theme != 'none') {
796f91d9 181 $link .= "fold=$mailbox\"><img src=\"" . SM_PATH . 'images/minus.png" border="0" height="7" width="7" />';
6395c46d 182 } else {
183 $link .= "fold=$mailbox\">-";
184 }
ffb1a3d9 185 }
186 $link .= '</a>';
187
188 /* Return the finished product. */
189 return ($link);
190}
191
192/**
193 * create_unseen_string:
194 *
195 * Create unseen and total message count for both this folder and
196 * it's subfolders.
197 *
198 * @param string $boxName name of the current mailbox
199 * @param array $boxArray array for the current mailbox
200 * @param $imapConnection current imap connection in use
8f6f9ba5 201 * @return array unseen message string (for display), unseen message count
ffb1a3d9 202 */
ae012102 203function create_unseen_string($boxName, $boxArray, $imapConnection, $unseen_type) {
ce68b76b 204 global $boxes, $color, $unseen_cum;
ffb1a3d9 205
206 /* Initialize the return value. */
0210ab4d 207 $result = array(0,0);
ffb1a3d9 208
209 /* Initialize the counts for this folder. */
210 $boxUnseenCount = 0;
211 $boxMessageCount = 0;
212 $totalUnseenCount = 0;
213 $totalMessageCount = 0;
214
215 /* Collect the counts for this box alone. */
474fc5fa 216 $status = sqimap_status_messages($imapConnection, $boxName);
217 $boxUnseenCount = $status['UNSEEN'];
218 if ($boxUnseenCount === false) {
134e4174 219 return false;
474fc5fa 220 }
ffb1a3d9 221 if ($unseen_type == 2) {
474fc5fa 222 $boxMessageCount = $status['MESSAGES'];
ffb1a3d9 223 }
70bf5a7f 224
22986991 225 /* Initialize the total counts. */
226
474fc5fa 227 if ($boxArray['collapse'] == SM_BOX_COLLAPSED && $unseen_cum) {
ffb1a3d9 228 /* Collect the counts for this boxes subfolders. */
229 $curBoxLength = strlen($boxName);
230 $boxCount = count($boxes);
22986991 231
ffb1a3d9 232 for ($i = 0; $i < $boxCount; ++$i) {
233 /* Initialize the counts for this subfolder. */
234 $subUnseenCount = 0;
235 $subMessageCount = 0;
236
237 /* Collect the counts for this subfolder. */
238 if (($boxName != $boxes[$i]['unformatted'])
134e4174 239 && (substr($boxes[$i]['unformatted'], 0, $curBoxLength) == $boxName)
240 && !in_array('noselect', $boxes[$i]['flags'])) {
241 $status = sqimap_status_messages($imapConnection, $boxes[$i]['unformatted']);
242 $subUnseenCount = $status['UNSEEN'];
ffb1a3d9 243 if ($unseen_type == 2) {
474fc5fa 244 $subMessageCount = $status['MESSAGES'];;
70bf5a7f 245 }
22986991 246 /* Add the counts for this subfolder to the total. */
247 $totalUnseenCount += $subUnseenCount;
248 $totalMessageCount += $subMessageCount;
249 }
70bf5a7f 250 }
22986991 251
252 /* Add the counts for all subfolders to that of the box. */
253 $boxUnseenCount += $totalUnseenCount;
254 $boxMessageCount += $totalMessageCount;
ffb1a3d9 255 }
256
257 /* And create the magic unseen count string. */
258 /* Really a lot more then just the unseen count. */
259 if (($unseen_type == 1) && ($boxUnseenCount > 0)) {
22986991 260 $result[0] = "($boxUnseenCount)";
ffb1a3d9 261 } else if ($unseen_type == 2) {
22986991 262 $result[0] = "($boxUnseenCount/$boxMessageCount)";
ffb1a3d9 263 $result[0] = "<font color=\"$color[11]\">$result[0]</font>";
70bf5a7f 264 }
ffb1a3d9 265
22986991 266 /* Set the unseen count to return to the outside world. */
ffb1a3d9 267 $result[1] = $boxUnseenCount;
2d367c68 268
ffb1a3d9 269 /* Return our happy result. */
270 return ($result);
95e93571 271}
272
273/**
274 * This simple function checks if a box is another box's parent.
275 */
276function is_parent_box($curbox_name, $parbox_name) {
277 global $delimiter;
278
279 /* Extract the name of the parent of the current box. */
280 $curparts = explode($delimiter, $curbox_name);
281 $curname = array_pop($curparts);
282 $actual_parname = implode($delimiter, $curparts);
283 $actual_parname = substr($actual_parname,0,strlen($parbox_name));
284
285 /* Compare the actual with the given parent name. */
286 return ($parbox_name == $actual_parname);
287}
288
3170c448 289function ListBoxes ($boxes, $j=0 ) {
ce68b76b 290 global $data_dir, $username, $color, $unseen_notify, $unseen_type,
324ac3c5 291 $move_to_trash, $trash_folder, $collapse_folders, $imapConnection,
a259636c 292 $use_icons, $icon_theme, $use_special_folder_color;
c5a52f46 293
ccc4580f 294 if (!isset($boxes) || empty($boxes))
295 return;
296
e4c5976a 297 $pre = '<nobr>';
f23f6a3a 298 $end = '';
299 $collapse = false;
ccc4580f 300 $unseen_found = false;
6c8fee24 301 $unseen = 0;
e4c5976a 302
ccc4580f 303 $mailbox = $boxes->mailboxname_full;
304 $leader = '<tt>';
305 $leader .= str_repeat('&nbsp;&nbsp;',$j);
306 $mailboxURL = urlencode($mailbox);
6c8fee24 307
ccc4580f 308 /* get unseen/total messages information */
309 /* Only need to display info when option is set */
310 if (isset($unseen_notify) && ($unseen_notify > 1) &&
311 (($boxes->unseen !== false) || ($boxes->total !== false))) {
e4c5976a 312
ccc4580f 313 if ($boxes->unseen !== false)
314 $unseen = $boxes->unseen;
dcc1cc82 315
ccc4580f 316 /*
317 Should only display unseen info if the folder is inbox
318 or you set the option for all folders
319 */
320
321 if ((strtolower($mailbox) == 'inbox') || ($unseen_notify == 3)) {
322 $unseen_string = $unseen;
323
324 /* If users requests, display message count too */
325 if (isset($unseen_type) && ($unseen_type == 2) && ($boxes->total !== false)) {
326 $unseen_string .= '/' . $boxes->total;
e4c5976a 327 }
ccc4580f 328
329 $unseen_string = "<font color=\"$color[11]\">($unseen_string)</font>";
330
331 /*
332 Finally allow the script to display the values by setting a boolean.
333 This can only occur if the unseen count is great than 0 (if you have
334 unseen count only), or you have the message count too.
335 */
336 if (($unseen > 0) || (isset($unseen_type) && ($unseen_type ==2))) {
337 $unseen_found = true;
338 }
339 }
340 }
341
342 if (isset($boxes->mbxs[0]) && $collapse_folders) {
343 $collapse = getPref($data_dir, $username, 'collapse_folder_' . $mailbox);
344 $collapse = ($collapse == '' ? SM_BOX_UNCOLLAPSED : $collapse);
345
346 $link = '<a target="left" style="text-decoration:none" ' .'href="left_main.php?';
347 if ($collapse) {
6395c46d 348 if ($use_icons && $icon_theme != 'none') {
796f91d9 349 $link .= "unfold=$mailboxURL\">$leader<img src=\"" . SM_PATH . 'images/plus.png" border="0" height="7" width="7" />&nbsp;</tt>';
6395c46d 350 } else {
351 $link .= "unfold=$mailboxURL\">$leader+&nbsp;</tt>";
352 }
a6172cd5 353 } else {
6395c46d 354 if ($use_icons && $icon_theme != 'none') {
796f91d9 355 $link .= "fold=$mailboxURL\">$leader<img src=\"" . SM_PATH . 'images/minus.png" border="0" height="7" width="7" />&nbsp;</tt>';
6395c46d 356 } else {
357 $link .= "fold=$mailboxURL\">$leader-&nbsp;</tt>";
358 }
a6172cd5 359 }
ccc4580f 360 $link .= '</a>';
361 $pre .= $link;
362 } else {
363 $pre.= $leader . '&nbsp;&nbsp;</tt>';
364 }
a6172cd5 365
ccc4580f 366 /* If there are unseen message, bold the line. */
367 if (($move_to_trash) && ($mailbox == $trash_folder)) {
368 if (! isset($boxes->total)) {
369 $boxes->total = sqimap_status_messages($imapConnection, $mailbox);
370 }
371 if ($unseen > 0) {
372 $pre .= '<b>';
373 }
324ac3c5 374 $pre .= "<a href=\"right_main.php?PG_SHOWALL=0&amp;startMessage=1&amp;mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\">";
c435f076 375 $end .= '</a>';
ccc4580f 376 if ($unseen > 0) {
377 $end .= '</b>';
378 }
ccc4580f 379 if ($boxes->total > 0) {
e4c5976a 380 if ($unseen > 0) {
381 $pre .= '<b>';
382 }
324ac3c5 383 $pre .= "<a href=\"right_main.php?PG_SHOWALL=0&amp;startMessage=1&amp;mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\">";
e4c5976a 384 if ($unseen > 0) {
385 $end .= '</b>';
386 }
3170c448 387 /* Print unseen information. */
ccc4580f 388 if ($unseen_found) {
3170c448 389 $end .= "&nbsp;<small>$unseen_string</small>";
390 }
e4c5976a 391 }
dea5ef88 392 $end .= "\n<small>\n" .
393 '&nbsp;&nbsp;[<a href="empty_trash.php">'._("Purge").'</a>]'.
394 '</small>';
ccc4580f 395 } else {
396 if (!$boxes->is_noselect) {
397 if ($unseen > 0) {
398 $pre .= '<b>';
399 }
324ac3c5 400 $pre .= "<a href=\"right_main.php?PG_SHOWALL=0&amp;startMessage=1&amp;mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\">";
c435f076 401 $end .= '</a>';
ccc4580f 402 if ($unseen > 0) {
403 $end .= '</b>';
404 }
e4c5976a 405 }
ccc4580f 406 /* Print unseen information. */
407 if ($unseen_found) {
408 $end .= "&nbsp;<small>$unseen_string</small>";
39027844 409 }
410
ccc4580f 411 }
412
413 $font = '';
414 $fontend = '';
a259636c 415 if ($use_special_folder_color && $boxes->is_special) {
ccc4580f 416 $font = "<font color=\"$color[11]\">";
417 $fontend = "</font>";
418 }
8fc208f8 419
420 // let plugins fiddle with end of line
421 $end .= concat_hook_function('left_main_after_each_folder',
324ac3c5 422 array(isset($numMessages) ? $numMessages : '',
8fc208f8 423 $boxes->mailboxname_full, $imapConnection));
424
ccc4580f 425 $end .= '</nobr>';
426
427 if (!$boxes->is_root) {
304141cb 428 echo "" . $pre .$font. str_replace(array(' ','<','>'),array('&nbsp;','&lt;','&gt;'),$boxes->mailboxname_sub) .$fontend . $end. '<br />' . "\n";
ccc4580f 429 $j++;
430 }
431
432 if (!$collapse || $boxes->is_root) {
433 for ($i = 0; $i <count($boxes->mbxs); $i++) {
434 listBoxes($boxes->mbxs[$i],$j);
e4c5976a 435 }
f23f6a3a 436 }
437}
438
c8fa94cf 439function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) {
ce68b76b 440 global $data_dir, $username, $color, $unseen_notify, $unseen_type,
134e4174 441 $move_to_trash, $trash_folder, $collapse_folders, $use_special_folder_color;
f23f6a3a 442
ccc4580f 443 if (!isset($boxes) || empty($boxes))
444 return;
4bdcd5e0 445
f23f6a3a 446 /* use_folder_images only works if the images exist in ../images */
c8fa94cf 447 $use_folder_images = true;
f23f6a3a 448
449 $pre = '';
450 $end = '';
451 $collapse = false;
6c8fee24 452 $unseen_found = false;
453 $unseen = 0;
a6172cd5 454
a6172cd5 455 $mailbox = $boxes->mailboxname_full;
456 $mailboxURL = urlencode($mailbox);
f23f6a3a 457
ccc4580f 458 /* get unseen/total messages information */
6c8fee24 459 /* Only need to display info when option is set */
ccc4580f 460 if (isset($unseen_notify) && ($unseen_notify > 1) &&
461 (($boxes->unseen !== false) || ($boxes->total !== false))) {
6c8fee24 462
51ea258b 463 if ($boxes->unseen !== false)
6c8fee24 464 $unseen = $boxes->unseen;
6c8fee24 465
ccc4580f 466 /*
6c8fee24 467 Should only display unseen info if the folder is inbox
468 or you set the option for all folders
469 */
470
471 if ((strtolower($mailbox) == 'inbox') || ($unseen_notify == 3)) {
472 $unseen_string = $unseen;
473
6c8fee24 474 /* If users requests, display message count too */
ccc4580f 475 if (isset($unseen_type) && ($unseen_type == 2) && ($boxes->total !== false)) {
51ea258b 476 $unseen_string .= '/' . $boxes->total;
ccc4580f 477 }
6c8fee24 478
479 $unseen_string = "<font color=\"$color[11]\">($unseen_string)</font>";
480
481 /*
482 Finally allow the script to display the values by setting a boolean.
483 This can only occur if the unseen count is great than 0 (if you have
484 unseen count only), or you have the message count too.
485 */
486 if (($unseen > 0) || (isset($unseen_type) && ($unseen_type ==2))) {
487 $unseen_found = true;
488 }
ccc4580f 489 }
6c8fee24 490 }
a6172cd5 491
492 /* If there are unseen message, bold the line. */
493 if ($unseen > 0) { $pre .= '<b>'; }
494
495 /* color special boxes */
a259636c 496 if ($use_special_folder_color && $boxes->is_special) {
4bdcd5e0 497 $pre .= "<font color=\"$color[11]\">";
a6172cd5 498 $end .= '</font>';
499 }
500
501 /* If there are unseen message, close bolding. */
502 if ($unseen > 0) { $end .= '</b>'; }
503
504 /* Print unseen information. */
ccc4580f 505 if ($unseen_found) {
506 $end .= "&nbsp;$unseen_string";
a6172cd5 507 }
508
509 if (($move_to_trash) && ($mailbox == $trash_folder)) {
324ac3c5 510 $pre = "<a class=\"mbx_link\" href=\"right_main.php?PG_SHOWALL=0&amp;startMessage=1&amp;mailbox=$mailboxURL\" target=\"right\">" . $pre;
4bdcd5e0 511 $end .= '</a>';
dea5ef88 512 $end .= "\n<small>\n" .
513 '&nbsp;&nbsp;[<a class="mbx_link" href="empty_trash.php">'._("Purge").'</a>]'.
514 '</small>';
a6172cd5 515 } else {
516 if (!$boxes->is_noselect) { /* \Noselect boxes can't be selected */
324ac3c5 517 $pre = "<a class=\"mbx_link\" href=\"right_main.php?PG_SHOWALL=0&amp;startMessage=1&amp;mailbox=$mailboxURL\" target=\"right\">" . $pre;
4bdcd5e0 518 $end .= '</a>';
a6172cd5 519 }
520 }
521
8fc208f8 522 // let plugins fiddle with end of line
523 global $imapConnection;
524 $end .= concat_hook_function('left_main_after_each_folder',
324ac3c5 525 array(isset($numMessages) ? $numMessages : '',
8fc208f8 526 $boxes->mailboxname_full, $imapConnection));
527
a6172cd5 528 if (!$boxes->is_root) {
529 if ($use_folder_images) {
ccc4580f 530 if ($boxes->is_inbox) {
531 $folder_img = '../images/inbox.png';
532 } else if ($boxes->is_sent) {
533 $folder_img = '../images/senti.png';
534 } else if ($boxes->is_trash) {
535 $folder_img = '../images/delitem.png';
536 } else if ($boxes->is_draft) {
537 $folder_img = '../images/draft.png';
538 } else if ($boxes->is_noinferiors) {
539 $folder_img = '../images/folder_noinf.png';
540 } else {
541 $folder_img = '../images/folder.png';
542 }
543 $folder_img = '&nbsp;<img src="'.$folder_img.'" height="15" valign="center" />&nbsp;';
544 } else {
545 $folder_img = '';
546 }
a6172cd5 547 if (!isset($boxes->mbxs[0])) {
548 echo ' ' . html_tag( 'div',
304141cb 549 '<tt>'. $pre . $folder_img . '</tt>'. str_replace(array(' ','<','>'),array('&nbsp;','&lt;','&gt;'),$boxes->mailboxname_sub) . $end,
3170c448 550 'left', '', 'class="mbx_sub" id="' .$j. '"' ) . "\n";
ccc4580f 551 } else {
a6172cd5 552 /* get collapse information */
3170c448 553 if ($collapse_folders) {
554 $form_entry = $j.'F';
555 if (isset($mbx) && isset($mbx[$form_entry])) {
556 $collapse = $mbx[$form_entry];
557 setPref($data_dir, $username, 'collapse_folder_'.$boxes->mailboxname_full , $collapse ? SM_BOX_COLLAPSED : SM_BOX_UNCOLLAPSED);
ccc4580f 558 } else {
3170c448 559 $collapse = getPref($data_dir, $username, 'collapse_folder_' . $mailbox);
560 $collapse = ($collapse == '' ? SM_BOX_UNCOLLAPSED : $collapse);
561 }
562 $img_src = ($collapse ? '../images/plus.png' : '../images/minus.png');
563 $collapse_link = '<a href="javascript:void(0)">'." <img src=\"$img_src\" border=\"1\" id=$j onclick=\"hidechilds(this)\" style=\"cursor:hand\" /></a>";
ccc4580f 564 } else {
3170c448 565 $collapse_link='';
ccc4580f 566 }
567 echo ' ' . html_tag( 'div',
a6172cd5 568 $collapse_link . $pre . $folder_img . '&nbsp;'. $boxes->mailboxname_sub . $end ,
3170c448 569 'left', '', 'class="mbx_par" id="' .$j. 'P"' ) . "\n";
ccc4580f 570 echo ' <input type="hidden" name="mbx['.$j. 'F]" value="'.$collapse.'" id="mbx['.$j.'F]" />'."\n";
a6172cd5 571 }
572 }
a6172cd5 573
4bdcd5e0 574 $visible = ($collapse ? ' style="display:none"' : ' style="display:block"');
575 if (isset($boxes->mbxs[0]) && !$boxes->is_root) /* mailbox contains childs */
576 echo html_tag( 'div', '', 'left', '', 'class="par_area" id='.$j.'.0000 '. $visible ) . "\n";
a6172cd5 577
4bdcd5e0 578 if ($j !='ID.0000')
579 $j = $j .'.0000';
580 for ($i = 0; $i <count($boxes->mbxs); $i++) {
581 $j++;
582 ListAdvancedBoxes($boxes->mbxs[$i],$mbx,$j);
f23f6a3a 583 }
4bdcd5e0 584 if (isset($boxes->mbxs[0]) && !$boxes->is_root)
585 echo '</div>'."\n\n";
f23f6a3a 586}
587
588
589
95e93571 590
591/* -------------------- MAIN ------------------------ */
592
f38b7cf0 593/* get globals */
594sqgetGlobalVar('username', $username, SQ_SESSION);
595sqgetGlobalVar('key', $key, SQ_COOKIE);
596sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
597sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
a32985a5 598
f38b7cf0 599sqgetGlobalVar('fold', $fold, SQ_GET);
600sqgetGlobalVar('unfold', $unfold, SQ_GET);
601
602/* end globals */
95e93571 603
604// open a connection on the imap port (143)
605$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output
606
f43c35f8 607/**
608 * Using stristr since older preferences may contain "None" and "none".
609 */
610if (isset($left_refresh) && ($left_refresh != '') &&
d68323ff 611 !stristr($left_refresh, 'none')){
612 $xtra = "\n<meta http-equiv=\"Expires\" content=\"Thu, 01 Dec 1994 16:00:00 GMT\" />\n" .
613 "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n".
dcc1cc82 614 "<meta http-equiv=\"REFRESH\" content=\"$left_refresh;URL=left_main.php\" />\n";
95e93571 615} else {
616 $xtra = '';
617}
618
f23f6a3a 619/**
a6172cd5 620 * $advanced_tree and $oldway are boolean vars which are default set to default
621 * SM behaviour.
c72be5a6 622 * Setting $oldway to false causes left_main.php to use the new experimental
f23f6a3a 623 * way of getting the mailbox-tree.
a6172cd5 624 * Setting $advanced tree to true causes SM to display a experimental
f23f6a3a 625 * mailbox-tree with dhtml behaviour.
a6172cd5 626 * It only works on browsers which supports css and javascript. The used
c72be5a6 627 * javascript is experimental and doesn't support all browsers.
628 * It has been tested on IE6 an Konquerer 3.0.0-2.
629 * It is now tested and working on: (please test and update this list)
630 * Windows: IE 5.5 SP2, IE 6 SP1, Gecko based (Mozilla, Firebird) and Opera7
631 * XWindow: ?
632 * Mac: ?
f23f6a3a 633 * In the function ListAdvancedBoxes there is another var $use_folder_images.
634 * setting this to true is only usefull if the images exists in ../images.
a6172cd5 635 *
f23f6a3a 636 * Feel free to experiment with the code and report bugs and enhancements
637 * to marc@its-projects.nl
a6172cd5 638 **/
f23f6a3a 639
78e5377d 640/* set this to true if you want to see a nicer mailboxtree */
641if (! isset($advanced_tree) || $advanced_tree=="" ) {
ccc4580f 642 $advanced_tree=false;
643}
78e5377d 644/* default SM behaviour */
645if (! isset($oldway) || $oldway=="" ) {
ccc4580f 646 $oldway=false;
647}
f23f6a3a 648
649if ($advanced_tree) {
2b5e4e10 650$xtra .= '<script language="Javascript" type="text/javascript">'."\n".
651'<!--'."\n".
652' function preload() {'."\n".
653' if (document.images) {'."\n".
654' var treeImages = new Array;'."\n".
655' var arguments = preload.arguments;'."\n".
656' for (var i = 0; i<arguments.length; i++) {'."\n".
657' treeImages[i] = new Image();'."\n".
658' treeImages[i].src = arguments[i];'."\n".
659' }'."\n".
660' }'."\n".
661' }'."\n".
662'var vTreeImg;'."\n".
663'var vTreeDiv;'."\n".
664'var vTreeSrc;'."\n".
665' function fTreeTimeout() {'."\n".
666' if (vTreeDiv.readyState == "complete")'."\n".
667' vTreeImg.src = vTreeSrc;'."\n".
668' else'."\n".
669' setTimeout("fTreeTimeout()", 100);'."\n".
670' }'."\n".
671' function hidechilds(img) {'."\n".
672' id = img.id + ".0000";'."\n".
673' form_id = "mbx[" + img.id +"F]";'."\n".
674' if (document.all) { //IE, Opera7'."\n".
675' div = document.all[id];'."\n".
676' if (div) {'."\n".
677' if (div.style.display == "none") {'."\n".
678' vTreeSrc = "../images/minus.png";'."\n".
679' style = "block";'."\n".
680' value = 0;'."\n".
681' }'."\n".
682' else {'."\n".
683' vTreeSrc = "../images/plus.png";'."\n".
684' style = "none";'."\n".
685' value = 1;'."\n".
686' }'."\n".
687' vTreeImg = img;'."\n".
688' vTreeDiv = div;'."\n".
689' if (typeof vTreeDiv.readyState != "undefined") //IE'."\n".
690' setTimeout("fTreeTimeout()",100);'."\n".
691' else //Non IE'."\n".
692' vTreeImg.src = vTreeSrc;'."\n".
693' div.style.display = style;'."\n".
694' document.all[form_id].value = value;'."\n".
695' }'."\n".
696' }'."\n".
697' else if (document.getElementById) { //Gecko'."\n".
698' div = document.getElementById(id);'."\n".
699' if (div) {'."\n".
700' if (div.style.display == "none") {'."\n".
701' src = "../images/minus.png";'."\n".
702' style = "block";'."\n".
703' value = 0;'."\n".
704' }'."\n".
705' else {'."\n".
706' src = "../images/plus.png";'."\n".
707' style = "none";'."\n".
708' value = 1;'."\n".
709' }'."\n".
710' div.style.display = style;'."\n".
711' img.src = src;'."\n".
712' document.getElementById(form_id).value = value;'."\n".
713' }'."\n".
714' }'."\n".
715' }'."\n".
716' function buttonover(el,on) {'."\n".
717' if (!on) {'."\n".
718"// el.style.borderColor=\"$color[9]\";}\n".
719" el.style.background=\"$color[0]\";}\n".
720' else {'."\n".
721" el.style.background=\"$color[9]\";}\n".
722' }'."\n".
723' function buttonclick(el,on) {'."\n".
724' if (!on) {'."\n".
725' el.style.border="groove";}'."\n".
726' else {'."\n".
727' el.style.border="ridge";}'."\n".
728' }'."\n".
729' function hideframe(hide) {'."\n".
730' left_size = "' . $left_size . '";'."\n".
731' if (document.all) {'."\n".
732' masterf = window.parent.document.all["fs1"];'."\n".
733' leftf = window.parent.document.all["left"];'."\n".
734' leftcontent = document.all["leftframe"];'."\n".
735' leftbutton = document.all["showf"];'."\n".
736' } else if (document.getElementById) {'."\n".
737' masterf = window.parent.document.getElementById("fs1");'."\n".
738' leftf = window.parent.document.getElementById("left");'."\n".
739' leftcontent = document.getElementById("leftframe");'."\n".
740' leftbutton = document.getElementById("showf");'."\n".
741' } else {'."\n".
742' return false;'."\n".
743' }'."\n".
744' if(hide) {'."\n".
745' new_col = calc_col("20");'."\n".
746' masterf.cols = new_col;'."\n".
747' document.body.scrollLeft=0;'."\n".
748' document.body.style.overflow="hidden";'."\n".
749' leftcontent.style.display = "none";'."\n".
750' leftbutton.style.display="block";'."\n".
751' } else {'."\n".
752' masterf.cols = calc_col(left_size);'."\n".
753' document.body.style.overflow="";'."\n".
754' leftbutton.style.display="none";'."\n".
755' leftcontent.style.display="block";'."\n".
756' }'."\n".
757' }'."\n".
758' function calc_col(c_w) {'."\n";
f23f6a3a 759
599038d5 760 if ($location_of_bar == 'right') {
761 $xtra .= ' right=true;';
a6172cd5 762 } else {
599038d5 763 $xtra .= ' right=false;';
764 }
765 $xtra .= "\n";
a6172cd5 766
2b5e4e10 767$xtra .= 'if (right) {'."\n".
768" new_col = '*,'+c_w;"."\n".
769' } else {'."\n".
770" new_col = c_w+',*';"."\n".
771' }'."\n".
772' return new_col;'."\n".
773' }'."\n".
774' function resizeframe(direction) {'."\n".
775' if (document.all) {'."\n".
776' masterf = window.parent.document.all["fs1"];'."\n".
777' } else if (document.getElementById) {'."\n".
778' window.parent.document.getElementById("fs1");'."\n".
779' } else {'."\n".
780' return false;'."\n".
781' }'."\n";
a6172cd5 782
599038d5 783 if ($location_of_bar == 'right') {
784 $xtra .= ' colPat=/^\*,(\d+)$/;';
a6172cd5 785 } else {
599038d5 786 $xtra .= ' colPat=/^(\d+),.*$/;';
787 }
788 $xtra .= "\n";
a6172cd5 789
2b5e4e10 790$xtra .= 'old_col = masterf.cols;'."\n".
791' colPat.exec(old_col);'."\n".
792' if (direction) {'."\n".
793' new_col_width = parseInt(RegExp.$1) + 25;'."\n".
794' } else {'."\n".
795' if (parseInt(RegExp.$1) > 35) {'."\n".
796' new_col_width = parseInt(RegExp.$1) - 25;'."\n".
797' }'."\n".
798' }'."\n".
799' masterf.cols = calc_col(new_col_width);'."\n".
800' }'."\n".
801'//-->'."\n".
802'</script>'."\n";
f23f6a3a 803
804/* style definitions */
386e556f 805
2b5e4e10 806$xtra .= '<style type="text/css">'."\n".
807'<!--'."\n".
808' body {'."\n".
809' margin: 0px 0px 0px 0px;'."\n".
810' padding: 5px 5px 5px 5px;'."\n".
811' }'."\n".
812' .button {'."\n".
813' border:outset;'."\n".
814" border-color: $color[9];\n".
815" background:$color[0];\n".
816" color:$color[6];\n".
817' width:99%;'."\n".
818' heigth:99%;'."\n".
819' }'."\n".
820' .mbx_par {'."\n".
821' font-size:1.0em;'."\n".
822' margin-left:4px;'."\n".
823' margin-right:0px;'."\n".
824' }'."\n".
825' a.mbx_link {'."\n".
826' text-decoration: none;'."\n".
827" background-color: $color[0];\n".
828' display: inline;'."\n".
829' }'."\n".
830' a:hover.mbx_link {'."\n".
831" background-color: $color[9];\n".
832' }'."\n".
833' a.mbx_link img {'."\n".
834' border-style: none;'."\n".
835' }'."\n".
836' .mbx_sub {'."\n".
837' padding-left:5px;'."\n".
838' padding-right:0px;'."\n".
839' margin-left:4px;'."\n".
840' margin-right:0px;'."\n".
841' font-size:0.9em;'."\n".
842' }'."\n".
843' .par_area {'."\n".
844' margin-top:0px;'."\n".
845' margin-left:4px;'."\n".
846' margin-right:0px;'."\n".
847' padding-left:10px;'."\n".
848' padding-bottom:5px;'."\n".
849' border-left: solid;'."\n".
850' border-left-width:0.1em;'."\n".
851" border-left-color:$color[9];\n".
852' border-bottom: solid;'."\n".
853' border-bottom-width:0.1em;'."\n".
854" border-bottom-color:$color[9];\n".
855' display: block;'."\n".
856' }'."\n".
857' .mailboxes {'."\n".
858' padding-bottom:3px;'."\n".
859' margin-right:4px;'."\n".
860' padding-right:4px;'."\n".
861' margin-left:4px;'."\n".
862' padding-left:4px;'."\n".
863' border: groove;'."\n".
864' border-width:0.1em;'."\n".
865" border-color:$color[9];\n".
866" background: $color[0];\n".
867' }'."\n".
868'-->'."\n".
869'</style>'."\n";
f23f6a3a 870}
871
dcc1cc82 872displayHtmlHeader( 'SquirrelMail', $xtra );
852abae7 873sqgetGlobalVar('auto_create_done',$auto_create_done,SQ_SESSION);
95e93571 874/* If requested and not yet complete, attempt to autocreate folders. */
875if ($auto_create_special && !isset($auto_create_done)) {
a3439b27 876 $autocreate = array($sent_folder, $trash_folder, $draft_folder);
95e93571 877 foreach( $autocreate as $folder ) {
a3439b27 878 if (($folder != '') && ($folder != 'none')) {
95e93571 879 if ( !sqimap_mailbox_exists($imapConnection, $folder)) {
880 sqimap_mailbox_create($imapConnection, $folder, '');
852abae7 881 } else {
7b1f03c9 882 // check for subscription is useless and expensive, just
883 // surpress the NO response. Unless we're on Mecury, which
884 // will just subscribe a folder again if it's already
885 // subscribed.
886 if ( strtolower($imap_server_type) != 'mercury32' ||
887 !sqimap_mailbox_is_subscribed($imapConnection, $folder) ) {
888 sqimap_subscribe($imapConnection, $folder, false);
889 }
2d367c68 890 }
ebf18afa 891 }
2d367c68 892 }
a6d2e0de 893
95e93571 894 /* Let the world know that autocreation is complete! Hurrah! */
90de1755 895 $auto_create_done = TRUE;
a32985a5 896 sqsession_register($auto_create_done, 'auto_create_done');
95e93571 897}
dcc1cc82 898
134e4174 899if ($advanced_tree) {
900 echo "\n<body" .
901 ' onload="preload(\'../images/minus.png\',\'../images/plus.png\')"' .
902 " bgcolor=\"$color[3]\" text=\"$color[6]\" link=\"$color[6]\" vlink=\"$color[6]\" alink=\"$color[6]\">\n";
903} else {
904 echo "\n<body bgcolor=\"$color[3]\" text=\"$color[6]\" link=\"$color[6]\" vlink=\"$color[6]\" alink=\"$color[6]\">\n";
905}
dcc1cc82 906
907do_hook('left_main_before');
908if ($advanced_tree) {
909 /* nice future feature, needs layout !! volunteers? */
910 $right_pos = $left_size - 20;
39bfea8f 911/* 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>&lt;&lt;</b></a></div>';
912 echo '<div id="showf" style="width=20;font-size:12;display:none;"><a href="javascript:hideframe(false)"><b>&gt;&gt;</b></a></div>';
913 echo '<div id="incrf" style="width=20;font-size:12"><a href="javascript:resizeframe(true)"><b>&gt;</b></a></div>';
914 echo '<div id="decrf" style="width=20;font-size:12"><a href="javascript:resizeframe(false)"><b>&lt;</b></a></div></div>';
915 echo '<div id="leftframe"><br /><br />';*/
599038d5 916}
dcc1cc82 917
a6172cd5 918echo "\n\n" . html_tag( 'table', '', 'left', '', 'border="0" cellspacing="0" cellpadding="0" width="99%"' ) .
919 html_tag( 'tr' ) .
dcc1cc82 920 html_tag( 'td', '', 'left' ) .
045fd8dd 921 html_tag( 'table', '', '', '', 'border="0" cellspacing="0" cellpadding="0" width="98%"' ) .
69319017 922 html_tag( 'tr' ) .
923 html_tag( 'td', '', 'center' ) .
924 '<font size="4"><b>'. _("Folders") . "</b><br /></font>\n\n";
a6d2e0de 925
95e93571 926if ($date_format != 6) {
927 /* First, display the clock. */
928 if ($hour_format == 1) {
3208c2a5 929 $hr = 'H:i';
95e93571 930 if ($date_format == 4) {
931 $hr .= ':s';
a6d2e0de 932 }
95e93571 933 } else {
934 if ($date_format == 4) {
935 $hr = 'g:i:s a';
936 } else {
937 $hr = 'g:i a';
2d367c68 938 }
939 }
940
95e93571 941 switch( $date_format ) {
e4f5158a 942 case 0:
134e4174 943 $clk = date('Y-m-d '.$hr. ' T', time());
944 break;
95e93571 945 case 1:
946 $clk = date('m/d/y '.$hr, time());
947 break;
948 case 2:
949 $clk = date('d/m/y '.$hr, time());
950 break;
951 case 4:
952 case 5:
953 $clk = date($hr, time());
954 break;
955 default:
67eb95d7 956 $clk = getDayAbrv( date( 'w', time() ) ) . date( ', ' . $hr, time() );
2d367c68 957 }
95e93571 958 $clk = str_replace(' ','&nbsp;',$clk);
959
b9f75857 960 echo '<small><span style="white-space: nowrap;">'
961 . str_replace(' ', '&nbsp;', _("Last Refresh"))
962 . ":</span><br /><span style=\"white-space: nowrap;\">$clk</span></small><br />";
95e93571 963}
964
965/* Next, display the refresh button. */
c435f076 966echo '<div style="white-space: nowrap;"><small>[<a href="../src/left_main.php" target="left">'.
045fd8dd 967 _("Check mail") . '</a>]</small></div></td></tr></table><br />';
95e93571 968
969/* Lastly, display the folder list. */
970if ( $collapse_folders ) {
971 /* If directed, collapse or uncollapse a folder. */
972 if (isset($fold)) {
973 setPref($data_dir, $username, 'collapse_folder_' . $fold, SM_BOX_COLLAPSED);
974 } else if (isset($unfold)) {
975 setPref($data_dir, $username, 'collapse_folder_' . $unfold, SM_BOX_UNCOLLAPSED);
976 }
977}
978
c5a52f46 979/* Get unseen/total display prefs */
980$unseen_type = getPref( $data_dir , $username , 'unseen_type' );
981$unseen_notify = getPref( $data_dir , $username , 'unseen_notify' );
982
983if (!isset($unseen_type) || empty($unseen_type)) {
984 if (isset($default_unseen_type) && !empty($default_unseen_type)) {
985 $unseen_type = $default_unseen_type;
986 } else {
987 $unseen_type = 1;
988 }
989}
990
991if (!isset($unseen_notify) || empty($unseen_notify)) {
992 if (isset($default_unseen_notify) && !empty($default_unseen_notify)) {
993 $unseen_notify = $default_unseen_notify;
994 } else {
995 $unseen_notify = 0;
996 }
997}
998
f23f6a3a 999if ($oldway) { /* normal behaviour SM */
a6172cd5 1000
f23f6a3a 1001$boxes = sqimap_mailbox_list($imapConnection);
95e93571 1002/* Prepare do do out collapsedness and visibility computation. */
1003$curbox = 0;
1004$boxcount = count($boxes);
1005
1006/* Compute the collapsedness and visibility of each box. */
90de1755 1007
95e93571 1008while ($curbox < $boxcount) {
1009 $boxes[$curbox]['visible'] = TRUE;
1010 compute_folder_children($curbox, $boxcount);
1011}
1012
1c52ba77 1013for ($i = 0; $i < count($boxes); $i++) {
95e93571 1014 if ( $boxes[$i]['visible'] ) {
1015 $mailbox = $boxes[$i]['formatted'];
1016 $mblevel = substr_count($boxes[$i]['unformatted'], $delimiter) + 1;
1017
1018 /* Create the prefix for the folder name and link. */
1019 $prefix = str_repeat(' ',$mblevel);
1020 if (isset($collapse_folders) && $collapse_folders && $boxes[$i]['parent']) {
1021 $prefix = str_replace(' ','&nbsp;',substr($prefix,0,strlen($prefix)-2)).
1022 create_collapse_link($i) . '&nbsp;';
1023 } else {
1024 $prefix = str_replace(' ','&nbsp;',$prefix);
1025 }
d68323ff 1026 $line = "<nobr><tt>$prefix</tt>";
95e93571 1027
1028 /* Add the folder name and link. */
1c52ba77 1029 if (! isset($color[15])) {
05611cba 1030 $color[15] = $color[6];
1c52ba77 1031 }
90de1755 1032
95e93571 1033 if (in_array('noselect', $boxes[$i]['flags'])) {
1c52ba77 1034 if( isSpecialMailbox( $boxes[$i]['unformatted']) ) {
d68323ff 1035 $line .= "<font color=\"$color[11]\">";
1c52ba77 1036 } else {
d68323ff 1037 $line .= "<font color=\"$color[15]\">";
1c52ba77 1038 }
95e93571 1039 if (ereg("^( *)([^ ]*)", $mailbox, $regs)) {
1040 $mailbox = str_replace('&nbsp;','',$mailbox);
1041 $line .= str_replace(' ', '&nbsp;', $mailbox);
2d367c68 1042 }
d68323ff 1043 $line .= '</font>';
95e93571 1044 } else {
1045 $line .= formatMailboxName($imapConnection, $boxes[$i]);
1046 }
2d367c68 1047
95e93571 1048 /* Put the final touches on our folder line. */
39bfea8f 1049 $line .= "</nobr><br />\n";
2d367c68 1050
95e93571 1051 /* Output the line for this folder. */
1052 echo $line;
2d367c68 1053 }
95e93571 1054}
a6172cd5 1055} else { /* expiremental code */
f23f6a3a 1056 $boxes = sqimap_mailbox_tree($imapConnection);
1057 if (isset($advanced_tree) && $advanced_tree) {
dcc1cc82 1058 echo '<form name="collapse" action="left_main.php" method="post" ' .
e4c5976a 1059 'enctype="multipart/form-data"'."\n";
b6d26135 1060 echo '<small>';
4bdcd5e0 1061 echo '<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 />';
e4c5976a 1062 echo '<div id="mailboxes" class="mailboxes">'."\n\n";
3170c448 1063 sqgetGlobalVar('mbx', $mbx, SQ_POST);
e4c5976a 1064 if (!isset($mbx)) $mbx=NULL;
a6172cd5 1065 ListAdvancedBoxes($boxes, $mbx);
3170c448 1066 echo '</div>';
1067 echo '</small>';
e4c5976a 1068 echo '</form>'."\n";
f23f6a3a 1069 } else {
324ac3c5 1070 //sqimap_get_status_mbx_tree($imap_stream,$boxes)
e4c5976a 1071 ListBoxes($boxes);
f23f6a3a 1072 }
1073} /* if ($oldway) else ... */
dcc1cc82 1074do_hook('left_main_after');
1075sqimap_logout($imapConnection);
1076
39bfea8f 1077?>
bdef333d 1078</td></tr></table>
3208c2a5 1079</body></html>