df1a1b9a54103b67a6d15f5d110f9836f406f79f
4 * login.php -- simple login screen
6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This a simple login screen. Some housekeeping is done to clean
10 * cookies and find language.
16 if (isset($emailaddress)) {
17 if (stristr($emailaddress, 'mailto:')) {
18 $rcptaddress = substr($emailaddress, 7);
20 $rcptaddress = $emailaddress;
23 if (($pos = strpos($rcptaddress, '?')) !== false) {
24 $a = substr($rcptaddress, $pos +
1);
25 $rcptaddress = substr($rcptaddress, 0, $pos);
26 $a = explode('=', $a, 2);
28 $name = urldecode($a[0]);
29 $val = urldecode($a[1]);
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);
42 $rcptaddress .= '&send_to_cc=' . $value;
43 } else if ($key == 'bcc') {
44 $rcptaddress .= '&send_to_bcc=' . $value;
45 } else if ($key == 'subject') {
46 $rcptaddress .= '&subject=' . $value;
47 } else if ($key == 'body') {
48 $rcptaddress .= '&body=' . $value;
52 /* Double-encode in this fashion to get past redirect.php properly. */
53 $rcptaddress = urlencode($rcptaddress);
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');
62 require_once('../functions/html.php');
65 * $squirrelmail_language is set by a cookie when the user selects
66 * language and logs out
68 set_up_language($squirrelmail_language, TRUE);
71 * Find out the base URI to set cookies.
73 if (!function_exists('sqm_baseuri')){
74 require_once('../functions/display_messages.php');
76 $base_uri = sqm_baseuri();
80 * In case the last session was not terminated properly, make sure
83 $cookie_params = session_get_cookie_params();
84 setcookie(session_name(), '', 0, $cookie_params['path'],
85 $cookie_params['domain']);
86 setcookie('username', '', 0, $base_uri);
87 setcookie('key', '', 0, $base_uri);
88 header('Pragma: no-cache');
90 do_hook('login_cookie');
92 /* Output the javascript onload function. */
94 $header = "<SCRIPT LANGUAGE=\"JavaScript\" type=\"text/javascript\">\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".
102 $custom_css = 'none';
103 displayHtmlHeader( "$org_name - " . _("Login"), $header, FALSE );
105 /* Set the title of this page. */
106 echo '<body text="#000000" bgcolor="#FFFFFF" link="#0000CC" vlink="#0000CC" alink="#0000CC" onLoad="squirrelmail_loginpage_onload();">';
108 $username_form_name = 'login_username';
109 $password_form_name = 'secretkey';
110 do_hook('login_top');
112 $loginname_value = (isset($loginname) ?
htmlspecialchars($loginname) : '');
114 /* Display width and height like good little people */
115 $width_and_height = '';
116 if (isset($org_logo_width) && is_int($org_logo_width) && $org_logo_width>0) {
117 $width_and_height = " width=\"$org_logo_width\"";
119 if (isset($org_logo_height) && is_int($org_logo_height) && $org_logo_height>0) {
120 $width_and_height .= " height=\"$org_logo_height\"";
123 $rcptaddress_input = '';
124 if ($rcptaddress != '') {
125 $rcptaddress_input = '<input type="hidden" name="rcptemail" value="htmlspecialchars(' . $rcptaddress . ')">';
132 "\n" . '<form action="redirect.php" method="post">' . "\n" .
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" ) .
144 '<b>' . sprintf (_("%s Login"), $org_name) . "</b>\n",
148 html_tag( 'td', "\n" .
153 'right', '', 'width="30%"' ) .
155 '<input type="text" name="' . $username_form_name .'" value="' . $loginname_value .'">' ,
156 'left', '', 'width="*"' )
161 'right', '', 'width="30%"' ) .
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="*"' )
169 '', '', '', 'border="0" cols="2" width="100%"' ) ,
174 '<center><input type="submit" value="' . _("Login") . '"></center>',
177 '', '', 'border="0" cols="1" width="350"' ) .
181 '', '', 'border="0" cellspacing="0" cellpadding="0" width="100%"' );
183 do_hook('login_form');
185 do_hook('login_bottom');