/**
* left_main.php
*
- * Copyright (c) 1999-2001 The Squirrelmail Development Team
+ * Copyright (c) 1999-2002 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.
*
* $Id$
- /
-
-/*****************************************************************/
-/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/
-/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/
-/*** + Base level indent should begin at left margin, as ***/
-/*** the require_once below looks. ***/
-/*** + All identation should consist of four space blocks ***/
-/*** + Tab characters are evil. ***/
-/*** + all comments should use "slash-star ... star-slash" ***/
-/*** style -- no pound characters, no slash-slash style ***/
-/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/
-/*** ALWAYS USE { AND } CHARACTERS!!! ***/
-/*** + Please use ' instead of ", when possible. Note " ***/
-/*** should always be used in _( ) function calls. ***/
-/*** Thank you for your help making the SM code more readable. ***/
-/*****************************************************************/
+ */
require_once('../src/validate.php');
require_once('../functions/array.php');
/* --------------------- FUNCTIONS ------------------------- */
function formatMailboxName($imapConnection, $box_array) {
- global $folder_prefix, $trash_folder, $sent_folder;
- global $color, $move_to_sent, $move_to_trash;
- global $unseen_notify, $unseen_type, $collapse_folders;
- global $draft_folder, $save_as_draft;
- global $use_special_folder_color;
+
+ global $folder_prefix, $trash_folder, $sent_folder,
+ $color, $move_to_sent, $move_to_trash,
+ $unseen_notify, $unseen_type, $collapse_folders,
+ $draft_folder, $save_as_draft,
+ $use_special_folder_color;
$real_box = $box_array['unformatted'];
$mailbox = str_replace(' ','',$box_array['formatted']);
$unseen = sqimap_unseen_messages($imapConnection, $real_box);
if ($unseen_type == 1 && $unseen > 0) {
$unseen_string = "($unseen)";
- $unseen_found = true;
+ $unseen_found = TRUE;
} else if ($unseen_type == 2) {
$numMessages = sqimap_get_num_messages($imapConnection, $real_box);
$unseen_string = "<font color=\"$color[11]\">($unseen/$numMessages)</font>";
- $unseen_found = true;
+ $unseen_found = TRUE;
}
}
- $special_color = false;
- if ($use_special_folder_color) {
- if ((strtolower($real_box) == 'inbox')
- || (($real_box == $trash_folder) && ($move_to_trash))
- || (($real_box == $sent_folder) && ($move_to_sent))
- || (($real_box == $draft_folder) && ($save_as_draft))) {
- $special_color = true;
- }
- }
+ $special_color = ($use_special_folder_color && isSpecialMailbox( $real_box ) );
/* Start off with a blank line. */
$line = '';
if ($unseen > 0) { $line .= '<B>'; }
/* Crate the link for this folder. */
- $line .= "<A HREF=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" TARGET=\"right\" STYLE=\"text-decoration:none\">";
- if ($special_color == true)
+ $line .= "<A HREF=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" TARGET=\"right\" STYLE=\"text-decoration:none\">";
+ if ($special_color) {
$line .= "<FONT COLOR=\"$color[11]\">";
- $line .= str_replace(' ',' ',$mailbox);
- if ($special_color == true)
+ }
+ if ( $mailbox == 'INBOX' ) {
+ $line .= _("INBOX");
+ } else {
+ $line .= str_replace(' ',' ',$mailbox);
+ }
+ if ($special_color == TRUE)
$line .= "</FONT>";
$line .= '</A>';
$line .= " <SMALL>$unseen_string</SMALL>";
}
- if (($move_to_trash == true) && ($real_box == $trash_folder)) {
+ if (($move_to_trash) && ($real_box == $trash_folder)) {
if (! isset($numMessages)) {
$numMessages = sqimap_get_num_messages($imapConnection, $real_box);
}
$urlMailbox = urlencode($real_box);
$line .= "\n<small>\n" .
" (<A HREF=\"empty_trash.php\" style=\"text-decoration:none\">"._("empty")."</A>)" .
- "\n</small>\n";
+ "</small>";
}
}
$parbox_name = $boxes[$parbox]['unformatted'];
/* 'Initialize' this parent box to childless. */
- $boxes[$parbox]['parent'] = false;
+ $boxes[$parbox]['parent'] = FALSE;
/* Compute the collapse status for this box. */
if( isset($collapse_folders) && $collapse_folders ) {
$boxes[$parbox]['collapse'] = $collapse;
/* Otherwise, get the name of the next box. */
- if (isset($boxes[$nextbox]['unformatted']))
+ if (isset($boxes[$nextbox]['unformatted'])) {
$nextbox_name = $boxes[$nextbox]['unformatted'];
- else
+ } else {
$nextbox_name = '';
+ }
/* Compute any children boxes for this box. */
while (($nextbox < $boxcount) &&
(is_parent_box($boxes[$nextbox]['unformatted'], $parbox_name))) {
/* Note that this 'parent' box has at least one child. */
- $boxes[$parbox]['parent'] = true;
+ $boxes[$parbox]['parent'] = TRUE;
/* Compute the visiblity of this box. */
- if ($boxes[$parbox]['visible'] &&
- ($boxes[$parbox]['collapse'] != SM_BOX_COLLAPSED)) {
- $boxes[$nextbox]['visible'] = true;
- } else {
- $boxes[$nextbox]['visible'] = false;
- }
+ $boxes[$nextbox]['visible'] = ($boxes[$parbox]['visible'] &&
+ ($boxes[$parbox]['collapse'] != SM_BOX_COLLAPSED));
/* Compute the visibility of any child boxes. */
compute_folder_children($nextbox, $boxcount);
$mailbox = urlencode($boxes[$boxnum]['unformatted']);
/* Create the link for this collapse link. */
- $link = '<a target="left" style="text-decoration:none" ';
- $link .= 'href="left_main.php?';
+ $link = '<a target="left" style="text-decoration:none" ' .
+ 'href="left_main.php?';
if ($boxes[$boxnum]['collapse'] == SM_BOX_COLLAPSED) {
$link .= "unfold=$mailbox\">+";
} else {
}
/* Let the world know that autocreation is complete! Hurrah! */
- $auto_create_done = true;
+ $auto_create_done = TRUE;
session_register('auto_create_done');
}
$clk = date($hr, time());
break;
default:
- $clk = date('D, '.$hr, time());
+ $clk = substr( getDayName( date( 'w', time() ) ), 0, 3 ) . date( ', ' . $hr, time() );
}
$clk = str_replace(' ',' ',$clk);
$boxcount = count($boxes);
/* Compute the collapsedness and visibility of each box. */
+
while ($curbox < $boxcount) {
$boxes[$curbox]['visible'] = TRUE;
compute_folder_children($curbox, $boxcount);
}
-for ($i = 0;$i < count($boxes); $i++) {
+
+for ($i = 0; $i < count($boxes); $i++) {
if ( $boxes[$i]['visible'] ) {
$mailbox = $boxes[$i]['formatted'];
$mblevel = substr_count($boxes[$i]['unformatted'], $delimiter) + 1;
$line = "<NOBR><TT>$prefix</TT>";
/* Add the folder name and link. */
+ if (! isset($color[15])) {
+ $color[15] = $color[6];
+ }
+
if (in_array('noselect', $boxes[$i]['flags'])) {
- $line .= "<FONT COLOR=\"$color[7]\">";
+ if( isSpecialMailbox( $boxes[$i]['unformatted']) ) {
+ $line .= "<FONT COLOR=\"$color[11]\">";
+ } else {
+ $line .= "<FONT COLOR=\"$color[15]\">";
+ }
if (ereg("^( *)([^ ]*)", $mailbox, $regs)) {
$mailbox = str_replace(' ','',$mailbox);
$line .= str_replace(' ', ' ', $mailbox);