diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index 6fc3a28e12..00c26911ad 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -89,6 +89,24 @@ function PMA_rangeOfUsers($initial = '') return $ret; } // end function +/** + * Formats privilege name for a display + * + * @param array $privilege Privilege information + * @param boolean $html Whether to use HTML + * + * @return string + */ +function PMA_formatPrivilege($privilege, $html) +{ + if ($html) { + return '' + . $privilege[1] . ''; + } else { + return $privilege[1]; + } +} + /** * Parses priliveges into an array, it modifies the array * @@ -162,22 +180,12 @@ function PMA_extractPrivInfo($row = null, $enableHTML = false, $tablePrivs = fal && count($GLOBALS[$current_grant[0]]) == $_REQUEST['column_count'] && empty($GLOBALS[$current_grant[0] . '_none'])))) ) { - if ($enableHTML) { - $privs[] = '' - . $current_grant[1] . ''; - } else { - $privs[] = $current_grant[1]; - } + $privs[] = PMA_formatPrivilege($current_grant, $enableHTML); } elseif (! empty($GLOBALS[$current_grant[0]]) && is_array($GLOBALS[$current_grant[0]]) && empty($GLOBALS[$current_grant[0] . '_none']) ) { - if ($enableHTML) { - $priv_string = '' - . $current_grant[1] . ''; - } else { - $priv_string = $current_grant[1]; - } + $privs[] = PMA_formatPrivilege($current_grant, $enableHTML); $privs[] = $priv_string . ' (`' . join('`, `', $GLOBALS[$current_grant[0]]) . '`)'; } else { @@ -1226,8 +1234,9 @@ function PMA_getHtmlForGlobalPrivTableWithCheckboxes( ) . '/>' . "\n" . '' . "\n" + . '' + . PMA_formatPrivilege($priv, true) + . '' . "\n" . '' . "\n"; } $html_output .= '' . "\n";