diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index fc9199a4e9..18483b8dcd 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -183,6 +183,11 @@ function PMA_extractPrivInfo($row = '', $enableHTML = false, $tablePrivs = false return $privs; } // end of the 'PMA_extractPrivInfo()' function +/** + * Returns an array of table grants and their descriptions + * + * @return array array of table grants + */ function PMA_getTableGrantsArray() { return array( @@ -201,11 +206,6 @@ function PMA_getTableGrantsArray() 'DROP', $GLOBALS['strPrivDescDropTbl'] ), - array( - 'Grant', - 'GRANT', - $GLOBALS['strPrivDescGrant'] - ), array( 'Index', 'INDEX', @@ -1823,14 +1823,14 @@ function PMA_getHtmlForSpecificDbPrivileges($db) list($list_of_privileges, $list_of_compared_privileges) = PMA_getListOfPrivilegesAndComparedPrivileges(); - $sql_query = '(SELECT ' . $list_of_privileges . ', `Db`' + $sql_query = '(SELECT ' . $list_of_privileges . ', `Db`, \'d\' AS `Type`' .' FROM `mysql`.`db`' .' WHERE \'' . PMA_Util::sqlAddSlashes($db) . "'" .' LIKE `Db`' .' AND NOT (' . $list_of_compared_privileges. ')) ' .'UNION ' - .'(SELECT ' . $list_of_privileges . ', \'*\' AS `Db`' + .'(SELECT ' . $list_of_privileges . ', \'*\' AS `Db`, \'g\' AS `Type`' .' FROM `mysql`.`user` ' .' WHERE NOT (' . $list_of_compared_privileges . ')) ' .' ORDER BY `User` ASC,' @@ -1929,15 +1929,15 @@ function PMA_getHtmlForSpecificTablePrivileges($db, $table) list($list_of_privileges, $list_of_compared_privileges) = PMA_getListOfPrivilegesAndComparedPrivileges(); - $sql_query + $sql_query = "(" - . " SELECT " . $list_of_privileges . ", '*' AS `Db`" + . " SELECT " . $list_of_privileges . ", '*' AS `Db`, 'g' AS `Type`" . " FROM `mysql`.`user`" . " WHERE NOT (" . $list_of_compared_privileges . ")" . ")" . " UNION " . "(" - . " SELECT " . $list_of_privileges . ", `Db`" + . " SELECT " . $list_of_privileges . ", `Db`, 'd' AS `Type`" . " FROM `mysql`.`db`" . " WHERE '" . PMA_Util::sqlAddSlashes($db) . "' LIKE `Db`" . " AND NOT (" . $list_of_compared_privileges. ")" @@ -1958,7 +1958,8 @@ function PMA_getHtmlForSpecificTablePrivileges($db, $table) $privMap[$user][$host][] = $row; } - $sql_query = "SELECT `User`, `Host`, `Db`, `Table_name`, `Table_priv`" + $sql_query = "SELECT `User`, `Host`, `Db`," + . " 't' AS `Type`, `Table_name`, `Table_priv`" . " FROM `mysql`.`tables_priv`" . " WHERE '" . PMA_Util::sqlAddSlashes($db) . "' LIKE `Db`" . " AND '" . PMA_Util::sqlAddSlashes($table) . "' LIKE `Table_name`" @@ -1987,7 +1988,7 @@ function PMA_getHtmlForSpecificTablePrivileges($db, $table) // Offer to create a new user for the current database $html_output .= '
' - . '' . _pgettext('Create new user', 'New') . ''; + . '' . _pgettext('Create new user', 'New') . ''; $html_output .= '' @@ -2054,20 +2054,19 @@ function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table = n // type $html_output .= ''; - if ($current['Db'] == '*') { + if ($current['Type'] == 'g') { $html_output .= __('global'); - } elseif ($current['Db'] == PMA_Util::escapeMysqlWildcards($db)) { - if (isset($current['Table_name']) - && $current['Table_name'] == PMA_Util::escapeMysqlWildcards($table) - ) { - $html_output .= __('table-specific'); - } else { + } elseif ($current['Type'] == 'd') { + if ($current['Db'] == PMA_Util::escapeMysqlWildcards($db)) { $html_output .= __('database-specific'); + } else { + $html_output .= __('wildcard'). ': ' + . '' + . htmlspecialchars($current['Db']) + . ''; } - } else { - $html_output .= __('wildcard'). ': ' - . '' . htmlspecialchars($current['Db']) - . ''; + } elseif ($current['Type'] == 't') { + $html_output .= __('table-specific'); } $html_output .= ''; @@ -2119,11 +2118,16 @@ function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table = n // action $html_output .= ''; + $specific_db = (isset($current['Db']) && $current['Db'] != '*') + ? $current['Db'] : ''; + $specific_table = (isset($current['Table_name']) + && $current['Table_name'] != '*') + ? $current['Table_name'] : ''; $html_output .= PMA_getUserEditLink( $current_user, $current_host, - (isset($current['Db']) && $current['Db'] != '*') ? $current['Db'] : '', - (isset($current['Table_name']) && $current['Table_name'] != '*') ? $current['Table_name'] : '' + $specific_db, + $specific_table ); $html_output .= ''; @@ -4523,11 +4527,13 @@ function PMA_getHtmlForSubMenusOnUsersPage($selfUrl) $items = array( array( 'name' => __('Users overview'), - 'url' => 'server_privileges.php' + 'url' => 'server_privileges.php', + 'specific_params' => '&viewing_mode=server' ), array( 'name' => __('User groups'), - 'url' => 'server_user_groups.php' + 'url' => 'server_user_groups.php', + 'specific_params' => '' ) ); @@ -4539,7 +4545,8 @@ function PMA_getHtmlForSubMenusOnUsersPage($selfUrl) } $retval .= '
  • '; $retval .= ''; + $retval .= ' href="' . $item['url'] + . '?' . $url_params . $item['specific_params'] . '">'; $retval .= $item['name']; $retval .= ''; $retval .= '
  • ';