make use of PMA_getIcon()

added support for EVENT and TRIGGER privileges
cleanup
This commit is contained in:
Sebastian Mendel
2007-10-11 09:13:27 +00:00
parent 504150a491
commit 69f193e47c

View File

@@ -46,10 +46,11 @@ if (isset($dbname)) {
if (!$is_superuser) { if (!$is_superuser) {
require './libraries/server_links.inc.php'; require './libraries/server_links.inc.php';
echo '<h2>' . "\n" echo '<h2>' . "\n"
. ($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 'b_usrlist.png" alt="" />' : '') . PMA_getIcon('b_usrlist.png')
. $GLOBALS['strPrivileges'] . "\n" . $GLOBALS['strPrivileges'] . "\n"
. '</h2>' . "\n" . '</h2>' . "\n";
. $GLOBALS['strNoPrivileges'] . "\n"; $message = new PMA_Message('strNoPrivileges', PMA_Message::ERROR);
$message->display();
require_once './libraries/footer.inc.php'; require_once './libraries/footer.inc.php';
} }
@@ -59,9 +60,10 @@ if (!$is_superuser) {
* @param string the user's initial * @param string the user's initial
* @return string the generated condition * @return string the generated condition
*/ */
function PMA_RangeOfUsers($initial = '') { function PMA_RangeOfUsers($initial = '')
// strtolower() is used because the User field {
// might be BINARY, so LIKE would be case sensitive // strtolower() is used because the User field
// might be BINARY, so LIKE would be case sensitive
if (!empty($initial)) { if (!empty($initial)) {
$ret = " WHERE " . PMA_convert_using('User') $ret = " WHERE " . PMA_convert_using('User')
. " LIKE " . PMA_convert_using($initial . '%', 'quoted') . " LIKE " . PMA_convert_using($initial . '%', 'quoted')
@@ -94,7 +96,7 @@ function PMA_extractPrivInfo($row = '', $enableHTML = FALSE)
array('Drop_priv', 'DROP', $GLOBALS['strPrivDescDropDb']), array('Drop_priv', 'DROP', $GLOBALS['strPrivDescDropDb']),
array('Reload_priv', 'RELOAD', $GLOBALS['strPrivDescReload']), array('Reload_priv', 'RELOAD', $GLOBALS['strPrivDescReload']),
array('Shutdown_priv', 'SHUTDOWN', $GLOBALS['strPrivDescShutdown']), array('Shutdown_priv', 'SHUTDOWN', $GLOBALS['strPrivDescShutdown']),
array('Process_priv', 'PROCESS', $GLOBALS['strPrivDescProcess' . ((!empty($row) && isset($row['Super_priv'])) || (empty($row) && isset($GLOBALS['Super_priv'])) ? '4' : '3')]), array('Process_priv', 'PROCESS', $GLOBALS['strPrivDescProcess4']),
array('File_priv', 'FILE', $GLOBALS['strPrivDescFile']), array('File_priv', 'FILE', $GLOBALS['strPrivDescFile']),
array('References_priv', 'REFERENCES', $GLOBALS['strPrivDescReferences']), array('References_priv', 'REFERENCES', $GLOBALS['strPrivDescReferences']),
array('Index_priv', 'INDEX', $GLOBALS['strPrivDescIndex']), array('Index_priv', 'INDEX', $GLOBALS['strPrivDescIndex']),
@@ -106,6 +108,8 @@ function PMA_extractPrivInfo($row = '', $enableHTML = FALSE)
array('Repl_slave_priv', 'REPLICATION SLAVE', $GLOBALS['strPrivDescReplSlave']), array('Repl_slave_priv', 'REPLICATION SLAVE', $GLOBALS['strPrivDescReplSlave']),
array('Repl_client_priv', 'REPLICATION CLIENT', $GLOBALS['strPrivDescReplClient']), array('Repl_client_priv', 'REPLICATION CLIENT', $GLOBALS['strPrivDescReplClient']),
array('Create_view_priv', 'CREATE VIEW', $GLOBALS['strPrivDescCreateView']), array('Create_view_priv', 'CREATE VIEW', $GLOBALS['strPrivDescCreateView']),
array('Event_priv', 'EVENT', $GLOBALS['strPrivDescEvent']),
array('Trigger_priv', 'TRIGGER', $GLOBALS['strPrivDescTrigger']),
// for table privs: // for table privs:
array('Create View_priv', 'CREATE VIEW', $GLOBALS['strPrivDescCreateView']), array('Create View_priv', 'CREATE VIEW', $GLOBALS['strPrivDescCreateView']),
array('Show_view_priv', 'SHOW VIEW', $GLOBALS['strPrivDescShowView']), array('Show_view_priv', 'SHOW VIEW', $GLOBALS['strPrivDescShowView']),
@@ -136,14 +140,23 @@ function PMA_extractPrivInfo($row = '', $enableHTML = FALSE)
$privs = array(); $privs = array();
$allPrivileges = TRUE; $allPrivileges = TRUE;
foreach ($grants as $current_grant) { foreach ($grants as $current_grant) {
if ((!empty($row) && isset($row[$current_grant[0]])) || (empty($row) && isset($GLOBALS[$current_grant[0]]))) { if ((!empty($row) && isset($row[$current_grant[0]]))
if ((!empty($row) && $row[$current_grant[0]] == 'Y') || (empty($row) && ($GLOBALS[$current_grant[0]] == 'Y' || (is_array($GLOBALS[$current_grant[0]]) && count($GLOBALS[$current_grant[0]]) == $GLOBALS['column_count'] && empty($GLOBALS[$current_grant[0] . '_none']))))) { || (empty($row) && isset($GLOBALS[$current_grant[0]]))) {
if ((!empty($row) && $row[$current_grant[0]] == 'Y')
|| (empty($row)
&& ($GLOBALS[$current_grant[0]] == 'Y'
|| (is_array($GLOBALS[$current_grant[0]])
&& count($GLOBALS[$current_grant[0]]) == $GLOBALS['column_count']
&& empty($GLOBALS[$current_grant[0] . '_none'])))))
{
if ($enableHTML) { if ($enableHTML) {
$privs[] = '<dfn title="' . $current_grant[2] . '">' . $current_grant[1] . '</dfn>'; $privs[] = '<dfn title="' . $current_grant[2] . '">' . $current_grant[1] . '</dfn>';
} else { } else {
$privs[] = $current_grant[1]; $privs[] = $current_grant[1];
} }
} elseif (!empty($GLOBALS[$current_grant[0]]) && is_array($GLOBALS[$current_grant[0]]) && empty($GLOBALS[$current_grant[0] . '_none'])) { } elseif (!empty($GLOBALS[$current_grant[0]])
&& is_array($GLOBALS[$current_grant[0]])
&& empty($GLOBALS[$current_grant[0] . '_none'])) {
if ($enableHTML) { if ($enableHTML) {
$priv_string = '<dfn title="' . $current_grant[2] . '">' . $current_grant[1] . '</dfn>'; $priv_string = '<dfn title="' . $current_grant[2] . '">' . $current_grant[1] . '</dfn>';
} else { } else {
@@ -171,52 +184,56 @@ function PMA_extractPrivInfo($row = '', $enableHTML = FALSE)
return $privs; return $privs;
} // end of the 'PMA_extractPrivInfo()' function } // end of the 'PMA_extractPrivInfo()' function
/** /**
* Displays on which column(s) a table-specific privilege is granted * Displays on which column(s) a table-specific privilege is granted
*/ */
function PMA_display_column_privs($spaces, $columns, $row, $name_for_select, $priv_for_header, $name, $name_for_dfn, $name_for_current) { function PMA_display_column_privs($columns, $row, $name_for_select,
$priv_for_header, $name, $name_for_dfn, $name_for_current)
echo $spaces . ' <div class="item" id="div_item_' . $name . '">' . "\n" {
. $spaces . ' <label for="select_' . $name . '_priv">' . "\n" echo ' <div class="item" id="div_item_' . $name . '">' . "\n"
. $spaces . ' <tt><dfn title="' . $name_for_dfn . '">' . $priv_for_header . '</dfn></tt>' . "\n" . ' <label for="select_' . $name . '_priv">' . "\n"
. $spaces . ' </label>' . "\n" . ' <tt><dfn title="' . $name_for_dfn . '">'
. $spaces . ' <select id="select_' . $name . '_priv" name="' . $name_for_select . '[]" multiple="multiple">' . "\n"; . $priv_for_header . '</dfn></tt>' . "\n"
. ' </label>' . "\n"
. ' <select id="select_' . $name . '_priv" name="'
. $name_for_select . '[]" multiple="multiple">' . "\n";
foreach ($columns as $current_column => $current_column_privileges) { foreach ($columns as $current_column => $current_column_privileges) {
echo $spaces . ' <option value="' . htmlspecialchars($current_column) . '"'; echo ' <option value="' . htmlspecialchars($current_column) . '"';
if ($row[$name_for_select] == 'Y' || $current_column_privileges[$name_for_current]) { if ($row[$name_for_select] == 'Y' || $current_column_privileges[$name_for_current]) {
echo ' selected="selected"'; echo ' selected="selected"';
} }
echo '>' . htmlspecialchars($current_column) . '</option>' . "\n"; echo '>' . htmlspecialchars($current_column) . '</option>' . "\n";
} }
echo $spaces . ' </select>' . "\n" echo ' </select>' . "\n"
. $spaces . ' <i>' . $GLOBALS['strOr'] . '</i>' . "\n" . ' <i>' . $GLOBALS['strOr'] . '</i>' . "\n"
. $spaces . ' <label for="checkbox_' . $name_for_select . '_none"><input type="checkbox"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' name="' . $name_for_select . '_none" id="checkbox_' . $name_for_select . '_none" title="' . $GLOBALS['strNone'] . '" />' . ' <label for="checkbox_' . $name_for_select
. $GLOBALS['strNone'] . '</label>' . "\n" . '_none"><input type="checkbox"'
. $spaces . ' </div>' . "\n"; . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"')
. ' name="' . $name_for_select . '_none" id="checkbox_'
. $name_for_select . '_none" title="' . $GLOBALS['strNone'] . '" />'
. $GLOBALS['strNone'] . '</label>' . "\n"
. ' </div>' . "\n";
} // end function } // end function
/** /**
* Displays the privileges form table * Displays the privileges form table
* *
* @param string $db the database * @param string $db the database
* @param string $table the table * @param string $table the table
* @param boolean $submit wheather to display the submit button or not * @param boolean $submit wheather to display the submit button or not
* @param int $indent the indenting level of the code
*
* @global array $cfg the phpMyAdmin configuration * @global array $cfg the phpMyAdmin configuration
* @global ressource $user_link the database connection * @global ressource $user_link the database connection
* *
* @return void * @return void
*/ */
function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = 0) function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE)
{ {
if ($db == '*') { if ($db == '*') {
$table = '*'; $table = '*';
} }
$spaces = str_repeat(' ', $indent);
if (isset($GLOBALS['username'])) { if (isset($GLOBALS['username'])) {
$username = $GLOBALS['username']; $username = $GLOBALS['username'];
@@ -333,27 +350,32 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
PMA_DBI_free_result($res); PMA_DBI_free_result($res);
unset($res, $row1, $current); unset($res, $row1, $current);
echo $spaces . '<input type="hidden" name="grant_count" value="' . count($row) . '" />' . "\n" echo '<input type="hidden" name="grant_count" value="' . count($row) . '" />' . "\n"
. $spaces . '<input type="hidden" name="column_count" value="' . count($columns) . '" />' . "\n" . '<input type="hidden" name="column_count" value="' . count($columns) . '" />' . "\n"
. $spaces . '<fieldset id="fieldset_user_priv">' . "\n" . '<fieldset id="fieldset_user_priv">' . "\n"
. $spaces . ' <legend>' . $GLOBALS['strTblPrivileges'] . '</legend>' . "\n" . ' <legend>' . $GLOBALS['strTblPrivileges'] . '</legend>' . "\n"
. $spaces . ' <p><small><i>' . $GLOBALS['strEnglishPrivileges'] . '</i></small></p>' . "\n"; . ' <p><small><i>' . $GLOBALS['strEnglishPrivileges'] . '</i></small></p>' . "\n";
// privs that are attached to a specific column // privs that are attached to a specific column
PMA_display_column_privs($spaces, $columns, $row, 'Select_priv', 'SELECT', 'select', $GLOBALS['strPrivDescSelect'], 'Select'); PMA_display_column_privs($columns, $row, 'Select_priv',
'SELECT', 'select', $GLOBALS['strPrivDescSelect'], 'Select');
PMA_display_column_privs($spaces, $columns, $row, 'Insert_priv', 'INSERT', 'insert', $GLOBALS['strPrivDescInsert'], 'Insert'); PMA_display_column_privs($columns, $row, 'Insert_priv',
'INSERT', 'insert', $GLOBALS['strPrivDescInsert'], 'Insert');
PMA_display_column_privs($spaces, $columns, $row, 'Update_priv', 'UPDATE', 'update', $GLOBALS['strPrivDescUpdate'], 'Update'); PMA_display_column_privs($columns, $row, 'Update_priv',
'UPDATE', 'update', $GLOBALS['strPrivDescUpdate'], 'Update');
PMA_display_column_privs($spaces, $columns, $row, 'References_priv', 'REFERENCES', 'references', $GLOBALS['strPrivDescReferences'], 'References'); PMA_display_column_privs($columns, $row, 'References_priv',
'REFERENCES', 'references', $GLOBALS['strPrivDescReferences'], 'References');
// privs that are not attached to a specific column // privs that are not attached to a specific column
echo $spaces . ' <div class="item">' . "\n"; echo ' <div class="item">' . "\n";
foreach ($row as $current_grant => $current_grant_value) { foreach ($row as $current_grant => $current_grant_value) {
if (in_array(substr($current_grant, 0, (strlen($current_grant) - 5)), array('Select', 'Insert', 'Update', 'References'))) { if (in_array(substr($current_grant, 0, (strlen($current_grant) - 5)),
array('Select', 'Insert', 'Update', 'References'))) {
continue; continue;
} }
// make a substitution to match the messages variables; // make a substitution to match the messages variables;
@@ -370,18 +392,30 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
$tmp_current_grant = $current_grant; $tmp_current_grant = $current_grant;
} }
echo $spaces . ' <div class="item">' . "\n" echo ' <div class="item">' . "\n"
. $spaces . ' <input type="checkbox"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' name="' . $current_grant . '" id="checkbox_' . $current_grant . '" value="Y" ' . ($current_grant_value == 'Y' ? 'checked="checked" ' : '') . 'title="'; . ' <input type="checkbox"'
. (empty($GLOBALS['checkall']) ? '' : ' checked="checked"')
. ' name="' . $current_grant . '" id="checkbox_' . $current_grant
. '" value="Y" '
. ($current_grant_value == 'Y' ? 'checked="checked" ' : '')
. 'title="';
echo (isset($GLOBALS['strPrivDesc' . substr($tmp_current_grant, 0, (strlen($tmp_current_grant) - 5))]) ? $GLOBALS['strPrivDesc' . substr($tmp_current_grant, 0, (strlen($tmp_current_grant) - 5))] : $GLOBALS['strPrivDesc' . substr($tmp_current_grant, 0, (strlen($tmp_current_grant) - 5)) . 'Tbl']) . '"/>' . "\n"; echo (isset($GLOBALS['strPrivDesc' . substr($tmp_current_grant, 0, (strlen($tmp_current_grant) - 5))])
? $GLOBALS['strPrivDesc' . substr($tmp_current_grant, 0, (strlen($tmp_current_grant) - 5))]
: $GLOBALS['strPrivDesc' . substr($tmp_current_grant, 0, (strlen($tmp_current_grant) - 5)) . 'Tbl']) . '"/>' . "\n";
echo $spaces . ' <label for="checkbox_' . $current_grant . '"><tt><dfn title="' . (isset($GLOBALS['strPrivDesc' . substr($tmp_current_grant, 0, (strlen($tmp_current_grant) - 5))]) ? $GLOBALS['strPrivDesc' . substr($tmp_current_grant, 0, (strlen($tmp_current_grant) - 5))] : $GLOBALS['strPrivDesc' . substr($tmp_current_grant, 0, (strlen($tmp_current_grant) - 5)) . 'Tbl']) . '">' . strtoupper(substr($current_grant, 0, strlen($current_grant) - 5)) . '</dfn></tt></label>' . "\n" echo ' <label for="checkbox_' . $current_grant
. $spaces . ' </div>' . "\n"; . '"><tt><dfn title="'
. (isset($GLOBALS['strPrivDesc' . substr($tmp_current_grant, 0, (strlen($tmp_current_grant) - 5))])
? $GLOBALS['strPrivDesc' . substr($tmp_current_grant, 0, (strlen($tmp_current_grant) - 5))]
: $GLOBALS['strPrivDesc' . substr($tmp_current_grant, 0, (strlen($tmp_current_grant) - 5)) . 'Tbl'])
. '">' . strtoupper(substr($current_grant, 0, strlen($current_grant) - 5)) . '</dfn></tt></label>' . "\n"
. ' </div>' . "\n";
} // end foreach () } // end foreach ()
echo $spaces . ' </div>' . "\n"; echo ' </div>' . "\n";
// for Safari 2.0.2 // for Safari 2.0.2
echo $spaces . ' <div class="clearfloat"></div>' . "\n"; echo ' <div class="clearfloat"></div>' . "\n";
} else { } else {
@@ -403,11 +437,13 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
array('Create', 'CREATE', ($table == '*' ? $GLOBALS['strPrivDescCreateDb'] : $GLOBALS['strPrivDescCreateTbl'])), array('Create', 'CREATE', ($table == '*' ? $GLOBALS['strPrivDescCreateDb'] : $GLOBALS['strPrivDescCreateTbl'])),
array('Alter', 'ALTER', $GLOBALS['strPrivDescAlter']), array('Alter', 'ALTER', $GLOBALS['strPrivDescAlter']),
array('Index', 'INDEX', $GLOBALS['strPrivDescIndex']), array('Index', 'INDEX', $GLOBALS['strPrivDescIndex']),
array('Drop', 'DROP', ($table == '*' ? $GLOBALS['strPrivDescDropDb'] : $GLOBALS['strPrivDescDropTbl'])) array('Drop', 'DROP', ($table == '*' ? $GLOBALS['strPrivDescDropDb'] : $GLOBALS['strPrivDescDropTbl'])),
array('Create_tmp_table', 'CREATE TEMPORARY TABLES', $GLOBALS['strPrivDescCreateTmpTable']),
array('Show_view', 'SHOW VIEW', $GLOBALS['strPrivDescShowView']),
array('Create_routine', 'CREATE ROUTINE', $GLOBALS['strPrivDescCreateRoutine']),
array('Alter_routine', 'ALTER ROUTINE', $GLOBALS['strPrivDescAlterRoutine']),
array('Execute', 'EXECUTE', $GLOBALS['strPrivDescExecute5']),
); );
if (isset($row['Create_tmp_table_priv'])) {
$privTable[1][] = array('Create_tmp_table', 'CREATE TEMPORARY TABLES', $GLOBALS['strPrivDescCreateTmpTable']);
}
// this one is for a db-specific priv: Create_view_priv // this one is for a db-specific priv: Create_view_priv
if (isset($row['Create_view_priv'])) { if (isset($row['Create_view_priv'])) {
$privTable[1][] = array('Create_view', 'CREATE VIEW', $GLOBALS['strPrivDescCreateView']); $privTable[1][] = array('Create_view', 'CREATE VIEW', $GLOBALS['strPrivDescCreateView']);
@@ -416,125 +452,140 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
if (isset($row['Create View_priv'])) { if (isset($row['Create View_priv'])) {
$privTable[1][] = array('Create View', 'CREATE VIEW', $GLOBALS['strPrivDescCreateView']); $privTable[1][] = array('Create View', 'CREATE VIEW', $GLOBALS['strPrivDescCreateView']);
} }
if (isset($row['Show_view_priv'])) { if (isset($row['Event_priv'])) {
$privTable[1][] = array('Show_view', 'SHOW VIEW', $GLOBALS['strPrivDescShowView']); // MySQL 5.1.6
} $privTable[1][] = array('Event', 'EVENT', $GLOBALS['strPrivDescEvent']);
if (isset($row['Create_routine_priv'])) { $privTable[1][] = array('Trigger', 'TRIGGER', $GLOBALS['strPrivDescTrigger']);
$privTable[1][] = array('Create_routine', 'CREATE ROUTINE', $GLOBALS['strPrivDescCreateRoutine']);
}
if (isset($row['Alter_routine_priv'])) {
$privTable[1][] = array('Alter_routine', 'ALTER ROUTINE', $GLOBALS['strPrivDescAlterRoutine']);
}
if (isset($row['Execute_priv'])) {
$privTable[1][] = array('Execute', 'EXECUTE', $GLOBALS['strPrivDescExecute5']);
} }
// a d m i n i s t r a t i o n // a d m i n i s t r a t i o n
$privTable[2] = array(); $privTable[2] = array(
if (isset($row['Grant_priv'])) { array('Grant', 'GRANT', $GLOBALS['strPrivDescGrant']),
$privTable[2][] = array('Grant', 'GRANT', $GLOBALS['strPrivDescGrant']); );
}
if ($db == '*') { if ($db == '*') {
if (isset($row['Super_priv'])) { $privTable[2][] = array('Super', 'SUPER', $GLOBALS['strPrivDescSuper']);
$privTable[2][] = array('Super', 'SUPER', $GLOBALS['strPrivDescSuper']); $privTable[2][] = array('Process', 'PROCESS', $GLOBALS['strPrivDescProcess4']);
$privTable[2][] = array('Process', 'PROCESS', $GLOBALS['strPrivDescProcess4']);
} else {
$privTable[2][] = array('Process', 'PROCESS', $GLOBALS['strPrivDescProcess3']);
}
$privTable[2][] = array('Reload', 'RELOAD', $GLOBALS['strPrivDescReload']); $privTable[2][] = array('Reload', 'RELOAD', $GLOBALS['strPrivDescReload']);
$privTable[2][] = array('Shutdown', 'SHUTDOWN', $GLOBALS['strPrivDescShutdown']); $privTable[2][] = array('Shutdown', 'SHUTDOWN', $GLOBALS['strPrivDescShutdown']);
if (isset($row['Show_db_priv'])) { $privTable[2][] = array('Show_db', 'SHOW DATABASES', $GLOBALS['strPrivDescShowDb']);
$privTable[2][] = array('Show_db', 'SHOW DATABASES', $GLOBALS['strPrivDescShowDb']);
}
}
if (isset($row['Lock_tables_priv'])) {
$privTable[2][] = array('Lock_tables', 'LOCK TABLES', $GLOBALS['strPrivDescLockTables']);
} }
$privTable[2][] = array('Lock_tables', 'LOCK TABLES', $GLOBALS['strPrivDescLockTables']);
$privTable[2][] = array('References', 'REFERENCES', $GLOBALS['strPrivDescReferences']); $privTable[2][] = array('References', 'REFERENCES', $GLOBALS['strPrivDescReferences']);
if ($db == '*') { if ($db == '*') {
//if (isset($row['Execute_priv'])) { $privTable[2][] = array('Repl_client', 'REPLICATION CLIENT', $GLOBALS['strPrivDescReplClient']);
// $privTable[2][] = array('Execute', 'EXECUTE', $GLOBALS['strPrivDescExecute']); $privTable[2][] = array('Repl_slave', 'REPLICATION SLAVE', $GLOBALS['strPrivDescReplSlave']);
//} $privTable[2][] = array('Create_user', 'CREATE USER', $GLOBALS['strPrivDescCreateUser']);
if (isset($row['Repl_client_priv'])) {
$privTable[2][] = array('Repl_client', 'REPLICATION CLIENT', $GLOBALS['strPrivDescReplClient']);
}
if (isset($row['Repl_slave_priv'])) {
$privTable[2][] = array('Repl_slave', 'REPLICATION SLAVE', $GLOBALS['strPrivDescReplSlave']);
}
if (isset($row['Create_user_priv'])) {
$privTable[2][] = array('Create_user', 'CREATE USER', $GLOBALS['strPrivDescCreateUser']);
}
} }
echo $spaces . '<input type="hidden" name="grant_count" value="' . (count($privTable[0]) + count($privTable[1]) + count($privTable[2]) - (isset($row['Grant_priv']) ? 1 : 0)) . '" />' . "\n" echo '<input type="hidden" name="grant_count" value="'
. $spaces . '<fieldset id="fieldset_user_global_rights">' . "\n" . (count($privTable[0]) + count($privTable[1]) + count($privTable[2]) - (isset($row['Grant_priv']) ? 1 : 0))
. $spaces . ' <legend>' . "\n" . '" />' . "\n"
. $spaces . ' ' . ($db == '*' ? $GLOBALS['strGlobalPrivileges'] : ($table == '*' ? $GLOBALS['strDbPrivileges'] : $GLOBALS['strTblPrivileges'])) . "\n" . '<fieldset id="fieldset_user_global_rights">' . "\n"
. $spaces . ' (<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;checkall=1" onclick="setCheckboxes(\'usersForm\', true); return false;">' . $GLOBALS['strCheckAll'] . '</a> /' . "\n" . ' <legend>' . "\n"
. $spaces . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '" onclick="setCheckboxes(\'usersForm\', false); return false;">' . $GLOBALS['strUncheckAll'] . '</a>)' . "\n" . ' '
. $spaces . ' </legend>' . "\n" . ($db == '*'
. $spaces . ' <p><small><i>' . $GLOBALS['strEnglishPrivileges'] . '</i></small></p>' . "\n" ? $GLOBALS['strGlobalPrivileges']
. $spaces . ' <fieldset>' . "\n" : ($table == '*'
. $spaces . ' <legend>' . $GLOBALS['strData'] . '</legend>' . "\n"; ? $GLOBALS['strDbPrivileges']
: $GLOBALS['strTblPrivileges'])) . "\n"
. ' (<a href="server_privileges.php?'
. $GLOBALS['url_query'] . '&amp;checkall=1" onclick="setCheckboxes(\'usersForm\', true); return false;">'
. $GLOBALS['strCheckAll'] . '</a> /' . "\n"
. ' <a href="server_privileges.php?'
. $GLOBALS['url_query'] . '" onclick="setCheckboxes(\'usersForm\', false); return false;">'
. $GLOBALS['strUncheckAll'] . '</a>)' . "\n"
. ' </legend>' . "\n"
. ' <p><small><i>' . $GLOBALS['strEnglishPrivileges'] . '</i></small></p>' . "\n"
. ' <fieldset>' . "\n"
. ' <legend>' . $GLOBALS['strData'] . '</legend>' . "\n";
foreach ($privTable[0] as $priv) foreach ($privTable[0] as $priv)
{ {
echo $spaces . ' <div class="item">' . "\n" echo ' <div class="item">' . "\n"
. $spaces . ' <input type="checkbox"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0] . '_priv" value="Y" ' . ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '') . 'title="' . $priv[2] . '"/>' . "\n" . ' <input type="checkbox"'
. $spaces . ' <label for="checkbox_' . $priv[0] . '_priv"><tt><dfn title="' . $priv[2] . '">' . $priv[1] . '</dfn></tt></label>' . "\n" . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"')
. $spaces . ' </div>' . "\n"; . ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0]
. '_priv" value="Y" '
. ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '')
. 'title="' . $priv[2] . '"/>' . "\n"
. ' <label for="checkbox_' . $priv[0]
. '_priv"><tt><dfn title="' . $priv[2] . '">' . $priv[1]
. '</dfn></tt></label>' . "\n"
. ' </div>' . "\n";
} }
echo $spaces . ' </fieldset>' . "\n" echo ' </fieldset>' . "\n"
. $spaces . ' <fieldset>' . "\n" . ' <fieldset>' . "\n"
. $spaces . ' <legend>' . $GLOBALS['strStructure'] . '</legend>' . "\n"; . ' <legend>' . $GLOBALS['strStructure'] . '</legend>' . "\n";
foreach ($privTable[1] as $priv) foreach ($privTable[1] as $priv)
{ {
echo $spaces . ' <div class="item">' . "\n" echo ' <div class="item">' . "\n"
. $spaces . ' <input type="checkbox"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0] . '_priv" value="Y" ' . ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '') . 'title="' . $priv[2] . '"/>' . "\n" . ' <input type="checkbox"'
. $spaces . ' <label for="checkbox_' . $priv[0] . '_priv"><tt><dfn title="' . $priv[2] . '">' . $priv[1] . '</dfn></tt></label>' . "\n" . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"')
. $spaces . ' </div>' . "\n"; . ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0]
. '_priv" value="Y" '
. ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '')
. 'title="' . $priv[2] . '"/>' . "\n"
. ' <label for="checkbox_' . $priv[0]
. '_priv"><tt><dfn title="' . $priv[2] . '">' . $priv[1]
. '</dfn></tt></label>' . "\n"
. ' </div>' . "\n";
} }
echo $spaces . ' </fieldset>' . "\n" echo ' </fieldset>' . "\n"
. $spaces . ' <fieldset>' . "\n" . ' <fieldset>' . "\n"
. $spaces . ' <legend>' . $GLOBALS['strAdministration'] . '</legend>' . "\n"; . ' <legend>' . $GLOBALS['strAdministration'] . '</legend>' . "\n";
foreach ($privTable[2] as $priv) foreach ($privTable[2] as $priv)
{ {
echo $spaces . ' <div class="item">' . "\n" echo ' <div class="item">' . "\n"
. $spaces . ' <input type="checkbox"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0] . '_priv" value="Y" ' . ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '') . 'title="' . $priv[2] . '"/>' . "\n" . ' <input type="checkbox"'
. $spaces . ' <label for="checkbox_' . $priv[0] . '_priv"><tt><dfn title="' . $priv[2] . '">' . $priv[1] . '</dfn></tt></label>' . "\n" . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"')
. $spaces . ' </div>' . "\n"; . ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0]
. '_priv" value="Y" '
. ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '')
. 'title="' . $priv[2] . '"/>' . "\n"
. ' <label for="checkbox_' . $priv[0]
. '_priv"><tt><dfn title="' . $priv[2] . '">' . $priv[1]
. '</dfn></tt></label>' . "\n"
. ' </div>' . "\n";
} }
echo $spaces . ' </fieldset>' . "\n"; echo ' </fieldset>' . "\n";
// The "Resource limits" box is not displayed for db-specific privs // The "Resource limits" box is not displayed for db-specific privs
if ($db == '*') { if ($db == '*') {
echo $spaces . ' <fieldset>' . "\n" echo ' <fieldset>' . "\n"
. $spaces . ' <legend>' . $GLOBALS['strResourceLimits'] . '</legend>' . "\n" . ' <legend>' . $GLOBALS['strResourceLimits'] . '</legend>' . "\n"
. $spaces . ' <p><small><i>' . $GLOBALS['strZeroRemovesTheLimit'] . '</i></small></p>' . "\n" . ' <p><small><i>' . $GLOBALS['strZeroRemovesTheLimit'] . '</i></small></p>' . "\n"
. $spaces . ' <div class="item">' . "\n" . ' <div class="item">' . "\n"
. $spaces . ' <label for="text_max_questions"><tt><dfn title="' . $GLOBALS['strPrivDescMaxQuestions'] . '">MAX QUERIES PER HOUR</dfn></tt></label>' . "\n" . ' <label for="text_max_questions"><tt><dfn title="'
. $spaces . ' <input type="text" name="max_questions" id="text_max_questions" value="' . $row['max_questions'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxQuestions'] . '" />' . "\n" . $GLOBALS['strPrivDescMaxQuestions'] . '">MAX QUERIES PER HOUR</dfn></tt></label>' . "\n"
. $spaces . ' </div>' . "\n" . ' <input type="text" name="max_questions" id="text_max_questions" value="'
. $spaces . ' <div class="item">' . "\n" . $row['max_questions'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxQuestions'] . '" />' . "\n"
. $spaces . ' <label for="text_max_updates"><tt><dfn title="' . $GLOBALS['strPrivDescMaxUpdates'] . '">MAX UPDATES PER HOUR</dfn></tt></label>' . "\n" . ' </div>' . "\n"
. $spaces . ' <input type="text" name="max_updates" id="text_max_updates" value="' . $row['max_updates'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxUpdates'] . '" />' . "\n" . ' <div class="item">' . "\n"
. $spaces . ' </div>' . "\n" . ' <label for="text_max_updates"><tt><dfn title="'
. $spaces . ' <div class="item">' . "\n" . $GLOBALS['strPrivDescMaxUpdates'] . '">MAX UPDATES PER HOUR</dfn></tt></label>' . "\n"
. $spaces . ' <label for="text_max_connections"><tt><dfn title="' . $GLOBALS['strPrivDescMaxConnections'] . '">MAX CONNECTIONS PER HOUR</dfn></tt></label>' . "\n" . ' <input type="text" name="max_updates" id="text_max_updates" value="'
. $spaces . ' <input type="text" name="max_connections" id="text_max_connections" value="' . $row['max_connections'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxConnections'] . '" />' . "\n" . $row['max_updates'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxUpdates'] . '" />' . "\n"
. $spaces . ' </div>' . "\n" . ' </div>' . "\n"
. $spaces . ' <div class="item">' . "\n" . ' <div class="item">' . "\n"
. $spaces . ' <label for="text_max_user_connections"><tt><dfn title="' . $GLOBALS['strPrivDescMaxUserConnections'] . '">MAX USER_CONNECTIONS</dfn></tt></label>' . "\n" . ' <label for="text_max_connections"><tt><dfn title="'
. $spaces . ' <input type="text" name="max_user_connections" id="text_max_user_connections" value="' . $row['max_user_connections'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxUserConnections'] . '" />' . "\n" . $GLOBALS['strPrivDescMaxConnections'] . '">MAX CONNECTIONS PER HOUR</dfn></tt></label>' . "\n"
. $spaces . ' </div>' . "\n" . ' <input type="text" name="max_connections" id="text_max_connections" value="'
. $spaces . ' </fieldset>' . "\n"; . $row['max_connections'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxConnections'] . '" />' . "\n"
. ' </div>' . "\n"
. ' <div class="item">' . "\n"
. ' <label for="text_max_user_connections"><tt><dfn title="'
. $GLOBALS['strPrivDescMaxUserConnections'] . '">MAX USER_CONNECTIONS</dfn></tt></label>' . "\n"
. ' <input type="text" name="max_user_connections" id="text_max_user_connections" value="'
. $row['max_user_connections'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxUserConnections'] . '" />' . "\n"
. ' </div>' . "\n"
. ' </fieldset>' . "\n";
} }
// for Safari 2.0.2 // for Safari 2.0.2
echo $spaces . ' <div class="clearfloat"></div>' . "\n"; echo ' <div class="clearfloat"></div>' . "\n";
} }
echo $spaces . '</fieldset>' . "\n"; echo '</fieldset>' . "\n";
if ($submit) { if ($submit) {
echo $spaces . '<fieldset id="fieldset_user_privtable_footer" class="tblFooters">' . "\n" echo '<fieldset id="fieldset_user_privtable_footer" class="tblFooters">' . "\n"
. $spaces . ' <input type="submit" name="update_privs" value="' . $GLOBALS['strGo'] . '" />' . "\n" . ' <input type="submit" name="update_privs" value="' . $GLOBALS['strGo'] . '" />' . "\n"
. $spaces . '</fieldset>' . "\n"; . '</fieldset>' . "\n";
} }
} // end of the 'PMA_displayPrivTable()' function } // end of the 'PMA_displayPrivTable()' function
@@ -545,16 +596,13 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
* *
* @param string $mode are we creating a new user or are we just * @param string $mode are we creating a new user or are we just
* changing one? (allowed values: 'new', 'change') * changing one? (allowed values: 'new', 'change')
* @param int $indent the indenting level of the code
*
* @global array $cfg the phpMyAdmin configuration * @global array $cfg the phpMyAdmin configuration
* @global ressource $user_link the database connection * @global ressource $user_link the database connection
* *
* @return void * @return void
*/ */
function PMA_displayLoginInformationFields($mode = 'new', $indent = 0) { function PMA_displayLoginInformationFields($mode = 'new')
$spaces = str_repeat(' ', $indent); {
// Get user/host name lengths // Get user/host name lengths
$fields_info = PMA_DBI_get_fields('mysql', 'user'); $fields_info = PMA_DBI_get_fields('mysql', 'user');
$username_length = 16; $username_length = 16;
@@ -579,27 +627,34 @@ function PMA_displayLoginInformationFields($mode = 'new', $indent = 0) {
if (isset($GLOBALS['username']) && strlen($GLOBALS['username']) === 0) { if (isset($GLOBALS['username']) && strlen($GLOBALS['username']) === 0) {
$GLOBALS['pred_username'] = 'any'; $GLOBALS['pred_username'] = 'any';
} }
echo $spaces . '<fieldset id="fieldset_add_user_login">' . "\n" echo '<fieldset id="fieldset_add_user_login">' . "\n"
. $spaces . '<legend>' . $GLOBALS['strLoginInformation'] . '</legend>' . "\n" . '<legend>' . $GLOBALS['strLoginInformation'] . '</legend>' . "\n"
. $spaces . '<div class="item">' . "\n" . '<div class="item">' . "\n"
. $spaces . '<label for="select_pred_username">' . "\n" . '<label for="select_pred_username">' . "\n"
. $spaces . ' ' . $GLOBALS['strUserName'] . ':' . "\n" . ' ' . $GLOBALS['strUserName'] . ':' . "\n"
. $spaces . '</label>' . "\n" . '</label>' . "\n"
. $spaces . '<span class="options">' . "\n" . '<span class="options">' . "\n"
. $spaces . ' <select name="pred_username" id="select_pred_username" title="' . $GLOBALS['strUserName'] . '"' . "\n" . ' <select name="pred_username" id="select_pred_username" title="' . $GLOBALS['strUserName'] . '"' . "\n"
. $spaces . ' onchange="if (this.value == \'any\') { username.value = \'\'; } else if (this.value == \'userdefined\') { username.focus(); username.select(); }">' . "\n" . ' onchange="if (this.value == \'any\') { username.value = \'\'; } else if (this.value == \'userdefined\') { username.focus(); username.select(); }">' . "\n"
. $spaces . ' <option value="any"' . ((isset($GLOBALS['pred_username']) && $GLOBALS['pred_username'] == 'any') ? ' selected="selected"' : '') . '>' . $GLOBALS['strAnyUser'] . '</option>' . "\n" . ' <option value="any"' . ((isset($GLOBALS['pred_username']) && $GLOBALS['pred_username'] == 'any') ? ' selected="selected"' : '') . '>' . $GLOBALS['strAnyUser'] . '</option>' . "\n"
. $spaces . ' <option value="userdefined"' . ((!isset($GLOBALS['pred_username']) || $GLOBALS['pred_username'] == 'userdefined') ? ' selected="selected"' : '') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n" . ' <option value="userdefined"' . ((!isset($GLOBALS['pred_username']) || $GLOBALS['pred_username'] == 'userdefined') ? ' selected="selected"' : '') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n"
. $spaces . ' </select>' . "\n" . ' </select>' . "\n"
. $spaces . '</span>' . "\n" . '</span>' . "\n"
. $spaces . '<input type="text" name="username" maxlength="' . $username_length . '" title="' . $GLOBALS['strUserName'] . '"' . (empty($GLOBALS['username']) ? '' : ' value="' . (isset($GLOBALS['new_username']) ? $GLOBALS['new_username'] : $GLOBALS['username']) . '"') . ' onchange="pred_username.value = \'userdefined\';" />' . "\n" . '<input type="text" name="username" maxlength="'
. $spaces . '</div>' . "\n" . $username_length . '" title="' . $GLOBALS['strUserName'] . '"'
. $spaces . '<div class="item">' . "\n" . (empty($GLOBALS['username'])
. $spaces . '<label for="select_pred_hostname">' . "\n" ? ''
. $spaces . ' ' . $GLOBALS['strHost'] . ':' . "\n" : ' value="' . (isset($GLOBALS['new_username'])
. $spaces . '</label>' . "\n" ? $GLOBALS['new_username']
. $spaces . '<span class="options">' . "\n" : $GLOBALS['username']) . '"')
. $spaces . ' <select name="pred_hostname" id="select_pred_hostname" title="' . $GLOBALS['strHost'] . '"' . "\n"; . ' onchange="pred_username.value = \'userdefined\';" />' . "\n"
. '</div>' . "\n"
. '<div class="item">' . "\n"
. '<label for="select_pred_hostname">' . "\n"
. ' ' . $GLOBALS['strHost'] . ':' . "\n"
. '</label>' . "\n"
. '<span class="options">' . "\n"
. ' <select name="pred_hostname" id="select_pred_hostname" title="' . $GLOBALS['strHost'] . '"' . "\n";
$res = PMA_DBI_query('SELECT USER();'); $res = PMA_DBI_query('SELECT USER();');
$row = PMA_DBI_fetch_row($res); $row = PMA_DBI_fetch_row($res);
PMA_DBI_free_result($res); PMA_DBI_free_result($res);
@@ -610,7 +665,7 @@ function PMA_displayLoginInformationFields($mode = 'new', $indent = 0) {
unset($thishost); unset($thishost);
} }
} }
echo $spaces . ' onchange="if (this.value == \'any\') { hostname.value = \'%\'; } else if (this.value == \'localhost\') { hostname.value = \'localhost\'; } ' echo ' onchange="if (this.value == \'any\') { hostname.value = \'%\'; } else if (this.value == \'localhost\') { hostname.value = \'localhost\'; } '
. (empty($thishost) ? '' : 'else if (this.value == \'thishost\') { hostname.value = \'' . addslashes(htmlspecialchars($thishost)) . '\'; } ') . (empty($thishost) ? '' : 'else if (this.value == \'thishost\') { hostname.value = \'' . addslashes(htmlspecialchars($thishost)) . '\'; } ')
. 'else if (this.value == \'hosttable\') { hostname.value = \'\'; } else if (this.value == \'userdefined\') { hostname.focus(); hostname.select(); }">' . "\n"; . 'else if (this.value == \'hosttable\') { hostname.value = \'\'; } else if (this.value == \'userdefined\') { hostname.focus(); hostname.select(); }">' . "\n";
unset($row); unset($row);
@@ -630,54 +685,74 @@ function PMA_displayLoginInformationFields($mode = 'new', $indent = 0) {
break; break;
} }
} }
echo $spaces . ' <option value="any"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'any') ? ' selected="selected"' : '') . '>' . $GLOBALS['strAnyHost'] . '</option>' . "\n" echo ' <option value="any"'
. $spaces . ' <option value="localhost"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'localhost') ? ' selected="selected"' : '') . '>' . $GLOBALS['strLocalhost'] . '</option>' . "\n"; . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'any')
? ' selected="selected"' : '') . '>' . $GLOBALS['strAnyHost']
. '</option>' . "\n"
. ' <option value="localhost"'
. ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'localhost')
? ' selected="selected"' : '') . '>' . $GLOBALS['strLocalhost']
. '</option>' . "\n";
if (!empty($thishost)) { if (!empty($thishost)) {
echo $spaces . ' <option value="thishost"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'thishost') ? ' selected="selected"' : '') . '>' . $GLOBALS['strThisHost'] . '</option>' . "\n"; echo ' <option value="thishost"'
. ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'thishost')
? ' selected="selected"' : '') . '>' . $GLOBALS['strThisHost']
. '</option>' . "\n";
} }
unset($thishost); unset($thishost);
echo $spaces . ' <option value="hosttable"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'hosttable') ? ' selected="selected"' : '') . '>' . $GLOBALS['strUseHostTable'] . '</option>' . "\n" echo ' <option value="hosttable"'
. $spaces . ' <option value="userdefined"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'userdefined') ? ' selected="selected"' : '') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n" . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'hosttable')
. $spaces . ' </select>' . "\n" ? ' selected="selected"' : '') . '>' . $GLOBALS['strUseHostTable']
. $spaces . '</span>' . "\n" . '</option>' . "\n"
. $spaces . '<input type="text" name="hostname" maxlength="' . $hostname_length . '" value="' . (isset($GLOBALS['hostname']) ? $GLOBALS['hostname'] : '') . '" title="' . $GLOBALS['strHost'] . '" onchange="pred_hostname.value = \'userdefined\';" />' . "\n" . ' <option value="userdefined"'
. $spaces . '</div>' . "\n" . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'userdefined')
. $spaces . '<div class="item">' . "\n" ? ' selected="selected"' : '')
. $spaces . '<label for="select_pred_password">' . "\n" . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n"
. $spaces . ' ' . $GLOBALS['strPassword'] . ':' . "\n" . ' </select>' . "\n"
. $spaces . '</label>' . "\n" . '</span>' . "\n"
. $spaces . '<span class="options">' . "\n" . '<input type="text" name="hostname" maxlength="'
. $spaces . ' <select name="pred_password" id="select_pred_password" title="' . $GLOBALS['strPassword'] . '"' . "\n" . $hostname_length . '" value="'
. $spaces . ' onchange="if (this.value == \'none\') { pma_pw.value = \'\'; pma_pw2.value = \'\'; } else if (this.value == \'userdefined\') { pma_pw.focus(); pma_pw.select(); }">' . "\n" . (isset($GLOBALS['hostname']) ? $GLOBALS['hostname'] : '')
. ($mode == 'change' ? $spaces . ' <option value="keep" selected="selected">' . $GLOBALS['strKeepPass'] . '</option>' . "\n" : '') . '" title="' . $GLOBALS['strHost']
. $spaces . ' <option value="none"'; . '" onchange="pred_hostname.value = \'userdefined\';" />' . "\n"
. '</div>' . "\n"
. '<div class="item">' . "\n"
. '<label for="select_pred_password">' . "\n"
. ' ' . $GLOBALS['strPassword'] . ':' . "\n"
. '</label>' . "\n"
. '<span class="options">' . "\n"
. ' <select name="pred_password" id="select_pred_password" title="'
. $GLOBALS['strPassword'] . '"' . "\n"
. ' onchange="if (this.value == \'none\') { pma_pw.value = \'\'; pma_pw2.value = \'\'; } else if (this.value == \'userdefined\') { pma_pw.focus(); pma_pw.select(); }">' . "\n"
. ($mode == 'change' ? ' <option value="keep" selected="selected">' . $GLOBALS['strKeepPass'] . '</option>' . "\n" : '')
. ' <option value="none"';
if (isset($GLOBALS['username']) && $mode != 'change') { if (isset($GLOBALS['username']) && $mode != 'change') {
echo ' selected="selected"'; echo ' selected="selected"';
} }
echo $spaces . '>' . $GLOBALS['strNoPassword'] . '</option>' . "\n" echo '>' . $GLOBALS['strNoPassword'] . '</option>' . "\n"
. $spaces . ' <option value="userdefined"' . (isset($GLOBALS['username']) ? '' : ' selected="selected"') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n" . ' <option value="userdefined"' . (isset($GLOBALS['username']) ? '' : ' selected="selected"') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n"
. $spaces . ' </select>' . "\n" . ' </select>' . "\n"
. $spaces . '</span>' . "\n" . '</span>' . "\n"
. $spaces . '<input type="password" id="text_pma_pw" name="pma_pw" title="' . $GLOBALS['strPassword'] . '" onchange="pred_password.value = \'userdefined\';" />' . "\n" . '<input type="password" id="text_pma_pw" name="pma_pw" title="' . $GLOBALS['strPassword'] . '" onchange="pred_password.value = \'userdefined\';" />' . "\n"
. $spaces . '</div>' . "\n" . '</div>' . "\n"
. $spaces . '<div class="item">' . "\n" . '<div class="item">' . "\n"
. $spaces . '<label for="text_pma_pw2">' . "\n" . '<label for="text_pma_pw2">' . "\n"
. $spaces . ' ' . $GLOBALS['strReType'] . ':' . "\n" . ' ' . $GLOBALS['strReType'] . ':' . "\n"
. $spaces . '</label>' . "\n" . '</label>' . "\n"
. $spaces . '<span class="options">&nbsp;</span>' . "\n" . '<span class="options">&nbsp;</span>' . "\n"
. $spaces . '<input type="password" name="pma_pw2" id="text_pma_pw2" title="' . $GLOBALS['strReType'] . '" onchange="pred_password.value = \'userdefined\';" />' . "\n" . '<input type="password" name="pma_pw2" id="text_pma_pw2" title="' . $GLOBALS['strReType'] . '" onchange="pred_password.value = \'userdefined\';" />' . "\n"
. $spaces . '</div>' . "\n" . '</div>' . "\n"
. $spaces . '<div class="item">' . "\n" . '<div class="item">' . "\n"
. $spaces . '<label for="button_generate_password">' . "\n" . '<label for="button_generate_password">' . "\n"
. $spaces . ' ' . $GLOBALS['strGeneratePassword'] . ':' . "\n" . ' ' . $GLOBALS['strGeneratePassword'] . ':' . "\n"
. $spaces . '</label>' . "\n" . '</label>' . "\n"
. $spaces . '<span class="options">' . "\n" . '<span class="options">' . "\n"
. $spaces . ' <input type="button" id="button_generate_password" value="' . $GLOBALS['strGenerate'] . '" onclick="suggestPassword()" />' . "\n" . ' <input type="button" id="button_generate_password" value="' . $GLOBALS['strGenerate'] . '" onclick="suggestPassword()" />' . "\n"
. $spaces . ' <input type="button" id="button_copy_password" value="' . $GLOBALS['strCopy'] . '" onclick="suggestPasswordCopy(this.form)" />' . "\n" . ' <input type="button" id="button_copy_password" value="' . $GLOBALS['strCopy'] . '" onclick="suggestPasswordCopy(this.form)" />' . "\n"
. $spaces . '</span>' . "\n" . '</span>' . "\n"
. $spaces . '<input type="text" name="generated_pw" id="generated_pw" />' . "\n" . '<input type="text" name="generated_pw" id="generated_pw" />' . "\n"
. $spaces . '</div>' . "\n" . '</div>' . "\n"
. $spaces . '</fieldset>' . "\n"; . '</fieldset>' . "\n";
} // end of the 'PMA_displayUserAndHostFields()' function } // end of the 'PMA_displayUserAndHostFields()' function
@@ -1196,29 +1271,21 @@ if (isset($viewing_mode) && $viewing_mode == 'db') {
* defines some standard links * defines some standard links
*/ */
$link_edit = '<a href="server_privileges.php?' . $GLOBALS['url_query'] $link_edit = '<a href="server_privileges.php?' . $GLOBALS['url_query']
.'&amp;username=%s' . '&amp;username=%s'
.'&amp;hostname=%s' . '&amp;hostname=%s'
.'&amp;dbname=%s' . '&amp;dbname=%s'
.'&amp;tablename=%s">'; . '&amp;tablename=%s">'
if ($GLOBALS['cfg']['PropertiesIconic']) { . PMA_getIcon('b_usredit.png', $GLOBALS['strEditPrivileges'])
$link_edit .= '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_usredit.png" width="16" height="16" alt="' . $GLOBALS['strEditPrivileges'] . '" title="' . $GLOBALS['strEditPrivileges'] . '" />'; . '</a>';
} else {
$link_edit .= $GLOBALS['strEditPrivileges'];
}
$link_edit .= '</a>';
$link_revoke = '<a href="server_privileges.php?' . $GLOBALS['url_query'] $link_revoke = '<a href="server_privileges.php?' . $GLOBALS['url_query']
.'&amp;username=%s' . '&amp;username=%s'
.'&amp;hostname=%s' . '&amp;hostname=%s'
.'&amp;dbname=%s' . '&amp;dbname=%s'
.'&amp;tablename=%s' . '&amp;tablename=%s'
.'&amp;revokeall=1">'; . '&amp;revokeall=1">'
if ($GLOBALS['cfg']['PropertiesIconic']) { . PMA_getIcon('b_usrdrop.png', $GLOBALS['strRevoke'])
$link_revoke .= '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_usrdrop.png" width="16" height="16" alt="' . $GLOBALS['strRevoke'] . '" title="' . $GLOBALS['strRevoke'] . '" />'; . '</a>';
} else {
$link_revoke .= $GLOBALS['strRevoke'];
}
$link_revoke .= '</a>';
/** /**
* Displays the page * Displays the page
@@ -1227,40 +1294,13 @@ if (empty($adduser) && (! isset($checkprivs) || ! strlen($checkprivs))) {
if (! isset($username)) { if (! isset($username)) {
// No username is given --> display the overview // No username is given --> display the overview
echo '<h2>' . "\n" echo '<h2>' . "\n"
. ($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 'b_usrlist.png" alt="" />' : '') . PMA_getIcon('b_usrlist.png')
. $GLOBALS['strUserOverview'] . "\n" . $GLOBALS['strUserOverview'] . "\n"
. '</h2>' . "\n"; . '</h2>' . "\n";
$sql_query = $sql_query =
'SELECT `User`,' . 'SELECT *,' .
' `Host`,' . " IF(`Password` = _latin1 '', 'N', 'Y') AS 'Password'" .
" IF(`Password` = _latin1 '', 'N', 'Y') AS 'Password'," .
' `Select_priv`,' .
' `Insert_priv`,' .
' `Update_priv`,' .
' `Delete_priv`,' .
' `Index_priv`,' .
' `Alter_priv`,' .
' `Create_priv`,' .
' `Drop_priv`,' .
' `Grant_priv`,' .
' `References_priv`,' .
' `Reload_priv`,' .
' `Shutdown_priv`,' .
' `Process_priv`,' .
' `File_priv`,' .
' `Show_db_priv`,' .
' `Super_priv`,' .
' `Create_tmp_table_priv`,' .
' `Lock_tables_priv`,' .
' `Execute_priv`,' .
' `Repl_slave_priv`,' .
' `Repl_client_priv`,' .
' `Create_view_priv`,' .
' `Show_view_priv`,' .
' `Create_user_priv`,' .
' `Create_routine_priv`,' .
' `Alter_routine_priv`' .
' FROM `mysql`.`user`'; ' FROM `mysql`.`user`';
$sql_query .= (isset($initial) ? PMA_RangeOfUsers($initial) : ''); $sql_query .= (isset($initial) ? PMA_RangeOfUsers($initial) : '');
@@ -1380,7 +1420,7 @@ if (empty($adduser) && (! isset($checkprivs) || ! strlen($checkprivs))) {
unset($res); unset($res);
echo '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post">' . "\n" echo '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post">' . "\n"
. PMA_generate_common_hidden_inputs('', '', 1) . PMA_generate_common_hidden_inputs('', '')
. ' <table id="tableuserrights" class="data">' . "\n" . ' <table id="tableuserrights" class="data">' . "\n"
. ' <thead>' . "\n" . ' <thead>' . "\n"
. ' <tr><td></td>' . "\n" . ' <tr><td></td>' . "\n"
@@ -1402,7 +1442,12 @@ if (empty($adduser) && (! isset($checkprivs) || ! strlen($checkprivs))) {
foreach ($user as $host) { foreach ($user as $host) {
$index_checkbox++; $index_checkbox++;
echo ' <tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n" echo ' <tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n"
. ' <td><input type="checkbox" name="selected_usr[]" id="checkbox_sel_users_' . $index_checkbox . '" value="' . str_replace(chr(27), '&#27;', htmlentities($host['User'] . $user_host_separator . $host['Host'])) . '"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' /></td>' . "\n" . ' <td><input type="checkbox" name="selected_usr[]" id="checkbox_sel_users_'
. $index_checkbox . '" value="'
. str_replace(chr(27), '&#27;', htmlentities($host['User'] . $user_host_separator . $host['Host']))
. '"'
. (empty($GLOBALS['checkall']) ? '' : ' checked="checked"')
. ' /></td>' . "\n"
. ' <td><label for="checkbox_sel_users_' . $index_checkbox . '">' . (empty($host['User']) ? '<span style="color: #FF0000">' . $GLOBALS['strAny'] . '</span>' : htmlspecialchars($host['User'])) . '</label></td>' . "\n" . ' <td><label for="checkbox_sel_users_' . $index_checkbox . '">' . (empty($host['User']) ? '<span style="color: #FF0000">' . $GLOBALS['strAny'] . '</span>' : htmlspecialchars($host['User'])) . '</label></td>' . "\n"
. ' <td>' . htmlspecialchars($host['Host']) . '</td>' . "\n"; . ' <td>' . htmlspecialchars($host['Host']) . '</td>' . "\n";
echo ' <td>'; echo ' <td>';
@@ -1449,12 +1494,12 @@ if (empty($adduser) && (! isset($checkprivs) || ! strlen($checkprivs))) {
// add/delete user fieldset // add/delete user fieldset
echo ' <fieldset id="fieldset_add_user">' . "\n" echo ' <fieldset id="fieldset_add_user">' . "\n"
. ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;adduser=1">' . "\n" . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;adduser=1">' . "\n"
. ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' . "\n" : '') . PMA_getIcon('b_usradd.png')
. ' ' . $GLOBALS['strAddUser'] . '</a>' . "\n" . ' ' . $GLOBALS['strAddUser'] . '</a>' . "\n"
. ' </fieldset>' . "\n" . ' </fieldset>' . "\n"
. ' <fieldset id="fieldset_delete_user">' . ' <fieldset id="fieldset_delete_user">'
. ' <legend>' . "\n" . ' <legend>' . "\n"
. ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usrdrop.png" width="16" height="16" alt="" />' . "\n" : '') . PMA_getIcon('b_usrdrop.png')
. ' ' . $GLOBALS['strRemoveSelectedUsers'] . '' . "\n" . ' ' . $GLOBALS['strRemoveSelectedUsers'] . '' . "\n"
. ' </legend>' . "\n" . ' </legend>' . "\n"
. ' <input type="hidden" name="mode" value="2" />' . "\n" . ' <input type="hidden" name="mode" value="2" />' . "\n"
@@ -1472,14 +1517,15 @@ if (empty($adduser) && (! isset($checkprivs) || ! strlen($checkprivs))) {
unset ($row); unset ($row);
echo ' <fieldset id="fieldset_add_user">' . "\n" echo ' <fieldset id="fieldset_add_user">' . "\n"
. ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;adduser=1">' . "\n" . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;adduser=1">' . "\n"
. ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' . "\n" : '') . PMA_getIcon('b_usradd.png')
. ' ' . $GLOBALS['strAddUser'] . '</a>' . "\n" . ' ' . $GLOBALS['strAddUser'] . '</a>' . "\n"
. ' </fieldset>' . "\n"; . ' </fieldset>' . "\n";
} // end if (display overview) } // end if (display overview)
echo '</form>' . "\n" echo '</form>' . "\n";
. '<div class="warning">' . "\n" $flushnote = new PMA_Message('strFlushPrivilegesNote', PMA_Message::WARNING);
. ' ' . sprintf($GLOBALS['strFlushPrivilegesNote'], '<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;flush_privileges=1">', '</a>') . "\n" $flushnote->addParam('<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;flush_privileges=1">');
. '</div>' . "\n"; $flushnote->addParam('</a>');
$flushnote->display();
} }
@@ -1488,18 +1534,28 @@ if (empty($adduser) && (! isset($checkprivs) || ! strlen($checkprivs))) {
// A user was selected -> display the user's properties // A user was selected -> display the user's properties
echo '<h2>' . "\n" echo '<h2>' . "\n"
. ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_usredit.png" width="16" height="16" alt="" />' : '') . 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"; . $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) && strlen($dbname)) { if (isset($dbname) && strlen($dbname)) {
if ($dbname_is_wildcard) { if ($dbname_is_wildcard) {
echo ' - ' . $GLOBALS['strDatabases']; echo ' - ' . $GLOBALS['strDatabases'];
} else { } else {
echo ' - ' . $GLOBALS['strDatabase']; echo ' - ' . $GLOBALS['strDatabase'];
} }
$url_dbname = urlencode(str_replace('\_', '_', $dbname)); $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"; 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) && strlen($tablename)) { if (isset($tablename) && strlen($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"; 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); unset($url_dbname);
} }
@@ -1514,7 +1570,7 @@ if (empty($adduser) && (! isset($checkprivs) || ! strlen($checkprivs))) {
//require_once './libraries/footer.inc.php'; //require_once './libraries/footer.inc.php';
} }
echo '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post">' . "\n" echo '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post">' . "\n"
. PMA_generate_common_hidden_inputs('', '', 3) . PMA_generate_common_hidden_inputs('', '')
. '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n" . '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"
. '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"; . '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n";
if (isset($dbname) && strlen($dbname)) { if (isset($dbname) && strlen($dbname)) {
@@ -1524,8 +1580,7 @@ if (empty($adduser) && (! isset($checkprivs) || ! strlen($checkprivs))) {
} }
} }
PMA_displayPrivTable(((! isset($dbname) || ! strlen($dbname)) ? '*' : $dbname), PMA_displayPrivTable(((! isset($dbname) || ! strlen($dbname)) ? '*' : $dbname),
(((! isset($dbname) || ! strlen($dbname)) || (! isset($tablename) || ! strlen($tablename))) ? '*' : $tablename), (((! isset($dbname) || ! strlen($dbname)) || (! isset($tablename) || ! strlen($tablename))) ? '*' : $tablename));
TRUE, 3);
echo '</form>' . "\n"; echo '</form>' . "\n";
if ((! isset($tablename) || ! strlen($tablename)) && empty($dbname_is_wildcard)) { if ((! isset($tablename) || ! strlen($tablename)) && empty($dbname_is_wildcard)) {
@@ -1535,7 +1590,7 @@ if (empty($adduser) && (! isset($checkprivs) || ! strlen($checkprivs))) {
// table header // table header
echo '<form action="server_privileges.php" method="post">' . "\n" echo '<form action="server_privileges.php" method="post">' . "\n"
. PMA_generate_common_hidden_inputs('', '', 6) . PMA_generate_common_hidden_inputs('', '')
. '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n" . '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"
. '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n" . '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"
. '<fieldset>' . "\n" . '<fieldset>' . "\n"
@@ -1801,12 +1856,12 @@ if (empty($adduser) && (! isset($checkprivs) || ! strlen($checkprivs))) {
require_once './libraries/display_change_password.lib.php'; require_once './libraries/display_change_password.lib.php';
echo '<form action="server_privileges.php" method="post" onsubmit="return checkPassword(this);">' . "\n" echo '<form action="server_privileges.php" method="post" onsubmit="return checkPassword(this);">' . "\n"
. PMA_generate_common_hidden_inputs('', '', 3) . PMA_generate_common_hidden_inputs('', '')
. '<input type="hidden" name="old_username" value="' . htmlspecialchars($username) . '" />' . "\n" . '<input type="hidden" name="old_username" value="' . htmlspecialchars($username) . '" />' . "\n"
. '<input type="hidden" name="old_hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n" . '<input type="hidden" name="old_hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"
. '<fieldset id="fieldset_change_copy_user">' . "\n" . '<fieldset id="fieldset_change_copy_user">' . "\n"
. ' <legend>' . $GLOBALS['strChangeCopyUser'] . '</legend>' . "\n"; . ' <legend>' . $GLOBALS['strChangeCopyUser'] . '</legend>' . "\n";
PMA_displayLoginInformationFields('change', 3); PMA_displayLoginInformationFields('change');
echo ' <fieldset>' . "\n" echo ' <fieldset>' . "\n"
. ' <legend>' . $GLOBALS['strChangeCopyMode'] . '</legend>' . "\n" . ' <legend>' . $GLOBALS['strChangeCopyMode'] . '</legend>' . "\n"
. ' <input type="radio" name="mode" value="4" id="radio_mode_4" checked="checked" /><label for="radio_mode_4">' . "\n" . ' <input type="radio" name="mode" value="4" id="radio_mode_4" checked="checked" /><label for="radio_mode_4">' . "\n"
@@ -1833,12 +1888,11 @@ if (empty($adduser) && (! isset($checkprivs) || ! strlen($checkprivs))) {
// Add a new user // Add a new user
$GLOBALS['url_query'] .= '&amp;adduser=1'; $GLOBALS['url_query'] .= '&amp;adduser=1';
echo '<h2>' . "\n" echo '<h2>' . "\n"
. ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' : '') . PMA_getIcon('b_usradd.png') . $GLOBALS['strAddUser'] . "\n"
. ' ' . $GLOBALS['strAddUser'] . "\n"
. '</h2>' . "\n" . '</h2>' . "\n"
. '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post" onsubmit="return checkAddUser(this);">' . "\n" . '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post" onsubmit="return checkAddUser(this);">' . "\n"
. PMA_generate_common_hidden_inputs('', '', 1); . PMA_generate_common_hidden_inputs('', '');
PMA_displayLoginInformationFields('new', 2); PMA_displayLoginInformationFields('new');
echo '<fieldset id="fieldset_add_user_database">' . "\n" echo '<fieldset id="fieldset_add_user_database">' . "\n"
. '<legend>' . $GLOBALS['strCreateUserDatabase'] . '</legend>' . "\n" . '<legend>' . $GLOBALS['strCreateUserDatabase'] . '</legend>' . "\n"
. ' <div class="item">' . "\n" . ' <div class="item">' . "\n"
@@ -1854,7 +1908,7 @@ if (empty($adduser) && (! isset($checkprivs) || ! strlen($checkprivs))) {
. ' <label for="radio_createdb_2">' . $GLOBALS['strCreateUserDatabaseWildcard'] . '</label>' . "\n" . ' <label for="radio_createdb_2">' . $GLOBALS['strCreateUserDatabaseWildcard'] . '</label>' . "\n"
. ' </div>' . "\n" . ' </div>' . "\n"
. '</fieldset>' . "\n"; . '</fieldset>' . "\n";
PMA_displayPrivTable('*', '*', FALSE, 1); PMA_displayPrivTable('*', '*', FALSE);
echo ' <fieldset id="fieldset_add_user_footer" class="tblFooters">' . "\n" echo ' <fieldset id="fieldset_add_user_footer" class="tblFooters">' . "\n"
. ' <input type="submit" name="adduser_submit" value="' . $GLOBALS['strGo'] . '" />' . "\n" . ' <input type="submit" name="adduser_submit" value="' . $GLOBALS['strGo'] . '" />' . "\n"
. ' </fieldset>' . "\n" . ' </fieldset>' . "\n"
@@ -1863,7 +1917,7 @@ if (empty($adduser) && (! isset($checkprivs) || ! strlen($checkprivs))) {
// check the privileges for a particular database. // check the privileges for a particular database.
echo '<table id="tablespecificuserrights" class="data">' . "\n" echo '<table id="tablespecificuserrights" class="data">' . "\n"
. '<caption class="tblHeaders">' . "\n" . '<caption class="tblHeaders">' . "\n"
. ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usrcheck.png" width="16" height="16" alt="" />' . "\n" : '') . PMA_getIcon('b_usrcheck.png')
. ' ' . sprintf($GLOBALS['strUsersHavingAccessToDb'], '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' . htmlspecialchars($checkprivs) . '</a>') . "\n" . ' ' . sprintf($GLOBALS['strUsersHavingAccessToDb'], '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' . htmlspecialchars($checkprivs) . '</a>') . "\n"
. '</caption>' . "\n" . '</caption>' . "\n"
. '<thead>' . "\n" . '<thead>' . "\n"