top index for user initials
This commit is contained in:
@@ -5,6 +5,9 @@ phpMyAdmin - Changelog
|
||||
$Id$
|
||||
$Source$
|
||||
|
||||
2004-10-23 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* server_privileges.php: top index for user initials
|
||||
|
||||
2004-10-22 Alexander M. Turek
|
||||
* lang/english-*.inc.php: Grammar fix.
|
||||
|
||||
|
@@ -913,7 +913,15 @@ if (empty($adduser) && empty($checkprivs)) {
|
||||
. '</h2>' . "\n";
|
||||
$oldPrivTables = FALSE;
|
||||
if (PMA_MYSQL_INT_VERSION >= 40002) {
|
||||
$res = PMA_DBI_try_query('SELECT `User`, `Host`, IF(`Password` = ' . (PMA_MYSQL_INT_VERSION >= 40100 ? '_latin1 ' : '') . '\'\', \'N\', \'Y\') AS \'Password\', `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Show_db_priv`, `Super_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Execute_priv`, `Repl_slave_priv`, `Repl_client_priv` FROM `user` ORDER BY `User` ASC, `Host` ASC;');
|
||||
$sql_query = 'SELECT `User`, `Host`, IF(`Password` = ' . (PMA_MYSQL_INT_VERSION >= 40100 ? '_latin1 ' : '') . '\'\', \'N\', \'Y\') AS \'Password\', `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Show_db_priv`, `Super_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Execute_priv`, `Repl_slave_priv`, `Repl_client_priv` FROM `user` ';
|
||||
|
||||
if (isset($initial)) {
|
||||
$sql_query .= " WHERE `User` LIKE '" . $initial . "%'";
|
||||
}
|
||||
|
||||
$sql_query .= ' ORDER BY `User` ASC, `Host` ASC;';
|
||||
$res = PMA_DBI_try_query($sql_query);
|
||||
|
||||
if (!$res) {
|
||||
// the query failed! This may have two reasons:
|
||||
// - the user has not enough privileges
|
||||
@@ -922,7 +930,15 @@ if (empty($adduser) && empty($checkprivs)) {
|
||||
}
|
||||
}
|
||||
if (empty($res) || PMA_MYSQL_INT_VERSION < 40002) {
|
||||
$res = PMA_DBI_try_query('SELECT `User`, `Host`, IF(`Password` = ' . (PMA_MYSQL_INT_VERSION >= 40100 ? '_latin1 ' : '') . '\'\', \'N\', \'Y\') AS \'Password\', `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Index_priv`, `Alter_priv`, `Create_priv`, `Drop_priv`, `Grant_priv`, `References_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv` FROM `user` ORDER BY `User` ASC, `Host` ASC;');
|
||||
$sql_query = 'SELECT `User`, `Host`, IF(`Password` = ' . (PMA_MYSQL_INT_VERSION >= 40100 ? '_latin1 ' : '') . '\'\', \'N\', \'Y\') AS \'Password\', `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Index_priv`, `Alter_priv`, `Create_priv`, `Drop_priv`, `Grant_priv`, `References_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv` FROM `user`';
|
||||
|
||||
if (isset($initial)) {
|
||||
$sql_query .= " WHERE `User` LIKE '" . $initial . "%'";
|
||||
}
|
||||
|
||||
$sql_query .= ' ORDER BY `User` ASC, `Host` ASC;';
|
||||
$res = PMA_DBI_try_query($sql_query);
|
||||
|
||||
if (!$res) {
|
||||
// the query failed! This may have two reasons:
|
||||
// - the user has not enough privileges
|
||||
@@ -943,6 +959,49 @@ if (empty($adduser) && empty($checkprivs)) {
|
||||
. ' Please run the script <tt>mysql_fix_privilege_tables</tt> that should be included in your MySQL server distribution to solve this problem!' . "\n"
|
||||
. '</div><br />' . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the initials
|
||||
*/
|
||||
|
||||
// for all initials, even non A-Z
|
||||
$array_initials = array();
|
||||
|
||||
// initialize to FALSE the letters A-Z
|
||||
for ($letter_counter = 1; $letter_counter < 27; $letter_counter++) {
|
||||
$array_initials[chr($letter_counter + 64)] = FALSE;
|
||||
}
|
||||
|
||||
$initials = PMA_DBI_try_query('SELECT DISTINCT UPPER(LEFT(`User`,1)) FROM `user` ORDER BY `User` ASC');
|
||||
while (list($tmp_initial) = PMA_DBI_fetch_row($initials)) {
|
||||
$array_initials[$tmp_initial] = TRUE;
|
||||
}
|
||||
|
||||
// Display the initials, which can be any characters, not
|
||||
// just letters. For letters A-Z, we add the non-used letters
|
||||
// as greyed out.
|
||||
|
||||
uksort($array_initials, "strnatcasecmp");
|
||||
reset($array_initials);
|
||||
|
||||
echo '<table cellspacing="5" ><tr>';
|
||||
foreach ($array_initials as $tmp_initial => $initial_was_found) {
|
||||
|
||||
if ($initial_was_found) {
|
||||
echo '<td><a href="' . $PHP_SELF . '?' . $url_query . '&initial=' . urlencode($tmp_initial) . '" style="font-size:' . $font_bigger . '">' . $tmp_initial . '</a></td>' . "\n";
|
||||
} else {
|
||||
echo '<td style="font-size:' . $font_bigger . '">' . $tmp_initial . '</td>';
|
||||
}
|
||||
}
|
||||
echo '<td><a href="' . $PHP_SELF . '?' . $url_query . '&showall=1" style="font-size:' . $font_bigger . '">[' . $strShowAll . ']</a></td>' . "\n";
|
||||
echo '</tr></table>';
|
||||
|
||||
/**
|
||||
* Displays the user overview
|
||||
*/
|
||||
|
||||
if (isset($initial) || isset($showall) || PMA_DBI_num_rows($res) < 50) {
|
||||
|
||||
echo '<form name="usersForm" action="server_privileges.php" method="post">' . "\n"
|
||||
. PMA_generate_common_hidden_inputs('', '', 1)
|
||||
. ' <table border="0" cellpadding="2" cellspacing="1">' . "\n"
|
||||
@@ -1029,9 +1088,12 @@ if (empty($adduser) && empty($checkprivs)) {
|
||||
. '<div class="tblWarn">' . "\n"
|
||||
. ' ' . sprintf($strFlushPrivilegesNote, '<a href="server_privileges.php?' . $url_query . '&flush_privileges=1">', '</a>') . "\n"
|
||||
. '</div>' . "\n";
|
||||
} // end if (display overview)
|
||||
}
|
||||
} else {
|
||||
|
||||
// A user was selected -> display the user's properties
|
||||
|
||||
echo '<h2>' . "\n"
|
||||
. ($cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_usredit.png" width="16" height="16" border="0" hspace="2" align="middle" />' : '' )
|
||||
. ' ' . $strUser . ' <i><a class="h2" href="server_privileges.php?' . $url_query . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '">\'' . htmlspecialchars($username) . '\'@\'' . htmlspecialchars($hostname) . '\'</a></i>' . "\n";
|
||||
|
Reference in New Issue
Block a user