Added _() to some strings missing from translation.
[squirrelmail.git] / src / left_main.php
CommitLineData
21c3249f 1<?
2 /**
a09387f4 3 ** left_main.php
21c3249f 4 **
5 ** This is the code for the left bar. The left bar shows the folders
6 ** available, and has cookie information.
7 **
8 **/
9
10 if(!isset($username)) {
11 echo "You need a valid user and password to access this page!";
12 exit;
13 }
142499d4 14
d068c0ec 15 if (!isset($config_php))
16 include("../config/config.php");
17 if (!isset($array_php))
18 include("../functions/array.php");
19 if (!isset($strings_php))
20 include("../functions/strings.php");
21 if (!isset($imap_php))
22 include("../functions/imap.php");
142499d4 23 if (!isset($page_header_php))
24 include("../functions/page_header.php");
25
26 echo "<HTML>";
21c3249f 27
91f999f6 28 function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, $color, $move_to_trash) {
d92b6f31 29 require ("../config/config.php");
30
4c34dac5 31 $mailboxURL = urlencode($real_box);
813eba2f 32 sqimap_mailbox_select ($imapConnection, $real_box);
33 $unseen = sqimap_unseen_messages($imapConnection, $numUnseen);
d92b6f31 34
97be2168 35 echo "<NOBR>";
d92b6f31 36 if ($unseen)
37 $line .= "<B>";
38
7ce342dc 39 $special_color = false;
40 for ($i = 0; $i < count($special_folders); $i++) {
f16d469a 41 if (($special_folders[$i] == $real_box) && ($use_special_folder_color == true))
7ce342dc 42 $special_color = true;
43 }
44
45 if ($special_color == true) {
aae41ae9 46 $line .= "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT COLOR=\"$color[11]\">";
813eba2f 47 $line .= replace_spaces($mailbox);
7ce342dc 48 $line .= "</font></a>";
49 } else {
aae41ae9 50 $line .= "<a href=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\">";
813eba2f 51 $line .= replace_spaces($mailbox);
7ce342dc 52 $line .= "</font></a>";
d92b6f31 53 }
7ce342dc 54
55 if ($unseen)
56 $line .= "</B>";
57
d92b6f31 58 if ($numUnseen > 0) {
aae41ae9 59 $line .= "&nbsp;<small>($numUnseen)</small>";
7ce342dc 60 }
61
0ab89329 62 if (($move_to_trash == true) && (trim($real_box) == $trash_folder)) {
63 $urlMailbox = urlencode($real_box);
aae41ae9 64 $line .= "<small>";
b6def0e7 65 $line .= "&nbsp;&nbsp;&nbsp;&nbsp;(<B><A HREF=\"empty_trash.php?numMessages=$numMessages&mailbox=$urlMailbox\" TARGET=right style=\"text-decoration:none\">"._("purge")."</A></B>)";
aae41ae9 66 $line .= "</small></a>\n";
d92b6f31 67 }
97be2168 68
69 echo "</NOBR>";
d92b6f31 70 return $line;
71 }
72
21c3249f 73 // open a connection on the imap port (143)
e1469126 74 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output
21c3249f 75
f3d17401 76 /** If it was a successful login, lets load their preferences **/
77 include("../src/load_prefs.php");
4c34dac5 78 if (isset($left_refresh) && ($left_refresh != "None") && ($left_refresh != "")) {
aff57ea5 79 echo "<META HTTP-EQUIV=\"Expires\" CONTENT=\"Thu, 01 Dec 1994 16:00:00 GMT\">";
80 echo "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">";
469eb37b 81 echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"$left_refresh;URL=left_main.php\">";
82 }
813eba2f 83
f3d17401 84 echo "<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\">";
f3d17401 85
813eba2f 86 $boxes = sqimap_mailbox_list($imapConnection);
21c3249f 87
aae41ae9 88 echo "<FONT SIZE=4><B><CENTER>";
813eba2f 89 echo _("Folders") . "</B><BR></FONT>";
97afcee9 90
aae41ae9 91 echo "<small>(<A HREF=\"../src/left_main.php\" TARGET=\"left\">";
ad6f805c 92 echo _("refresh folder list");
aae41ae9 93 echo "</A>)</small></CENTER><BR>";
813eba2f 94 $delimeter = sqimap_get_delimiter($imapConnection);
4c34dac5 95
7ce342dc 96 for ($i = 0;$i < count($boxes); $i++) {
d92b6f31 97 $line = "";
813eba2f 98 $mailbox = $boxes[$i]["formatted"];
d92b6f31 99
813eba2f 100 if ($boxes[$i]["flags"]) {
7ce342dc 101 $noselect = false;
813eba2f 102 for ($h = 0; $h < count($boxes[$i]["flags"]); $h++) {
103 if (strtolower($boxes[$i]["flags"][$h]) == "noselect")
7ce342dc 104 $noselect = true;
d92b6f31 105 }
7ce342dc 106 if ($noselect == true) {
aae41ae9 107 $line .= "<FONT COLOR=\"$color[10]\">";
813eba2f 108 $line .= replace_spaces(readShortMailboxName($mailbox, $delimeter));
aae41ae9 109 $line .= "</FONT>";
7ce342dc 110 } else {
813eba2f 111 $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $color, $move_to_trash);
d92b6f31 112 }
7ce342dc 113 } else {
813eba2f 114 $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $color, $move_to_trash);
d92b6f31 115 }
7ce342dc 116 echo "$line<BR>";
d92b6f31 117 }
118
21c3249f 119
120 fclose($imapConnection);
121
122?>
aae41ae9 123</BODY></HTML>