X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fleft_main.php;h=76da5f303267b7460c02d881af8d4239d0f77e00;hb=97be216806423d7008317ac7b4ca81ca8a4c8504;hp=2c13f745d6624b3be25b35e4dcb757cd65710a02;hpb=e2370222dc6e0e9ec897575778ec5eec6c337ade;p=squirrelmail.git diff --git a/src/left_main.php b/src/left_main.php index 2c13f745..76da5f30 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -13,66 +13,103 @@ } ?> - - - - - "; - echo "
$org_name
"; - echo "Folders
"; - echo "
"; - echo "\n"; - for ($i = 0;$i < count($str); $i++) { - $mailbox = Chop($str[$i]); - $mailbox = findMailboxName($mailbox); - - // find the quote at the begining of the mailbox name. - // i subtract 1 from the strlen so it doesn't find the quote at the end of the mailbox name. - $periodCount = countCharInString($mailbox, "."); - - // indent the correct number of spaces. - for ($j = 0;$j < $periodCount;$j++) - echo "  "; - + function formatMailboxName($imapConnection, $mailbox, $delimeter) { + require ("../config/config.php"); + $mailboxURL = urlencode($mailbox); - echo ""; - echo readShortMailboxName($mailbox, "."); - if (($move_to_trash == true) && ($mailbox == $trash_folder)) { + selectMailbox($imapConnection, $mailbox, $numNessages); + $unseen = unseenMessages($imapConnection, $numUnseen); + + echo ""; + 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 ($special_color == true) { + $line .= ""; + $line .= readShortMailboxName($mailbox, $delimeter); + $line .= ""; + } else { + $line .= ""; + $line .= readShortMailboxName($mailbox, $delimeter); + $line .= ""; + } + + if ($unseen) + $line .= ""; + + if ($numUnseen > 0) { + $line .= " ($numUnseen)"; + } + + if (($move_to_trash == true) && (trim($mailbox) == $trash_folder)) { $urlMailbox = urlencode($mailbox); - selectMailbox($imapConnection, $mailbox, $numNessages); - echo "    (empty)"; + $line .= ""; + $line .= "    (empty)"; + $line .= "\n"; } - echo "
\n"; + + echo "
"; + return $line; + } + + echo ""; + echo ""; + // open a connection on the imap port (143) + $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 10); // the 10 is to hide the output + + getFolderList($imapConnection, $boxes); + + echo "
"; + echo "Folders
"; + + echo "(refresh folder list)

"; + 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); + + $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); + } + } else { + $line .= formatMailboxName($imapConnection, $mailbox, $delimeter); + } + echo "$line
"; } - echo "
"; + + echo ""; fclose($imapConnection);