X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fleft_main.php;h=c72f89dcaa3d2021f7a8aa8e6056f1f83df1c720;hb=ce20ea9260adccbf62ca895c7e372947c3007f21;hp=3330a5fea1e86162effcc16bbc52e8247a0f5aa9;hpb=625c8b787b79d07a1e53ba05213f66451d73651e;p=squirrelmail.git diff --git a/src/left_main.php b/src/left_main.php index 3330a5fe..c72f89dc 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -3,7 +3,7 @@ /** * left_main.php * - * Copyright (c) 1999-2002 The SquirrelMail Project Team + * Copyright (c) 1999-2003 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 @@ -35,7 +35,6 @@ function formatMailboxName($imapConnection, $box_array) { $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']); $mailboxURL = urlencode($real_box); @@ -45,18 +44,15 @@ function formatMailboxName($imapConnection, $box_array) { $mailbox = $regs[2]; } $unseen = 0; - $status = array(); + $status = array('',''); if (($unseen_notify == 2 && $real_box == 'INBOX') || $unseen_notify == 3) { - $status = create_unseen_string($real_box, $box_array, $imapConnection, $unseen_type ); + $tmp_status = create_unseen_string($real_box, $box_array, $imapConnection, $unseen_type ); if ($status !== false) { - list($unseen_string, $unseen) = $status; - } else { - list($unseen_string, $unseen) = array(_("Not available"),''); - } - } else { - list($unseen_string, $unseen) = array('',''); + $status = $tmp_status; + } } + list($unseen_string, $unseen) = $status; $special_color = ($use_special_folder_color && isSpecialMailbox($real_box)); /* Start off with a blank line. */ @@ -92,12 +88,13 @@ function formatMailboxName($imapConnection, $box_array) { $line .= " $unseen_string"; } + /* If it's the trash folder, show a purge link when needed */ if (($move_to_trash) && ($real_box == $trash_folder)) { if (! isset($numMessages)) { $numMessages = sqimap_get_num_messages($imapConnection, $real_box); } - if ($numMessages > 0) { + if (($numMessages > 0) or ($box_array['parent'] == 1)) { $urlMailbox = urlencode($real_box); $line .= "\n\n" . "  ("._("purge").")" . @@ -290,7 +287,7 @@ function listBoxes ($boxes, $j=0 ) { $mailbox = $boxes->mailboxname_full; $leader = ''; for ($k = 0; $k < $j; $k++) { - $leader.= '   '; + $leader.= '   '; } $mailboxURL = urlencode($mailbox); @@ -313,14 +310,14 @@ function listBoxes ($boxes, $j=0 ) { $link = '$leader + "; + $link .= "unfold=$mailboxURL\">$leader + "; } else { - $link .= "fold=$mailboxURL\">$leader - "; + $link .= "fold=$mailboxURL\">$leader - "; } $link .= ''; $pre .= $link; } else { - $pre.= $leader . '   '; + $pre.= $leader . '   '; } @@ -336,33 +333,33 @@ function listBoxes ($boxes, $j=0 ) { if ($numMessages > 0) { $urlMailbox = urlencode($mailbox); $pre .= "\n\n" . - "  ("._("purge").")" . + "  ("._("purge").")" . ""; } } else { if (!$boxes->is_noselect) { - $pre .= ""; + $pre .= ""; $end .= ''; } } /* If there are unseen message, close bolding. */ - if ($unseen > 0) { $end .= ""; } + if ($unseen > 0) { $end .= ""; } /* Print unseen information. */ if (isset($unseen_found) && $unseen_found) { - $end .= " $unseen_string"; + $end .= " $unseen_string"; } $font = ''; $fontend = ''; if ($boxes->is_special) { - $font = ""; - $fontend = ""; + $font = ""; + $fontend = ""; } if (!$boxes->is_root) { - echo "" . $pre .$font. $boxes->mailboxname_sub .$fontend . $end. '
'; + echo "" . $pre .$font. $boxes->mailboxname_sub .$fontend . $end. '
'; $j++; } if (!$collapse || $boxes->is_root) { @@ -401,16 +398,16 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) { } else $unseen = 0; /* If there are unseen message, bold the line. */ - if ($unseen > 0) { $pre .= ''; } + if ($unseen > 0) { $pre .= ''; } /* color special boxes */ if ($boxes->is_special) { - $pre .= ""; - $end .= ""; + $pre .= ""; + $end .= ''; } /* If there are unseen message, close bolding. */ - if ($unseen > 0) { $end .= ""; } + if ($unseen > 0) { $end .= ''; } /* Print unseen information. */ if (isset($unseen_found) && $unseen_found) { @@ -424,12 +421,12 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) { 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 .= ''; } } @@ -445,7 +442,7 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) { } 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 ' ' . html_tag( 'div', @@ -469,9 +466,9 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) { $collapse = ($collapse == '' ? SM_BOX_UNCOLLAPSED : $collapse); } if ($collapse) { - $link = ''." "; + $link = ''." "; } else { - $link = ''.""; + $link = ''.""; } $collapse_link = $link; } else $collapse_link=''; @@ -479,13 +476,13 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) { $collapse_link . $pre . $folder_img . ' '. $boxes->mailboxname_sub . $end , 'left', '', 'class="mbx_par" id="' .$j. 'P"' ) . "\n"; - echo ' '."\n"; + echo ' '."\n"; } } if ($collapse) { - $visible = ' STYLE="display:none;"'; + $visible = ' style="display:none;"'; } else { - $visible = ' STYLE="display:block;"'; + $visible = ' style="display:block;"'; } if (isset($boxes->mbxs[0]) && !$boxes->is_root) /* mailbox contains childs */ @@ -507,17 +504,16 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) { /* -------------------- MAIN ------------------------ */ -$key = $_COOKIE['key']; -$onetimepad = $_SESSION['onetimepad']; -$username = $_SESSION['username']; -$delimiter = $_SESSION['delimiter']; +/* get globals */ +sqgetGlobalVar('username', $username, SQ_SESSION); +sqgetGlobalVar('key', $key, SQ_COOKIE); +sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION); +sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); -if (isset($_GET['fold'])) { - $fold = $_GET['fold']; -} -if (isset($_GET['unfold'])) { - $unfold = $_GET['unfold']; -} +sqgetGlobalVar('fold', $fold, SQ_GET); +sqgetGlobalVar('unfold', $unfold, SQ_GET); + +/* end globals */ // open a connection on the imap port (143) $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output @@ -526,10 +522,10 @@ $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 1 * Using stristr since older preferences may contain "None" and "none". */ if (isset($left_refresh) && ($left_refresh != '') && - !stristr($left_refresh, "none")){ - $xtra = "\n\n" . - "\n". - "\n"; + !stristr($left_refresh, 'none')){ + $xtra = "\n\n" . + "\n". + "\n"; } else { $xtra = ''; } @@ -714,7 +710,7 @@ ECHO; $xtra .= << + + ECHO; @@ -815,23 +811,23 @@ if ($auto_create_special && !isset($auto_create_done)) { sqsession_register($auto_create_done, 'auto_create_done'); } -echo "\n\n"; +echo "\n\n"; do_hook('left_main_before'); if ($advanced_tree) { /* nice future feature, needs layout !! volunteers? */ $right_pos = $left_size - 20; echo '
'; - echo ''; - echo ''; - echo '
'; - echo '


'; + echo ''; + echo ''; + echo '
'; + echo '


'; } 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"; + '
'. _("Folders") . "
\n\n"; if ($date_format != 6) { /* First, display the clock. */ @@ -870,7 +866,7 @@ if ($date_format != 6) { /* Next, display the refresh button. */ echo '('. - _("refresh folder list") . ')

'; + _("refresh folder list") . ')

'; /* Lastly, display the folder list. */ if ( $collapse_folders ) { @@ -910,7 +906,7 @@ for ($i = 0; $i < count($boxes); $i++) { } else { $prefix = str_replace(' ',' ',$prefix); } - $line = "$prefix"; + $line = "$prefix"; /* Add the folder name and link. */ if (! isset($color[15])) { @@ -919,21 +915,21 @@ for ($i = 0; $i < count($boxes); $i++) { if (in_array('noselect', $boxes[$i]['flags'])) { if( isSpecialMailbox( $boxes[$i]['unformatted']) ) { - $line .= ""; + $line .= ""; } else { - $line .= ""; + $line .= ""; } if (ereg("^( *)([^ ]*)", $mailbox, $regs)) { $mailbox = str_replace(' ','',$mailbox); $line .= str_replace(' ', ' ', $mailbox); } - $line .= ''; + $line .= ''; } else { $line .= formatMailboxName($imapConnection, $boxes[$i]); } /* Put the final touches on our folder line. */ - $line .= "
\n"; + $line .= "
\n"; /* Output the line for this folder. */ echo $line; @@ -942,14 +938,14 @@ for ($i = 0; $i < count($boxes); $i++) { } else { /* expiremental code */ $boxes = sqimap_mailbox_tree($imapConnection); if (isset($advanced_tree) && $advanced_tree) { - echo '


'; - echo '
'."\n\n"; + echo '

'; + echo '
'."\n\n"; if (!isset($mbx)) $mbx=NULL; ListAdvancedBoxes($boxes, $mbx); echo '
'."\n"; - echo ''."\n"; + echo ''."\n"; } else { ListBoxes($boxes); }