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