ac9b981590a03105eb5c9d36473fcf5caa144e53
4 * login.php -- simple login screen
6 * Copyright (c) 1999-2003 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This a simple login screen. Some housekeeping is done to clean
10 * cookies and find language.
15 /* Path for SquirrelMail required files. */
16 define('SM_PATH','../');
18 /* SquirrelMail required files. */
19 require_once(SM_PATH
. 'functions/strings.php');
20 require_once(SM_PATH
. 'config/config.php');
21 require_once(SM_PATH
. 'functions/i18n.php');
22 require_once(SM_PATH
. 'functions/plugin.php');
23 require_once(SM_PATH
. 'functions/constants.php');
24 require_once(SM_PATH
. 'functions/page_header.php');
25 require_once(SM_PATH
. 'functions/html.php');
26 require_once(SM_PATH
. 'functions/global.php');
27 require_once(SM_PATH
. 'functions/imap_general.php');
30 * $squirrelmail_language is set by a cookie when the user selects
31 * language and logs out
33 set_up_language($squirrelmail_language, TRUE, TRUE);
36 * Find out the base URI to set cookies.
38 if (!function_exists('sqm_baseuri')){
39 require_once(SM_PATH
. 'functions/display_messages.php');
41 $base_uri = sqm_baseuri();
44 * In case the last session was not terminated properly, make sure
50 header('Pragma: no-cache');
52 $imap = sqimap_create_stream($imapServerAddress, $imapPort, $use_imap_tls);
53 $logindisabled = sqimap_capability($imap,'LOGINDISABLED');
56 $string = "The IMAP server is reporting that logins are disabled.<br>";
58 $string .= "The use of TLS may allow SquirrelMail to login.<br>";
60 $string .= "Please contact your system administrator.";
61 error_box($string,$color);
65 do_hook('login_cookie');
67 /* Output the javascript onload function. */
69 $header = "<script language=\"JavaScript\" type=\"text/javascript\">\n" .
71 " function squirrelmail_loginpage_onload() {\n".
72 " document.forms[0].js_autodetect_results.value = '" . SMPREF_JS_ON
. "';\n".
73 " var textElements = 0;\n".
74 " for (i = 0; i < document.forms[0].elements.length; i++) {\n".
75 " if (document.forms[0].elements[i].type == \"text\" || document.forms[0].elements[i].type == \"password\") {\n".
77 " if (textElements == " . (isset($loginname) ?
2 : 1) . ") {\n".
78 " document.forms[0].elements[i].focus();\n".
87 if (@file_exists
($theme[$theme_default]['PATH']))
88 @include
($theme[$theme_default]['PATH']);
90 displayHtmlHeader( "$org_name - " . _("Login"), $header, FALSE );
92 echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\" onLoad=\"squirrelmail_loginpage_onload()\">" .
93 "\n" . '<form action="redirect.php" method="post">' . "\n";
95 $username_form_name = 'login_username';
96 $password_form_name = 'secretkey';
99 $loginname_value = (sqGetGlobalVar('loginname', $loginname) ?
htmlspecialchars($loginname) : '');
101 /* If they don't have a logo, don't bother.. */
102 if (isset($org_logo) && $org_logo) {
103 /* Display width and height like good little people */
104 $width_and_height = '';
105 if (isset($org_logo_width) && is_numeric($org_logo_width) &&
107 $width_and_height = " width=\"$org_logo_width\"";
109 if (isset($org_logo_height) && is_numeric($org_logo_height) &&
110 $org_logo_height>0) {
111 $width_and_height .= " height=\"$org_logo_height\"";
115 if(sqgetGlobalVar('mailto', $mailto)) {
116 $rcptaddress = '<input type="hidden" name="mailto" value="' . urlencode($mailto) . '" />' . "\n";
120 echo html_tag( 'table',
124 ( isset($org_logo) && $org_logo
125 ?
'<img src="' . $org_logo . '" alt="' .
126 sprintf(_("%s Logo"), $org_name) .'"' . $width_and_height .
129 ( (isset($hide_sm_attributions) && $hide_sm_attributions) ?
'' :
130 '<small>' . sprintf (_("SquirrelMail version %s"), $version) . '<br />' ."\n".
131 ' ' . _("By the SquirrelMail Development Team") . '<br /></small>' . "\n" ) .
135 '<b>' . sprintf (_("%s Login"), $org_name) . "</b>\n",
136 'center', $color[0] )
139 html_tag( 'td', "\n" .
144 'right', '', 'width="30%"' ) .
146 '<input type="text" name="' . $username_form_name .'" value="' . $loginname_value .'" />' ,
147 'left', '', 'width="*"' )
152 'right', '', 'width="30%"' ) .
154 '<input type="password" name="' . $password_form_name . '" />' . "\n" .
155 '<input type="hidden" name="js_autodetect_results" value="SMPREF_JS_OFF" />' . "\n" .
157 '<input type="hidden" name="just_logged_in" value="1" />' . "\n",
158 'left', '', 'width="*"' )
160 'center', $color[4], 'border="0" width="100%"' ) ,
165 '<center><input type="submit" value="' . _("Login") . '" /></center>',
168 '', $color[4], 'border="0" width="350"' ) . '</center>',
171 '', $color[4], 'border="0" cellspacing="0" cellpadding="0" width="100%"' );
172 do_hook('login_form');
173 echo '</form>' . "\n";
175 do_hook('login_bottom');