Copypaste error. This could be avoided by doing $theme[] in stead of $theme[n]
[squirrelmail.git] / src / login.php
CommitLineData
59177427 1<?php
895905c0 2
35586184 3/**
4 * login.php -- simple login screen
5 *
76911253 6 * Copyright (c) 1999-2003 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 */
8e2ed807 14
86725763 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');
a32985a5 26require_once(SM_PATH . 'functions/global.php');
98f2ee76 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);
d4e84069 33
85b454a0 34/**
35 * Find out the base URI to set cookies.
36 */
f3bc099d 37if (!function_exists('sqm_baseuri')){
86725763 38 require_once(SM_PATH . 'functions/display_messages.php');
f3bc099d 39}
40$base_uri = sqm_baseuri();
8e2ed807 41
98f2ee76 42/*
43 * In case the last session was not terminated properly, make sure
44 * we get a new one.
45 */
69146537 46
47sqsession_destroy();
48
98f2ee76 49header('Pragma: no-cache');
50
51do_hook('login_cookie');
52
53/* Output the javascript onload function. */
54
d68323ff 55$header = "<script language=\"JavaScript\" type=\"text/javascript\">\n" .
98f2ee76 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";
a714cb95 63$custom_css = 'none';
98f2ee76 64displayHtmlHeader( "$org_name - " . _("Login"), $header, FALSE );
65
d68323ff 66echo '<body text="#000000" bgcolor="#FFFFFF" link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="squirrelmail_loginpage_onload();">';
98f2ee76 67
0fce910a 68$username_form_name = 'login_username';
69$password_form_name = 'secretkey';
98f2ee76 70do_hook('login_top');
71
72$loginname_value = (isset($loginname) ? htmlspecialchars($loginname) : '');
73
b6e0c3b6 74/* Display width and height like good little people */
4da8e94a 75$width_and_height = '';
8e2ed807 76if (isset($org_logo_width) && is_numeric($org_logo_width) && $org_logo_width>0) {
77 $width_and_height = " width=\"$org_logo_width\"";
b6e0c3b6 78}
8e2ed807 79if (isset($org_logo_height) && is_numeric($org_logo_height) && $org_logo_height>0) {
80 $width_and_height .= " height=\"$org_logo_height\"";
98f2ee76 81}
3fde693b 82
8e2ed807 83echo "\n" . '<form action="redirect.php" method="post">' . "\n" .
84html_tag( 'table',
85 html_tag( 'tr',
86 html_tag( 'td',
87 '<center>'.
88 '<img src="' . $org_logo . '" alt="' . sprintf(_("%s Logo"), $org_name) .'"' .
d68323ff 89 $width_and_height .' /><br />' . "\n".
8e2ed807 90 ( $hide_sm_attributions ? '' :
d68323ff 91 '<small>' . sprintf (_("SquirrelMail version %s"), $version) . '<br />' ."\n".
92 ' ' . _("By the SquirrelMail Development Team") . '<br /></small>' . "\n" ) .
8e2ed807 93 html_tag( 'table',
94 html_tag( 'tr',
95 html_tag( 'td',
96 '<b>' . sprintf (_("%s Login"), $org_name) . "</b>\n",
97 'center', '#DCDCDC' )
98 ) .
99 html_tag( 'tr',
100 html_tag( 'td', "\n" .
101 html_tag( 'table',
102 html_tag( 'tr',
103 html_tag( 'td',
104 _("Name:") ,
105 'right', '', 'width="30%"' ) .
106 html_tag( 'td',
d68323ff 107 '<input type="text" name="' . $username_form_name .'" value="' . $loginname_value .'" />' ,
8e2ed807 108 'left', '', 'width="*"' )
109 ) . "\n" .
110 html_tag( 'tr',
111 html_tag( 'td',
112 _("Password:") ,
113 'right', '', 'width="30%"' ) .
114 html_tag( 'td',
d68323ff 115 '<input type="password" name="' . $password_form_name . '" />' . "\n" .
116 '<input type="hidden" name="js_autodetect_results" value="SMPREF_JS_OFF" />' . "\n" .
117 '<input type="hidden" name="just_logged_in" value="1" />' . "\n",
8e2ed807 118 'left', '', 'width="*"' )
119 ) ,
12ff1cab 120 'center', '#ffffff', 'border="0" width="100%"' ) ,
8e2ed807 121 'left', '#FFFFFF' )
122 ) .
123 html_tag( 'tr',
124 html_tag( 'td',
d68323ff 125 '<center><input type="submit" value="' . _("Login") . '" /></center>',
8e2ed807 126 'left' )
127 ),
12ff1cab 128 '', '#ffffff', 'border="0" width="350"' ) . '</center>',
8e2ed807 129 'center' )
130 ) ,
131'', '#ffffff', 'border="0" cellspacing="0" cellpadding="0" width="100%"' ) .
132'</form>' . "\n";
98f2ee76 133
134do_hook('login_form');
98f2ee76 135
136do_hook('login_bottom');
8e2ed807 137echo "</body>\n".
138 "</html>\n";
139?>