respect the chosen initial
This commit is contained in:
@@ -12,6 +12,7 @@ $Source$
|
|||||||
|
|
||||||
2005-10-29 Marc Delisle <lem9@users.sourceforge.net>
|
2005-10-29 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* Documentation.html: clarification on FAQ 6.20
|
* Documentation.html: clarification on FAQ 6.20
|
||||||
|
* server_privileges.php: respect the chosen initial
|
||||||
|
|
||||||
2005-10-28 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
2005-10-28 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
||||||
* server_privilegs.php, libraries/common.lib.php,
|
* server_privilegs.php, libraries/common.lib.php,
|
||||||
|
@@ -44,6 +44,26 @@ if (!$is_superuser) {
|
|||||||
require_once('./footer.inc.php');
|
require_once('./footer.inc.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a condition on the user name
|
||||||
|
*
|
||||||
|
* @param string the user's initial
|
||||||
|
* @return string the generated condition
|
||||||
|
*/
|
||||||
|
function PMA_RangeOfUsers($initial = '') {
|
||||||
|
// strtolower() is used because the User field
|
||||||
|
// might be BINARY, so LIKE would be case sensitive
|
||||||
|
if (!empty($initial)) {
|
||||||
|
$ret = " WHERE " . PMA_convert_using('User')
|
||||||
|
. " LIKE " . PMA_convert_using($initial . '%', 'quoted')
|
||||||
|
. " OR ". PMA_convert_using('User')
|
||||||
|
. " LIKE " . PMA_convert_using(strtolower($initial) . '%', 'quoted');
|
||||||
|
} else {
|
||||||
|
$ret = '';
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
} // end function
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts the privilege information of a priv table row
|
* Extracts the privilege information of a priv table row
|
||||||
*
|
*
|
||||||
@@ -1257,14 +1277,7 @@ if (empty($adduser) && empty($checkprivs)) {
|
|||||||
|
|
||||||
$sql_query .= ' FROM `mysql`.`user`';
|
$sql_query .= ' FROM `mysql`.`user`';
|
||||||
|
|
||||||
// the strtolower() is because sometimes the User field
|
$sql_query .= (isset($initial) ? PMA_RangeOfUsers($initial) : '');
|
||||||
// might be BINARY, so LIKE would be case sensitive
|
|
||||||
if (isset($initial)) {
|
|
||||||
$sql_query .= " WHERE " . PMA_convert_using('User')
|
|
||||||
. " LIKE " . PMA_convert_using($initial . '%', 'quoted')
|
|
||||||
. " OR ". PMA_convert_using('User')
|
|
||||||
. " LIKE " . PMA_convert_using(strtolower($initial) . '%', 'quoted');
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql_query .= ' ORDER BY `User` ASC, `Host` ASC;';
|
$sql_query .= ' ORDER BY `User` ASC, `Host` ASC;';
|
||||||
$res = PMA_DBI_try_query($sql_query, NULL, PMA_DBI_QUERY_STORE);
|
$res = PMA_DBI_try_query($sql_query, NULL, PMA_DBI_QUERY_STORE);
|
||||||
@@ -1302,7 +1315,7 @@ if (empty($adduser) && empty($checkprivs)) {
|
|||||||
$db_rights_sqls = array();
|
$db_rights_sqls = array();
|
||||||
foreach ( $tables_to_search_for_users as $table_search_in ) {
|
foreach ( $tables_to_search_for_users as $table_search_in ) {
|
||||||
if ( in_array( $table_search_in, $tables ) ) {
|
if ( in_array( $table_search_in, $tables ) ) {
|
||||||
$db_rights_sqls[] = 'SELECT DISTINCT `User`, `Host` FROM `mysql`.`' . $table_search_in . '` ';
|
$db_rights_sqls[] = 'SELECT DISTINCT `User`, `Host` FROM `mysql`.`' . $table_search_in . '` ' . (isset($initial) ? PMA_RangeOfUsers($initial) : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1329,10 +1342,6 @@ if (empty($adduser) && empty($checkprivs)) {
|
|||||||
$db_rights_row = array_merge( $user_defaults, $db_rights_row );
|
$db_rights_row = array_merge( $user_defaults, $db_rights_row );
|
||||||
$db_rights[$db_rights_row['User']][$db_rights_row['Host']] =
|
$db_rights[$db_rights_row['User']][$db_rights_row['Host']] =
|
||||||
$db_rights_row;
|
$db_rights_row;
|
||||||
if ( ! empty( $db_rights_row['User'] ) ) {
|
|
||||||
$letter = strtoupper( $db_rights_row['User']{0} );
|
|
||||||
$array_initials[$letter] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ( $db_rights_sqls as $db_rights_sql ) {
|
foreach ( $db_rights_sqls as $db_rights_sql ) {
|
||||||
@@ -1342,10 +1351,6 @@ if (empty($adduser) && empty($checkprivs)) {
|
|||||||
$db_rights_row = array_merge( $user_defaults, $db_rights_row );
|
$db_rights_row = array_merge( $user_defaults, $db_rights_row );
|
||||||
$db_rights[$db_rights_row['User']][$db_rights_row['Host']] =
|
$db_rights[$db_rights_row['User']][$db_rights_row['Host']] =
|
||||||
$db_rights_row;
|
$db_rights_row;
|
||||||
if ( ! empty( $db_rights_row['User'] ) ) {
|
|
||||||
$letter = strtoupper( $db_rights_row['User']{0} );
|
|
||||||
$array_initials[$letter] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1364,6 +1369,11 @@ if (empty($adduser) && empty($checkprivs)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$initials = PMA_DBI_try_query('SELECT DISTINCT UPPER(LEFT(' . PMA_convert_using('User') . ',1)) FROM `user` ORDER BY `User` ASC', NULL, PMA_DBI_QUERY_STORE);
|
||||||
|
while (list($tmp_initial) = PMA_DBI_fetch_row($initials)) {
|
||||||
|
$array_initials[$tmp_initial] = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// Display the initials, which can be any characters, not
|
// Display the initials, which can be any characters, not
|
||||||
// just letters. For letters A-Z, we add the non-used letters
|
// just letters. For letters A-Z, we add the non-used letters
|
||||||
// as greyed out.
|
// as greyed out.
|
||||||
|
Reference in New Issue
Block a user