changed log in method back to using cookies. also session id is now stored
[squirrelmail.git] / src / right_main.php
1 <?php
2 /**
3 ** right_main.php
4 **
5 ** This is where the mailboxes are listed. This controls most of what
6 ** goes on in SquirrelMail.
7 **
8 **/
9
10 session_start();
11
12 if(!isset($logged_in)) {
13 echo _("You must login first.");
14 exit;
15 }
16 if(!isset($username) || !isset($key)) {
17 echo _("You need a valid user and password to access this page!");
18 exit;
19 }
20
21 if (!isset($config_php))
22 include("../config/config.php");
23 if (!isset($imap_php))
24 include("../functions/imap.php");
25 if (!isset($strings_php))
26 include("../functions/strings.php");
27 if (!isset($date_php))
28 include("../functions/date.php");
29 if (!isset($page_header_php))
30 include("../functions/page_header.php");
31 if (!isset($array_php))
32 include("../functions/array.php");
33 if (!isset($mime_php))
34 include("../functions/mime.php");
35 if (!isset($mailbox_display_php))
36 include("../functions/mailbox_display.php");
37 if (!isset($display_messages_php))
38 include("../functions/display_messages.php");
39 ?>
40 <HTML>
41 <FONT FACE="Arial,Helvetica">
42 <?php
43 /////////////////////////////////////////////////////////////////////////////////
44 //
45 // incoming variables from URL:
46 // $sort Direction to sort by date
47 // values: 0 - descending order
48 // values: 1 - ascending order
49 // $startMessage Message to start at
50 // $mailbox Full Mailbox name
51 //
52 // incoming from cookie:
53 // $username duh
54 // $key pass
55 //
56 /////////////////////////////////////////////////////////////////////////////////
57
58 // open a connection on the imap port (143)
59 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
60
61 /** If it was a successful login, lets load their preferences **/
62 include("../src/load_prefs.php");
63 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
64
65 // If the page has been loaded without a specific mailbox,
66 // just show a page of general info.
67 if (!isset($mailbox)) {
68 displayPageHeader($color, "None");
69 general_info($motd, $org_logo, $version, $org_name, $color);
70 echo "</BODY></HTML>";
71 exit;
72 }
73
74 sqimap_mailbox_select($imapConnection, $mailbox);
75 $numMessages = sqimap_get_num_messages ($imapConnection, $mailbox);
76 displayPageHeader($color, $mailbox);
77
78 // Check to see if we can use cache or not. Currently the only time when you wont use it is
79 // when a link on the left hand frame is used. Also check to make sure we actually have the
80 // array in the registered session data. :)
81 // if (!$use_mailbox_cache || !session_is_registered("msgs")) {
82 // echo "<br>not using cache<br>\n";
83 // if (session_is_registered("messages"))
84 // session_unregister("messages");
85
86 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color);
87 // } else {
88 // echo "<br>using cache<br>\n";
89 // $msgs = unserialize($messages);
90
91 // displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $mailbox, $sort, $color);
92 // }
93
94 // close the connection
95 sqimap_logout ($imapConnection);
96 ?>
97 </FONT>
98 </BODY>
99 </HTML>