21c3249f |
1 | <? |
2 | /** |
a09387f4 |
3 | ** right_main.php |
21c3249f |
4 | ** |
5 | ** This is where the mailboxes are listed. This controls most of what |
6 | ** goes on in SquirrelMail. |
7 | ** |
8 | **/ |
9 | |
10 | if(!isset($logged_in)) { |
a09387f4 |
11 | echo "You must <a href=\"login.php\">login</a> first."; |
21c3249f |
12 | exit; |
13 | } |
14 | if(!isset($username) || !isset($key)) { |
15 | echo "You need a valid user and password to access this page!"; |
16 | exit; |
17 | } |
18 | ?> |
19 | <HTML> |
21c3249f |
20 | <FONT FACE="Arial,Helvetica"> |
21 | <? |
a09387f4 |
22 | include("../config/config.php"); |
23 | include("../functions/imap.php"); |
24 | include("../functions/strings.php"); |
25 | include("../functions/date.php"); |
26 | include("../functions/page_header.php"); |
27 | include("../functions/array.php"); |
28 | include("../functions/mailbox.php"); |
29 | include("../functions/mailbox_display.php"); |
30 | include("../functions/display_messages.php"); |
21c3249f |
31 | |
32 | ///////////////////////////////////////////////////////////////////////////////// |
33 | // |
34 | // incoming variables from URL: |
35 | // $sort Direction to sort by date |
36 | // values: 0 - descending order |
37 | // values: 1 - ascending order |
38 | // $startMessage Message to start at |
39 | // $mailbox Full Mailbox name |
40 | // |
41 | // incoming from cookie: |
42 | // $username duh |
43 | // $key pass |
44 | // |
45 | ///////////////////////////////////////////////////////////////////////////////// |
46 | |
21c3249f |
47 | // open a connection on the imap port (143) |
2aa12d5e |
48 | $imapConnection = loginToImapServer($username, $key, $imapServerAddress); |
21c3249f |
49 | |
f3d17401 |
50 | /** If it was a successful login, lets load their preferences **/ |
51 | include("../src/load_prefs.php"); |
f3d17401 |
52 | echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n"; |
53 | echo "<FONT FACE=\"Arial,Helvetica\">"; |
54 | |
21c3249f |
55 | // If the page has been loaded without a specific mailbox, |
56 | // just show a page of general info. |
57 | if (!isset($mailbox)) { |
f8f9bed9 |
58 | displayPageHeader($color, "None"); |
59 | general_info($motd, $org_logo, $version, $org_name, $color); |
aa32c5e4 |
60 | echo "</BODY></HTML>"; |
21c3249f |
61 | exit; |
62 | } |
63 | |
21c3249f |
64 | // switch to the mailbox, and get the number of messages in it. |
65 | selectMailbox($imapConnection, $mailbox, $numMessages); |
21c3249f |
66 | |
926da13e |
67 | // Display the header at the top of the page |
f8f9bed9 |
68 | displayPageHeader($color, $mailbox); |
21c3249f |
69 | |
926da13e |
70 | // Get the list of messages for this mailbox |
d3cdb279 |
71 | showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color); |
21c3249f |
72 | |
926da13e |
73 | // close the connection |
4c2d69ac |
74 | fputs($imapConnection, "1 logout\n"); |
21c3249f |
75 | fclose($imapConnection); |
76 | ?> |
77 | </FONT> |
78 | </BODY> |
79 | </HTML> |