From 736e7faa3adb3cd6b79454cca748162e42e38439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Fri, 8 Mar 2002 15:52:28 +0000 Subject: [PATCH] headers were sometimes missing before an error is displayed --- ChangeLog | 3 +++ header.inc.php3 | 6 ++++++ libraries/common.lib.php3 | 7 ++++++- user_details.php3 | 6 +++++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index da77ac645..2ac62ce52 100755 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,9 @@ $Source$ Luís V. . * lang/hebrew.inc.php3: updated thanks to Moran Zaltsman . + * header.inc.php3, lines 161-165; user_details.php3, lines 978-980; + libraries/common.lib.php3, lines 229-232: headers were sometimes missing + before an error is displayed. 2002-03-07 Marc Delisle * Documentation.html, config.inc.php3, libraries/common.lib.php3: diff --git a/header.inc.php3 b/header.inc.php3 index 323feeaff..61532d7a0 100755 --- a/header.inc.php3 +++ b/header.inc.php3 @@ -157,4 +157,10 @@ if (isset($db)) { echo '' . "\n"; } echo "\n"; + + +/** + * Sets a variable to remember headers have been sent + */ +$is_header_sent = TRUE; ?> diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3 index 689b7aede..5efc9fbf9 100644 --- a/libraries/common.lib.php3 +++ b/libraries/common.lib.php3 @@ -225,6 +225,11 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){ function PMA_mysqlDie($error_message = '', $the_query = '', $is_modify_link = TRUE, $back_url = '') { + + if (empty($GLOBALS['is_header_sent'])) { + include('./header.inc.php3'); + } + if (!$error_message) { $error_message = mysql_error(); } @@ -232,7 +237,7 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){ $the_query = $GLOBALS['sql_query']; } - echo ''. $GLOBALS['strError'] . '' . "\n"; + echo '

'. $GLOBALS['strError'] . '

' . "\n"; // if the config password is wrong, or the MySQL server does not // respond, do not show the query that would reveal the // username/password diff --git a/user_details.php3 b/user_details.php3 index 6f1a62462..b0e0f5ec6 100644 --- a/user_details.php3 +++ b/user_details.php3 @@ -975,7 +975,11 @@ function PMA_confirm($the_host, $the_user) { */ $result = @mysql_query('USE mysql'); if (mysql_error()) { - PMA_mysqlDie($GLOBALS['strNoRights'], '', FALSE, ''); + include('./header.inc.php3'); + echo '

' . $strError . '

' . "\n"; + echo '

    ' . $strNoRights . '

' . "\n"; + include('./footer.inc.php3'); + exit(); } $result = @mysql_query('SELECT COUNT(Password) FROM mysql.user'); $password_field = (mysql_result($result, 0) ? 'Password' : 'password');