X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fleft_main.php;h=3416c3142c2ce049dd5f4659ac10cd72070fc171;hp=8b7ce15d7dcfde16a5b74e56953773c7dff61eb0;hb=895905c0f766ea03e85deab260b4bb1522dd0e3c;hpb=aed206bf645384642333d8d1970c8245992a20f4
diff --git a/src/left_main.php b/src/left_main.php
index 8b7ce15d..3416c314 100644
--- a/src/left_main.php
+++ b/src/left_main.php
@@ -1,130 +1,346 @@
";
-
- function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, $color, $move_to_trash) {
- global $folder_prefix;
- require ("../config/config.php");
-
- $mailboxURL = urlencode($real_box);
- sqimap_mailbox_select ($imapConnection, $real_box);
- $unseen = sqimap_unseen_messages($imapConnection, $numUnseen);
-
- echo "";
- if ($unseen)
- $line .= "";
-
- $special_color = false;
- for ($i = 0; $i < count($special_folders); $i++) {
- if ((substr($real_box, strlen($folder_prefix), strlen($special_folders[$i])) == $special_folders[$i]) && ($use_special_folder_color == true))
- $special_color = true;
- }
-
- if ($special_color == true) {
- $line .= "";
- $line .= replace_spaces($mailbox);
- $line .= "";
- } else {
- $line .= "";
- $line .= replace_spaces($mailbox);
- $line .= "";
- }
-
- if ($unseen)
- $line .= "";
-
- if ($numUnseen > 0) {
- $line .= " ($numUnseen)";
- }
-
- if (($move_to_trash == true) && (trim($real_box) == $trash_folder)) {
- $urlMailbox = urlencode($real_box);
- $line .= "";
- $line .= " ("._("purge").")";
- $line .= "\n";
- }
-
- echo "";
- return $line;
- }
-
- // open a connection on the imap port (143)
- $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output
-
- /** If it was a successful login, lets load their preferences **/
- include("../src/load_prefs.php");
-
- if (isset($left_refresh) && ($left_refresh != "None") && ($left_refresh != "")) {
- echo "";
- echo "";
- echo "";
- }
-
- echo "
";
-
- $boxes = sqimap_mailbox_list($imapConnection);
-
- echo "";
- echo _("Folders") . "
";
-
- echo "(";
- echo _("refresh folder list");
- echo ")
";
- $delimeter = sqimap_get_delimiter($imapConnection);
-
- for ($i = 0;$i < count($boxes); $i++) {
- $line = "";
- $mailbox = $boxes[$i]["formatted"];
-
- if ($boxes[$i]["flags"]) {
- $noselect = false;
- for ($h = 0; $h < count($boxes[$i]["flags"]); $h++) {
- if (strtolower($boxes[$i]["flags"][$h]) == "noselect")
- $noselect = true;
- }
- if ($noselect == true) {
- $line .= "";
- $line .= replace_spaces(readShortMailboxName($mailbox, $delimeter));
+ ** $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');
+
+ /* These constants are used for folder stuff. */
+ define('SM_BOX_UNCOLLAPSED', 0);
+ define('SM_BOX_COLLAPSED', 1);
+
+/* --------------------- 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;
+
+ $real_box = $box_array['unformatted'];
+ $mailbox = str_replace(' ','',$box_array['formatted']);
+ $mailboxURL = urlencode($real_box);
+
+ /* Strip down the mailbox name. */
+ if (ereg("^( *)([^ ]*)$", $mailbox, $regs)) {
+ $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 = 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;
+ }
+ }
+
+ /* Start off with a blank line. */
+ $line = '';
+
+ /* If there are unseen message, bold the line. */
+ if ($unseen > 0) { $line .= ''; }
+
+ /* Crate the link for this folder. */
+ $line .= "";
+ if ($special_color == true)
+ $line .= "";
+ $line .= str_replace(' ',' ',$mailbox);
+ if ($special_color == true)
$line .= "";
- } else {
- $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $color, $move_to_trash);
- }
- } else {
- $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $color, $move_to_trash);
- }
- echo "$line
";
- }
-
-
- fclose($imapConnection);
-
-?>
-