patch #1821619 [privileges] Extra back reference when editing table-specific privileges

This commit is contained in:
Marc Delisle
2008-12-08 17:39:30 +00:00
parent 8c7f465209
commit 9b5b648e65
4 changed files with 82 additions and 51 deletions

View File

@@ -7,11 +7,13 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
3.2.0.0 (not yet released)
- [core] better support for vendor customisation (based on what Debian needs)
- rfe #2127987 warn when session.gc_maxlifetime is less than cookie validity
- rfe #2100910 configurable default charset for import
- rfe #1913541 link to InnoDB status when error 1005 occurs
- rfe #1927189 strip ` from column names on import
- rfe #1821619 LeftFrameDBSeparator can be an array
+ rfe #2127987 warn when session.gc_maxlifetime is less than cookie validity
+ rfe #2100910 configurable default charset for import
+ rfe #1913541 link to InnoDB status when error 1005 occurs
+ rfe #1927189 strip ` from column names on import
+ rfe #1821619 LeftFrameDBSeparator can be an array
+ patch #1821619 [privileges] Extra back reference when editing table-specific
privileges, thanks to Herman van Rink - helmo
3.1.2.0 (not yet released)
- bug #1253252 [display] Can't NULL a column with relation defined

View File

@@ -2667,31 +2667,12 @@ function PMA_duplicateFirstNewline($string){
* get the action word corresponding to a script name
* in order to display it as a title in navigation panel
*
* @uses switch()
* @uses $GLOBALS
* @param string a valid value for $cfg['LeftDefaultTabTable']
* or $cfg['DefaultTabTable']
* or $cfg['DefaultTabDatabase']
*/
function PMA_getTitleForTarget($target) {
switch ($target) {
case 'tbl_structure.php':
$message = 'strStructure';
break;
case 'tbl_sql.php':
$message = 'strSQL';
break;
case 'tbl_select.php':
$message = 'strSearch';
break;
case 'tbl_change.php':
$message = 'strInsert';
break;
case 'sql.php':
$message = 'strBrowse';
break;
default:
$message = '';
}
return $GLOBALS[$message];
return $GLOBALS[$GLOBALS['cfg']['DefaultTabTranslationMapping'][$target]];
}
?>

View File

@@ -962,6 +962,28 @@ $cfg['DefaultTabDatabase'] = 'db_structure.php';
*/
$cfg['DefaultTabTable'] = 'sql.php';
/**
* Mapping between script filenames and translation keys
*
* Lookup can be performed by PMA_getTitleForTarget()
*
* @global string $cfg['DefaultTabTranslationMapping']
*/
$cfg['DefaultTabTranslationMapping'] = array(
// Values for $cfg['DefaultTabTable']
'tbl_structure.php' => 'strStructure',
'tbl_sql.php' => 'strSQL',
'tbl_select.php' => 'strSearch',
'tbl_change.php' => 'strInsert',
'sql.php' => 'strBrowse',
// Values for $cfg['DefaultTabDatabase']
'db_structure.php' => 'strStructure',
'db_sql.php' => 'strSQL',
'db_search.php' => 'strSearch',
'db_operations.php' => 'strOperations',
);
/*******************************************************************************
* Export defaults

View File

@@ -1543,32 +1543,39 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
echo '<h2>' . "\n"
. PMA_getIcon('b_usredit.png')
. $GLOBALS['strUser'] . ' <i><a href="server_privileges.php?'
. $GLOBALS['url_query'] . '&amp;username=' . urlencode($username)
. '&amp;hostname=' . urlencode($hostname) . '">\''
. htmlspecialchars($username) . '\'@\'' . htmlspecialchars($hostname)
. '\'</a></i>' . "\n";
if (isset($dbname)) {
if ($dbname_is_wildcard) {
echo ' - ' . $GLOBALS['strDatabases'];
} else {
echo ' - ' . $GLOBALS['strDatabase'];
}
$url_dbname = urlencode(str_replace('\_', '_', $dbname));
echo ' <i><a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?'
. $GLOBALS['url_query'] . '&amp;db=' . $url_dbname . '&amp;reload=1">'
. htmlspecialchars($dbname) . '</a></i>' . "\n";
if (isset($tablename)) {
echo ' - ' . $GLOBALS['strTable'] . ' <i><a href="'
. $GLOBALS['cfg']['DefaultTabTable'] . '?' . $GLOBALS['url_query']
. '&amp;db=' . $url_dbname . '&amp;table=' . urlencode($tablename)
. '&amp;reload=1">' . htmlspecialchars($tablename) . '</a></i>'
. "\n";
}
unset($url_dbname);
}
echo ' : ' . $GLOBALS['strEditPrivileges'] . '</h2>' . "\n";
. $GLOBALS['strEditPrivileges'] . ': '
. $GLOBALS['strUser'] ;
if (isset($dbname)) {
echo ' <i><a href="server_privileges.php?'
. $GLOBALS['url_query'] . '&amp;username=' . urlencode($username)
. '&amp;hostname=' . urlencode($hostname) . '">\''
. htmlspecialchars($username) . '\'@\'' . htmlspecialchars($hostname)
. '\'</a></i>' . "\n";
$url_dbname = urlencode(str_replace('\_', '_', $dbname));
if (isset($dbname)) {
if (isset($tablename)) {
echo ' - ' . ($dbname_is_wildcard ? $GLOBALS['strDatabases'] : $GLOBALS['strDatabase'] )
. ' <i><a href="server_privileges.php?' . $GLOBALS['url_query']
. '&amp;username=' . urlencode($username) . '&amp;hostname=' . urlencode($hostname)
. '&amp;dbname=' . $url_dbname . '">' . htmlspecialchars($dbname) . '</a></i>';
echo ' - ' . $GLOBALS['strTable'] . ' <i>' . htmlspecialchars($tablename) . '</i>';
} else {
echo ' - ' . $GLOBALS['strDatabase'] . ' <i>' . htmlspecialchars($dbname) . '</i>';
}
}
} else {
echo ' <i>\'' . htmlspecialchars($username) . '\'@\'' . htmlspecialchars($hostname)
. '\'</i>' . "\n";
}
if (isset($dbname)) {
echo '</h2>' . "\n";
}
$sql = "SELECT '1' FROM `mysql`.`user`"
. " WHERE `User` = '" . PMA_sqlAddslashes($username) . "'"
. " AND `Host` = '" . PMA_sqlAddslashes($hostname) . "';";
@@ -1865,6 +1872,25 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
. ' <input type="submit" value="' . $GLOBALS['strGo'] . '" />'
. '</fieldset>' . "\n"
. '</form>' . "\n";
}
// Provide a line with links to the relevant database and table
if (isset($dbname)) {
echo '[ ' . $GLOBALS['strDatabase']
. ' <a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?'
. $GLOBALS['url_query'] . '&amp;db=' . $url_dbname . '&amp;reload=1">'
. htmlspecialchars($dbname) . ': ' . PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabDatabase']) . "</a> ]\n";
if (isset($tablename)) {
echo ' [ ' . $GLOBALS['strTable'] . ' <a href="'
. $GLOBALS['cfg']['DefaultTabTable'] . '?' . $GLOBALS['url_query']
. '&amp;db=' . $url_dbname . '&amp;table=' . urlencode($tablename)
. '&amp;reload=1">' . htmlspecialchars($tablename) . ': '
. PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable'])
. "</a> ]\n";
}
unset($url_dbname);
}
if (! isset($dbname) && ! $user_does_not_exists) {