X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fleft_main.php;h=c02855008e1689dff0b4d1fccbe0c5e40be2425b;hb=2f174eff269644043331f63b9083ebf339762ebc;hp=dda2b3c7221c5a338e92c6eff79499ea21f225b1;hpb=ccc4580f87b82ef3620724d28bad4111dd114b9b;p=squirrelmail.git diff --git a/src/left_main.php b/src/left_main.php index dda2b3c7..c0285500 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -3,17 +3,20 @@ /** * left_main.php * - * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Copyright (c) 1999-2004 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$ + * @version $Id$ * @package squirrelmail */ -/** Path for SquirrelMail required files. */ +/** + * Path for SquirrelMail required files. + * @ignore + */ define('SM_PATH','../'); /* SquirrelMail required files. */ @@ -65,7 +68,7 @@ function formatMailboxName($imapConnection, $box_array) { /* Create the link for this folder. */ if ($status !== false) { - $line .= ''; } if ($special_color) { @@ -74,7 +77,7 @@ function formatMailboxName($imapConnection, $box_array) { if ( $mailbox == 'INBOX' ) { $line .= _("INBOX"); } else { - $line .= str_replace(' ',' ',$mailbox); + $line .= str_replace(array(' ','<','>'),array(' ','<','>'),$mailbox); } if ($special_color == TRUE) $line .= ''; @@ -99,14 +102,17 @@ function formatMailboxName($imapConnection, $box_array) { if (($numMessages > 0) or ($box_array['parent'] == 1)) { $urlMailbox = urlencode($real_box); $line .= "\n\n" . - "  ("._("purge").")" . - ""; - } else { - $line .= concat_hook_function('left_main_after_each_folder', - array(isset($numMessages) ? $numMessages : '',$real_box,$imapConnection)); + '  ['._("purge").']' . + ''; } } + + // let plugins fiddle with end of line + $line .= concat_hook_function('left_main_after_each_folder', + array(isset($numMessages) ? $numMessages : '', $real_box, $imapConnection)); + + /* Return the final product. */ return ($line); } @@ -167,23 +173,27 @@ function compute_folder_children(&$parbox, $boxcount) { * currently appropriate. */ function create_collapse_link($boxnum) { - global $boxes, $imapConnection, $unseen_notify, $color; + global $boxes, $imapConnection, $unseen_notify, $color, $use_icons, $icon_theme; $mailbox = urlencode($boxes[$boxnum]['unformatted']); /* Create the link for this collapse link. */ $link = '+"; + if ($use_icons && $icon_theme != 'none') { + $link .= "unfold=$mailbox\">"; + } else { + $link .= "unfold=$mailbox\">+"; + } } else { - $link .= "fold=$mailbox\">-"; + if ($use_icons && $icon_theme != 'none') { + $link .= "fold=$mailbox\">"; + } else { + $link .= "fold=$mailbox\">-"; + } } $link .= ''; - $hooklink = do_hook_function('create_collapse_link',$link); - if ($hooklink != '') - $link = $hooklink; - /* Return the finished product. */ return ($link); } @@ -287,7 +297,8 @@ function is_parent_box($curbox_name, $parbox_name) { function ListBoxes ($boxes, $j=0 ) { global $data_dir, $username, $startmessage, $color, $unseen_notify, $unseen_type, - $move_to_trash, $trash_folder, $collapse_folders, $imapConnection; + $move_to_trash, $trash_folder, $collapse_folders, $imapConnection, + $use_icons, $icon_theme, $use_special_folder_color; if (!isset($boxes) || empty($boxes)) return; @@ -343,9 +354,17 @@ function ListBoxes ($boxes, $j=0 ) { $link = '$leader+ "; + if ($use_icons && $icon_theme != 'none') { + $link .= "unfold=$mailboxURL\">$leader "; + } else { + $link .= "unfold=$mailboxURL\">$leader+ "; + } } else { - $link .= "fold=$mailboxURL\">$leader- "; + if ($use_icons && $icon_theme != 'none') { + $link .= "fold=$mailboxURL\">$leader "; + } else { + $link .= "fold=$mailboxURL\">$leader- "; + } } $link .= ''; $pre .= $link; @@ -361,7 +380,7 @@ function ListBoxes ($boxes, $j=0 ) { if ($unseen > 0) { $pre .= ''; } - $pre .= ""; + $pre .= ""; if ($unseen > 0) { $end .= ''; } @@ -370,7 +389,7 @@ function ListBoxes ($boxes, $j=0 ) { if ($unseen > 0) { $pre .= ''; } - $pre .= ""; + $pre .= ""; if ($unseen > 0) { $end .= ''; } @@ -379,15 +398,15 @@ function ListBoxes ($boxes, $j=0 ) { $end .= " $unseen_string"; } $end .= "\n\n" . - "  ("._("purge").")" . - ""; + '  ['._("purge").']'. + ''; } } else { if (!$boxes->is_noselect) { if ($unseen > 0) { $pre .= ''; } - $pre .= ""; + $pre .= ""; if ($unseen > 0) { $end .= ''; } @@ -402,14 +421,20 @@ function ListBoxes ($boxes, $j=0 ) { $font = ''; $fontend = ''; - if ($boxes->is_special) { + if ($use_special_folder_color && $boxes->is_special) { $font = ""; $fontend = ""; } + + // let plugins fiddle with end of line + $end .= concat_hook_function('left_main_after_each_folder', + array(isset($numMessages) ? $numMessages : '', + $boxes->mailboxname_full, $imapConnection)); + $end .= ''; if (!$boxes->is_root) { - echo "" . $pre .$font. $boxes->mailboxname_sub .$fontend . $end. '
' . "\n"; + echo "" . $pre .$font. str_replace(array(' ','<','>'),array(' ','<','>'),$boxes->mailboxname_sub) .$fontend . $end. '
' . "\n"; $j++; } @@ -422,7 +447,7 @@ function ListBoxes ($boxes, $j=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; + $move_to_trash, $trash_folder, $collapse_folders, $use_special_folder_color; if (!isset($boxes) || empty($boxes)) return; @@ -477,7 +502,7 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) { if ($unseen > 0) { $pre .= ''; } /* color special boxes */ - if ($boxes->is_special) { + if ($use_special_folder_color && $boxes->is_special) { $pre .= ""; $end .= ''; } @@ -494,21 +519,27 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) { if (! isset($numMessages)) { $numMessages = $boxes->total; } - $pre = "
" . $pre; + $pre = "" . $pre; $end .= ''; if ($numMessages > 0) { $urlMailbox = urlencode($mailbox); $end .= "\n\n" . - "  ("._("purge").")" . - ""; + '  ['._("purge").']'. + ''; } } else { if (!$boxes->is_noselect) { /* \Noselect boxes can't be selected */ - $pre = "" . $pre; + $pre = "" . $pre; $end .= ''; } } + // let plugins fiddle with end of line + global $imapConnection; + $end .= concat_hook_function('left_main_after_each_folder', + array(isset($numMessages) ? $numMessages : '', + $boxes->mailboxname_full, $imapConnection)); + if (!$boxes->is_root) { if ($use_folder_images) { if ($boxes->is_inbox) { @@ -530,7 +561,7 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) { } if (!isset($boxes->mbxs[0])) { echo ' ' . html_tag( 'div', - ''. $pre . $folder_img . ''. $boxes->mailboxname_sub . $end, + ''. $pre . $folder_img . ''. str_replace(array(' ','<','>'),array(' ','<','>'),$boxes->mailboxname_sub) . $end, 'left', '', 'class="mbx_sub" id="' .$j. '"' ) . "\n"; } else { /* get collapse information */ @@ -893,7 +924,7 @@ ECHO; } 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); @@ -901,8 +932,11 @@ if ($auto_create_special && !isset($auto_create_done)) { if (($folder != '') && ($folder != 'none')) { if ( !sqimap_mailbox_exists($imapConnection, $folder)) { sqimap_mailbox_create($imapConnection, $folder, ''); - } else if (!sqimap_mailbox_is_subscribed($imapConnection, $folder)) { - sqimap_subscribe($imapConnection, $folder); + } else { + //if (!sqimap_mailbox_is_subscribed($imapConnection, $folder)) { + // check for subscription is useless and expensive just + // surpress the NO response + sqimap_subscribe($imapConnection, $folder, false); } } } @@ -933,7 +967,10 @@ if ($advanced_tree) { echo "\n\n" . html_tag( 'table', '', 'left', '', 'border="0" cellspacing="0" cellpadding="0" width="99%"' ) . html_tag( 'tr' ) . html_tag( 'td', '', 'left' ) . - '
'. _("Folders") . "
\n\n"; + html_tag( 'table', '', '', '', 'border="0" cellspacing="0" cellpadding="0"' ) . + html_tag( 'tr' ) . + html_tag( 'td', '', 'center' ) . + ''. _("Folders") . "
\n\n"; if ($date_format != 6) { /* First, display the clock. */ @@ -951,6 +988,9 @@ if ($date_format != 6) { } switch( $date_format ) { + case 0: + $clk = date('Y-m-d '.$hr. ' T', time()); + break; case 1: $clk = date('m/d/y '.$hr, time()); break; @@ -966,13 +1006,13 @@ if ($date_format != 6) { } $clk = str_replace(' ',' ',$clk); - echo '
' . str_replace(' ',' ',_("Last Refresh")) . - ": $clk
"; + echo '' . str_replace(' ',' ',_("Last Refresh")) . + ": $clk
"; } /* Next, display the refresh button. */ -echo '('. - _("refresh folder list") . ')

'; +echo '['. + _("Check mail") . ']
'; /* Lastly, display the folder list. */ if ( $collapse_folders ) { @@ -1075,7 +1115,7 @@ for ($i = 0; $i < count($boxes); $i++) { echo ''; echo ''."\n"; } else { - //sqimap_get_status_mbx_tree($imap_stream,$boxes) + //sqimap_get_status_mbx_tree($imap_stream,$boxes) ListBoxes($boxes); } } /* if ($oldway) else ... */ @@ -1085,4 +1125,4 @@ sqimap_logout($imapConnection); echo '' . "\n". "\n"; -?> +?> \ No newline at end of file