59177427 |
1 | <?php |
c6d6fe73 |
2 | |
864b1c33 |
3 | /** |
15e6162e |
4 | * webmail.php -- Displays the main frameset |
5 | * |
15e6162e |
6 | * This file generates the main frameset. The files that are |
7 | * shown can be given as parameters. If the user is not logged in |
8 | * this file will verify username and password. |
9 | * |
47ccfad4 |
10 | * @copyright © 1999-2006 The SquirrelMail Project Team |
4b4abf93 |
11 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
30967a1e |
12 | * @version $Id$ |
8f6f9ba5 |
13 | * @package squirrelmail |
15e6162e |
14 | */ |
21c3249f |
15 | |
30967a1e |
16 | /** |
202bcbcc |
17 | * Include the SquirrelMail initialization file. |
30967a1e |
18 | */ |
202bcbcc |
19 | require('../include/init.php'); |
a32985a5 |
20 | |
f38b7cf0 |
21 | sqgetGlobalVar('username', $username, SQ_SESSION); |
22 | sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION); |
23 | sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); |
dcc1cc82 |
24 | |
ef8d36ad |
25 | if (sqgetGlobalVar('sort', $sort)) { |
26 | $sort = (int) $sort; |
27 | } |
28 | |
29 | if (sqgetGlobalVar('startMessage', $startMessage)) { |
30 | $startMessage = (int) $startMessage; |
31 | } |
32 | |
a2b193bc |
33 | if (!sqgetGlobalVar('mailbox', $mailbox)) { |
ef8d36ad |
34 | $mailbox = 'INBOX'; |
35 | } |
36 | |
f38b7cf0 |
37 | sqgetGlobalVar('right_frame', $right_frame, SQ_GET); |
38 | |
db6a9192 |
39 | if ( isset($_SESSION['session_expired_post']) ) { |
40 | sqsession_unregister('session_expired_post'); |
41 | } |
c67e4479 |
42 | if(!sqgetGlobalVar('mailto', $mailto)) { |
43 | $mailto = ''; |
44 | } |
a32985a5 |
45 | |
148ee1ef |
46 | do_hook('webmail_top'); |
47 | |
151562a7 |
48 | $output = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"\n". |
49 | " \"http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd\">\n". |
0e3b9a5a |
50 | "<html><head>\n" . |
f8a1ed5a |
51 | "<meta name=\"robots\" content=\"noindex,nofollow\">\n" . |
0e3b9a5a |
52 | "<title>$org_title</title>\n". |
53 | "</head>"; |
65c3ec94 |
54 | |
871ab9eb |
55 | $left_size = getPref($data_dir, $username, 'left_size'); |
56 | $location_of_bar = getPref($data_dir, $username, 'location_of_bar'); |
fab3baa6 |
57 | |
0c660770 |
58 | if (isset($languages[$squirrelmail_language]['DIR']) && |
59 | strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') { |
fab3baa6 |
60 | $temp_location_of_bar = 'right'; |
61 | } else { |
62 | $temp_location_of_bar = 'left'; |
63 | } |
64 | |
864b1c33 |
65 | if ($location_of_bar == '') { |
fab3baa6 |
66 | $location_of_bar = $temp_location_of_bar; |
864b1c33 |
67 | } |
fab3baa6 |
68 | $temp_location_of_bar = ''; |
69 | |
864b1c33 |
70 | if ($left_size == "") { |
71 | if (isset($default_left_size)) { |
f740c049 |
72 | $left_size = $default_left_size; |
864b1c33 |
73 | } |
74 | else { |
75 | $left_size = 200; |
76 | } |
65c3ec94 |
77 | } |
78 | |
864b1c33 |
79 | if ($location_of_bar == 'right') { |
0e3b9a5a |
80 | $output .= "<frameset cols=\"*, $left_size\" id=\"fs1\">\n"; |
864b1c33 |
81 | } |
82 | else { |
0e3b9a5a |
83 | $output .= "<frameset cols=\"$left_size, *\" id=\"fs1\">\n"; |
864b1c33 |
84 | } |
ad6787f0 |
85 | |
864b1c33 |
86 | /* |
87 | * There are three ways to call webmail.php |
88 | * 1. webmail.php |
89 | * - This just loads the default entry screen. |
90 | * 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX |
91 | * - This loads the frames starting at the given values. |
92 | * 3. webmail.php?right_frame=folders.php |
93 | * - Loads the frames with the Folder options in the right frame. |
94 | * |
95 | * This was done to create a pure HTML way of refreshing the folder list since |
96 | * we would like to use as little Javascript as possible. |
0a03f924 |
97 | * |
98 | * The test for // should catch any attempt to include off-site webpages into |
99 | * our frameset. |
864b1c33 |
100 | */ |
f3fa1c10 |
101 | |
0a03f924 |
102 | if (empty($right_frame) || (strpos(urldecode($right_frame), '//') !== false)) { |
793cc001 |
103 | $right_frame = ''; |
91e0dccc |
104 | } |
f3fa1c10 |
105 | |
9a186afe |
106 | if ( strpos($right_frame,'?') ) { |
107 | $right_frame_file = substr($right_frame,0,strpos($right_frame,'?')); |
108 | } else { |
109 | $right_frame_file = $right_frame; |
110 | } |
111 | |
02d8345e |
112 | switch($right_frame) { |
113 | case 'right_main.php': |
114 | $right_frame_url = "right_main.php?mailbox=".urlencode($mailbox) |
ef8d36ad |
115 | . (!empty($sort)?"&sort=$sort":'') |
116 | . (!empty($startMessage)?"&startMessage=$startMessage":''); |
02d8345e |
117 | break; |
118 | case 'options.php': |
119 | $right_frame_url = 'options.php'; |
120 | break; |
121 | case 'folders.php': |
122 | $right_frame_url = 'folders.php'; |
123 | break; |
124 | case 'compose.php': |
125 | $right_frame_url = 'compose.php?' . $mailto; |
126 | break; |
127 | case '': |
128 | $right_frame_url = 'right_main.php'; |
129 | break; |
130 | default: |
131 | $right_frame_url = urlencode($right_frame); |
132 | break; |
202bcbcc |
133 | } |
9a732bb6 |
134 | |
da9a8410 |
135 | $left_frame = '<frame src="left_main.php" name="left" frameborder="1" title="'. |
136 | _("Folder List") ."\" />\n"; |
137 | $right_frame = '<frame src="'.$right_frame_url.'" name="right" frameborder="1" title="'. |
138 | _("Message List") ."\" />\n"; |
139 | |
864b1c33 |
140 | if ($location_of_bar == 'right') { |
0e3b9a5a |
141 | $output .= $right_frame . $left_frame; |
864b1c33 |
142 | } |
143 | else { |
0e3b9a5a |
144 | $output .= $left_frame . $right_frame; |
864b1c33 |
145 | } |
0e3b9a5a |
146 | $ret = concat_hook_function('webmail_bottom', $output); |
147 | if($ret != '') { |
148 | $output = $ret; |
149 | } |
a2b193bc |
150 | |
202bcbcc |
151 | echo $output . '</frameset>'; |
152 | |
153 | $oTemplate->display('footer.tpl'); |