I thought the hook login_form was supposed to be part of the <form> element.
[squirrelmail.git] / src / login.php
... / ...
CommitLineData
1<?php
2
3/**
4 * login.php -- simple login screen
5 *
6 * Copyright (c) 1999-2003 The SquirrelMail Project 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 */
14
15/* Path for SquirrelMail required files. */
16define('SM_PATH','../');
17
18/* SquirrelMail required files. */
19require_once(SM_PATH . 'functions/strings.php');
20require_once(SM_PATH . 'config/config.php');
21require_once(SM_PATH . 'functions/i18n.php');
22require_once(SM_PATH . 'functions/plugin.php');
23require_once(SM_PATH . 'functions/constants.php');
24require_once(SM_PATH . 'functions/page_header.php');
25require_once(SM_PATH . 'functions/html.php');
26require_once(SM_PATH . 'functions/global.php');
27
28/*
29 * $squirrelmail_language is set by a cookie when the user selects
30 * language and logs out
31 */
32set_up_language($squirrelmail_language, TRUE);
33
34/**
35 * Find out the base URI to set cookies.
36 */
37if (!function_exists('sqm_baseuri')){
38 require_once(SM_PATH . 'functions/display_messages.php');
39}
40$base_uri = sqm_baseuri();
41
42/*
43 * In case the last session was not terminated properly, make sure
44 * we get a new one.
45 */
46
47sqsession_destroy();
48
49header('Pragma: no-cache');
50
51do_hook('login_cookie');
52
53/* Output the javascript onload function. */
54
55$header = "<script language=\"JavaScript\" type=\"text/javascript\">\n" .
56 "<!--\n".
57 " function squirrelmail_loginpage_onload() {\n".
58 " document.forms[0].js_autodetect_results.value = '" . SMPREF_JS_ON . "';\n".
59 ' document.forms[0].elements[' . (isset($loginname) ? 1 : 0) . "].focus();\n".
60 " }\n".
61 "// -->\n".
62 "</script>\n";
63$custom_css = 'none';
64displayHtmlHeader( "$org_name - " . _("Login"), $header, FALSE );
65
66echo '<body text="#000000" bgcolor="#FFFFFF" link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="squirrelmail_loginpage_onload();">';
67
68$username_form_name = 'login_username';
69$password_form_name = 'secretkey';
70do_hook('login_top');
71
72$loginname_value = (isset($loginname) ? htmlspecialchars($loginname) : '');
73
74/* If they don't have a logo, don't bother.. */
75if (isset($org_logo) && $org_logo) {
76 /* Display width and height like good little people */
77 $width_and_height = '';
78 if (isset($org_logo_width) && is_numeric($org_logo_width) &&
79 $org_logo_width>0) {
80 $width_and_height = " width=\"$org_logo_width\"";
81 }
82 if (isset($org_logo_height) && is_numeric($org_logo_height) &&
83 $org_logo_height>0) {
84 $width_and_height .= " height=\"$org_logo_height\"";
85 }
86}
87
88echo "\n" . '<form action="redirect.php" method="post">' . "\n" .
89html_tag( 'table',
90 html_tag( 'tr',
91 html_tag( 'td',
92 '<center>'.
93 ( isset($org_logo) && $org_logo
94 ? '<img src="' . $org_logo . '" alt="' .
95 sprintf(_("%s Logo"), $org_name) .'"' . $width_and_height .
96 ' /><br />' . "\n"
97 : '' ).
98 ( $hide_sm_attributions ? '' :
99 '<small>' . sprintf (_("SquirrelMail version %s"), $version) . '<br />' ."\n".
100 ' ' . _("By the SquirrelMail Development Team") . '<br /></small>' . "\n" ) .
101 html_tag( 'table',
102 html_tag( 'tr',
103 html_tag( 'td',
104 '<b>' . sprintf (_("%s Login"), $org_name) . "</b>\n",
105 'center', '#DCDCDC' )
106 ) .
107 html_tag( 'tr',
108 html_tag( 'td', "\n" .
109 html_tag( 'table',
110 html_tag( 'tr',
111 html_tag( 'td',
112 _("Name:") ,
113 'right', '', 'width="30%"' ) .
114 html_tag( 'td',
115 '<input type="text" name="' . $username_form_name .'" value="' . $loginname_value .'" />' ,
116 'left', '', 'width="*"' )
117 ) . "\n" .
118 html_tag( 'tr',
119 html_tag( 'td',
120 _("Password:") ,
121 'right', '', 'width="30%"' ) .
122 html_tag( 'td',
123 '<input type="password" name="' . $password_form_name . '" />' . "\n" .
124 '<input type="hidden" name="js_autodetect_results" value="SMPREF_JS_OFF" />' . "\n" .
125 '<input type="hidden" name="just_logged_in" value="1" />' . "\n",
126 'left', '', 'width="*"' )
127 ) ,
128 'center', '#ffffff', 'border="0" width="100%"' ) ,
129 'left', '#FFFFFF' )
130 ) .
131 html_tag( 'tr',
132 html_tag( 'td',
133 '<center><input type="submit" value="' . _("Login") . '" /></center>',
134 'left' )
135 ),
136 '', '#ffffff', 'border="0" width="350"' ) . '</center>',
137 'center' )
138 ) ,
139'', '#ffffff', 'border="0" cellspacing="0" cellpadding="0" width="100%"' );
140do_hook('login_form');
141echo '</form>' . "\n";
142
143do_hook('login_bottom');
144echo "</body>\n".
145 "</html>\n";
146?>