diff --git a/ChangeLog b/ChangeLog index 886fa6110..b402a2f26 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - ChangeLog $Id$ $Source$ +2006-05-18 Marc Delisle + * libraries/check_user_privileges.lib.php, /database_interface.lib.php, /db_details_links.inc.php, + /server_common.inc.php, /header.inc.php: bug #1490193 and code simplification + 2006-05-17 Marc Delisle * server_privileges.php: bug #1478812, Add user (password containing a backslash); also minor optimization diff --git a/libraries/check_user_privileges.lib.php b/libraries/check_user_privileges.lib.php index d6ce3d48b..04dfb0ec2 100644 --- a/libraries/check_user_privileges.lib.php +++ b/libraries/check_user_privileges.lib.php @@ -6,17 +6,6 @@ // ($controllink and $userlink are links to MySQL defined in the "common.lib.php" library) // Note: if no controluser is defined, $controllink contains $userlink -/** - * returns true (int > 0) if current user is superuser - * otherwise 0 - * - * @return integer $is_superuser - */ -function PMA_isSuperuser() { - return PMA_DBI_try_query( 'SELECT COUNT(*) FROM mysql.user', - $GLOBALS['userlink'], PMA_DBI_QUERY_STORE ); -} - $is_create_db_priv = false; $is_process_priv = true; $is_reload_priv = false; diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index a7a8d47f7..4c74d1bd0 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -1167,4 +1167,15 @@ function PMA_DBI_getCompatibilities() return $compats; } + +/** + * returns true (int > 0) if current user is superuser + * otherwise 0 + * + * @return integer $is_superuser + */ +function PMA_isSuperuser() { + return PMA_DBI_try_query( 'SELECT COUNT(*) FROM mysql.user', + $GLOBALS['userlink'], PMA_DBI_QUERY_STORE ); +} ?> diff --git a/libraries/db_details_links.inc.php b/libraries/db_details_links.inc.php index 2dc725e99..6e5e190e8 100644 --- a/libraries/db_details_links.inc.php +++ b/libraries/db_details_links.inc.php @@ -14,12 +14,8 @@ if (empty($sub_part)) { /** * Checks for superuser privileges - */ - // We were checking privileges with 'USE mysql' but users with the global - // priv CREATE TEMPORARY TABLES or LOCK TABLES can do a 'USE mysql' - // (even if they cannot see the tables) - -$is_superuser = PMA_DBI_try_query('SELECT COUNT(*) FROM mysql.user', null, PMA_DBI_QUERY_STORE); + */ +$is_superuser = PMA_isSuperuser(); /** * Prepares links diff --git a/libraries/header.inc.php b/libraries/header.inc.php index 450abb79f..dabca93ca 100644 --- a/libraries/header.inc.php +++ b/libraries/header.inc.php @@ -50,6 +50,7 @@ if (empty($GLOBALS['is_header_sent'])) { (!empty($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['TitleServer'] : $GLOBALS['cfg']['TitleDefault'])) ); + $is_superuser = PMA_isSuperuser(); ?>