59177427 |
1 | <?php |
21c3249f |
2 | /** |
a09387f4 |
3 | ** right_main.php |
21c3249f |
4 | ** |
3bcede49 |
5 | ** Copyright (c) 1999-2000 The SquirrelMail development team |
6 | ** Licensed under the GNU GPL. For full terms see the file COPYING. |
7 | ** |
21c3249f |
8 | ** This is where the mailboxes are listed. This controls most of what |
9 | ** goes on in SquirrelMail. |
10 | ** |
11 | **/ |
12 | |
dc54c9f2 |
13 | |
2a32fc83 |
14 | session_start(); |
15 | |
21c3249f |
16 | if(!isset($logged_in)) { |
138f26f6 |
17 | echo _("You must login first."); |
21c3249f |
18 | exit; |
19 | } |
20 | if(!isset($username) || !isset($key)) { |
b581fa60 |
21 | echo _("You need a valid user and password to access this page!"); |
21c3249f |
22 | exit; |
23 | } |
44139266 |
24 | |
d068c0ec |
25 | if (!isset($config_php)) |
26 | include("../config/config.php"); |
27 | if (!isset($imap_php)) |
28 | include("../functions/imap.php"); |
29 | if (!isset($strings_php)) |
30 | include("../functions/strings.php"); |
31 | if (!isset($date_php)) |
32 | include("../functions/date.php"); |
33 | if (!isset($page_header_php)) |
34 | include("../functions/page_header.php"); |
35 | if (!isset($array_php)) |
36 | include("../functions/array.php"); |
37 | if (!isset($mime_php)) |
38 | include("../functions/mime.php"); |
39 | if (!isset($mailbox_display_php)) |
40 | include("../functions/mailbox_display.php"); |
41 | if (!isset($display_messages_php)) |
42 | include("../functions/display_messages.php"); |
44139266 |
43 | ?> |
59177427 |
44 | <?php |
21c3249f |
45 | ///////////////////////////////////////////////////////////////////////////////// |
46 | // |
47 | // incoming variables from URL: |
48 | // $sort Direction to sort by date |
49 | // values: 0 - descending order |
50 | // values: 1 - ascending order |
51 | // $startMessage Message to start at |
52 | // $mailbox Full Mailbox name |
53 | // |
54 | // incoming from cookie: |
55 | // $username duh |
56 | // $key pass |
57 | // |
58 | ///////////////////////////////////////////////////////////////////////////////// |
59 | |
21c3249f |
60 | // open a connection on the imap port (143) |
e1469126 |
61 | $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); |
21c3249f |
62 | |
f3d17401 |
63 | /** If it was a successful login, lets load their preferences **/ |
64 | include("../src/load_prefs.php"); |
f3d17401 |
65 | |
21c3249f |
66 | // If the page has been loaded without a specific mailbox, |
67 | // just show a page of general info. |
68 | if (!isset($mailbox)) { |
e9f8ea4e |
69 | $mailbox = "INBOX"; |
70 | $sort = $newsort = 0; |
71 | $startMessage = 1; |
72 | |
73 | // displayPageHeader($color, "None"); |
74 | // general_info($motd, $org_logo, $version, $org_name, $color); |
75 | // echo "</BODY></HTML>"; |
76 | // exit; |
21c3249f |
77 | } |
78 | |
813eba2f |
79 | sqimap_mailbox_select($imapConnection, $mailbox); |
f8f9bed9 |
80 | displayPageHeader($color, $mailbox); |
21c3249f |
81 | |
e452ce9b |
82 | if (isset($newsort)) { |
83 | $sort = $newsort; |
84 | session_register("sort"); |
85 | } |
86 | |
9f2215a1 |
87 | // Check to see if we can use cache or not. Currently the only time when you wont use it is |
88 | // when a link on the left hand frame is used. Also check to make sure we actually have the |
89 | // array in the registered session data. :) |
90033b64 |
90 | if ($use_mailbox_cache && session_is_registered("msgs")) { |
dc54c9f2 |
91 | showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache); |
90033b64 |
92 | } else { |
93 | if (session_is_registered("msgs")) |
94 | unset($msgs); |
dc54c9f2 |
95 | if (session_is_registered("msort")) |
96 | unset($msort); |
1108e8bb |
97 | if (session_is_registered("numMessages")) |
98 | unset($numMessages); |
99 | |
100 | $numMessages = sqimap_get_num_messages ($imapConnection, $mailbox); |
9f2215a1 |
101 | |
dc54c9f2 |
102 | showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache); |
90033b64 |
103 | |
104 | if (session_is_registered("msgs") && isset($msgs)) |
105 | session_register("msgs"); |
dc54c9f2 |
106 | if (session_is_registered("msort") && isset($msort)) |
107 | session_register("msort"); |
1108e8bb |
108 | session_register("numMessages"); |
90033b64 |
109 | } |
21c3249f |
110 | |
926da13e |
111 | // close the connection |
813eba2f |
112 | sqimap_logout ($imapConnection); |
21c3249f |
113 | ?> |
114 | </FONT> |
115 | </BODY> |
116 | </HTML> |