saving sent messages works!
[squirrelmail.git] / src / right_main.php
1 <?
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 if(!isset($logged_in)) {
11 echo _("You must ");
12 echo "<a href=\"login.php\">";
13 echo _("login");
14 echo "</a>";
15 echo _(" first.");
16 exit;
17 }
18 if(!isset($username) || !isset($key)) {
19 echo _("You need a valid user and password to access this page!");
20 exit;
21 }
22
23 if (!isset($config_php))
24 include("../config/config.php");
25 if (!isset($imap_php))
26 include("../functions/imap.php");
27 if (!isset($strings_php))
28 include("../functions/strings.php");
29 if (!isset($date_php))
30 include("../functions/date.php");
31 if (!isset($page_header_php))
32 include("../functions/page_header.php");
33 if (!isset($array_php))
34 include("../functions/array.php");
35 if (!isset($mime_php))
36 include("../functions/mime.php");
37 if (!isset($mailbox_display_php))
38 include("../functions/mailbox_display.php");
39 if (!isset($display_messages_php))
40 include("../functions/display_messages.php");
41 ?>
42 <HTML>
43 <FONT FACE="Arial,Helvetica">
44 <?
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
60 // open a connection on the imap port (143)
61 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
62
63 /** If it was a successful login, lets load their preferences **/
64 include("../src/load_prefs.php");
65 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
66
67 // If the page has been loaded without a specific mailbox,
68 // just show a page of general info.
69 if (!isset($mailbox)) {
70 displayPageHeader($color, "None");
71 general_info($motd, $org_logo, $version, $org_name, $color);
72 echo "</BODY></HTML>";
73 exit;
74 }
75
76 sqimap_mailbox_select($imapConnection, $mailbox);
77 $numMessages = sqimap_get_num_messages ($imapConnection, $mailbox);
78 displayPageHeader($color, $mailbox);
79
80 showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color);
81
82 // close the connection
83 sqimap_logout ($imapConnection);
84 ?>
85 </FONT>
86 </BODY>
87 </HTML>