bug #1668724 JavaScript focus login Opera

This commit is contained in:
Sebastian Mendel
2007-03-15 10:16:15 +00:00
parent 02ca5e9e51
commit 3e9a417afa
2 changed files with 71 additions and 67 deletions

View File

@@ -10,6 +10,7 @@ $HeadURL$
- bug #1615530 [upload] added more specific error message if field upload fails - bug #1615530 [upload] added more specific error message if field upload fails
- bug #1627210, #1083301, #1482401 [data] warning on duplicate indexes - bug #1627210, #1083301, #1482401 [data] warning on duplicate indexes
- bug #1679055 #1050 - Table '<table name>' already exists - bug #1679055 #1050 - Table '<table name>' already exists
- bug #1668724 JavaScript focus login Opera
- [gui] avoid displaying a wide selector in server selection - [gui] avoid displaying a wide selector in server selection
+ [core] added PMA_fatalError() and made use of it + [core] added PMA_fatalError() and made use of it
. [i18n] use generic $strOptions . [i18n] use generic $strOptions

View File

@@ -1,14 +1,17 @@
<?php <?php
/* $Id$ */ /* vim: expandtab sw=4 ts=4 sts=4: */
// vim: expandtab sw=4 ts=4 sts=4: /**
* Set of functions used to run cookie based authentication.
// +--------------------------------------------------------------------------+ * Thanks to Piotr Roszatycki <d3xter at users.sourceforge.net> and
// | Set of functions used to run cookie based authentication. | * Dan Wilson who built this patch for the Debian package.
// | Thanks to Piotr Roszatycki <d3xter at users.sourceforge.net> and | *
// | Dan Wilson who built this patch for the Debian package. | * @version $Id$
// +--------------------------------------------------------------------------+ */
/**
* @todo replace by constant
* $coming_from_common can be set from outside with register_globals on
*/
if (!isset($coming_from_common)) { if (!isset($coming_from_common)) {
exit; exit;
} }
@@ -23,7 +26,7 @@ if (function_exists('mcrypt_encrypt') || PMA_dl('mcrypt')) {
} else { } else {
require_once './libraries/blowfish.php'; require_once './libraries/blowfish.php';
// for main.php: // for main.php:
define('PMA_WARN_FOR_MCRYPT',1); define('PMA_WARN_FOR_MCRYPT', 1);
} }
@@ -96,7 +99,7 @@ function PMA_auth()
$page_title = 'phpMyAdmin ' . PMA_VERSION; $page_title = 'phpMyAdmin ' . PMA_VERSION;
require './libraries/header_meta_style.inc.php'; require './libraries/header_meta_style.inc.php';
?> ?>
<script type="text/javascript" language="javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
// show login form in top frame // show login form in top frame
if (top != self) { if (top != self) {
@@ -108,10 +111,11 @@ if (top != self) {
<body class="loginform"> <body class="loginform">
<?php if (file_exists('./config.header.inc.php')) { <?php
require('./config.header.inc.php'); if (file_exists('./config.header.inc.php')) {
} require './config.header.inc.php';
?> }
?>
<div class="container"> <div class="container">
<a href="http://www.phpmyadmin.net" target="_blank" class="logo"><?php <a href="http://www.phpmyadmin.net" target="_blank" class="logo"><?php
@@ -122,12 +126,12 @@ if (top != self) {
echo '<img name="imLogo" id="imLogo" src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo.png' . '" ' echo '<img name="imLogo" id="imLogo" src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo.png' . '" '
. 'border="0" width="88" height="31" alt="phpMyAdmin" />'; . 'border="0" width="88" height="31" alt="phpMyAdmin" />';
} }
?></a> ?></a>
<h1> <h1>
<?php <?php
echo sprintf( $GLOBALS['strWelcome'], echo sprintf( $GLOBALS['strWelcome'],
'<bdo dir="ltr" xml:lang="en">phpMyAdmin ' . PMA_VERSION . '</bdo>'); '<bdo dir="ltr" xml:lang="en">phpMyAdmin ' . PMA_VERSION . '</bdo>');
?> ?>
</h1> </h1>
<?php <?php
@@ -148,21 +152,21 @@ echo sprintf( $GLOBALS['strWelcome'],
// Displays the warning message and the login form // Displays the warning message and the login form
if (empty($GLOBALS['cfg']['blowfish_secret'])) { if (empty($GLOBALS['cfg']['blowfish_secret'])) {
?> ?>
<div class="error"><h1><?php echo $GLOBALS['strError']; ?></h1> <div class="error"><h1><?php echo $GLOBALS['strError']; ?></h1>
<?php echo $GLOBALS['strSecretRequired']; ?> <?php echo $GLOBALS['strSecretRequired']; ?>
</div> </div>
<?php <?php
echo '</div>' . "\n"; echo '</div>' . "\n";
if (file_exists('./config.footer.inc.php')) { if (file_exists('./config.footer.inc.php')) {
require('./config.footer.inc.php'); require './config.footer.inc.php';
} }
echo ' </body>' . "\n" echo ' </body>' . "\n"
. '</html>'; . '</html>';
exit(); exit;
} }
?> ?>
<br /> <br />
<!-- Login form --> <!-- Login form -->
<form method="post" action="index.php" name="login_form"<?php echo $autocomplete; ?> target="_top" class="login"> <form method="post" action="index.php" name="login_form"<?php echo $autocomplete; ?> target="_top" class="login">
@@ -190,11 +194,11 @@ echo sprintf( $GLOBALS['strWelcome'],
<div class="item"> <div class="item">
<label for="select_server"><?php echo $GLOBALS['strServerChoice']; ?>:</label> <label for="select_server"><?php echo $GLOBALS['strServerChoice']; ?>:</label>
<select name="server" id="select_server" <select name="server" id="select_server"
<?php <?php
if ($GLOBALS['cfg']['AllowArbitraryServer']) { if ($GLOBALS['cfg']['AllowArbitraryServer']) {
echo ' onchange="document.forms[\'login_form\'].elements[\'pma_servername\'].value = \'\'" '; echo ' onchange="document.forms[\'login_form\'].elements[\'pma_servername\'].value = \'\'" ';
} }
?> ?>
> >
<?php <?php
require_once './libraries/select_server.lib.php'; require_once './libraries/select_server.lib.php';
@@ -202,7 +206,7 @@ echo sprintf( $GLOBALS['strWelcome'],
?> ?>
</select> </select>
</div> </div>
<?php <?php
} else { } else {
echo ' <input type="hidden" name="server" value="' . $server . '" />'; echo ' <input type="hidden" name="server" value="' . $server . '" />';
} // end if (server choice) } // end if (server choice)
@@ -225,45 +229,44 @@ echo sprintf( $GLOBALS['strWelcome'],
?> ?>
</fieldset> </fieldset>
</form> </form>
<?php
<?php // show the "Cookies required" message only if cookies are disabled
// show the "Cookies required" message only if cookies are disabled // (we previously tried to set some cookies)
// (we previously tried to set some cookies) if (empty($_COOKIE)) {
if (empty($_COOKIE)) { echo '<div class="notice">' . $GLOBALS['strCookiesRequired'] . '</div>' . "\n";
echo '<div class="notice">' . $GLOBALS['strCookiesRequired'] . '</div>' . "\n"; }
} if ( ! empty( $GLOBALS['PMA_errors'] ) && is_array( $GLOBALS['PMA_errors'] ) ) {
if ( ! empty( $GLOBALS['PMA_errors'] ) && is_array( $GLOBALS['PMA_errors'] ) ) { foreach ( $GLOBALS['PMA_errors'] as $error ) {
foreach ( $GLOBALS['PMA_errors'] as $error ) { echo '<div class="error">' . $error . '</div>' . "\n";
echo '<div class="error">' . $error . '</div>' . "\n"; }
}
?>
<script type="text/javascript">
// <![CDATA[
function PMA_focusInput()
{
var input_username = document.getElementById('input_username');
var input_password = document.getElementById('input_password');
if (input_username.value == '') {
input_username.focus();
} else {
input_password.focus();
} }
} }
?>
<script type="text/javascript" language="javascript"> window.setTimeout('PMA_focusInput()', 500);
<!-- // ]]>
var uname = document.forms['login_form'].elements['pma_username'];
var pword = document.forms['login_form'].elements['pma_password'];
if (uname.value == '') {
uname.focus();
} else {
pword.focus();
}
//-->
</script> </script>
</div> </div>
<?php
<?php if (file_exists('./config.footer.inc.php')) { if (file_exists('./config.footer.inc.php')) {
require('./config.footer.inc.php'); require './config.footer.inc.php';
} }
?> ?>
</body> </body>
</html> </html>
<?php <?php
exit(); exit;
return true;
} // end of the 'PMA_auth()' function } // end of the 'PMA_auth()' function