bug #1490193 and code simplification
This commit is contained in:
@@ -5,6 +5,10 @@ phpMyAdmin - ChangeLog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2006-05-18 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
|
* 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 <lem9@users.sourceforge.net>
|
2006-05-17 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* server_privileges.php: bug #1478812, Add user (password containing
|
* server_privileges.php: bug #1478812, Add user (password containing
|
||||||
a backslash); also minor optimization
|
a backslash); also minor optimization
|
||||||
|
@@ -6,17 +6,6 @@
|
|||||||
// ($controllink and $userlink are links to MySQL defined in the "common.lib.php" library)
|
// ($controllink and $userlink are links to MySQL defined in the "common.lib.php" library)
|
||||||
// Note: if no controluser is defined, $controllink contains $userlink
|
// 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_create_db_priv = false;
|
||||||
$is_process_priv = true;
|
$is_process_priv = true;
|
||||||
$is_reload_priv = false;
|
$is_reload_priv = false;
|
||||||
|
@@ -1167,4 +1167,15 @@ function PMA_DBI_getCompatibilities()
|
|||||||
return $compats;
|
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 );
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@@ -15,11 +15,7 @@ if (empty($sub_part)) {
|
|||||||
/**
|
/**
|
||||||
* Checks for superuser privileges
|
* Checks for superuser privileges
|
||||||
*/
|
*/
|
||||||
// We were checking privileges with 'USE mysql' but users with the global
|
$is_superuser = PMA_isSuperuser();
|
||||||
// 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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepares links
|
* Prepares links
|
||||||
|
@@ -50,6 +50,7 @@ if (empty($GLOBALS['is_header_sent'])) {
|
|||||||
(!empty($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['TitleServer'] :
|
(!empty($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['TitleServer'] :
|
||||||
$GLOBALS['cfg']['TitleDefault']))
|
$GLOBALS['cfg']['TitleDefault']))
|
||||||
);
|
);
|
||||||
|
$is_superuser = PMA_isSuperuser();
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" language="javascript">
|
<script type="text/javascript" language="javascript">
|
||||||
<!--
|
<!--
|
||||||
|
@@ -35,19 +35,12 @@ require_once('./libraries/header.inc.php');
|
|||||||
/**
|
/**
|
||||||
* Checks for superuser privileges
|
* 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');
|
$is_superuser = PMA_isSuperuser();
|
||||||
|
|
||||||
// now, select the mysql db
|
// now, select the mysql db
|
||||||
if ($is_superuser) {
|
if ($is_superuser) {
|
||||||
PMA_DBI_free_result($is_superuser);
|
|
||||||
PMA_DBI_select_db('mysql', $userlink);
|
PMA_DBI_select_db('mysql', $userlink);
|
||||||
$is_superuser = TRUE;
|
|
||||||
} else {
|
|
||||||
$is_superuser = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$has_binlogs = FALSE;
|
$has_binlogs = FALSE;
|
||||||
|
Reference in New Issue
Block a user