diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | libraries/common.lib.php | 12 | ||||
-rw-r--r-- | server_privileges.php | 9 |
3 files changed, 15 insertions, 8 deletions
@@ -16,7 +16,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA - bug #1817224 [import] Incorrect detection of file_uploads in some cases, thanks to Juergen Wind - bug #1777249 [display] Do not underline links in left panel (in default - themes) +- bug #1826022 [privileges] unable to add user (MySQL 3.23) since PMA 2.11.2 2.11.2.0 (2007-10-27) - patch #1791576 HTTP auth: support REDIRECT_REMOTE_USER, thanks to Allard diff --git a/libraries/common.lib.php b/libraries/common.lib.php index d33b504efb..5d1e955b5a 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -572,7 +572,7 @@ function PMA_mysqlDie($error_message = '', $the_query = '', * * @access private */ -function PMA_convert_using($string, $mode='unquoted') +function PMA_convert_using($string, $mode='unquoted', $force_utf8 = false) { if ($mode == 'quoted') { $possible_quote = "'"; @@ -581,8 +581,14 @@ function PMA_convert_using($string, $mode='unquoted') } if (PMA_MYSQL_INT_VERSION >= 40100) { - list($conn_charset) = explode('_', $GLOBALS['collation_connection']); - $converted_string = "CONVERT(" . $possible_quote . $string . $possible_quote . " USING " . $conn_charset . ")"; + if ($force_utf8) { + $charset = 'utf8'; + $collate = ' COLLATE utf8_bin'; + } else { + list($charset) = explode('_', $GLOBALS['collation_connection']); + $collate = ''; + } + $converted_string = "CONVERT(" . $possible_quote . $string . $possible_quote . " USING " . $charset . ")" . $collate; } else { $converted_string = $possible_quote . $string . $possible_quote; } diff --git a/server_privileges.php b/server_privileges.php index 40513e2d9c..012a8d15d7 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -749,11 +749,12 @@ if (!empty($adduser_submit) || !empty($change_copy)) { } $res = PMA_DBI_query( 'SELECT \'foo\' FROM `mysql`.`user`' - .' WHERE CONVERT(`User` USING utf8) COLLATE utf8_bin ' - .' = CONVERT(\'' . PMA_sqlAddslashes($username) . '\' USING utf8) COLLATE utf8_bin ' - .' AND CONVERT(`Host` USING utf8) COLLATE utf8_bin ' - .' = CONVERT(\'' . PMA_sqlAddslashes($hostname) . '\' USING utf8) COLLATE utf8_bin ;', + .' WHERE ' . PMA_convert_using('User', 'unquoted', true) + .' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted', true) + .' AND ' . PMA_convert_using('Host', 'unquoted', true) + .' = ' . PMA_convert_using($hostname, 'quoted', true) . ';', null, PMA_DBI_QUERY_STORE); + if (PMA_DBI_num_rows($res) == 1) { PMA_DBI_free_result($res); $message = sprintf($GLOBALS['strUserAlreadyExists'], '[i]\'' . $username . '\'@\'' . $hostname . '\'[/i]'); |