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 | /*****************************************************************/ |
16 | /*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ |
17 | /*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ |
18 | /*** + Base level indent should begin at left margin, as ***/ |
19 | /*** the first two lines below look. ***/ |
20 | /*** + All identation should consist of four space blocks ***/ |
21 | /*** + Tab characters are evil. ***/ |
22 | /*** + all comments should use "slash-star ... star-slash" ***/ |
23 | /*** style -- no pound characters, no slash-slash style ***/ |
24 | /*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ |
25 | /*** ALWAYS USE { AND } CHARACTERS!!! ***/ |
26 | /*** + Please use ' instead of ", when possible. Note " ***/ |
27 | /*** should always be used in _( ) function calls. ***/ |
28 | /*** Thank you for your help making the SM code more readable. ***/ |
29 | /*****************************************************************/ |
30 | |
31 | $rcptaddress = ''; |
32 | if (isset($emailaddress)) { |
23d6bd09 |
33 | if (stristr($emailaddress, 'mailto:')) { |
34 | $rcptaddress = substr($emailaddress, 7); |
35 | } else { |
36 | $rcptaddress = $emailaddress; |
37 | } |
0ee3f2af |
38 | |
23d6bd09 |
39 | if (($pos = strpos($rcptaddress, '?')) !== false) { |
40 | $a = substr($rcptaddress, $pos + 1); |
0ee3f2af |
41 | $rcptaddress = substr($rcptaddress, 0, $pos); |
23d6bd09 |
42 | $a = explode('=', $a, 2); |
43 | if (isset($a[1])) { |
44 | $name = urldecode($a[0]); |
45 | $val = urldecode($a[1]); |
46 | global $$name; |
47 | $$naame = $val; |
48 | } |
49 | } |
0ee3f2af |
50 | |
23d6bd09 |
51 | /* At this point, we have parsed a lot of the mailto stuff. */ |
52 | /* Let's do the rest -- CC, BCC, Subject, Body */ |
53 | /* Note: They can all be case insensitive */ |
54 | foreach ($GLOBALS as $k => $v) { |
55 | $key = strtolower($k); |
56 | $value = urlencode($v); |
57 | if ($key == 'cc') { |
58 | $rcptaddress .= '&send_to_cc=' . $value; |
59 | } else if ($key == 'bcc') { |
60 | $rcptaddress .= '&send_to_bcc=' . $value; |
61 | } else if ($key == 'subject') { |
62 | $rcptaddress .= '&subject=' . $value; |
63 | } else if ($key == 'body') { |
64 | $rcptaddress .= '&body=' . $value; |
65 | } |
66 | } |
0ee3f2af |
67 | |
23d6bd09 |
68 | /* Double-encode in this fashion to get past redirect.php properly. */ |
69 | $rcptaddress = urlencode($rcptaddress); |
70 | } |
d4e84069 |
71 | |
cb48c245 |
72 | |
640f7f11 |
73 | |
23d6bd09 |
74 | require_once('../functions/strings.php'); |
75 | require_once('../config/config.php'); |
76 | require_once('../functions/i18n.php'); |
77 | require_once('../functions/plugin.php'); |
78 | require_once('../functions/constants.php'); |
692155b7 |
79 | require_once('../functions/page_header.php'); |
21c3249f |
80 | |
23d6bd09 |
81 | /* |
82 | * $squirrelmail_language is set by a cookie when the user selects |
83 | * language and logs out |
84 | */ |
85 | set_up_language($squirrelmail_language, true); |
288491a4 |
86 | |
23d6bd09 |
87 | /* Need the base URI to set the cookies. (Same code as in webmail.php). */ |
88 | ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs); |
89 | $base_uri = $regs[1]; |
90 | @session_destroy(); |
c6d6fe73 |
91 | |
23d6bd09 |
92 | /* |
93 | * In case the last session was not terminated properly, make sure |
94 | * we get a new one. |
95 | */ |
692155b7 |
96 | $cookie_params = session_get_cookie_params(); |
97 | setcookie(session_name(),'',0,$cookie_params['path'].$cookie_params['domain']); |
23d6bd09 |
98 | setcookie('username', '', 0, $base_uri); |
99 | setcookie('key', '', 0, $base_uri); |
100 | header ('Pragma: no-cache'); |
c6d6fe73 |
101 | |
23d6bd09 |
102 | do_hook('login_cookie'); |
1bfeac81 |
103 | |
23d6bd09 |
104 | /* Output the javascript onload function. */ |
692155b7 |
105 | displayHtmlHeader( "$org_name - " . _("Login"), |
106 | "<SCRIPT LANGUAGE=\"JavaScript\">\n" . |
107 | "<!--\n". |
108 | " function squirrelmail_loginpage_onload() {\n". |
109 | " document.forms[0].js_autodetect_results.value = '" . SMPREF_JS_ON . "';\n". |
110 | " document.forms[0].elements[0].focus();\n". |
111 | " }\n". |
112 | "// -->\n". |
113 | "</script>\n", FALSE ); |
23d6bd09 |
114 | |
115 | /* Set the title of this page. */ |
bd9bbfef |
116 | echo "<BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000CC\" VLINK=\"#0000CC\" ALINK=\"#0000CC\" onLoad='squirrelmail_loginpage_onload();'>\n". |
0ee3f2af |
117 | "<FORM ACTION=\"redirect.php\" METHOD=\"POST\" NAME=f>\n"; |
118 | |
23d6bd09 |
119 | $username_form_name = 'login_username'; |
120 | $password_form_name = 'secretkey'; |
121 | do_hook('login_top'); |
122 | |
123 | $loginname_value = (isset($loginname) ? htmlspecialchars($loginname) : ''); |
0ee3f2af |
124 | |
826b7f71 |
125 | echo "<CENTER>". |
0ee3f2af |
126 | " <IMG SRC=\"$org_logo\"><BR>\n". |
826b7f71 |
127 | ( $hide_sm_attributions ? '' : |
128 | '<SMALL>' . sprintf (_("SquirrelMail version %s"), $version) . "<BR>\n". |
129 | ' ' . _("By the SquirrelMail Development Team") . "<BR></SMALL>\n" ) . |
130 | "</CENTER>\n". |
0ee3f2af |
131 | |
826b7f71 |
132 | "<CENTER>\n". |
0ee3f2af |
133 | "<TABLE COLS=1 WIDTH=350>\n". |
bd9bbfef |
134 | " <TR><TD ALIGN=CENTER BGCOLOR=\"#DCDCDC\">\n". |
135 | ' <B>' . sprintf (_("%s Login"), $org_name) . "</B>\n". |
0ee3f2af |
136 | " </TD></TR>". |
137 | " <TR><TD BGCOLOR=\"#FFFFFF\"><TABLE COLS=2 WIDTH=\"100%\">\n". |
138 | " <TR>\n". |
bd9bbfef |
139 | ' <TD WIDTH="30%" ALIGN=right>' . _("Name:") . "</TD>\n". |
140 | " <TD WIDTH=\"*\" ALIGN=left>\n". |
0ee3f2af |
141 | " <INPUT TYPE=TEXT NAME=\"$username_form_name\" VALUE=\"$loginname_value\">\n". |
142 | " </TD>\n". |
143 | " </TR>\n". |
144 | " <TR>\n". |
145 | ' <TD WIDTH="30%" ALIGN=right>' . _("Password:") . "</TD>\n". |
7c0060c9 |
146 | " <TD WIDTH=\"*\" ALIGN=left>\n". |
0ee3f2af |
147 | " <INPUT TYPE=PASSWORD NAME=\"$password_form_name\">\n". |
148 | " <INPUT TYPE=HIDDEN NAME=\"js_autodetect_results\" VALUE=\"" . SMPREF_JS_OFF . "\">\n". |
149 | " <INPUT TYPE=HIDDEN NAME=\"just_logged_in\" value=1>\n"; |
23d6bd09 |
150 | if ($rcptaddress != '') { |
151 | echo " <INPUT TYPE=HIDDEN NAME=\"rcptemail\" VALUE=\"".htmlspecialchars($rcptaddress)."\">\n"; |
152 | } |
0ee3f2af |
153 | echo " </TD>\n". |
154 | " </TR>\n". |
155 | " </TABLE></TD></TR>\n". |
156 | " <TR><TD>\n". |
157 | ' <CENTER><INPUT TYPE=SUBMIT VALUE="' . _("Login") . "\"></CENTER>\n". |
158 | " </TD></TR>\n". |
826b7f71 |
159 | "</TABLE>\n". |
160 | "</CENTER>\n"; |
23d6bd09 |
161 | |
162 | do_hook('login_form'); |
163 | echo "</FORM>\n"; |
164 | |
165 | do_hook('login_bottom'); |
0ee3f2af |
166 | echo "</BODY>\n". |
167 | "</HTML>\n"; |
826b7f71 |
168 | ?> |