fix - Bad ajax response when adding a user without a host

This commit is contained in:
Thilina Buddika 2012-08-03 05:04:29 +05:30
parent 3c26833ba4
commit 059cb239bb
2 changed files with 12 additions and 11 deletions

View File

@ -1742,7 +1742,7 @@ function PMA_getStandardLinks($conditional_class)
* @return array $extra_data
*/
function PMA_getExtraDataForAjaxBehavior($password, $link_export, $sql_query,
$link_edit, $dbname_is_wildcard
$link_edit, $dbname_is_wildcard, $hostname, $username
) {
if (strlen($sql_query)) {
$extra_data['sql_query']
@ -1756,14 +1756,14 @@ function PMA_getExtraDataForAjaxBehavior($password, $link_export, $sql_query,
$new_user_string = '<tr>'."\n"
. '<td> <input type="checkbox" name="selected_usr[]" id="checkbox_sel_users_"'
. 'value="'
. htmlspecialchars($_REQUEST['username'])
. '&amp;#27;' . htmlspecialchars($_REQUEST['hostname']) . '" />'
. htmlspecialchars($username)
. '&amp;#27;' . htmlspecialchars($hostname) . '" />'
. '</td>' . "\n"
. '<td><label for="checkbox_sel_users_">'
. (empty($_REQUEST['username'])
? '<span style="color: #FF0000">' . __('Any') . '</span>'
: htmlspecialchars($_REQUEST['username']) ) . '</label></td>' . "\n"
. '<td>' . htmlspecialchars($_REQUEST['hostname']) . '</td>' . "\n";
: htmlspecialchars($username) ) . '</label></td>' . "\n"
. '<td>' . htmlspecialchars($hostname) . '</td>' . "\n";
$new_user_string .= '<td>';
@ -1791,15 +1791,15 @@ function PMA_getExtraDataForAjaxBehavior($password, $link_export, $sql_query,
$new_user_string .= '<td>'
. sprintf($link_edit,
urlencode($_REQUEST['username']),
urlencode($_REQUEST['hostname']),
urlencode($username),
urlencode($hostname),
'', ''
)
. '</td>' . "\n";
$new_user_string .= '<td>'
. sprintf($link_export,
urlencode($_REQUEST['username']),
urlencode($_REQUEST['hostname']),
urlencode($username),
urlencode($hostname),
(isset($_GET['initial']) ? $_GET['initial'] : '')
)
. '</td>' . "\n";
@ -1812,7 +1812,7 @@ function PMA_getExtraDataForAjaxBehavior($password, $link_export, $sql_query,
* Generate the string for this alphabet's initial, to update the user
* pagination
*/
$new_user_initial = strtoupper(substr($_REQUEST['username'], 0, 1));
$new_user_initial = strtoupper(substr($username, 0, 1));
$new_user_initial_string = '<a href="server_privileges.php?'
. $GLOBALS['url_query'] . '&initial=' . $new_user_initial .'">'
. $new_user_initial . '</a>';

View File

@ -379,7 +379,8 @@ if ($GLOBALS['is_ajax_request']
$isPass = true;
}
$extra_data = PMA_getExtraDataForAjaxBehavior($isPass, $link_export,
(isset($sql_query) ? $sql_query : ''), $link_edit, $dbname_is_wildcard
(isset($sql_query) ? $sql_query : ''), $link_edit, $dbname_is_wildcard,
$hostname, $username
);
if ($message instanceof PMA_Message) {