/**
* left_main.php
*
- * Copyright (c) 1999-2005 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
* This is the code for the left bar. The left bar shows the folders
* available, and has cookie information.
*
+ * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
*/
define('SM_PATH','../');
/* SquirrelMail required files. */
-require_once(SM_PATH . 'include/validate.php');
+include_once(SM_PATH . 'include/validate.php');
require_once(SM_PATH . 'functions/imap.php');
require_once(SM_PATH . 'functions/plugin.php');
require_once(SM_PATH . 'functions/page_header.php');
$unseen_string .= '/' . $boxes->total;
}
- $unseen_string = "<font color=\"$color[11]\">($unseen_string)</font>";
+ $unseen_string = "<span class=\"highlight\">($unseen_string)</span>";
/*
Finally allow the script to display the values by setting a boolean.
$boxes->total = $result['MESSAGES'];
$boxes->unseen = $result['UNSEEN'];
}
-
+
$pre .= "<a href=\"right_main.php?PG_SHOWALL=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\">";
if ($unseen > 0) {
$pre .= '<b>';
}
- $font = '';
- $fontend = '';
+ $span = '';
+ $spanend = '';
if ($use_special_folder_color && $boxes->is_special) {
- $font = "<font color=\"$color[11]\">";
- $fontend = "</font>";
+ $span = "<span class=\"leftspecial\">";
+ $spanend = "</span>";
} elseif ( $boxes->is_noselect ) {
- $font = "<font color=\"$color[15]\">";
- $fontend = '</font>';
+ $span = "<span class=\"leftnoselect\">";
+ $spanend = '</span>';
}
+
// let plugins fiddle with end of line
$end .= concat_hook_function('left_main_after_each_folder',
array(isset($numMessages) ? $numMessages : '',
$end .= '</span>';
if (!$boxes->is_root) {
- echo "" . $pre .$font.
+ echo "" . $span . $pre .
str_replace(
array(' ','<','>'),
array(' ','<','>'),
$boxes->mailboxname_sub) .
- $fontend . $end. '<br />' . "\n";
+ $end. $spanend .'<br />' . "\n";
$j++;
}
$unseen_string .= '/' . $boxes->total;
}
- $unseen_string = "<font color=\"$color[11]\">($unseen_string)</font>";
+ $unseen_string = "<span class=\"highlight\">($unseen_string)</span>";
/*
Finally allow the script to display the values by setting a boolean.
/* color special boxes */
if ($use_special_folder_color && $boxes->is_special) {
- $pre .= "<font color=\"$color[11]\">";
- $end .= '</font>';
+ $pre .= "<span class=\"highlight\">";
+ $end .= '</span>';
}
/* If there are unseen message, close bolding. */
HEREDOC;
}
+// get mailbox list and cache it
+$mailboxes=sqimap_get_mailboxes($imapConnection,false,$show_only_subscribed_folders);
+
displayHtmlHeader( 'SquirrelMail', $xtra );
+
sqgetGlobalVar('auto_create_done',$auto_create_done,SQ_SESSION);
/* If requested and not yet complete, attempt to autocreate folders. */
if ($auto_create_special && !isset($auto_create_done)) {
$autocreate = array($sent_folder, $trash_folder, $draft_folder);
foreach( $autocreate as $folder ) {
if (($folder != '') && ($folder != 'none')) {
- if ( !sqimap_mailbox_exists($imapConnection, $folder)) {
+ // use $mailboxes array for checking if mailbox exists
+ if ( !sqimap_mailbox_exists($imapConnection, $folder, $mailboxes)) {
sqimap_mailbox_create($imapConnection, $folder, '');
} else {
// check for subscription is useless and expensive, just
if ($advanced_tree) {
echo "\n<body" .
' onload="preload(\'../images/minus.png\',\'../images/plus.png\')"' .
- " bgcolor=\"$color[3]\" text=\"$color[6]\" link=\"$color[6]\" vlink=\"$color[6]\" alink=\"$color[6]\">\n";
+ " class=\"leftmain\">\n<div class=\"leftmain\">\n";
} else {
- echo "\n<body bgcolor=\"$color[3]\" text=\"$color[6]\" link=\"$color[6]\" vlink=\"$color[6]\" alink=\"$color[6]\">\n";
+ echo "\n<body class=\"leftmain\">\n<div class=\"leftmain\">\n";
}
do_hook('left_main_before');
echo '<div id="leftframe"><br /><br />';*/
}
-echo "\n\n" .
- '<center><font size="4"><b>'. _("Folders") . "</b><br /></font>\n\n";
+echo "\n\n" . html_tag( 'table', '', 'left', '', 'border="0" cellspacing="0" cellpadding="0" width="99%"' ) .
+ html_tag( 'tr' ) .
+ html_tag( 'td', '', 'left' ) .
+ html_tag( 'table', '', '', '', 'border="0" cellspacing="0" cellpadding="0"' ) .
+ html_tag( 'tr' ) .
+ html_tag( 'td', '', 'center' ) .
+ '<font size="4"><b>'. _("Folders") . "</b><br /></font>\n\n";
if ($date_format != 6) {
/* First, display the clock. */
/* Next, display the refresh button. */
echo '<div style="white-space: nowrap;"><small>[<a href="../src/left_main.php" target="left">'.
- _("Check mail") . "</a>]</small></div></center><br />\n\n";
+ _("Check mail") . "</a>]</small></div></td></tr></table><br />\n\n";
/* Lastly, display the folder list. */
-echo "<center><table><tr><td>\n";
-
if ( $collapse_folders ) {
/* If directed, collapse or uncollapse a folder. */
$unseen_notify = 0;
}
}
+/**
+ * pass $mailboxes now instead of $imapconnection - sqimap_get_mailboxes() has been separated from
+ * sqimap_mailbox_tree() so that the cached mailbox list can be used elsewhere in left_main and beyond
+ */
+$boxes = sqimap_mailbox_tree($imapConnection,$mailboxes,$show_only_subscribed_folders);
-$boxes = sqimap_mailbox_tree($imapConnection);
if (isset($advanced_tree) && $advanced_tree) {
echo '<form name="collapse" action="left_main.php" method="post" ' .
'enctype="multipart/form-data">'."\n";
ListBoxes($boxes);
}
-echo "</td></tr></table></center>\n";
-
do_hook('left_main_after');
sqimap_logout($imapConnection);
?>
-</body></html>
+</td></tr></table>
+</div>
+<?php
+$oTemplate->display('footer.tpl');
+?>
\ No newline at end of file