X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fleft_main.php;h=187b1ef19f99068178205018a071b80e21f9c67f;hp=12efed216be10aac3495a6ef48682ddfff576c8b;hb=0210ab4da65e25ee6873ec15fe6b6aedbfad6677;hpb=386e556f84e68c5cca3b936456f36473ad7c70a3 diff --git a/src/left_main.php b/src/left_main.php index 12efed21..187b1ef1 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -12,11 +12,16 @@ * $Id$ */ -require_once('../src/validate.php'); -require_once('../functions/array.php'); -require_once('../functions/imap.php'); -require_once('../functions/plugin.php'); -require_once('../functions/page_header.php'); +/* Path for SquirrelMail required files. */ +define('SM_PATH','../'); + +/* SquirrelMail required files. */ +require_once(SM_PATH . 'include/validate.php'); +require_once(SM_PATH . 'functions/array.php'); +require_once(SM_PATH . 'functions/imap.php'); +require_once(SM_PATH . 'functions/plugin.php'); +require_once(SM_PATH . 'functions/page_header.php'); +require_once(SM_PATH . 'functions/html.php'); /* These constants are used for folder stuff. */ define('SM_BOX_UNCOLLAPSED', 0); @@ -41,22 +46,8 @@ function formatMailboxName($imapConnection, $box_array) { $mailbox = $regs[2]; } - $unseen = 0; - - if (($unseen_notify == 2 && $real_box == 'INBOX') || - $unseen_notify == 3) { - $unseen = sqimap_unseen_messages($imapConnection, $real_box); - if ($unseen_type == 1 && $unseen > 0) { - $unseen_string = "($unseen)"; - $unseen_found = TRUE; - } else if ($unseen_type == 2) { - $numMessages = sqimap_get_num_messages($imapConnection, $real_box); - $unseen_string = "($unseen/$numMessages)"; - $unseen_found = TRUE; - } - } - - $special_color = ($use_special_folder_color && isSpecialMailbox( $real_box ) ); + list($unseen_string, $unseen) = create_unseen_string($real_box, $box_array, $imapConnection); + $special_color = ($use_special_folder_color && isSpecialMailbox($real_box)); /* Start off with a blank line. */ $line = ''; @@ -64,10 +55,12 @@ function formatMailboxName($imapConnection, $box_array) { /* If there are unseen message, bold the line. */ if ($unseen > 0) { $line .= ''; } - /* Crate the link for this folder. */ - $line .= ""; + /* Create the link for this folder. */ + $line .= ''; + if ($special_color) { - $line .= ""; + $line .= ""; } if ( $mailbox == 'INBOX' ) { $line .= _("INBOX"); @@ -75,14 +68,14 @@ function formatMailboxName($imapConnection, $box_array) { $line .= str_replace(' ',' ',$mailbox); } if ($special_color == TRUE) - $line .= ""; - $line .= ''; + $line .= ''; + $line .= ''; /* If there are unseen message, close bolding. */ if ($unseen > 0) { $line .= ""; } /* Print unseen information. */ - if (isset($unseen_found) && $unseen_found) { + if ($unseen_string != '') { $line .= " $unseen_string"; } @@ -159,9 +152,9 @@ function compute_folder_children(&$parbox, $boxcount) { * currently appropriate. */ function create_collapse_link($boxnum) { - global $boxes; + global $boxes, $imapConnection, $unseen_notify, $color; $mailbox = urlencode($boxes[$boxnum]['unformatted']); - + /* Create the link for this collapse link. */ $link = '$result[0]"; + } + + /* Set the unseen count to return to the outside world. */ + $result[1] = $boxUnseenCount; + + /* Return our happy result. */ + return ($result); +} + /** * This simple function checks if a box is another box's parent. */ @@ -252,7 +323,7 @@ function listBoxes ($boxes, $j=0 ) { } } else { if (!$boxes->is_noselect) { - $pre .= ""; + $pre .= ""; $end .= ''; } } @@ -285,12 +356,12 @@ function listBoxes ($boxes, $j=0 ) { } } -function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0' ) { +function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) { global $data_dir, $username, $startmessage, $color, $unseen_notify, $unseen_type, $move_to_trash, $trash_folder, $collapse_folders; /* use_folder_images only works if the images exist in ../images */ - $use_folder_images = false; + $use_folder_images = true; $pre = ''; $end = ''; @@ -311,10 +382,23 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0' ) { } } else $unseen = 0; - /* If there are unseen message, bold the line. */ if ($unseen > 0) { $pre .= ''; } + /* color special boxes */ + if ($boxes->is_special) { + $pre .= ""; + $end .= ""; + } + + /* If there are unseen message, close bolding. */ + if ($unseen > 0) { $end .= ""; } + + /* Print unseen information. */ + if (isset($unseen_found) && $unseen_found) { + $end .= " $unseen_string"; + } + if (($move_to_trash) && ($mailbox == $trash_folder)) { if (! isset($numMessages)) { $numMessages = $boxes->total; @@ -322,32 +406,16 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0' ) { if ($numMessages > 0) { $urlMailbox = urlencode($mailbox); $pre .= "\n\n" . - "  ("._("purge").")" . + "  ("._("purge").")" . ""; } } else { if (!$boxes->is_noselect) { /* \Noselect boxes can't be selected */ - $pre .= ""; + $pre .= ""; $end .= ''; } } - /* If there are unseen message, close bolding. */ - if ($unseen > 0) { $end .= ""; } - - /* Print unseen information. */ - if (isset($unseen_found) && $unseen_found) { - $end .= " $unseen_string"; - } - - $font = ''; - $fontend = ''; - - /* color special boxes */ - if ($boxes->is_special) { - $font = ""; - $fontend = ""; - } if (!$boxes->is_root) { if ($use_folder_images) { if ($boxes->is_inbox) { @@ -359,10 +427,13 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0' ) { } else if ($boxes->is_draft) { $folder_img = '../images/draft.gif'; } else $folder_img = '../images/folder.gif'; - $folder_img = '  '; + $folder_img = '  '; } else $folder_img = ''; if (!isset($boxes->mbxs[0])) { - echo '
' . $folder_img .$pre .$font. $boxes->mailboxname_sub .$fontend . $end. '
'."\n"; + echo ' ' . html_tag( 'div', + $pre . $folder_img . $boxes->mailboxname_sub . $end , + 'left', '', 'class="mbx_sub" id="' .$j. '"' ) + . "\n"; } else { /* get collapse information */ if ($collapse_folders) { @@ -386,8 +457,11 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0' ) { } $collapse_link = $link; } else $collapse_link=''; - echo '
' . $collapse_link . $folder_img .$pre. $font. '  '. $boxes->mailboxname_sub .$fontend . $end. '
'."\n"; - echo ' '."\n"; + echo ' ' . html_tag( 'div', + $collapse_link . $pre . $folder_img . ' '. $boxes->mailboxname_sub . $end , + 'left', '', 'class="mbx_par" id="' .$j. 'P"' ) + . "\n"; + echo ' '."\n"; } } if ($collapse) { @@ -397,9 +471,10 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0' ) { } if (isset($boxes->mbxs[0]) && !$boxes->is_root) /* mailbox contains childs */ - echo '
'."\n"; - if ($j !='ID.0') { - $j = $j .'.0'; + echo html_tag( 'div', '', 'left', '', 'class="par_area" id='.$j.'.0000 '. $visible ) . "\n"; + + if ($j !='ID.0000') { + $j = $j .'.0000'; } for ($i = 0; $i mbxs); $i++) { $j++; @@ -414,7 +489,17 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0' ) { /* -------------------- MAIN ------------------------ */ -global $delimiter, $default_folder_prefix, $left_size; +$key = $_COOKIE['key']; +$onetimepad = $_SESSION['onetimepad']; +$username = $_SESSION['username']; +$delimiter = $_SESSION['delimiter']; + +if (isset($_GET['fold'])) { + $fold = $_GET['fold']; +} +if (isset($_GET['unfold'])) { + $unfold = $_GET['unfold']; +} // open a connection on the imap port (143) $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output @@ -458,7 +543,7 @@ $xtra .= << +