diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index a8123a558e..cda36a8c68 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -2681,76 +2681,79 @@ function PMA_getHtmlForUserRights($db_rights, $dbname, ) { $html_output = ''; $found_rows = array(); + // display rows if (count($db_rights) < 1) { $html_output .= '' . "\n" . '
' . __('None') . '
' . "\n" . '' . "\n"; - } else { - $odd_row = true; - //while ($row = $GLOBALS['dbi']->fetchAssoc($res)) { - foreach ($db_rights as $row) { - $dbNameLength = /*overload*/mb_strlen($dbname); - $found_rows[] = (!$dbNameLength) - ? $row['Db'] - : $row['Table_name']; + return array($found_rows, $html_output); + } - $html_output .= '' . "\n" - . '' - . htmlspecialchars( - (!$dbNameLength) - ? $row['Db'] - : $row['Table_name'] - ) - . '' . "\n" - . '' . "\n" - . ' ' - . join( - ',' . "\n" . ' ', - PMA_extractPrivInfo($row, true) - ) . "\n" - . '' . "\n" - . '' - . ((((!$dbNameLength) && $row['Grant_priv'] == 'Y') - || ($dbNameLength - && in_array('Grant', explode(',', $row['Table_priv'])))) - ? __('Yes') - : __('No')) - . '' . "\n" - . ''; - if (! empty($row['Table_privs']) || ! empty ($row['Column_priv'])) { - $html_output .= __('Yes'); - } else { - $html_output .= __('No'); - } - $html_output .= '' . "\n" - . ''; + $odd_row = true; + //while ($row = $GLOBALS['dbi']->fetchAssoc($res)) { + foreach ($db_rights as $row) { + $dbNameLength = /*overload*/mb_strlen($dbname); + $found_rows[] = (!$dbNameLength) + ? $row['Db'] + : $row['Table_name']; + + $html_output .= '' . "\n" + . '' + . htmlspecialchars( + (!$dbNameLength) + ? $row['Db'] + : $row['Table_name'] + ) + . '' . "\n" + . '' . "\n" + . ' ' + . join( + ',' . "\n" . ' ', + PMA_extractPrivInfo($row, true) + ) . "\n" + . '' . "\n" + . '' + . ((((!$dbNameLength) && $row['Grant_priv'] == 'Y') + || ($dbNameLength + && in_array('Grant', explode(',', $row['Table_priv'])))) + ? __('Yes') + : __('No')) + . '' . "\n" + . ''; + if (! empty($row['Table_privs']) || ! empty ($row['Column_priv'])) { + $html_output .= __('Yes'); + } else { + $html_output .= __('No'); + } + $html_output .= '' . "\n" + . ''; + $html_output .= PMA_getUserLink( + 'edit', + $username, + $hostname, + (!$dbNameLength) ? $row['Db'] : $dbname, + (!$dbNameLength) ? '' : $row['Table_name'] + ); + $html_output .= '' . "\n" + . ' '; + if (! empty($row['can_delete']) + || isset($row['Table_name']) + && /*overload*/mb_strlen($row['Table_name']) + ) { $html_output .= PMA_getUserLink( - 'edit', + 'revoke', $username, $hostname, (!$dbNameLength) ? $row['Db'] : $dbname, (!$dbNameLength) ? '' : $row['Table_name'] ); - $html_output .= '' . "\n" - . ' '; - if (! empty($row['can_delete']) - || isset($row['Table_name']) - && /*overload*/mb_strlen($row['Table_name']) - ) { - $html_output .= PMA_getUserLink( - 'revoke', - $username, - $hostname, - (!$dbNameLength) ? $row['Db'] : $dbname, - (!$dbNameLength) ? '' : $row['Table_name'] - ); - } - $html_output .= '' . "\n" - . '' . "\n"; - $odd_row = ! $odd_row; - } // end while - } //end if + } + $html_output .= '' . "\n" + . '' . "\n"; + $odd_row = ! $odd_row; + } // end while + return array($found_rows, $html_output); }