Changed default value for SpamFilters_YourHop
[squirrelmail.git] / src / login.php
CommitLineData
59177427 1<?php
895905c0 2
23d6bd09 3 /**
895905c0 4 ** login.php -- simple login screen
5 **
6 ** Copyright (c) 1999-2001 The Squirrelmail Development Team
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
23d6bd09 15 $rcptaddress = '';
16 if (isset($emailaddress)) {
17 if (stristr($emailaddress, 'mailto:')) {
18 $rcptaddress = substr($emailaddress, 7);
19 } else {
20 $rcptaddress = $emailaddress;
21 }
0ee3f2af 22
23d6bd09 23 if (($pos = strpos($rcptaddress, '?')) !== false) {
24 $a = substr($rcptaddress, $pos + 1);
0ee3f2af 25 $rcptaddress = substr($rcptaddress, 0, $pos);
23d6bd09 26 $a = explode('=', $a, 2);
27 if (isset($a[1])) {
28 $name = urldecode($a[0]);
29 $val = urldecode($a[1]);
30 global $$name;
31 $$naame = $val;
32 }
33 }
0ee3f2af 34
23d6bd09 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') {
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;
49 }
50 }
0ee3f2af 51
23d6bd09 52 /* Double-encode in this fashion to get past redirect.php properly. */
53 $rcptaddress = urlencode($rcptaddress);
54 }
d4e84069 55
cb48c245 56
640f7f11 57
23d6bd09 58 require_once('../functions/strings.php');
59 require_once('../config/config.php');
60 require_once('../functions/i18n.php');
61 require_once('../functions/plugin.php');
62 require_once('../functions/constants.php');
692155b7 63 require_once('../functions/page_header.php');
21c3249f 64
23d6bd09 65 /*
66 * $squirrelmail_language is set by a cookie when the user selects
67 * language and logs out
68 */
69 set_up_language($squirrelmail_language, true);
288491a4 70
23d6bd09 71 /* Need the base URI to set the cookies. (Same code as in webmail.php). */
72 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
73 $base_uri = $regs[1];
74 @session_destroy();
c6d6fe73 75
23d6bd09 76 /*
77 * In case the last session was not terminated properly, make sure
78 * we get a new one.
79 */
692155b7 80 $cookie_params = session_get_cookie_params();
81 setcookie(session_name(),'',0,$cookie_params['path'].$cookie_params['domain']);
23d6bd09 82 setcookie('username', '', 0, $base_uri);
83 setcookie('key', '', 0, $base_uri);
84 header ('Pragma: no-cache');
c6d6fe73 85
23d6bd09 86 do_hook('login_cookie');
1bfeac81 87
23d6bd09 88 /* Output the javascript onload function. */
692155b7 89 displayHtmlHeader( "$org_name - " . _("Login"),
90 "<SCRIPT LANGUAGE=\"JavaScript\">\n" .
91 "<!--\n".
92 " function squirrelmail_loginpage_onload() {\n".
93 " document.forms[0].js_autodetect_results.value = '" . SMPREF_JS_ON . "';\n".
94 " document.forms[0].elements[0].focus();\n".
95 " }\n".
96 "// -->\n".
97 "</script>\n", FALSE );
23d6bd09 98
99 /* Set the title of this page. */
692155b7 100 echo "<BODY TEXT=#000000 BGCOLOR=#FFFFFF LINK=#0000CC VLINK=#0000CC ALINK=#0000CC onLoad='squirrelmail_loginpage_onload();'>\n".
0ee3f2af 101 "<FORM ACTION=\"redirect.php\" METHOD=\"POST\" NAME=f>\n";
102
23d6bd09 103 $username_form_name = 'login_username';
104 $password_form_name = 'secretkey';
105 do_hook('login_top');
106
107 $loginname_value = (isset($loginname) ? htmlspecialchars($loginname) : '');
0ee3f2af 108
826b7f71 109 echo "<CENTER>".
0ee3f2af 110 " <IMG SRC=\"$org_logo\"><BR>\n".
826b7f71 111 ( $hide_sm_attributions ? '' :
112 '<SMALL>' . sprintf (_("SquirrelMail version %s"), $version) . "<BR>\n".
113 ' ' . _("By the SquirrelMail Development Team") . "<BR></SMALL>\n" ) .
114 "</CENTER>\n".
0ee3f2af 115
826b7f71 116 "<CENTER>\n".
0ee3f2af 117 "<TABLE COLS=1 WIDTH=350>\n".
118 " <TR><TD BGCOLOR=#DCDCDC>\n".
119 ' <B><CENTER>' . sprintf (_("%s Login"), $org_name) . "</CENTER></B>\n".
120 " </TD></TR>".
121 " <TR><TD BGCOLOR=\"#FFFFFF\"><TABLE COLS=2 WIDTH=\"100%\">\n".
122 " <TR>\n".
123 ' <TD WIDTH=30% ALIGN=right>' . _("Name:") . "</TD>\n".
124 " <TD WIDTH=* ALIGN=left>\n".
125 " <INPUT TYPE=TEXT NAME=\"$username_form_name\" VALUE=\"$loginname_value\">\n".
126 " </TD>\n".
127 " </TR>\n".
128 " <TR>\n".
129 ' <TD WIDTH="30%" ALIGN=right>' . _("Password:") . "</TD>\n".
130 " <TD WIDTH=* ALIGN=left>\n".
131 " <INPUT TYPE=PASSWORD NAME=\"$password_form_name\">\n".
132 " <INPUT TYPE=HIDDEN NAME=\"js_autodetect_results\" VALUE=\"" . SMPREF_JS_OFF . "\">\n".
133 " <INPUT TYPE=HIDDEN NAME=\"just_logged_in\" value=1>\n";
23d6bd09 134 if ($rcptaddress != '') {
135 echo " <INPUT TYPE=HIDDEN NAME=\"rcptemail\" VALUE=\"".htmlspecialchars($rcptaddress)."\">\n";
136 }
0ee3f2af 137 echo " </TD>\n".
138 " </TR>\n".
139 " </TABLE></TD></TR>\n".
140 " <TR><TD>\n".
141 ' <CENTER><INPUT TYPE=SUBMIT VALUE="' . _("Login") . "\"></CENTER>\n".
142 " </TD></TR>\n".
826b7f71 143 "</TABLE>\n".
144 "</CENTER>\n";
23d6bd09 145
146 do_hook('login_form');
147 echo "</FORM>\n";
148
149 do_hook('login_bottom');
0ee3f2af 150 echo "</BODY>\n".
151 "</HTML>\n";
826b7f71 152?>