Backport from trunk.

This commit is contained in:
Michal Čihař
2006-12-05 10:24:14 +00:00
parent c7fe79e82e
commit 5ddc03eb7c
2 changed files with 13 additions and 6 deletions

View File

@@ -5,6 +5,11 @@ phpMyAdmin - ChangeLog
$Id$ $Id$
$Source$ $Source$
2006-12-05 Michal Čihař <michal@cihar.com>
* server_privileges.php: Add IF NOT EXISTS to CREATE DATABASE query (RFE
#1608372), reload navigation after creating database.
* server_privileges.php: Use correct links (patch #1607236).
2006-12-04 Marc Delisle <lem9@users.sourceforge.net> 2006-12-04 Marc Delisle <lem9@users.sourceforge.net>
* db_details_structure.php, bug #1605985, missing HTML tag * db_details_structure.php, bug #1605985, missing HTML tag

View File

@@ -470,8 +470,8 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
. $spaces . '<fieldset id="fieldset_user_global_rights">' . "\n" . $spaces . '<fieldset id="fieldset_user_global_rights">' . "\n"
. $spaces . ' <legend>' . "\n" . $spaces . ' <legend>' . "\n"
. $spaces . ' ' . ($db == '*' ? $GLOBALS['strGlobalPrivileges'] : ($table == '*' ? $GLOBALS['strDbPrivileges'] : $GLOBALS['strTblPrivileges'])) . "\n" . $spaces . ' ' . ($db == '*' ? $GLOBALS['strGlobalPrivileges'] : ($table == '*' ? $GLOBALS['strDbPrivileges'] : $GLOBALS['strTblPrivileges'])) . "\n"
. $spaces . ' ( <a href="./server_privileges.php?' . $GLOBALS['url_query'] . '&amp;checkall=1" onclick="setCheckboxes(\'usersForm\', true); return false;">' . $GLOBALS['strCheckAll'] . '</a> /' . "\n" . $spaces . ' ( <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;checkall=1" onclick="setCheckboxes(\'usersForm\', true); return false;">' . $GLOBALS['strCheckAll'] . '</a> /' . "\n"
. $spaces . ' <a href="./server_privileges.php?' . $GLOBALS['url_query'] . '" onclick="setCheckboxes(\'usersForm\', false); return false;">' . $GLOBALS['strUncheckAll'] . '</a> )' . "\n" . $spaces . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '" onclick="setCheckboxes(\'usersForm\', false); return false;">' . $GLOBALS['strUncheckAll'] . '</a> )' . "\n"
. $spaces . ' </legend>' . "\n" . $spaces . ' </legend>' . "\n"
. $spaces . ' <p><small><i>' . $GLOBALS['strEnglishPrivileges'] . '</i></small></p>' . "\n" . $spaces . ' <p><small><i>' . $GLOBALS['strEnglishPrivileges'] . '</i></small></p>' . "\n"
. $spaces . ' <fieldset>' . "\n" . $spaces . ' <fieldset>' . "\n"
@@ -834,9 +834,11 @@ if (!empty($adduser_submit) || !empty($change_copy)) {
/* Create database for new user */ /* Create database for new user */
if (isset($createdb) && $createdb > 0) { if (isset($createdb) && $createdb > 0) {
if ($createdb == 1) { if ($createdb == 1) {
$q = 'CREATE DATABASE ' . PMA_backquote(PMA_sqlAddslashes($username)) . ';'; $q = 'CREATE DATABASE IF NOT EXISTS ' . PMA_backquote(PMA_sqlAddslashes($username)) . ';';
$sql_query .= $q; $sql_query .= $q;
PMA_DBI_try_query($q) or PMA_mysqlDie(PMA_DBI_getError(), $sql_query); PMA_DBI_try_query($q) or PMA_mysqlDie(PMA_DBI_getError(), $sql_query);
$GLOBALS['reload'] = TRUE;
PMA_reloadNavigation();
$q = 'GRANT ALL PRIVILEGES ON ' . PMA_backquote(PMA_sqlAddslashes($username)) . '.* TO \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\';'; $q = 'GRANT ALL PRIVILEGES ON ' . PMA_backquote(PMA_sqlAddslashes($username)) . '.* TO \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\';';
$sql_query .= $q; $sql_query .= $q;
@@ -1413,12 +1415,12 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
echo '<table cellspacing="5"><tr>'; echo '<table cellspacing="5"><tr>';
foreach ($array_initials as $tmp_initial => $initial_was_found) { foreach ($array_initials as $tmp_initial => $initial_was_found) {
if ($initial_was_found) { if ($initial_was_found) {
echo '<td><a href="' . $PHP_SELF . '?' . $GLOBALS['url_query'] . '&amp;initial=' . urlencode($tmp_initial) . '">' . $tmp_initial . '</a></td>' . "\n"; echo '<td><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;initial=' . urlencode($tmp_initial) . '">' . $tmp_initial . '</a></td>' . "\n";
} else { } else {
echo '<td>' . $tmp_initial . '</td>'; echo '<td>' . $tmp_initial . '</td>';
} }
} }
echo '<td><a href="' . $PHP_SELF . '?' . $GLOBALS['url_query'] . '&amp;showall=1">[' . $GLOBALS['strShowAll'] . ']</a></td>' . "\n"; echo '<td><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;showall=1">[' . $GLOBALS['strShowAll'] . ']</a></td>' . "\n";
echo '</tr></table>'; echo '</tr></table>';
/** /**
@@ -1494,7 +1496,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) )
.' src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png"' .' src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png"'
.' width="38" height="22"' .' width="38" height="22"'
.' alt="' . $GLOBALS['strWithChecked'] . '" />' . "\n" .' alt="' . $GLOBALS['strWithChecked'] . '" />' . "\n"
.'<a href="./server_privileges.php?' . $GLOBALS['url_query'] . '&amp;checkall=1"' .'<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;checkall=1"'
.' onclick="if ( markAllRows(\'usersForm\') ) return false;">' .' onclick="if ( markAllRows(\'usersForm\') ) return false;">'
. $GLOBALS['strCheckAll'] . '</a>' . "\n" . $GLOBALS['strCheckAll'] . '</a>' . "\n"
.'/' . "\n" .'/' . "\n"