X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fleft_main.php;h=d80fdd781590391ca48b72dd392d791c4aa2c709;hb=f7196031c2f53609c6f0e6886dbd45d5f9b7e914;hp=6941b7883b535c767ef6b48f4454cb77cc42052e;hpb=ad6f805c8cfdb983377806474e5243b74e0423cc;p=squirrelmail.git diff --git a/src/left_main.php b/src/left_main.php index 6941b788..d80fdd78 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -1,122 +1,155 @@ -', + $color[8], $color[4], $color[7], $color[7], $color[7]); + echo ""; exit; } -?> - -"; - if ($unseen) - $line .= ""; - $special_color = false; - for ($i = 0; $i < count($special_folders); $i++) { - if (($special_folders[$i] == $mailbox) && ($use_special_folder_color == true)) - $special_color = true; + + if (!isset($strings_php)) + include("../functions/strings.php"); + if (!isset($config_php)) + include("../config/config.php"); + if (!isset($array_php)) + include("../functions/array.php"); + if (!isset($imap_php)) + include("../functions/imap.php"); + if (!isset($page_header_php)) + include("../functions/page_header.php"); + if (!isset($i18n_php)) + include("../functions/i18n.php"); + if (!isset($plugin_php)) + include("../functions/plugin.php"); + + // 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"); + + displayHtmlHeader(); + + function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, $unseen) { + global $folder_prefix, $trash_folder, $sent_folder; + global $color, $move_to_sent, $move_to_trash; + global $unseen_notify, $unseen_type; + + $mailboxURL = urlencode($real_box); + + if ($unseen_notify == 2 && $real_box == "INBOX") { + $unseen = sqimap_unseen_messages($imapConnection, $numUnseen, $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; + } + } else if ($unseen_notify == 3) { + $unseen = sqimap_unseen_messages($imapConnection, $numUnseen, $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; + } } + + $line = ""; + if ($unseen > 0) + $line .= ""; + $special_color = false; + if ((strtolower($real_box) == "inbox") || + (($real_box == $trash_folder) && ($move_to_trash)) || + (($real_box == $sent_folder) && ($move_to_sent))) + $special_color = true; + if ($special_color == true) { - $line .= ""; - $line .= readShortMailboxName($mailbox, $delimeter); + $line .= ""; + $line .= replace_spaces($mailbox); $line .= ""; } else { - $line .= ""; - $line .= readShortMailboxName($mailbox, $delimeter); - $line .= ""; + $line .= ""; + $line .= replace_spaces($mailbox); + $line .= ""; } - if ($unseen) + if ($unseen > 0) $line .= ""; - - if ($numUnseen > 0) { - $line .= " ($numUnseen)"; + + if (isset($unseen_found) && $unseen_found) { + $line .= " $unseen_string"; } - if (($move_to_trash == true) && (trim($mailbox) == $trash_folder)) { - $urlMailbox = urlencode($mailbox); - $line .= ""; - $line .= "    (empty)"; - $line .= "\n"; + if (($move_to_trash == true) && ($real_box == $trash_folder)) { + $urlMailbox = urlencode($real_box); + $line .= "\n\n"; + $line .= "   ("._("purge").")"; + $line .= "\n\n"; } - - echo ""; + $line .= ""; return $line; } - // open a connection on the imap port (143) - $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 10); // the 10 is to hide the output + if (isset($left_refresh) && ($left_refresh != "None") && ($left_refresh != "")) { + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "\n\n"; - /** If it was a successful login, lets load their preferences **/ - include("../src/load_prefs.php"); - echo ""; - echo ""; + do_hook("left_main_before"); - getFolderList($imapConnection, $boxes); + $boxes = sqimap_mailbox_list($imapConnection); - echo "
"; - echo "Folders
"; + echo "
"; + echo _("Folders") . "
\n\n"; - echo "("; + echo "("; echo _("refresh folder list"); - echo ")

"; - echo "\n"; - $delimeter = findMailboxDelimeter($imapConnection); - for ($i = 0;$i < count($boxes); $i++) { - $mailbox = $boxes[$i]["UNFORMATTED"]; - $boxFlags = getMailboxFlags($boxes[$i]["RAW"]); - - $boxCount = countCharInString($mailbox, $delimeter); + echo ")

"; + $delimeter = sqimap_get_delimiter($imapConnection); + for ($i = 0;$i < count($boxes); $i++) { $line = ""; - // indent the correct number of spaces. - for ($j = 0;$j < $boxCount;$j++) - $line .= "  "; - - if (trim($boxFlags[0]) != "") { - $noselect = false; - for ($h = 0; $h < count($boxFlags); $h++) { - if (strtolower($boxFlags[$h]) == "noselect") - $noselect = true; - } - - if ($noselect == true) { - $line .= ""; - $line .= readShortMailboxName($mailbox, $delimeter); - $line .= ""; - } else { - $line .= formatMailboxName($imapConnection, $mailbox, $delimeter, $color, $move_to_trash); - } + $mailbox = $boxes[$i]["formatted"]; + + if (in_array('noselect', $boxes[$i]['flags'])) { + $line .= ""; + $line .= replace_spaces($mailbox); + $line .= ''; } else { - $line .= formatMailboxName($imapConnection, $mailbox, $delimeter, $color, $move_to_trash); + if (! isset($boxes[$i]['unseen'])) + $boxes[$i]['unseen'] = ''; + $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"]); } - echo "$line
"; + echo "$line
\n"; } - - echo "
"; - - fclose($imapConnection); - + sqimap_logout($imapConnection); + do_hook("left_main_after"); ?> -
+