59177427 |
1 | <?php |
895905c0 |
2 | |
35586184 |
3 | /** |
4 | * login.php -- simple login screen |
5 | * |
15e6162e |
6 | * Copyright (c) 1999-2002 The SquirrelMail Project Team |
35586184 |
7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | * |
9 | * This a simple login screen. Some housekeeping is done to clean |
10 | * cookies and find language. |
11 | * |
12 | * $Id$ |
13 | */ |
21c3249f |
14 | |
35586184 |
15 | $rcptaddress = ''; |
16 | if (isset($emailaddress)) { |
98f2ee76 |
17 | if (stristr($emailaddress, 'mailto:')) { |
18 | $rcptaddress = substr($emailaddress, 7); |
19 | } else { |
20 | $rcptaddress = $emailaddress; |
21 | } |
22 | |
23 | if (($pos = strpos($rcptaddress, '?')) !== false) { |
24 | $a = substr($rcptaddress, $pos + 1); |
25 | $rcptaddress = substr($rcptaddress, 0, $pos); |
26 | $a = explode('=', $a, 2); |
27 | if (isset($a[1])) { |
28 | $name = urldecode($a[0]); |
29 | $val = urldecode($a[1]); |
30 | global $$name; |
8675ae42 |
31 | $$name = $val; |
23d6bd09 |
32 | } |
98f2ee76 |
33 | } |
34 | |
35 | /* At this point, we have parsed a lot of the mailto stuff. */ |
36 | /* Let's do the rest -- CC, BCC, Subject, Body */ |
37 | /* Note: They can all be case insensitive */ |
38 | foreach ($GLOBALS as $k => $v) { |
39 | $key = strtolower($k); |
40 | $value = urlencode($v); |
41 | if ($key == 'cc') { |
5e9e90fd |
42 | $rcptaddress .= '&send_to_cc=' . $value; |
98f2ee76 |
43 | } else if ($key == 'bcc') { |
5e9e90fd |
44 | $rcptaddress .= '&send_to_bcc=' . $value; |
98f2ee76 |
45 | } else if ($key == 'subject') { |
5e9e90fd |
46 | $rcptaddress .= '&subject=' . $value; |
98f2ee76 |
47 | } else if ($key == 'body') { |
5e9e90fd |
48 | $rcptaddress .= '&body=' . $value; |
23d6bd09 |
49 | } |
23d6bd09 |
50 | } |
98f2ee76 |
51 | |
52 | /* Double-encode in this fashion to get past redirect.php properly. */ |
53 | $rcptaddress = urlencode($rcptaddress); |
54 | } |
55 | |
56 | require_once('../functions/strings.php'); |
57 | require_once('../config/config.php'); |
58 | require_once('../functions/i18n.php'); |
59 | require_once('../functions/plugin.php'); |
60 | require_once('../functions/constants.php'); |
61 | require_once('../functions/page_header.php'); |
3fde693b |
62 | require_once('../functions/html.php'); |
98f2ee76 |
63 | |
64 | /* |
65 | * $squirrelmail_language is set by a cookie when the user selects |
66 | * language and logs out |
67 | */ |
68 | set_up_language($squirrelmail_language, TRUE); |
d4e84069 |
69 | |
85b454a0 |
70 | /** |
71 | * Find out the base URI to set cookies. |
72 | */ |
f3bc099d |
73 | if (!function_exists('sqm_baseuri')){ |
74 | require_once('../functions/display_messages.php'); |
75 | } |
76 | $base_uri = sqm_baseuri(); |
98f2ee76 |
77 | @session_destroy(); |
cb48c245 |
78 | |
98f2ee76 |
79 | /* |
80 | * In case the last session was not terminated properly, make sure |
81 | * we get a new one. |
82 | */ |
83 | $cookie_params = session_get_cookie_params(); |
85b454a0 |
84 | setcookie(session_name(), '', 0, $cookie_params['path'], |
85 | $cookie_params['domain']); |
98f2ee76 |
86 | setcookie('username', '', 0, $base_uri); |
87 | setcookie('key', '', 0, $base_uri); |
88 | header('Pragma: no-cache'); |
89 | |
90 | do_hook('login_cookie'); |
91 | |
92 | /* Output the javascript onload function. */ |
93 | |
3fde693b |
94 | $header = "<SCRIPT LANGUAGE=\"JavaScript\" type=\"text/javascript\">\n" . |
98f2ee76 |
95 | "<!--\n". |
96 | " function squirrelmail_loginpage_onload() {\n". |
97 | " document.forms[0].js_autodetect_results.value = '" . SMPREF_JS_ON . "';\n". |
98 | ' document.forms[0].elements[' . (isset($loginname) ? 1 : 0) . "].focus();\n". |
99 | " }\n". |
100 | "// -->\n". |
101 | "</script>\n"; |
a714cb95 |
102 | $custom_css = 'none'; |
98f2ee76 |
103 | displayHtmlHeader( "$org_name - " . _("Login"), $header, FALSE ); |
104 | |
105 | /* Set the title of this page. */ |
3fde693b |
106 | echo '<body text="#000000" bgcolor="#FFFFFF" link="#0000CC" vlink="#0000CC" alink="#0000CC" onLoad="squirrelmail_loginpage_onload();">'; |
98f2ee76 |
107 | |
0fce910a |
108 | $username_form_name = 'login_username'; |
109 | $password_form_name = 'secretkey'; |
98f2ee76 |
110 | do_hook('login_top'); |
111 | |
112 | $loginname_value = (isset($loginname) ? htmlspecialchars($loginname) : ''); |
113 | |
b6e0c3b6 |
114 | /* Display width and height like good little people */ |
4da8e94a |
115 | $width_and_height = ''; |
b6e0c3b6 |
116 | if (isset($org_logo_width) && is_int($org_logo_width) && $org_logo_width>0) { |
3fde693b |
117 | $width_and_height = " width=\"$org_logo_width\""; |
b6e0c3b6 |
118 | } |
119 | if (isset($org_logo_height) && is_int($org_logo_height) && $org_logo_height>0) { |
3fde693b |
120 | $width_and_height .= " height=\"$org_logo_height\""; |
b6e0c3b6 |
121 | } |
122 | |
3fde693b |
123 | $rcptaddress_input = ''; |
98f2ee76 |
124 | if ($rcptaddress != '') { |
3fde693b |
125 | $rcptaddress_input = '<input type="hidden" name="rcptemail" value="htmlspecialchars(' . $rcptaddress . ')">'; |
98f2ee76 |
126 | } |
3fde693b |
127 | |
128 | echo |
129 | html_tag( 'table', |
130 | html_tag( 'tr', |
131 | html_tag( 'td', |
132 | "\n" . '<form action="redirect.php" method="post">' . "\n" . |
133 | '<center>'. |
134 | '<img src="' . $org_logo . '" alt="' . sprintf(_("%s Logo"), $org_name) .'"' . |
135 | $width_and_height .'><br>' . "\n". |
136 | ( $hide_sm_attributions ? '' : |
137 | '<small>' . sprintf (_("SquirrelMail version %s"), $version) . '<br>' ."\n". |
138 | ' ' . _("By the SquirrelMail Development Team") . '<br></small>' . "\n" ) . |
139 | "<br>\n" . |
140 | |
141 | html_tag( 'table', |
142 | html_tag( 'tr', |
143 | html_tag( 'td', |
144 | '<b>' . sprintf (_("%s Login"), $org_name) . "</b>\n", |
145 | 'left', '#DCDCDC' ) |
146 | ) . "\n" . |
147 | html_tag( 'tr', |
148 | html_tag( 'td', "\n" . |
149 | html_tag( 'table', |
150 | html_tag( 'tr', |
151 | html_tag( 'td', |
152 | _("Name:") , |
153 | 'right', '', 'width="30%"' ) . |
154 | html_tag( 'td', |
155 | '<input type="text" name="' . $username_form_name .'" value="' . $loginname_value .'">' , |
156 | 'left', '', 'width="*"' ) |
157 | ) . "\n" . |
158 | html_tag( 'tr', |
159 | html_tag( 'td', |
160 | _("Password:") , |
161 | 'right', '', 'width="30%"' ) . |
162 | html_tag( 'td', |
163 | '<input type="password" name="' . $password_form_name . '">' . "\n" . |
164 | '<input type=hidden name="js_autodetect_results" value="SMPREF_JS_OFF">' . "\n" . |
165 | '<input type=hidden name="just_logged_in" value=1>' . "\n" . |
166 | $rcptaddress_input . "\n" , |
167 | 'left', '', 'width="*"' ) |
168 | ) , |
169 | '', '', '', 'border="0" cols="2" width="100%"' ) , |
170 | 'left', '#FFFFFF' ) |
171 | ) . "\n" . |
172 | html_tag( 'tr', |
173 | html_tag( 'td', |
174 | '<center><input type="submit" value="' . _("Login") . '"></center>', |
175 | 'left' ) |
176 | ) . "\n" , |
177 | '', '', 'border="0" cols="1" width="350"' ) . |
178 | '</form>' . "\n", |
179 | 'left' ) |
180 | ) , |
181 | '', '', 'border="0" cellspacing="0" cellpadding="0" width="100%"' ); |
98f2ee76 |
182 | |
183 | do_hook('login_form'); |
98f2ee76 |
184 | |
185 | do_hook('login_bottom'); |
3fde693b |
186 | echo "</body>\n". |
187 | "</html>\n"; |
4da8e94a |
188 | ?> |