X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fleft_main.php;h=1b8afaae5d4c7b009a290246838a24a1f812141d;hb=6614128e580396f5e881fa058c1935b0ee2fc867;hp=12efed216be10aac3495a6ef48682ddfff576c8b;hpb=386e556f84e68c5cca3b936456f36473ad7c70a3;p=squirrelmail.git
diff --git a/src/left_main.php b/src/left_main.php
index 12efed21..1b8afaae 100644
--- a/src/left_main.php
+++ b/src/left_main.php
@@ -12,11 +12,15 @@
* $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/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);
@@ -40,23 +44,20 @@ function formatMailboxName($imapConnection, $box_array) {
if (ereg("^( *)([^ ]*)$", $mailbox, $regs)) {
$mailbox = $regs[2];
}
-
$unseen = 0;
-
+ $status = array();
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;
- }
+ $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('','');
}
-
- $special_color = ($use_special_folder_color && isSpecialMailbox( $real_box ) );
+ $special_color = ($use_special_folder_color && isSpecialMailbox($real_box));
/* Start off with a blank line. */
$line = '';
@@ -64,10 +65,13 @@ 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. */
+ if ($status !== false) {
+ $line .= '';
+ }
if ($special_color) {
- $line .= "";
+ $line .= "";
}
if ( $mailbox == 'INBOX' ) {
$line .= _("INBOX");
@@ -75,14 +79,16 @@ function formatMailboxName($imapConnection, $box_array) {
$line .= str_replace(' ',' ',$mailbox);
}
if ($special_color == TRUE)
- $line .= "";
- $line .= '';
+ $line .= '';
+ if ($status !== false) {
+ $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 +165,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 = ' 0)) {
+ $result[0] = "($boxUnseenCount)";
+ } else if ($unseen_type == 2) {
+ $result[0] = "($boxUnseenCount/$boxMessageCount)";
+ $result[0] = "$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.
*/
@@ -241,39 +329,40 @@ function listBoxes ($boxes, $j=0 ) {
if (($move_to_trash) && ($mailbox == $trash_folder)) {
if (! isset($numMessages)) {
- $numMessages = sqimap_get_num_messages($imapConnection, $mailbox);
+ $status = sqimap_status_messages($imapConnection, $mailbox);
+ $numMessages = $status['MESSAGES'];
}
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) {
@@ -285,12 +374,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,9 +400,22 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0' ) {
}
} 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 .= '';
+ }
+
+ /* 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)) {
@@ -322,32 +424,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 +445,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 '