diff options
author | Michal Čihař <michal@cihar.com> | 2005-09-26 23:03:11 +0400 |
---|---|---|
committer | Michal Čihař <michal@cihar.com> | 2005-09-26 23:03:11 +0400 |
commit | 64bd56dfba419951886c092c6d0ba6948d05ce95 (patch) | |
tree | 3de25bb883b290a29f2d3ecda066c99ce9558beb /server_privileges.php | |
parent | 176c60cfe3a76e13ade9d10bf05a8747e87a7055 (diff) |
Support for browsing selected columns (RFE #1275909).
Diffstat (limited to 'server_privileges.php')
-rw-r--r-- | server_privileges.php | 1199 |
1 files changed, 599 insertions, 600 deletions
diff --git a/server_privileges.php b/server_privileges.php index 7884cfc744..82369b6479 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -29,9 +29,9 @@ if (!$is_superuser) { require('./server_links.inc.php'); echo '<h2>' . "\n" . ' ' . ($GLOBALS['cfg']['MainPageIconic'] ? '<img src="'. $GLOBALS['pmaThemeImage'] . 'b_usrlist.png" border="0" hspace="2" align="middle" />' : '') - . ' ' . $strPrivileges . "\n" + . ' ' . $GLOBALS['strPrivileges'] . "\n" . '</h2>' . "\n" - . $strNoPrivileges . "\n"; + . $GLOBALS['strNoPrivileges'] . "\n"; require_once('./footer.inc.php'); } @@ -39,17 +39,15 @@ if (!$is_superuser) { /** * Extracts the privilege information of a priv table row * - * @param array the row - * @param boolean add <dfn> tag with tooltips + * @param array $row the row + * @param boolean $enableHTML add <dfn> tag with tooltips * - * @global ressource the database connection + * @global ressource $user_link the database connection * * @return array */ function PMA_extractPrivInfo($row = '', $enableHTML = FALSE) { - global $userlink; - $grants = array( array('Select_priv', 'SELECT', $GLOBALS['strPrivDescSelect']), array('Insert_priv', 'INSERT', $GLOBALS['strPrivDescInsert']), @@ -70,10 +68,19 @@ function PMA_extractPrivInfo($row = '', $enableHTML = FALSE) array('Lock_tables_priv', 'LOCK TABLES', $GLOBALS['strPrivDescLockTables']), array('Execute_priv', 'EXECUTE', $GLOBALS['strPrivDescExecute']), 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']), + // for table privs: + array('Create View_priv', 'CREATE VIEW', $GLOBALS['strPrivDescCreateView']), + array('Show_view_priv', 'SHOW VIEW', $GLOBALS['strPrivDescShowView']), + // for table privs: + array('Show view_priv', 'SHOW VIEW', $GLOBALS['strPrivDescShowView']), + array('Create_routine_priv', 'CREATE ROUTINE', $GLOBALS['strPrivDescCreateRoutine']), + array('Alter_routine_priv', 'ALTER ROUTINE', $GLOBALS['strPrivDescAlterRoutine']), + array('Create_user_priv', 'CREATE USER', $GLOBALS['strPrivDescCreateUser']) ); if (!empty($row) && isset($row['Table_priv'])) { - $res = PMA_DBI_query('SHOW COLUMNS FROM `tables_priv` LIKE \'Table_priv\';', $userlink); + $res = PMA_DBI_query('SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';', $GLOBALS['userlink']); $row1 = PMA_DBI_fetch_assoc($res); PMA_DBI_free_result($res); $av_grants = explode ('\',\'' , substr($row1['Type'], 5, strlen($row1['Type']) - 7)); @@ -92,13 +99,13 @@ function PMA_extractPrivInfo($row = '', $enableHTML = FALSE) if ((!empty($row) && isset($row[$current_grant[0]])) || (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) { - $privs[] = '<dfn title="' . $current_grant[2] . '">' . str_replace(' ', ' ', $current_grant[1]) . '</dfn>'; + $privs[] = '<dfn title="' . $current_grant[2] . '">' . $current_grant[1] . '</dfn>'; } else { $privs[] = $current_grant[1]; } } else if (!empty($GLOBALS[$current_grant[0]]) && is_array($GLOBALS[$current_grant[0]]) && empty($GLOBALS[$current_grant[0] . '_none'])) { if ($enableHTML) { - $priv_string = '<dfn title="' . $current_grant[2] . '">' . str_replace(' ', ' ', $current_grant[1]) . '</dfn>'; + $priv_string = '<dfn title="' . $current_grant[2] . '">' . $current_grant[1] . '</dfn>'; } else { $priv_string = $current_grant[1]; } @@ -116,7 +123,7 @@ function PMA_extractPrivInfo($row = '', $enableHTML = FALSE) } } else if ($allPrivileges && (!isset($GLOBALS['grant_count']) || count($privs) == $GLOBALS['grant_count'])) { if ($enableHTML) { - $privs = array('<dfn title="' . $GLOBALS['strPrivDescAllPrivileges'] . '">ALL PRIVILEGES</dfn>'); + $privs = array('<dfn title="' . $GLOBALS['strPrivDescAllPrivileges'] . '">ALL PRIVILEGES</dfn>'); } else { $privs = array('ALL PRIVILEGES'); } @@ -124,39 +131,62 @@ function PMA_extractPrivInfo($row = '', $enableHTML = FALSE) return $privs; } // end of the 'PMA_extractPrivInfo()' function + +/** + * 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) { + + echo $spaces . ' <div class="item" id="div_item_' . $name . '">' . "\n" + . $spaces . ' <label for="select_' . $name . '_priv">' . "\n" + . $spaces . ' <tt><dfn title="' . $name_for_dfn . '">' . $priv_for_header . '</dfn></tt>' . "\n" + . $spaces . ' </label>' . "\n" + . $spaces . ' <select id="select_' . $name . '_priv" name="' . $name_for_select . '[]" multiple="multiple">' . "\n"; + + foreach ($columns as $current_column => $current_column_privileges) { + echo $spaces . ' <option value="' . htmlspecialchars($current_column) . '"'; + if ($row[$name_for_select] == 'Y' || $current_column_privileges[$name_for_current]) { + echo ' selected="selected"'; + } + echo '>' . htmlspecialchars($current_column) . '</option>' . "\n"; + } + + echo $spaces . ' </select>' . "\n" + . $spaces . ' <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'] . '" />' + . $GLOBALS['strNone'] . '</label>' . "\n" + . $spaces . ' </div>' . "\n"; +} // end function + /** * Displays the privileges form table * - * @param string the database - * @param string the table - * @param boolean wheather to display the submit button or not - * @param int the indenting level of the code + * @param string $db the database + * @param string $table the table + * @param boolean $submit wheather to display the submit button or not + * @param int $indent the indenting level of the code * - * @global array the phpMyAdmin configuration - * @global ressource the database connection + * @global array $cfg the phpMyAdmin configuration + * @global ressource $user_link the database connection * * @return void */ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = 0) { - global $cfg, $userlink, $url_query, $checkall; - if ($db == '*') { $table = '*'; } - $spaces = ''; - for ($i = 0; $i < $indent; $i++) { - $spaces .= ' '; - } + $spaces = str_repeat( ' ', $indent ); + if (isset($GLOBALS['username'])) { $username = $GLOBALS['username']; $hostname = $GLOBALS['hostname']; if ($db == '*') { - $sql_query = 'SELECT * FROM `user` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ';'; + $sql_query = 'SELECT * FROM `mysql`.`user` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ';'; } else if ($table == '*') { - $sql_query = 'SELECT * FROM `db` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ' AND ' . PMA_convert_using('Db') . ' = ' . PMA_convert_using($db, 'quoted') . ';'; + $sql_query = 'SELECT * FROM `mysql`.`db` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ' AND ' . PMA_convert_using('Db') . ' = ' . PMA_convert_using($db, 'quoted') . ';'; } else { - $sql_query = 'SELECT `Table_priv` FROM `tables_priv` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' .PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ' AND ' . PMA_convert_using('Db') . ' = ' . PMA_convert_using($db, 'quoted') . ' AND ' . PMA_convert_using('Table_name') . ' = ' . PMA_convert_using($table, 'quoted') . ';'; + $sql_query = 'SELECT `Table_priv` FROM `mysql`.`tables_priv` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' .PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ' AND ' . PMA_convert_using('Db') . ' = ' . PMA_convert_using($db, 'quoted') . ' AND ' . PMA_convert_using('Table_name') . ' = ' . PMA_convert_using($table, 'quoted') . ';'; } $res = PMA_DBI_query($sql_query); $row = PMA_DBI_fetch_assoc($res); @@ -183,12 +213,18 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = } } if (isset($row['Table_priv'])) { - $res = PMA_DBI_query('SHOW COLUMNS FROM `tables_priv` LIKE \'Table_priv\';', $userlink); + $res = PMA_DBI_query('SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';', $GLOBALS['userlink']); + // note: in MySQL 5.0.3 we get "Create View', 'Show view'; + // the View for Create is spelled with uppercase V + // the view for Show is spelled with lowercase v + // and there is a space between the words + $row1 = PMA_DBI_fetch_assoc($res); PMA_DBI_free_result($res); $av_grants = explode ('\',\'' , substr($row1['Type'], strpos($row1['Type'], '(') + 2, strpos($row1['Type'], ')') - strpos($row1['Type'], '(') - 3)); unset($res, $row1); $users_grants = explode(',', $row['Table_priv']); + foreach ($av_grants as $current_grant) { $row[$current_grant . '_priv'] = in_array($current_grant, $users_grants) ? 'Y' : 'N'; } @@ -208,8 +244,10 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = } unset($res, $row1); } + // t a b l e - s p e c i f i c p r i v i l e g e s + if (!empty($columns)) { - $res = PMA_DBI_QUERY('SELECT `Column_name`, `Column_priv` FROM `columns_priv` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ' AND ' . PMA_convert_using('Db') . ' = ' . PMA_convert_using($db, 'quoted') . ' AND ' . PMA_convert_using('Table_name') . ' = ' . PMA_convert_using($table, 'quoted') . ';'); + $res = PMA_DBI_QUERY('SELECT `Column_name`, `Column_priv` FROM `mysql`.`columns_priv` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ' AND ' . PMA_convert_using('Db') . ' = ' . PMA_convert_using($db, 'quoted') . ' AND ' . PMA_convert_using('Table_name') . ' = ' . PMA_convert_using($table, 'quoted') . ';'); while ($row1 = PMA_DBI_fetch_row($res)) { $row1[1] = explode(',', $row1[1]); @@ -221,99 +259,60 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = unset($res); unset($row1); unset($current); + echo $spaces . '<input type="hidden" name="grant_count" value="' . count($row) . '" />' . "\n" . $spaces . '<input type="hidden" name="column_count" value="' . count($columns) . '" />' . "\n" - . $spaces . '<table border="0" cellpadding="2" cellspacing="1">' . "\n" - . $spaces . ' <tr>' . "\n" - . $spaces . ' <th colspan="6"> ' . $GLOBALS['strTblPrivileges'] . ' </th>' . "\n" - . $spaces . ' </tr>' . "\n" - . $spaces . ' <tr>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '" colspan="6"><small><i>' . $GLOBALS['strEnglishPrivileges'] . '</i></small></td>' . "\n" - . $spaces . ' </tr>' . "\n" - . $spaces . ' <tr>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorOne'] . '"> <tt><dfn title="' . $GLOBALS['strPrivDescSelect'] . '">SELECT</dfn></tt> </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorOne'] . '"> <tt><dfn title="' . $GLOBALS['strPrivDescInsert'] . '">INSERT</dfn></tt> </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorOne'] . '"> <tt><dfn title="' . $GLOBALS['strPrivDescUpdate'] . '">UPDATE</dfn></tt> </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorOne'] . '"> <tt><dfn title="' . $GLOBALS['strPrivDescReferences'] . '">REFERENCES</dfn></tt> </td>' . "\n"; - list($current_grant, $current_grant_value) = each($row); - while (in_array(substr($current_grant, 0, (strlen($current_grant) - 5)), array('Select', 'Insert', 'Update', 'References'))) { - list($current_grant, $current_grant_value) = each($row); - } - echo $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><input type="checkbox"' . (empty($checkall) ? '' : ' checked="checked"') . ' name="' . $current_grant . '" id="checkbox_' . $current_grant . '" value="Y" ' . ($current_grant_value == 'Y' ? 'checked="checked" ' : '') . 'title="' . (isset($GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5))]) ? $GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5))] : $GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5)) . 'Tbl']) . '"/></td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><label for="checkbox_' . $current_grant . '"><tt><dfn title="' . (isset($GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5))]) ? $GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5))] : $GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5)) . 'Tbl']) . '">' . strtoupper(substr($current_grant, 0, strlen($current_grant) - 5)) . '</dfn></tt></label></td>' . "\n" - . $spaces . ' </tr>' . "\n" - . $spaces . ' <tr>' . "\n"; - $rowspan = count($row) - 5; - echo $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '" rowspan="' . $rowspan . '" valign="top">' . "\n" - . $spaces . ' <select name="Select_priv[]" multiple="multiple">' . "\n"; - foreach ($columns as $current_column => $current_column_privileges) { - echo $spaces . ' <option value="' . htmlspecialchars($current_column) . '"'; - if ($row['Select_priv'] == 'Y' || $current_column_privileges['Select']) { - echo ' selected="selected"'; - } - echo '>' . htmlspecialchars($current_column) . '</option>' . "\n"; - } - echo $spaces . ' </select><br />' . "\n" - . $spaces . ' <i>' . $GLOBALS['strOr'] . '</i><br />' . "\n" - . $spaces . ' <input type="checkbox"' . (empty($checkall) ? '' : ' checked="checked"') . ' name="Select_priv_none" id="checkbox_Select_priv_none" title="' . $GLOBALS['strNone'] . '" /><label for="checkbox_Select_priv_none">' . $GLOBALS['strNone'] . '</label>' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '" rowspan="' . $rowspan . '" valign="top">' . "\n" - . $spaces . ' <select name="Insert_priv[]" multiple="multiple">' . "\n"; - foreach ($columns as $current_column => $current_column_privileges) { - echo $spaces . ' <option value="' . htmlspecialchars($current_column) . '"'; - if ($row['Insert_priv'] == 'Y' || $current_column_privileges['Insert']) { - echo ' selected="selected"'; - } - echo '>' . htmlspecialchars($current_column) . '</option>' . "\n"; - } - echo $spaces . ' </select><br />' . "\n" - . $spaces . ' <i>' . $GLOBALS['strOr'] . '</i><br />' . "\n" - . $spaces . ' <input type="checkbox"' . (empty($checkall) ? '' : ' checked="checked"') . ' name="Insert_priv_none" id="checkbox_Insert_priv_none" title="' . $GLOBALS['strNone'] . '" /><label for="checkbox_Insert_priv_none">' . $GLOBALS['strNone'] . '</label>' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '" rowspan="' . $rowspan . '" valign="top">' . "\n" - . $spaces . ' <select name="Update_priv[]" multiple="multiple">' . "\n"; - foreach ($columns as $current_column => $current_column_privileges) { - echo $spaces . ' <option value="' . htmlspecialchars($current_column) . '"'; - if ($row['Update_priv'] == 'Y' || $current_column_privileges['Update']) { - echo ' selected="selected"'; - } - echo '>' . htmlspecialchars($current_column) . '</option>' . "\n"; - } - echo $spaces . ' </select><br />' . "\n" - . $spaces . ' <i>' . $GLOBALS['strOr'] . '</i><br />' . "\n" - . $spaces . ' <input type="checkbox"' . (empty($checkall) ? '' : ' checked="checked"') . ' name="Update_priv_none" id="checkbox_Update_priv_none" title="' . $GLOBALS['strNone'] . '" /><label for="checkbox_Update_priv_none">' . $GLOBALS['strNone'] . '</label>' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '" rowspan="' . $rowspan . '" valign="top">' . "\n" - . $spaces . ' <select name="References_priv[]" multiple="multiple">' . "\n"; - foreach ($columns as $current_column => $current_column_privileges) { - echo $spaces . ' <option value="' . htmlspecialchars($current_column) . '"'; - if ($row['References_priv'] == 'Y' || $current_column_privileges['References']) { - echo ' selected="selected"'; - } - echo '>' . htmlspecialchars($current_column) . '</option>' . "\n"; - } - echo $spaces . ' </select><br />' . "\n" - . $spaces . ' <i>' . $GLOBALS['strOr'] . '</i><br />' . "\n" - . $spaces . ' <input type="checkbox"' . (empty($checkall) ? '' : ' checked="checked"') . ' name="References_priv_none" id="checkbox_References_priv_none" title="' . $GLOBALS['strNone'] . '" /><label for="checkbox_References_priv_none">' . $GLOBALS['strNone'] . '</label>' . "\n" - . $spaces . ' </td>' . "\n"; - unset($rowspan); - list($current_grant, $current_grant_value) = each($row); - while (in_array(substr($current_grant, 0, (strlen($current_grant) - 5)), array('Select', 'Insert', 'Update', 'References'))) { - list($current_grant, $current_grant_value) = each($row); - } - echo $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><input type="checkbox"' . (empty($checkall) ? '' : ' checked="checked"') . ' name="' . $current_grant . '" id="checkbox_' . $current_grant . '" value="Y" ' . ($current_grant_value == 'Y' ? 'checked="checked" ' : '') . 'title="' . (isset($GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5))]) ? $GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5))] : $GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5)) . 'Tbl']) . '"/></td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><label for="checkbox_' . $current_grant . '"><tt><dfn title="' . (isset($GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5))]) ? $GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5))] : $GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5)) . 'Tbl']) . '">' . strtoupper(substr($current_grant, 0, strlen($current_grant) - 5)) . '</dfn></tt></label></td>' . "\n" - . $spaces . ' </tr>' . "\n"; - while (list($current_grant, $current_grant_value) = each($row)) { + . $spaces . '<fieldset id="fieldset_user_priv">' . "\n" + . $spaces . ' <legend>' . $GLOBALS['strTblPrivileges'] . '</legend>' . "\n" + . $spaces . ' <p><small><i>' . $GLOBALS['strEnglishPrivileges'] . '</i></small></p>' . "\n"; + + + // 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($spaces, $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($spaces, $columns, $row, 'References_priv', 'REFERENCES', 'references', $GLOBALS['strPrivDescReferences'], 'References'); + + // privs that are not attached to a specific column + + foreach($row as $current_grant => $current_grant_value) { if (in_array(substr($current_grant, 0, (strlen($current_grant) - 5)), array('Select', 'Insert', 'Update', 'References'))) { continue; } - echo $spaces . ' <tr>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><input type="checkbox"' . (empty($checkall) ? '' : ' checked="checked"') . ' name="' . $current_grant . '" id="checkbox_' . $current_grant . '" value="Y" ' . ($current_grant_value == 'Y' ? 'checked="checked" ' : '') . 'title="' . (isset($GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5))]) ? $GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5))] : $GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5)) . 'Tbl']) . '"/></td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><label for="checkbox_' . $current_grant . '"><tt><dfn title="' . (isset($GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5))]) ? $GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5))] : $GLOBALS['strPrivDesc' . substr($current_grant, 0, (strlen($current_grant) - 5)) . 'Tbl']) . '">' . strtoupper(substr($current_grant, 0, strlen($current_grant) - 5)) . '</dfn></tt></label></td>' . "\n" - . $spaces . ' </tr>' . "\n"; - } + // make a substitution to match the messages variables; + // also we must substitute the grant we get, because we can't generate + // a form variable containing blanks (those would get changed to + // an underscore when receiving the POST) + if ($current_grant == 'Create View_priv') { + $tmp_current_grant = 'CreateView_priv'; + $current_grant = 'Create_view_priv'; + } elseif ($current_grant == 'Show view_priv') { + $tmp_current_grant = 'ShowView_priv'; + $current_grant = 'Show_view_priv'; + } else { + $tmp_current_grant = $current_grant; + } + + echo $spaces . ' <div class="item">' . "\n" + . $spaces . ' <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="'; + + 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" + . $spaces . ' </div>' . "\n"; + } // end foreach() + + echo $spaces . ' </div>' . "\n"; + } else { + + // g l o b a l o r d b - s p e c i f i c + // + // d a t a $privTable[0] = array( array('Select', 'SELECT', $GLOBALS['strPrivDescSelect']), array('Insert', 'INSERT', $GLOBALS['strPrivDescInsert']), @@ -323,6 +322,8 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = if ($db == '*') { $privTable[0][] = array('File', 'FILE', $GLOBALS['strPrivDescFile']); } + + // s t r u c t u r e $privTable[1] = array( array('Create', 'CREATE', ($table == '*' ? $GLOBALS['strPrivDescCreateDb'] : $GLOBALS['strPrivDescCreateTbl'])), array('Alter', 'ALTER', $GLOBALS['strPrivDescAlter']), @@ -330,8 +331,27 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = array('Drop', 'DROP', ($table == '*' ? $GLOBALS['strPrivDescDropDb'] : $GLOBALS['strPrivDescDropTbl'])) ); if (isset($row['Create_tmp_table_priv'])) { - $privTable[1][] = array('Create_tmp_table', 'CREATE TEMPORARY TABLES', $GLOBALS['strPrivDescCreateTmpTable']); + $privTable[1][] = array('Create_tmp_table', 'CREATE TEMPORARY TABLES', $GLOBALS['strPrivDescCreateTmpTable']); + } + // this one is for a db-specific priv: Create_view_priv + if (isset($row['Create_view_priv'])) { + $privTable[1][] = array('Create_view', 'CREATE VIEW', $GLOBALS['strPrivDescCreateView']); + } + // this one is for a table-specific priv: Create View_priv + if (isset($row['Create View_priv'])) { + $privTable[1][] = array('Create View', 'CREATE VIEW', $GLOBALS['strPrivDescCreateView']); + } + if (isset($row['Show_view_priv'])) { + $privTable[1][] = array('Show_view', 'SHOW VIEW', $GLOBALS['strPrivDescShowView']); + } + if (isset($row['Create_routine_priv'])) { + $privTable[1][] = array('Create_routine', 'CREATE ROUTINE', $GLOBALS['strPrivDescCreateRoutine']); + } + if (isset($row['Alter_routine_priv'])) { + $privTable[1][] = array('Alter_routine', 'ALTER ROUTINE', $GLOBALS['strPrivDescAlterRoutine']); } + + // a d m i n i s t r a t i o n $privTable[2] = array(); if (isset($row['Grant_priv'])) { $privTable[2][] = array('Grant', 'GRANT', $GLOBALS['strPrivDescGrant']); @@ -346,11 +366,11 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = $privTable[2][] = array('Reload', 'RELOAD', $GLOBALS['strPrivDescReload']); $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']); if ($db == '*') { @@ -358,76 +378,80 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = $privTable[2][] = array('Execute', 'EXECUTE', $GLOBALS['strPrivDescExecute']); } if (isset($row['Repl_client_priv'])) { - $privTable[2][] = array('Repl_client', 'REPLICATION CLIENT', $GLOBALS['strPrivDescReplClient']); + $privTable[2][] = array('Repl_client', 'REPLICATION CLIENT', $GLOBALS['strPrivDescReplClient']); } if (isset($row['Repl_slave_priv'])) { - $privTable[2][] = array('Repl_slave', 'REPLICATION SLAVE', $GLOBALS['strPrivDescReplSlave']); + $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" - . $spaces . '<table border="0" cellpadding="2" cellspacing="1">' . "\n" - . $spaces . ' <tr>' . "\n" - . $spaces . ' <th colspan="6"> ' . ($db == '*' ? $GLOBALS['strGlobalPrivileges'] : ($table == '*' ? $GLOBALS['strDbPrivileges'] : $GLOBALS['strTblPrivileges'])) . ' </th>' . "\n" - . $spaces . ' </tr>' . "\n" - . $spaces . ' <tr>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '" align="center" colspan="6"><small><i>' . $GLOBALS['strEnglishPrivileges'] . '</i></small><br />' . "\n" - . $spaces . ' <a href="./server_privileges.php?' . $url_query . '&checkall=1" onclick="setCheckboxes(\'usersForm\', \'\', true); return false;">' . $GLOBALS['strCheckAll'] . '</a>' . "\n" - . $spaces . '  ' . "\n" - . $spaces . ' <a href="./server_privileges.php?' . $url_query . '" onclick="setCheckboxes(\'usersForm\', \'\', false); return false;">' . $GLOBALS['strUncheckAll'] . '</a></td>' . "\n" - . $spaces . ' </tr>' . "\n" - . $spaces . ' <tr>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorOne'] . '" colspan="2"> <b><i>' . $GLOBALS['strData'] . '</i></b> </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorOne'] . '" colspan="2"> <b><i>' . $GLOBALS['strStructure'] . '</i></b> </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorOne'] . '" colspan="2"> <b><i>' . $GLOBALS['strAdministration'] . '</i></b> </td>' . "\n" - . $spaces . ' </tr>' . "\n"; - $limitTable = FALSE; - for ($i = 0; isset($privTable[0][$i]) || isset($privTable[1][$i]) || isset($privTable[2][$i]); $i++) { - echo $spaces . ' <tr>' . "\n"; - for ($j = 0; $j < 3; $j++) { - if (isset($privTable[$j][$i])) { - echo $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><input type="checkbox"' . (empty($checkall) ? '' : ' checked="checked"') . ' name="' . $privTable[$j][$i][0] . '_priv" id="checkbox_' . $privTable[$j][$i][0] . '_priv" value="Y" ' . ($row[$privTable[$j][$i][0] . '_priv'] == 'Y' ? 'checked="checked" ' : '') . 'title="' . $privTable[$j][$i][2] . '"/></td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><label for="checkbox_' . $privTable[$j][$i][0] . '_priv"><tt><dfn title="' . $privTable[$j][$i][2] . '">' . $privTable[$j][$i][1] . '</dfn></tt></label></td>' . "\n"; - } else if ($db == '*' && !isset($privTable[0][$i]) && !isset($privTable[1][$i]) - && isset($row['max_questions']) && isset($row['max_updates']) && isset($row['max_connections']) - && !$limitTable) { - echo $spaces . ' <td colspan="4" rowspan="' . (count($privTable[2]) - $i) . '">' . "\n" - . $spaces . ' <table border="0" cellpadding="0" cellspacing="0">' . "\n" - . $spaces . ' <tr>' . "\n" - . $spaces . ' <th colspan="2"> ' . $GLOBALS['strResourceLimits'] . ' </th>' . "\n" - . $spaces . ' </tr>' . "\n" - . $spaces . ' <tr>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '" colspan="2"><small><i>' . $GLOBALS['strZeroRemovesTheLimit'] . '</i></small></td>' . "\n" - . $spaces . ' </tr>' . "\n" - . $spaces . ' <tr>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><label for="text_max_questions"><tt><dfn title="' . $GLOBALS['strPrivDescMaxQuestions'] . '">MAX QUERIES PER HOUR</dfn></tt></label></td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><input type="text" class="textfield" name="max_questions" id="text_max_questions" value="' . $row['max_questions'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxQuestions'] . '" /></td>' . "\n" - . $spaces . ' </tr>' . "\n" - . $spaces . ' <tr>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><label for="text_max_updates"><tt><dfn title="' . $GLOBALS['strPrivDescMaxUpdates'] . '">MAX UPDATES PER HOUR</dfn></tt></label></td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><input type="text" class="textfield" name="max_updates" id="text_max_updates" value="' . $row['max_updates'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxUpdates'] . '" /></td>' . "\n" - . $spaces . ' </tr>' . "\n" - . $spaces . ' <tr>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><label for="text_max_connections"><tt><dfn title="' . $GLOBALS['strPrivDescMaxConnections'] . '">MAX CONNECTIONS PER HOUR</dfn></tt></label></td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><input type="text" class="textfield" name="max_connections" id="text_max_connections" value="' . $row['max_connections'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxConnections'] . '" /></td>' . "\n" - . $spaces . ' </tr>' . "\n" - . $spaces . ' </table>' . "\n" - . $spaces . ' </td>' . "\n"; - $limitTable = TRUE; - } else if (!$limitTable) { - echo $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '" colspan="2"> </td>' . "\n"; - } - } + . $spaces . '<fieldset id="fieldset_user_global_rights">' . "\n" + . $spaces . ' <legend>' . "\n" + . $spaces . ' ' . ($db == '*' ? $GLOBALS['strGlobalPrivileges'] : ($table == '*' ? $GLOBALS['strDbPrivileges'] : $GLOBALS['strTblPrivileges'])) . "\n" + . $spaces . ' ( <a href="./server_privileges.php?' . $GLOBALS['url_query'] . '&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 . ' </legend>' . "\n" + . $spaces . ' <p><small><i>' . $GLOBALS['strEnglishPrivileges'] . '</i></small><p>' . "\n" + . $spaces . ' <fieldset>' . "\n" + . $spaces . ' <legend>' . $GLOBALS['strData'] . '</legend>' . "\n"; + foreach ( $privTable[0] as $priv ) + { + echo $spaces . ' <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" + . $spaces . ' <label for="checkbox_' . $priv[0] . '_priv"><tt><dfn title="' . $priv[2] . '">' . $priv[1] . '</dfn></tt></label>' . "\n" + . $spaces . ' </div>' . "\n"; + } + echo $spaces . ' </fieldset>' . "\n" + . $spaces . ' <fieldset>' . "\n" + . $spaces . ' <legend>' . $GLOBALS['strStructure'] . '</legend>' . "\n"; + foreach ( $privTable[1] as $priv ) + { + echo $spaces . ' <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" + . $spaces . ' <label for="checkbox_' . $priv[0] . '_priv"><tt><dfn title="' . $priv[2] . '">' . $priv[1] . '</dfn></tt></label>' . "\n" + . $spaces . ' </div>' . "\n"; + } + echo $spaces . ' </fieldset>' . "\n" + . $spaces . ' <fieldset>' . "\n" + . $spaces . ' <legend>' . $GLOBALS['strAdministration'] . '</legend>' . "\n"; + foreach ( $privTable[2] as $priv ) + { + echo $spaces . ' <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" + . $spaces . ' <label for="checkbox_' . $priv[0] . '_priv"><tt><dfn title="' . $priv[2] . '">' . $priv[1] . '</dfn></tt></label>' . "\n" + . $spaces . ' </div>' . "\n"; } - echo $spaces . ' </tr>' . "\n"; + + echo $spaces . ' </fieldset>' . "\n"; + // The "Resource limits" box is not displayed for db-specific privs + if ($db == '*') { + echo $spaces . ' <fieldset>' . "\n" + . $spaces . ' <legend>' . $GLOBALS['strResourceLimits'] . '</legend>' . "\n" + . $spaces . ' <p><small><i>' . $GLOBALS['strZeroRemovesTheLimit'] . '</i></small></p>' . "\n" + . $spaces . ' <div class="item">' . "\n" + . $spaces . ' <label for="text_max_questions"><tt><dfn title="' . $GLOBALS['strPrivDescMaxQuestions'] . '">MAX QUERIES PER HOUR</dfn></tt></label>' . "\n" + . $spaces . ' <input type="text" class="textfield" name="max_questions" id="text_max_questions" value="' . $row['max_questions'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxQuestions'] . '" />' . "\n" + . $spaces . ' </div>' . "\n" + . $spaces . ' <div class="item">' . "\n" + . $spaces . ' <label for="text_max_updates"><tt><dfn title="' . $GLOBALS['strPrivDescMaxUpdates'] . '">MAX UPDATES PER HOUR</dfn></tt></label>' . "\n" + . $spaces . ' <input type="text" class="textfield" name="max_updates" id="text_max_updates" value="' . $row['max_updates'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxUpdates'] . '" />' . "\n" + . $spaces . ' </div>' . "\n" + . $spaces . ' <div class="item">' . "\n" + . $spaces . ' <label for="text_max_connections"><tt><dfn title="' . $GLOBALS['strPrivDescMaxConnections'] . '">MAX CONNECTIONS PER HOUR</dfn></tt></label>' . "\n" + . $spaces . ' <input type="text" class="textfield" name="max_connections" id="text_max_connections" value="' . $row['max_connections'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxConnections'] . '" />' . "\n" + . $spaces . ' </div>' . "\n" + . $spaces . ' </fieldset>' . "\n"; + } } + echo $spaces . '</fieldset>' . "\n"; if ($submit) { - echo $spaces . ' <tr>' . "\n" - . $spaces . ' <td colspan="6" align="right">' . "\n" - . $spaces . ' <input type="submit" name="update_privs" value="' . $GLOBALS['strGo'] . '" />' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . ' </tr>' . "\n"; + echo $spaces . '<fieldset id="fieldset_user_privtable_footer" class="tblFooters">' . "\n" + . $spaces . ' <input type="submit" name="update_privs" value="' . $GLOBALS['strGo'] . '" />' . "\n" + . $spaces . '</fieldset>' . "\n"; } - echo $spaces . '</table>' . "\n"; } // end of the 'PMA_displayPrivTable()' function @@ -435,47 +459,40 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = * Displays the fields used by the "new user" form as well as the * "change login information / copy user" form. * - * @param string are we creating a new user or are we just changing one? - * (allowed values: 'new', 'change') - * @param int the indenting level of the code + * @param string $mode are we creating a new user or are we just + * changing one? (allowed values: 'new', 'change') + * @param int $indent the indenting level of the code * - * @global array the phpMyAdmin configuration - * @global ressource the database connection + * @global array $cfg the phpMyAdmin configuration + * @global ressource $user_link the database connection * * @return void */ -function PMA_displayLoginInformationFields($mode = 'new', $indent = 0) +function PMA_displayLoginInformationFields($mode = 'new', $indent = 0 ) { - global $cfg, $userlink; - $spaces = ''; - for ($i = 0; $i < $indent; $i++) { - $spaces .= ' '; - } - echo $spaces . '<tr>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" - . $spaces . ' <label for="select_pred_username">' . "\n" - . $spaces . ' ' . $GLOBALS['strUserName'] . ':' . "\n" - . $spaces . ' </label>' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" - . $spaces . ' <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" - . $spaces . ' <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" - . $spaces . ' </select>' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" - . $spaces . ' <input type="text" class="textfield" name="username" class="textfield" title="' . $GLOBALS['strUserName'] . '"' . (empty($GLOBALS['username']) ? '' : ' value="' . (isset($GLOBALS['new_username']) ? $GLOBALS['new_username'] : $GLOBALS['username']) . '"') . ' onchange="pred_username.value = \'userdefined\';" />' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . '</tr>' . "\n" - . $spaces . '<tr>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" - . $spaces . ' <label for="select_pred_hostname">' . "\n" - . $spaces . ' ' . $GLOBALS['strHost'] . ':' . "\n" - . $spaces . ' </label>' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" - . $spaces . ' <select name="pred_hostname" id="select_pred_hostname" title="' . $GLOBALS['strHost'] . '"' . "\n"; + $spaces = str_repeat( ' ', $indent); + + echo $spaces . '<fieldset id="fieldset_add_user_login">' . "\n" + . $spaces . '<legend>' . $GLOBALS['strLoginInformation'] . '</legend>' . "\n" + . $spaces . '<div class="item">' . "\n" + . $spaces . '<label for="select_pred_username">' . "\n" + . $spaces . ' ' . $GLOBALS['strUserName'] . ':' . "\n" + . $spaces . '</label>' . "\n" + . $spaces . '<span class="options">' . "\n" + . $spaces . ' <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" + . $spaces . ' <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" + . $spaces . ' </select>' . "\n" + . $spaces . '</span>' . "\n" + . $spaces . '<input type="text" class="textfield" name="username" class="textfield" title="' . $GLOBALS['strUserName'] . '"' . (empty($GLOBALS['username']) ? '' : ' value="' . (isset($GLOBALS['new_username']) ? $GLOBALS['new_username'] : $GLOBALS['username']) . '"') . ' onchange="pred_username.value = \'userdefined\';" />' . "\n" + . $spaces . '</div>' . "\n" + . $spaces . '<div class="item">' . "\n" + . $spaces . '<label for="select_pred_hostname">' . "\n" + . $spaces . ' ' . $GLOBALS['strHost'] . ':' . "\n" + . $spaces . '</label>' . "\n" + . $spaces . '<span class="options">' . "\n" + . $spaces . ' <select name="pred_hostname" id="select_pred_hostname" title="' . $GLOBALS['strHost'] . '"' . "\n"; $res = PMA_DBI_query('SELECT USER();'); $row = PMA_DBI_fetch_row($res); PMA_DBI_free_result($res); @@ -486,7 +503,7 @@ function PMA_displayLoginInformationFields($mode = 'new', $indent = 0) unset($thishost); } } - echo $spaces . ' onchange="if (this.value == \'any\') { hostname.value = \'%\'; } else if (this.value == \'localhost\') { hostname.value = \'localhost\'; } ' + echo $spaces . ' 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)) . '\'; } ') . 'else if (this.value == \'hosttable\') { hostname.value = \'\'; } else if (this.value == \'userdefined\') { hostname.focus(); hostname.select(); }">' . "\n"; unset($row); @@ -506,63 +523,50 @@ function PMA_displayLoginInformationFields($mode = 'new', $indent = 0) break; } } - echo $spaces . ' <option value="any"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'any') ? ' selected="selected"' : '') . '>' . $GLOBALS['strAnyHost'] . '</option>' . "\n" - . $spaces . ' <option value="localhost"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'localhost') ? ' selected="selected"' : '') . '>' . $GLOBALS['strLocalhost'] . '</option>' . "\n"; + echo $spaces . ' <option value="any"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'any') ? ' selected="selected"' : '') . '>' . $GLOBALS['strAnyHost'] . '</option>' . "\n" + . $spaces . ' <option value="localhost"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'localhost') ? ' selected="selected"' : '') . '>' . $GLOBALS['strLocalhost'] . '</option>' . "\n"; if (!empty($thishost)) { - echo $spaces . ' <option value="thishost"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'thishost') ? ' selected="selected"' : '') . '>' . $GLOBALS['strThisHost'] . '</option>' . "\n"; + echo $spaces . ' <option value="thishost"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'thishost') ? ' selected="selected"' : '') . '>' . $GLOBALS['strThisHost'] . '</option>' . "\n"; } unset($thishost); - echo $spaces . ' <option value="hosttable"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'hosttable') ? ' selected="selected"' : '') . '>' . $GLOBALS['strUseHostTable'] . '</option>' . "\n" - . $spaces . ' <option value="userdefined"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'userdefined') ? ' selected="selected"' : '') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n" - . $spaces . ' </select>' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" - . $spaces . ' <input type="text" class="textfield" name="hostname" value="' . ( isset($GLOBALS['hostname']) ? $GLOBALS['hostname'] : '' ) . '" class="textfield" title="' . $GLOBALS['strHost'] . '" onchange="pred_hostname.value = \'userdefined\';" />' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . '</tr>' . "\n" - . $spaces . '<tr>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" - . $spaces . ' <label for="select_pred_password">' . "\n" - . $spaces . ' ' . $GLOBALS['strPassword'] . ':' . "\n" - . $spaces . ' </label>' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" - . $spaces . ' <select name="pred_password" id="select_pred_password" title="' . $GLOBALS['strPassword'] . '"' . "\n" + echo $spaces . ' <option value="hosttable"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'hosttable') ? ' selected="selected"' : '') . '>' . $GLOBALS['strUseHostTable'] . '</option>' . "\n" + . $spaces . ' <option value="userdefined"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'userdefined') ? ' selected="selected"' : '') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n" + . $spaces . ' </select>' . "\n" + . $spaces . '</span>' . "\n" + . $spaces . '<input type="text" class="textfield" name="hostname" value="' . ( isset($GLOBALS['hostname']) ? $GLOBALS['hostname'] : '' ) . '" class="textfield" title="' . $GLOBALS['strHost'] . '" onchange="pred_hostname.value = \'userdefined\';" />' . "\n" + . $spaces . '</div>' . "\n" + . $spaces . '<div class="item">' . "\n" + . $spaces . '<label for="select_pred_password">' . "\n" + . $spaces . ' ' . $GLOBALS['strPassword'] . ':' . "\n" + . $spaces . '</label>' . "\n" + . $spaces . '<span class="options">' . "\n" + . $spaces . ' <select name="pred_password" id="select_pred_password" title="' . $GLOBALS['strPassword'] . '"' . "\n" . $spaces . ' 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' ? $spaces . ' <option value="keep" selected="selected">' . $GLOBALS['strKeepPass'] . '</option>' . "\n" : '') - . $spaces . ' <option value="none">' . $GLOBALS['strNoPassword'] . '</option>' . "\n" - . $spaces . ' <option value="userdefined"' . ($mode == 'change' ? '' : ' selected="selected"') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n" - . $spaces . ' </select>' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" - . $spaces . ' <input type="password" name="pma_pw" class="textfield" title="' . $GLOBALS['strPassword'] . '" onchange="pred_password.value = \'userdefined\';" />' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . '</tr>' . "\n" - . $spaces . '<tr>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" - . $spaces . ' <label for="text_pma_pw2">' . "\n" - . $spaces . ' ' . $GLOBALS['strReType'] . ':' . "\n" - . $spaces . ' </label>' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"> </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" - . $spaces . ' <input type="password" name="pma_pw2" id="text_pma_pw2" class="textfield" title="' . $GLOBALS['strReType'] . '" onchange="pred_password.value = \'userdefined\';" />' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . '</tr>' . "\n" - . $spaces . '<tr>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" - . $spaces . ' <label for="text_pma_pw2">' . "\n" - . $spaces . ' ' . $GLOBALS['strGeneratePassword'] . ':' . "\n" - . $spaces . ' </label>' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" - . $spaces . ' <input type="button" value="' . $GLOBALS['strGenerate'] . '" onClick="suggestPassword(this.form, \'generated_pw\')">' . "\n" - . $spaces . ' <input type="button" value="' . $GLOBALS['strCopy'] . '" onClick="suggestPasswordCopy(this.form)">' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" - . $spaces . ' <input type="text" name="generated_pw" id="generated_pw" class="textfield"/>' . "\n" - . $spaces . ' </td>' . "\n" - . $spaces . '</tr>' . "\n"; + . $spaces . ' <option value="none">' . $GLOBALS['strNoPassword'] . '</option>' . "\n" + . $spaces . ' <option value="userdefined"' . ($mode == 'change' ? '' : ' selected="selected"') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n" + . $spaces . ' </select>' . "\n" + . $spaces . '</span>' . "\n" + . $spaces . '<input type="password" name="pma_pw" class="textfield" title="' . $GLOBALS['strPassword'] . '" onchange="pred_password.value = \'userdefined\';" />' . "\n" + . $spaces . '</div>' . "\n" + . $spaces . '<div class="item">' . "\n" + . $spaces . '<label for="text_pma_pw2">' . "\n" + . $spaces . ' ' . $GLOBALS['strReType'] . ':' . "\n" + . $spaces . '</label>' . "\n" + . $spaces . '<span class="options"></span>' . "\n" + . $spaces . '<input type="password" name="pma_pw2" id="text_pma_pw2" class="textfield" title="' . $GLOBALS['strReType'] . '" onchange="pred_password.value = \'userdefined\';" />' . "\n" + . $spaces . '</div>' . "\n" + . $spaces . '<div class="item">' . "\n" + . $spaces . '<label for="button_generate_password">' . "\n" + . $spaces . ' ' . $GLOBALS[''] . $GLOBALS['strGeneratePassword'] . ':' . "\n" + . $spaces . '</label>' . "\n" + . $spaces . '<span class="options">' . "\n" + . $spaces . ' <input type="button" id="button_generate_password" value="' . $GLOBALS['strGenerate'] . '" onClick="suggestPassword(this.form, \'generated_pw\')">' . "\n" + . $spaces . ' <input type="button" id="button_copy_password" value="' . $GLOBALS['strCopy'] . '" onClick="suggestPasswordCopy(this.form)">' . "\n" + . $spaces . '</span>' . "\n" + . $spaces . '<input type="text" name="generated_pw" id="generated_pw" class="textfield"/>' . "\n" + . $spaces . '</div>' . "\n" + . $spaces . '</fieldset>' . "\n"; } // end of the 'PMA_displayUserAndHostFields()' function @@ -573,7 +577,7 @@ if (!empty($change_copy)) { $user_host_condition = ' WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($old_username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($old_hostname, 'quoted') . ';'; $res = PMA_DBI_query('SELECT * FROM `mysql`.`user` ' . $user_host_condition); if (!$res) { - $message = $strNoUsersFound; + $message = $GLOBALS['strNoUsersFound']; unset($change_copy); } else { $row = PMA_DBI_fetch_assoc($res); @@ -618,10 +622,10 @@ if (!empty($adduser_submit) || !empty($change_copy)) { unset($row); break; } - $res = PMA_DBI_query('SELECT \'foo\' FROM `user` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ';', NULL, PMA_DBI_QUERY_STORE); + $res = PMA_DBI_query('SELECT \'foo\' FROM `mysql`.`user` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ';', NULL, PMA_DBI_QUERY_STORE); if (PMA_DBI_num_rows($res) == 1) { PMA_DBI_free_result($res); - $message = sprintf($strUserAlreadyExists, '[i]\'' . $username . '\'@\'' . $hostname . '\'[/i]'); + $message = sprintf($GLOBALS['strUserAlreadyExists'], '[i]\'' . $username . '\'@\'' . $hostname . '\'[/i]'); $adduser = 1; } else { PMA_DBI_free_result($res); @@ -665,7 +669,7 @@ if (!empty($adduser_submit) || !empty($change_copy)) { $sql_query .= ';'; if (empty($change_copy)) { PMA_DBI_try_query($real_sql_query) or PMA_mysqlDie(PMA_DBI_getError(), $sql_query); - $message = $strAddUserMessage; + $message = $GLOBALS['strAddUserMessage']; } else { $queries[] = $real_sql_query; // we put the query containing the hidden password in @@ -689,7 +693,7 @@ if (!empty($change_copy)) { $queries[] = 'GRANT ' . join(', ', PMA_extractPrivInfo($row)) . ' ON `' . $row['Db'] . '`.* TO \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\'' . ($row['Grant_priv'] == 'Y' ? ' WITH GRANT OPTION' : '') . ';'; } PMA_DBI_free_result($res); - $res = PMA_DBI_query('SELECT `Db`, `Table_name`, `Table_priv` FROM `mysql`.`tables_priv`' . $user_host_condition, $userlink, PMA_DBI_QUERY_STORE); + $res = PMA_DBI_query('SELECT `Db`, `Table_name`, `Table_priv` FROM `mysql`.`tables_priv`' . $user_host_condition, $GLOBALS['userlink'], PMA_DBI_QUERY_STORE); while ($row = PMA_DBI_fetch_assoc($res)) { $res2 = PMA_DBI_QUERY('SELECT `Column_name`, `Column_priv` FROM `mysql`.`columns_priv` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($old_username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($old_hostname, 'quoted') . ' AND ' . PMA_convert_using('Db') . ' = ' . PMA_convert_using($row['Db'], 'quoted') . ' AND ' . PMA_convert_using('Table_name') . ' = ' . PMA_convert_using($row['Table_name'], 'quoted') . ';', NULL, PMA_DBI_QUERY_STORE); @@ -798,7 +802,7 @@ if (!empty($update_privs)) { $sql_query = (isset($sql_query0) ? $sql_query0 . ' ' : '') . (isset($sql_query1) ? $sql_query1 . ' ' : '') . $sql_query2; - $message = sprintf($strUpdatePrivMessage, '\'' . $username . '\'@\'' . $hostname . '\''); + $message = sprintf($GLOBALS['strUpdatePrivMessage'], '\'' . $username . '\'@\'' . $hostname . '\''); } @@ -814,7 +818,7 @@ if (!empty($revokeall)) { unset($sql_query1); } $sql_query = $sql_query0 . (isset($sql_query1) ? ' ' . $sql_query1 : ''); - $message = sprintf($strRevokeMessage, '\'' . $username . '\'@\'' . $hostname . '\''); + $message = sprintf($GLOBALS['strRevokeMessage'], '\'' . $username . '\'@\'' . $hostname . '\''); if (empty($tablename)) { unset($dbname); } else { @@ -830,11 +834,11 @@ if (!empty($change_pw)) { if ($nopass == 1) { $sql_query = 'SET PASSWORD FOR \'' . $username . '\'@\'' . $hostname . '\' = \'\';'; PMA_DBI_query($sql_query); - $message = sprintf($strPasswordChanged, '\'' . $username . '\'@\'' . $hostname . '\''); + $message = sprintf($GLOBALS['strPasswordChanged'], '\'' . $username . '\'@\'' . $hostname . '\''); } else if (empty($pma_pw) || empty($pma_pw2)) { - $message = $strPasswordEmpty; + $message = $GLOBALS['strPasswordEmpty']; } else if ($pma_pw != $pma_pw2) { - $message = $strPasswordNotSame; + $message = $GLOBALS['strPasswordNotSame']; } else { $hidden_pw = ''; for ($i = 0; $i < strlen($pma_pw); $i++) { @@ -843,7 +847,7 @@ if (!empty($change_pw)) { $local_query = 'SET PASSWORD FOR \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\' = PASSWORD(\'' . PMA_sqlAddslashes($pma_pw) . '\')'; $sql_query = 'SET PASSWORD FOR \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\' = PASSWORD(\'' . $hidden_pw . '\')'; PMA_DBI_try_query($local_query) or PMA_mysqlDie(PMA_DBI_getError(), $sql_query); - $message = sprintf($strPasswordChanged, '\'' . $username . '\'@\'' . $hostname . '\''); + $message = sprintf($GLOBALS['strPasswordChanged'], '\'' . $username . '\'@\'' . $hostname . '\''); } } @@ -862,7 +866,7 @@ if (!empty($delete) || (!empty($change_copy) && $mode < 4)) { } for ($i = 0; isset($selected_usr[$i]); $i++) { list($this_user, $this_host) = explode($user_host_separator, $selected_usr[$i]); - $queries[] = '# ' . sprintf($strDeleting, '\'' . $this_user . '\'@\'' . $this_host . '\'') . ' ...'; + $queries[] = '# ' . sprintf($GLOBALS['strDeleting'], '\'' . $this_user . '\'@\'' . $this_host . '\'') . ' ...'; if ($mode == 2) { // The SHOW GRANTS query may fail if the user has not been loaded // into memory @@ -884,34 +888,36 @@ if (!empty($delete) || (!empty($change_copy) && $mode < 4)) { } unset($res); } - $queries[] = 'DELETE FROM `user` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($this_user), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($this_host, 'quoted') . ';'; + $queries[] = 'DELETE FROM `mysql`.`user` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($this_user), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($this_host, 'quoted') . ';'; if ($mode != 2) { // If we REVOKE the table grants, we should not need to modify the - // `db`, `tables_priv` and `columns_priv` tables manually... + // `mysql`.`db`, `mysql`.`tables_priv` and `mysql`.`columns_priv` tables manually... $user_host_condition = ' WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($this_user), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($this_host, 'quoted') . ';'; - $queries[] = 'DELETE FROM `db`' . $user_host_condition; - $queries[] = 'DELETE FROM `tables_priv`' . $user_host_condition; - $queries[] = 'DELETE FROM `columns_priv`' . $user_host_condition; + $queries[] = 'DELETE FROM `mysql`.`db`' . $user_host_condition; + $queries[] = 'DELETE FROM `mysql`.`tables_priv`' . $user_host_condition; + $queries[] = 'DELETE FROM `mysql`.`columns_priv`' . $user_host_condition; } if (!empty($drop_users_db)) { $queries[] = 'DROP DATABASE IF EXISTS ' . PMA_backquote($this_user) . ';'; + $GLOBALS['reload'] = TRUE; + PMA_reloadNavigation(); } } if (empty($change_copy)) { if (empty($queries)) { - $message = $strError . ': ' . $strDeleteNoUsersSelected; + $message = $GLOBALS['strError'] . ': ' . $GLOBALS['strDeleteNoUsersSelected']; } else { if ($mode == 3) { - $queries[] = '# ' . $strReloadingThePrivileges . ' ...'; + $queries[] = '# ' . $GLOBALS['strReloadingThePrivileges'] . ' ...'; $queries[] = 'FLUSH PRIVILEGES;'; } foreach ($queries as $sql_query) { if ($sql_query{0} != '#') { - PMA_DBI_query($sql_query, $userlink); + PMA_DBI_query($sql_query, $GLOBALS['userlink']); } } $sql_query = join("\n", $queries); - $message = $strUsersDeleted; + $message = $GLOBALS['strUsersDeleted']; } unset($queries); } @@ -934,7 +940,7 @@ if (!empty($change_copy)) { $queries[$tmp_count] = $queries_for_display[$tmp_count]; } } - $message = $strSuccess; + $message = $GLOBALS['strSuccess']; $sql_query = join("\n", $queries); } @@ -945,14 +951,24 @@ if (!empty($change_copy)) { if (!empty($flush_privileges)) { $sql_query = 'FLUSH PRIVILEGES;'; PMA_DBI_query($sql_query); - $message = $strPrivilegesReloaded; + $message = $GLOBALS['strPrivilegesReloaded']; } /** * Displays the links */ -require('./server_links.inc.php'); +if (isset($viewing_mode) && $viewing_mode == 'db') { + $db = $checkprivs; + $url_query .= '&goto=db_operations.php'; + + // Gets the database structure + $sub_part = '_structure'; + require('./db_details_db_info.php'); + echo "\n"; +} else { + require('./server_links.inc.php'); +} /** @@ -963,64 +979,59 @@ if (empty($adduser) && empty($checkprivs)) { // No username is given --> display the overview echo '<h2>' . "\n" . ' ' . ($GLOBALS['cfg']['MainPageIconic'] ? '<img src="'. $GLOBALS['pmaThemeImage'] . 'b_usrlist.png" border="0" hspace="2" align="middle" />' : '') - . $strUserOverview . "\n" + . $GLOBALS['strUserOverview'] . "\n" . '</h2>' . "\n"; - $oldPrivTables = FALSE; + + $sql_query = 'SELECT `User`, `Host`, IF(`Password` = ' . (PMA_MYSQL_INT_VERSION >= 40100 ? '_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`'; + if (PMA_MYSQL_INT_VERSION >= 40002) { - $sql_query = 'SELECT `User`, `Host`, IF(`Password` = ' . (PMA_MYSQL_INT_VERSION >= 40100 ? '_latin1 ' : '') . '\'\', \'N\', \'Y\') AS \'Password\', `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Show_db_priv`, `Super_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Execute_priv`, `Repl_slave_priv`, `Repl_client_priv` FROM `user` '; + $sql_query .= ', `Show_db_priv`, `Super_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Execute_priv`, `Repl_slave_priv`, `Repl_client_priv`'; + } + + if (PMA_MYSQL_INT_VERSION >= 50001) { + $sql_query .= ', `Create_view_priv`, `Show_view_priv`'; + } - // the strtolower() is because sometimes the User field - // might be BINARY, so LIKE would be case sensitive - if (isset($initial)) { - $sql_query .= " WHERE " . PMA_convert_using('User') - . " LIKE " . PMA_convert_using($initial . '%', 'quoted') - . " OR ". PMA_convert_using('User') - . " LIKE " . PMA_convert_using(strtolower($initial) . '%', 'quoted'); - } + if (PMA_MYSQL_INT_VERSION >= 50003) { + $sql_query .= ', `Create_user_priv`, `Create_routine_priv`, `Alter_routine_priv`'; + } + + $sql_query .= ' FROM `mysql`.`user`'; + + // the strtolower() is because sometimes the User field + // might be BINARY, so LIKE would be case sensitive + if (isset($initial)) { + $sql_query .= " WHERE " . PMA_convert_using('User') + . " LIKE " . PMA_convert_using($initial . '%', 'quoted') + . " OR ". PMA_convert_using('User') + . " LIKE " . PMA_convert_using(strtolower($initial) . '%', 'quoted'); + } - $sql_query .= ' ORDER BY `User` ASC, `Host` ASC;'; - $res = PMA_DBI_try_query($sql_query, NULL, PMA_DBI_QUERY_STORE); + $sql_query .= ' ORDER BY `User` ASC, `Host` ASC;'; + $res = PMA_DBI_try_query($sql_query, NULL, PMA_DBI_QUERY_STORE); - if (!$res) { - // the query failed! This may have two reasons: - // - the user has not enough privileges - // - the privilege tables use a structure of an earlier version. - $oldPrivTables = TRUE; - } - } - if (empty($res) || PMA_MYSQL_INT_VERSION < 40002) { - $sql_query = 'SELECT `User`, `Host`, IF(`Password` = ' . (PMA_MYSQL_INT_VERSION >= 40100 ? '_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` FROM `user`'; - - if (isset($initial)) { - $sql_query .= " WHERE " . PMA_convert_using('User') - . " LIKE " . PMA_convert_using($initial . '%', 'quoted') - . " OR ". PMA_convert_using('User') - . " LIKE " . PMA_convert_using(strtolower($initial) . '%', 'quoted'); - } + if (!$res) { + // the query failed! This may have two reasons: + // - the user does not have enough privileges + // - the privilege tables use a structure of an earlier version. + // so let's try a more simple query - $sql_query .= ' ORDER BY `User` ASC, `Host` ASC;'; + $sql_query = 'SELECT * FROM `mysql`.`user`'; $res = PMA_DBI_try_query($sql_query, NULL, PMA_DBI_QUERY_STORE); if (!$res) { - // the query failed! This may have two reasons: - // - the user has not enough privileges - // - the privilege tables use a structure of an earlier version. - $oldPrivTables = TRUE; - } - } - if (!$res) { - echo '<i>' . $strNoPrivileges . '</i>' . "\n"; - PMA_DBI_free_result($res); - unset($res); - } else { - if ($oldPrivTables) { + echo '<i>' . $GLOBALS['strNoPrivileges'] . '</i>' . "\n"; + PMA_DBI_free_result($res); + unset($res); + } else { // rabus: This message is hardcoded because I will replace it by // a automatic repair feature soon. echo '<div class="warning">' . "\n" - . ' Warning: Your privilege table structure seem to be older than this MySQL version!<br />' . "\n" + . ' Warning: Your privilege table structure seems to be older than this MySQL version!<br />' . "\n" . ' Please run the script <tt>mysql_fix_privilege_tables</tt> that should be included in your MySQL server distribution to solve this problem!' . "\n" . '</div><br />' . "\n"; } + } else { /** * Displays the initials @@ -1034,7 +1045,7 @@ if (empty($adduser) && empty($checkprivs)) { $array_initials[chr($letter_counter + 64)] = FALSE; } - $initials = PMA_DBI_try_query('SELECT DISTINCT UPPER(LEFT(' . PMA_convert_using('User') . ',1)) FROM `user` ORDER BY `User` ASC', NULL, PMA_DBI_QUERY_STORE); + $initials = PMA_DBI_try_query('SELECT DISTINCT UPPER(LEFT(' . PMA_convert_using('User') . ',1)) FROM `mysql`.`user` ORDER BY `User` ASC', NULL, PMA_DBI_QUERY_STORE); while (list($tmp_initial) = PMA_DBI_fetch_row($initials)) { $array_initials[$tmp_initial] = TRUE; } @@ -1050,16 +1061,17 @@ if (empty($adduser) && empty($checkprivs)) { foreach ($array_initials as $tmp_initial => $initial_was_found) { if ($initial_was_found) { - echo '<td><a href="' . $PHP_SELF . '?' . $url_query . '&initial=' . urlencode($tmp_initial) . '" style="font-size:' . $font_bigger . '">' . $tmp_initial . '</a></td>' . "\n"; + echo '<td><a href="' . $PHP_SELF . '?' . $GLOBALS['url_query'] . '&initial=' . urlencode($tmp_initial) . '" style="font-size:' . $font_bigger . '">' . $tmp_initial . '</a></td>' . "\n"; } else { echo '<td style="font-size:' . $font_bigger . '">' . $tmp_initial . '</td>'; } } - echo '<td><a href="' . $PHP_SELF . '?' . $url_query . '&showall=1" style="font-size:' . $font_bigger . '">[' . $strShowAll . ']</a></td>' . "\n"; + echo '<td><a href="' . $PHP_SELF . '?' . $GLOBALS['url_query'] . '&showall=1" style="font-size:' . $font_bigger . '">[' . $GLOBALS['strShowAll'] . ']</a></td>' . "\n"; echo '</tr></table>'; /** - * Displays the user overview + * Display the user overview + * (if less than 50 users, display them immediately) */ if (isset($initial) || isset($showall) || PMA_DBI_num_rows($res) < 50) { @@ -1069,30 +1081,30 @@ if (empty($adduser) && empty($checkprivs)) { . ' <table border="0" cellpadding="2" cellspacing="1">' . "\n" . ' <tr>' . "\n" . ' <td></td>' . "\n" - . ' <th> ' . $strUser . ' </th>' . "\n" - . ' <th> ' . $strHost . ' </th>' . "\n" - . ' <th> ' . $strPassword . ' </th>' . "\n" - . ' <th> ' . $strGlobalPrivileges . ' </th>' . "\n" - . ' <th> ' . $strGrantOption . ' </th>' . "\n" - . ' ' . ($cfg['PropertiesIconic'] ? '<td> </td>' : '<th>' . $strAction . '</th>') . "\n"; + . ' <th>' . $GLOBALS['strUser'] . '</th>' . "\n" + . ' <th>' . $GLOBALS['strHost'] . '</th>' . "\n" + . ' <th>' . $GLOBALS['strPassword'] . '</th>' . "\n" + . ' <th>' . $GLOBALS['strGlobalPrivileges'] . '</th>' . "\n" + . ' <th>' . $GLOBALS['strGrantOption'] . '</th>' . "\n" + . ' ' . ($GLOBALS['cfg']['PropertiesIconic'] ? '<td></td>' : '<th>' . $GLOBALS['strAction'] . '</th>') . "\n"; echo ' </tr>' . "\n"; $useBgcolorOne = TRUE; for ($i = 0; $row = PMA_DBI_fetch_assoc($res); $i++) { echo ' <tr>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '"><input type="checkbox" name="selected_usr[]" id="checkbox_sel_users_' . $i . '" value="' . htmlspecialchars($row['User'] . $user_host_separator . $row['Host']) . '"' . (empty($checkall) ? '' : ' checked="checked"') . ' /></td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '"><label for="checkbox_sel_users_' . $i . '">' . (empty($row['User']) ? '<span style="color: #FF0000">' . $strAny . '</span>' : htmlspecialchars($row['User'])) . '</label></td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . htmlspecialchars($row['Host']) . '</td>' . "\n"; + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '"><input type="checkbox" name="selected_usr[]" id="checkbox_sel_users_' . $i . '" value="' . htmlspecialchars($row['User'] . $user_host_separator . $row['Host']) . '"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' /></td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '"><label for="checkbox_sel_users_' . $i . '">' . (empty($row['User']) ? '<span style="color: #FF0000">' . $GLOBALS['strAny'] . '</span>' : htmlspecialchars($row['User'])) . '</label></td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . htmlspecialchars($row['Host']) . '</td>' . "\n"; $privs = PMA_extractPrivInfo($row, TRUE); - echo ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . ($row['Password'] == 'Y' ? $strYes : '<span style="color: #FF0000">' . $strNo . '</span>') . '</td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '"><tt>' . "\n" + echo ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . ($row['Password'] == 'Y' ? $GLOBALS['strYes'] : '<span style="color: #FF0000">' . $GLOBALS['strNo'] . '</span>') . '</td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '"><tt>' . "\n" . ' ' . join(',' . "\n" . ' ', $privs) . "\n" . ' </tt></td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . ($row['Grant_priv'] == 'Y' ? $strYes : $strNo) . '</td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '" align="center"><a href="server_privileges.php?' . $url_query . '&username=' . urlencode($row['User']) . '&hostname=' . urlencode($row['Host']) . '">'; + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . ($row['Grant_priv'] == 'Y' ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . '</td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '" align="center"><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&username=' . urlencode($row['User']) . '&hostname=' . urlencode($row['Host']) . '">'; if ($GLOBALS['cfg']['PropertiesIconic']) { - echo '<img src="' . $GLOBALS['pmaThemeImage'] . 'b_usredit.png" width="16" height="16" border="0" hspace="2" align="middle" alt="' . $strEditPrivileges . '" title="' . $strEditPrivileges . '" />'; + echo '<img src="' . $GLOBALS['pmaThemeImage'] . 'b_usredit.png" width="16" height="16" border="0" hspace="2" align="middle" alt="' . $GLOBALS['strEditPrivileges'] . '" title="' . $GLOBALS['strEditPrivileges'] . '" />'; } else { - echo $strEditPrivileges; + echo $GLOBALS['strEditPrivileges']; } echo '</a></td>' . "\n" . ' </tr>' . "\n"; @@ -1104,68 +1116,63 @@ if (empty($adduser) && empty($checkprivs)) { echo ' <tr>' . "\n" . ' <td></td>' . "\n" . ' <td colspan="5">' . "\n" - . ' <i>' . $strEnglishPrivileges . '</i> ' . "\n" + . ' <i>' . $GLOBALS['strEnglishPrivileges'] . '</i>' . "\n" . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td colspan="6" valign="bottom">' . "\n" - . ' <img src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png" border="0" width="38" height="22" alt="' . $strWithChecked . '" />' . "\n" - . ' <a href="./server_privileges.php?' . $url_query . '&checkall=1" onclick="setCheckboxes(\'usersForm\', \'selected_usr\', true); return false;">' . $strCheckAll . '</a>' . "\n" - . ' / ' . "\n" - . ' <a href="server_privileges.php?' . $url_query . '" onclick="setCheckboxes(\'usersForm\', \'selected_usr\', false); return false;">' . $strUncheckAll . '</a>' . "\n" + . ' <img src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png" border="0" width="38" height="22" alt="' . $GLOBALS['strWithChecked'] . '" />' . "\n" + . ' <a href="./server_privileges.php?' . $GLOBALS['url_query'] . '&checkall=1" onclick="setCheckboxes(\'usersForm\', \'selected_usr\', true); return false;">' . $GLOBALS['strCheckAll'] . '</a>' . "\n" + . ' /' . "\n" + . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '" onclick="setCheckboxes(\'usersForm\', \'selected_usr\', false); return false;">' . $GLOBALS['strUncheckAll'] . '</a>' . "\n" . ' </td>' . "\n" . ' </tr>' . "\n" - . ' </table>' . "\n" - . ' <br /><table border="0" cellpading="3" cellspacing="0">' . "\n" - . ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td ' - . ($cfg['PropertiesIconic'] ? 'colspan="3"><b><a href="server_privileges.php?' . $url_query . '&adduser=1"><img src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" hspace="2" border="0" align="middle" />' : 'width="20" nowrap="nowrap" align="center" valign="top"><b>•</b></td><td><b><a href="server_privileges.php?' . $url_query . '&adduser=1">' ). "\n" - . ' ' . $strAddUser . '</a></b>' . "\n" - . ' ' . "\n" - . ' </td></tr>' . "\n" . ' <tr><td colspan="2"></td></tr>' - . ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td ' - . ($cfg['PropertiesIconic'] ? 'colspan="3"><b><img src="' . $pmaThemeImage . 'b_usrdrop.png" width="16" height="16" hspace="2" border="0" align="middle" />' : 'width="20" nowrap="nowrap" align="center" valign="top"><b>•</b></td><td><b>' ). "\n" - . ' <b>' . $strRemoveSelectedUsers . '</b>' . "\n" - . ' </td></tr>' . "\n" - . ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td width="16" class="nowrap"> </td><td valign="top"><input type="radio" title="' . $strJustDelete . ' ' . $strJustDeleteDescr . '" name="mode" id="radio_mode_1" value="1" checked="checked" /></td>' . "\n" - . ' <td><label for="radio_mode_1" title="' . $strJustDelete . ' ' . $strJustDeleteDescr . '">' . "\n" - . ' ' . $strJustDelete . "\n" - . ' </label></td></tr>' . "\n" - . ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td width="16" class="nowrap"> </td><td valign="top"><input type="radio" title="' . $strRevokeAndDelete . ' ' . $strRevokeAndDeleteDescr . '" name="mode" id="radio_mode_2" value="2" /></td>' . "\n" - . ' <td><label for="radio_mode_2" title="' . $strRevokeAndDelete . ' ' . $strRevokeAndDeleteDescr . '">' . "\n" - . ' ' . $strRevokeAndDelete . "\n" - . ' </label></td></tr>' . "\n" - . ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td width="16" class="nowrap"> </td><td valign="top"><input type="radio" title="' . $strDeleteAndFlush . ' ' . $strDeleteAndFlushDescr . '" name="mode" id="radio_mode_3" value="3" /></td>' . "\n" - . ' <td><label for="radio_mode_3" title="' . $strDeleteAndFlush . ' ' . $strDeleteAndFlushDescr . '">' . "\n" - . ' ' . $strDeleteAndFlush . "\n" - . ' </label></td></tr>' . "\n" - . ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td width="16" class="nowrap"> </td><td valign="top"><input type="checkbox" title="' . $strDropUsersDb . '" name="drop_users_db" id="checkbox_drop_users_db" /></td>' . "\n" - . ' <td><label for="checkbox_drop_users_db" title="' . $strDropUsersDb . '">' . "\n" - . ' ' . $strDropUsersDb . "\n" - . ' </label>' . "\n" - . ' </td></tr>' . "\n" . ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td colspan="3" align="right">' - . ' <input type="submit" name="delete" value="' . $strGo . '" id="buttonGo" />' . "\n" - . ' </td></tr>' . "\n" - . ' </table>' . "\n" - . '</form>' . "\n" - . '<div class="tblWarn">' . "\n" - . ' ' . sprintf($strFlushPrivilegesNote, '<a href="server_privileges.php?' . $url_query . '&flush_privileges=1">', '</a>') . "\n" - . '</div>' . "\n"; - } else { + . ' </table><br />' . "\n"; + + // add/delete user fieldset + echo ' <fieldset id="fieldset_add_user">' . "\n" + . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&adduser=1">' . "\n" + . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" hspace="2" border="0" align="middle" />' . "\n" : '' ) + . ' ' . $GLOBALS['strAddUser'] . '</a></b>' . "\n" + . ' </fieldset>' . "\n" + . ' <fieldset id="fieldset_delete_user">' + . ' <legend>' . "\n" + . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img src="' . $pmaThemeImage . 'b_usrdrop.png" width="16" height="16" hspace="2" border="0" align="middle" />' . "\n" : '' ) + . ' ' . $GLOBALS['strRemoveSelectedUsers'] . '' . "\n" + . ' </legend>' . "\n" + . ' <input type="radio" title="' . $GLOBALS['strJustDelete'] . ' ' . $GLOBALS['strJustDeleteDescr'] . '" name="mode" id="radio_mode_1" value="1" checked="checked" />' . "\n" + . ' <label for="radio_mode_1" title="' . $GLOBALS['strJustDelete'] . ' ' . $GLOBALS['strJustDeleteDescr'] . '">' . "\n" + . ' ' . $GLOBALS['strJustDelete'] . "\n" + . ' </label><br />' . "\n" + . ' <input type="radio" title="' . $GLOBALS['strRevokeAndDelete'] . ' ' . $GLOBALS['strRevokeAndDeleteDescr'] . '" name="mode" id="radio_mode_2" value="2" />' . "\n" + . ' <label for="radio_mode_2" title="' . $GLOBALS['strRevokeAndDelete'] . ' ' . $GLOBALS['strRevokeAndDeleteDescr'] . '">' . "\n" + . ' ' . $GLOBALS['strRevokeAndDelete'] . "\n" + . ' </label><br />' . "\n" + . ' <input type="radio" title="' . $GLOBALS['strDeleteAndFlush'] . ' ' . $GLOBALS['strDeleteAndFlushDescr'] . '" name="mode" id="radio_mode_3" value="3" />' . "\n" + . ' <label for="radio_mode_3" title="' . $GLOBALS['strDeleteAndFlush'] . ' ' . $GLOBALS['strDeleteAndFlushDescr'] . '">' . "\n" + . ' ' . $GLOBALS['strDeleteAndFlush'] . "\n" + . ' </label><br />' . "\n" + . ' <input type="checkbox" title="' . $GLOBALS['strDropUsersDb'] . '" name="drop_users_db" id="checkbox_drop_users_db" />' . "\n" + . ' <label for="checkbox_drop_users_db" title="' . $GLOBALS['strDropUsersDb'] . '">' . "\n" + . ' ' . $GLOBALS['strDropUsersDb'] . "\n" + . ' </label>' . "\n" + . ' </fieldset>' . "\n" + . ' <fieldset id="fieldset_delete_user_footer" class="tblFooters">' . "\n" + . ' <input type="submit" name="delete" value="' . $GLOBALS['strGo'] . '" id="buttonGo" />' . "\n" + . ' </fieldset>' . "\n"; + } else { unset ($row); - echo ' <br /><table border="0" cellpading="3" cellspacing="0">' . "\n" - . ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td ' - . ($cfg['PropertiesIconic'] ? 'colspan="3"><b><a href="server_privileges.php?' . $url_query . '&adduser=1"><img src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" hspace="2" border="0" align="middle" />' : 'width="20" nowrap="nowrap" align="center" valign="top"><b>•</b></td><td><b><a href="server_privileges.php?' . $url_query . '&adduser=1">' ). "\n" - . ' ' . $strAddUser . '</a></b>' . "\n" - . ' ' . "\n" - . ' </td></tr>' . "\n" . ' <tr><td colspan="2"></td></tr>' - . ' </table>' . "\n" - . '</form>' . "\n" - . '<div class="tblWarn">' . "\n" - . ' ' . sprintf($strFlushPrivilegesNote, '<a href="server_privileges.php?' . $url_query . '&flush_privileges=1">', '</a>') . "\n" - . '</div>' . "\n"; - } // end if (display overview) - + echo ' <fieldset id="fieldset_add_user">' . "\n" + . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&adduser=1">' . "\n" + . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" hspace="2" border="0" align="middle" />' . "\n" : '' ) + . ' ' . $GLOBALS['strAddUser'] . '</a></b>' . "\n" + . ' </fieldset>' . "\n"; + } // end if (display overview) + echo '</form>' . "\n" + . '<div class="tblWarn">' . "\n" + . ' ' . sprintf($GLOBALS['strFlushPrivilegesNote'], '<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&flush_privileges=1">', '</a>') . "\n" + . '</div>' . "\n"; } @@ -1174,64 +1181,67 @@ if (empty($adduser) && empty($checkprivs)) { // A user was selected -> display the user's properties echo '<h2>' . "\n" - . ($cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_usredit.png" width="16" height="16" border="0" hspace="2" align="middle" />' : '' ) - . ' ' . $strUser . ' <i><a class="h2" href="server_privileges.php?' . $url_query . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '">\'' . htmlspecialchars($username) . '\'@\'' . htmlspecialchars($hostname) . '\'</a></i>' . "\n"; + . ($GLOBALS['cfg']['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_usredit.png" width="16" height="16" border="0" hspace="2" align="middle" />' : '' ) + . ' ' . $GLOBALS['strUser'] . ' <i><a class="h2" href="server_privileges.php?' . $GLOBALS['url_query'] . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '">\'' . htmlspecialchars($username) . '\'@\'' . htmlspecialchars($hostname) . '\'</a></i>' . "\n"; if (!empty($dbname)) { - echo ' - ' . $strDatabase . ' <i><a class="h2" href="' . $cfg['DefaultTabDatabase'] . '?' . $url_query . '&db=' . urlencode($dbname) . '&reload=1">' . htmlspecialchars($dbname) . '</a></i>' . "\n"; + echo ' - ' . $GLOBALS['strDatabase'] . ' <i><a class="h2" href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['url_query'] . '&db=' . urlencode($dbname) . '&reload=1">' . htmlspecialchars($dbname) . '</a></i>' . "\n"; if (!empty($tablename)) { - echo ' - ' . $strTable . ' <i><a class="h2" href="' . $cfg['DefaultTabTable'] . '?' . $url_query . '&db=' . urlencode($dbname) . '&table=' . urlencode($tablename) . '&reload=1">' . htmlspecialchars($tablename) . '</a></i>' . "\n"; + echo ' - ' . $GLOBALS['strTable'] . ' <i><a class="h2" href="' . $GLOBALS['cfg']['DefaultTabTable'] . '?' . $GLOBALS['url_query'] . '&db=' . urlencode($dbname) . '&table=' . urlencode($tablename) . '&reload=1">' . htmlspecialchars($tablename) . '</a></i>' . "\n"; } } - echo '</h2>' . "\n"; - $res = PMA_DBI_query('SELECT \'foo\' FROM `user` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ';', NULL, PMA_DBI_QUERY_STORE); + echo ' : ' . $GLOBALS['strEditPrivileges'] . '</h2>' . "\n"; + $res = PMA_DBI_query('SELECT \'foo\' FROM `mysql`.`user` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ';', NULL, PMA_DBI_QUERY_STORE); if (PMA_DBI_num_rows($res) < 1) { - echo $strUserNotFound; + echo $GLOBALS['strUserNotFound']; require_once('./footer.inc.php'); } PMA_DBI_free_result($res); unset($res); - echo '<ul>' . "\n" - . ' <li>' . "\n" - . ' <form name="usersForm" action="server_privileges.php" method="post">' . "\n" + echo '<form name="usersForm" action="server_privileges.php" method="post">' . "\n" . PMA_generate_common_hidden_inputs('', '', 3) - . ' <input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n" - . ' <input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"; + . '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n" + . '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"; if (!empty($dbname)) { - echo ' <input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '" />' . "\n"; + echo '<input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '" />' . "\n"; if (!empty($tablename)) { - echo ' <input type="hidden" name="tablename" value="' . htmlspecialchars($tablename) . '" />' . "\n"; + echo ' <input type="hidden" name="tablename" value="' . htmlspecialchars($tablename) . '" />' . "\n"; } } - echo ' <b>' . $strEditPrivileges . '</b><br />' . "\n"; PMA_displayPrivTable((empty($dbname) ? '*' : $dbname), ((empty($dbname) || empty($tablename)) ? '*' : $tablename), TRUE, 3); - echo ' </form>' . "\n" - . ' </li>' . "\n"; + echo '</form>' . "\n"; if (empty($tablename)) { - echo ' <li>' . "\n" - . ' <b>' . (empty($dbname) ? $strDbPrivileges : $strTblPrivileges) . '</b><br />' . "\n" - . ' <table border="0" cellpadding="2" cellspacing="1">' . "\n" - . ' <tr>' . "\n" - . ' <th> ' . (empty($dbname) ? $strDatabase : $strTable) . ' </th>' . "\n" - . ' <th> ' . $strPrivileges . ' </th>' . "\n" - . ' <th> ' . $strGrantOption . ' </th>' . "\n" - . ' <th> ' . (empty($dbname) ? $strTblPrivileges : $strColumnPrivileges) . ' </th>' . "\n" - . ' <th colspan="2"> ' . $strAction . ' </th>' . "\n" - . ' </tr>' . "\n"; + echo '<form action="server_privileges.php" method="post">' . "\n" + . PMA_generate_common_hidden_inputs('', '', 6) + . '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n" + . '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n" + . '<fieldset>' . "\n" + . '<legend>' . (empty($dbname) ? $GLOBALS['strDbPrivileges'] : $GLOBALS['strTblPrivileges']) . '<legend>' . "\n" + . '<table border="0" cellpadding="2" cellspacing="1">' . "\n" + . '<thead>' . "\n" + . '<tr>' . "\n" + . ' <th>' . (empty($dbname) ? $GLOBALS['strDatabase'] : $GLOBALS['strTable']) . '</th>' . "\n" + . ' <th>' . $GLOBALS['strPrivileges'] . '</th>' . "\n" + . ' <th>' . $GLOBALS['strGrantOption'] . '</th>' . "\n" + . ' <th>' . (empty($dbname) ? $GLOBALS['strTblPrivileges'] : $GLOBALS['strColumnPrivileges']) . '</th>' . "\n" + . ' <th colspan="2">' . $GLOBALS['strAction'] . '</th>' . "\n" + . '</tr>' . "\n" + . '</thead>' . "\n" + . '<tbody>' . "\n"; $user_host_condition = ' WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted'); if (empty($dbname)) { - $sql_query = 'SELECT * FROM `db`' . $user_host_condition . ' ORDER BY `Db` ASC;'; + $sql_query = 'SELECT * FROM `mysql`.`db`' . $user_host_condition . ' ORDER BY `Db` ASC;'; } else { - $sql_query = 'SELECT `Table_name`, `Table_priv`, IF(`Column_priv` = ' . (PMA_MYSQL_INT_VERSION >= 40100 ? '_latin1 ' : '') . ' \'\', 0, 1) AS \'Column_priv\' FROM `tables_priv`' . $user_host_condition . ' AND ' . PMA_convert_using('Db') . ' = ' . PMA_convert_using($dbname, 'quoted') . ' ORDER BY `Table_name` ASC;'; + $sql_query = 'SELECT `Table_name`, `Table_priv`, IF(`Column_priv` = ' . (PMA_MYSQL_INT_VERSION >= 40100 ? '_latin1 ' : '') . ' \'\', 0, 1) AS \'Column_priv\' FROM `mysql`.`tables_priv`' . $user_host_condition . ' AND ' . PMA_convert_using('Db') . ' = ' . PMA_convert_using($dbname, 'quoted') . ' ORDER BY `Table_name` ASC;'; } $res = PMA_DBI_query($sql_query, NULL, PMA_DBI_QUERY_STORE); if (PMA_DBI_affected_rows() == 0) { - echo ' <tr>' . "\n" - . ' <td bgcolor="' . $cfg['BgcolorOne'] . '" colspan="6"><center><i>' . $strNone . '</i></center></td>' . "\n" - . ' </tr>' . "\n"; + echo '<tr>' . "\n" + . ' <td bgcolor="' . $GLOBALS['cfg']['BgcolorOne'] . '" colspan="6"><center><i>' . $GLOBALS['strNone'] . '</i></center></td>' . "\n" + . '</tr>' . "\n"; } else { $useBgcolorOne = TRUE; if (empty($dbname)) { - $res2 = PMA_DBI_query('SELECT `Db` FROM `tables_priv`' . $user_host_condition . ' GROUP BY `Db` ORDER BY `Db` ASC;'); + $res2 = PMA_DBI_query('SELECT `Db` FROM `mysql`.`tables_priv`' . $user_host_condition . ' GROUP BY `Db` ORDER BY `Db` ASC;'); $row2 = PMA_DBI_fetch_assoc($res2); } $found_rows = array(); @@ -1240,41 +1250,41 @@ if (empty($adduser) && empty($checkprivs)) { while (empty($dbname) && $row2 && $row['Db'] > $row2['Db']) { $found_rows[] = $row2['Db']; - echo ' <tr>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . htmlspecialchars($row2['Db']) . '</td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '"><tt>' . "\n" - . ' <dfn title="' . $strPrivDescUsage . '">USAGE</dfn>' . "\n" - . ' </tt></td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . $strNo . '</td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . $strYes . '</td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '"><a href="server_privileges.php?' . $url_query . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '&dbname=' . urlencode($row2['Db']) . '">' . $strEdit . '</a></td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '"><a href="server_privileges.php?' . $url_query . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '&dbname=' . urlencode($row2['Db']) . '&revokeall=1">' . $strRevoke . '</a></td>' . "\n" - . ' </tr>' . "\n"; + echo '<tr>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . htmlspecialchars($row2['Db']) . '</td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '"><tt>' . "\n" + . ' <dfn title="' . $GLOBALS['strPrivDescUsage'] . '">USAGE</dfn>' . "\n" + . ' </tt></td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . $GLOBALS['strNo'] . '</td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . $GLOBALS['strYes'] . '</td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '"><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '&dbname=' . urlencode($row2['Db']) . '">' . $GLOBALS['strEdit'] . '</a></td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '"><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '&dbname=' . urlencode($row2['Db']) . '&revokeall=1">' . $GLOBALS['strRevoke'] . '</a></td>' . "\n" + . '</tr>' . "\n"; $row2 = PMA_DBI_fetch_assoc($res2); $useBgcolorOne = !$useBgcolorOne; } // end while $found_rows[] = empty($dbname) ? $row['Db'] : $row['Table_name']; - echo ' <tr>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . htmlspecialchars(empty($dbname) ? $row['Db'] : $row['Table_name']) . '</td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '"><tt>' . "\n" - . ' ' . join(',' . "\n" . ' ', PMA_extractPrivInfo($row, TRUE)) . "\n" - . ' </tt></td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . (((empty($dbname) && $row['Grant_priv'] == 'Y') || (!empty($dbname) && in_array('Grant', explode(',', $row['Table_priv'])))) ? $strYes : $strNo) . '</td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">'; + echo '<tr>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . htmlspecialchars(empty($dbname) ? $row['Db'] : $row['Table_name']) . '</td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '"><tt>' . "\n" + . ' ' . join(',' . "\n" . ' ', PMA_extractPrivInfo($row, TRUE)) . "\n" + . ' </tt></td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . (((empty($dbname) && $row['Grant_priv'] == 'Y') || (!empty($dbname) && in_array('Grant', explode(',', $row['Table_priv'])))) ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . '</td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">'; if ((empty($dbname) && $row2 && $row['Db'] == $row2['Db']) || (!empty($dbname) && $row['Column_priv'])) { - echo $strYes; + echo $GLOBALS['strYes']; if (empty($dbname)) { $row2 = PMA_DBI_fetch_assoc($res2); } } else { - echo $strNo; + echo $GLOBALS['strNo']; } echo '</td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '"><a href="server_privileges.php?' . $url_query . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '&dbname=' . (empty($dbname) ? urlencode($row['Db']) : urlencode($dbname) . '&tablename=' . urlencode($row['Table_name'])) . '">' . $strEdit . '</a></td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '"><a href="server_privileges.php?' . $url_query . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '&dbname=' . (empty($dbname) ? urlencode($row['Db']) : urlencode($dbname) . '&tablename=' . urlencode($row['Table_name'])) . '&revokeall=1">' . $strRevoke . '</a></td>' . "\n" - . ' </tr>' . "\n"; + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '"><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '&dbname=' . (empty($dbname) ? urlencode($row['Db']) : urlencode($dbname) . '&tablename=' . urlencode($row['Table_name'])) . '">' . $GLOBALS['strEdit'] . '</a></td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '"><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '&dbname=' . (empty($dbname) ? urlencode($row['Db']) : urlencode($dbname) . '&tablename=' . urlencode($row['Table_name'])) . '&revokeall=1">' . $GLOBALS['strRevoke'] . '</a></td>' . "\n" + . '</tr>' . "\n"; $useBgcolorOne = !$useBgcolorOne; } // end while @@ -1282,16 +1292,16 @@ if (empty($adduser) && empty($checkprivs)) { while (empty($dbname) && $row2) { $found_rows[] = $row2['Db']; - echo ' <tr>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . htmlspecialchars($row2['Db']) . '</td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '"><tt>' . "\n" - . ' <dfn title="' . $strPrivDescUsage . '">USAGE</dfn>' . "\n" - . ' </tt></td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . $strNo . '</td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . $strYes . '</td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '"><a href="server_privileges.php?' . $url_query . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '&dbname=' . urlencode($row2['Db']) . '">' . $strEdit . '</a></td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '"><a href="server_privileges.php?' . $url_query . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '&dbname=' . urlencode($row2['Db']) . '&revokeall=1">' . $strRevoke . '</a></td>' . "\n" - . ' </tr>' . "\n"; + echo '<tr>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . htmlspecialchars($row2['Db']) . '</td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '"><tt>' . "\n" + . ' <dfn title="' . $GLOBALS['strPrivDescUsage'] . '">USAGE</dfn>' . "\n" + . ' </tt></td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . $GLOBALS['strNo'] . '</td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . $GLOBALS['strYes'] . '</td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '"><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '&dbname=' . urlencode($row2['Db']) . '">' . $GLOBALS['strEdit'] . '</a></td>' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '"><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '&dbname=' . urlencode($row2['Db']) . '&revokeall=1">' . $GLOBALS['strRevoke'] . '</a></td>' . "\n" + . '</tr>' . "\n"; $row2 = PMA_DBI_fetch_assoc($res2); $useBgcolorOne = !$useBgcolorOne; @@ -1305,14 +1315,10 @@ if (empty($adduser) && empty($checkprivs)) { PMA_DBI_free_result($res); unset($res); unset($row); - echo ' <tr>' . "\n" - . ' <td colspan="5">' . "\n" - . ' <form action="server_privileges.php" method="post">' . "\n" - . PMA_generate_common_hidden_inputs('', '', 6) - . ' <input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n" - . ' <input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"; + echo '</tbody>' . "\n" + . '</table>' . "\n"; if (empty($dbname)) { - echo ' <label for="text_dbname">' . $strAddPrivilegesOnDb . ':</label>' . "\n"; + echo ' <label for="text_dbname">' . $GLOBALS['strAddPrivilegesOnDb'] . ':</label>' . "\n"; $res = PMA_DBI_query('SHOW DATABASES;'); $pred_db_array = array(); while ($row = PMA_DBI_fetch_row($res)) { @@ -1324,17 +1330,17 @@ if (empty($adduser) && empty($checkprivs)) { unset($res); unset($row); if (!empty($pred_db_array)) { - echo ' <select name="pred_dbname" onchange="this.form.submit();">' . "\n" - . ' <option value="" selected="selected">' . $strUseTextField . ':</option>' . "\n"; + echo ' <select name="pred_dbname" onchange="this.form.submit();">' . "\n" + . ' <option value="" selected="selected">' . $GLOBALS['strUseTextField'] . ':</option>' . "\n"; foreach ($pred_db_array as $current_db) { - echo ' <option value="' . htmlspecialchars(str_replace('_', '\\_', $current_db)) . '">' . htmlspecialchars($current_db) . '</option>' . "\n"; + echo ' <option value="' . htmlspecialchars(str_replace('_', '\\_', $current_db)) . '">' . htmlspecialchars($current_db) . '</option>' . "\n"; } - echo ' </select>' . "\n"; + echo ' </select>' . "\n"; } - echo ' <input type="text" id="text_dbname" name="dbname" class="textfield" />' . "\n"; + echo ' <input type="text" id="text_dbname" name="dbname" class="textfield" />' . "\n"; } else { - echo ' <input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '"/>' . "\n" - . ' <label for="text_tablename">' . $strAddPrivilegesOnTbl . ':</label>' . "\n"; + echo ' <input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '"/>' . "\n" + . ' <label for="text_tablename">' . $GLOBALS['strAddPrivilegesOnTbl'] . ':</label>' . "\n"; if ($res = @PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($dbname) . ';', NULL, PMA_DBI_QUERY_STORE)) { $pred_tbl_array = array(); while ($row = PMA_DBI_fetch_row($res)) { @@ -1346,135 +1352,127 @@ if (empty($adduser) && empty($checkprivs)) { unset($res); unset($row); if (!empty($pred_tbl_array)) { - echo ' <select name="pred_tablename" onchange="this.form.submit();">' . "\n" - . ' <option value="" selected="selected">' . $strUseTextField . ':</option>' . "\n"; + echo ' <select name="pred_tablename" onchange="this.form.submit();">' . "\n" + . ' <option value="" selected="selected">' . $GLOBALS['strUseTextField'] . ':</option>' . "\n"; foreach ($pred_tbl_array as $current_table) { - echo ' <option value="' . htmlspecialchars($current_table) . '">' . htmlspecialchars($current_table) . '</option>' . "\n"; + echo ' <option value="' . htmlspecialchars($current_table) . '">' . htmlspecialchars($current_table) . '</option>' . "\n"; } - echo ' </select>' . "\n"; + echo ' </select>' . "\n"; } } else { unset($res); } - echo ' <input type="text" id="text_tablename" name="tablename" class="textfield" />' . "\n"; + echo ' <input type="text" id="text_tablename" name="tablename" class="textfield" />' . "\n"; } - echo ' <input type="submit" value="' . $strGo . '" />' . PMA_showHint($strEscapeWildcards) . "\n" - . ' </form>' . "\n" - . ' </td>' . "\n" - . ' </tr>' . "\n" - . ' </table><br />' . "\n" - . ' </li>' . "\n"; + echo ' <input type="submit" value="' . $GLOBALS['strGo'] . '" />' . PMA_showHint($GLOBALS['strEscapeWildcards']) . "\n" + . '</fieldset>' . "\n" + . '</form>' . "\n"; } if (empty($dbname)) { - echo ' <li>' . "\n" - . ' <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) - . ' <input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n" - . ' <input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"; - echo ' <b>' . $strChangePassword . '</b><br />' . "\n" - . ' <table border="0" cellpadding="2" cellspacing="1">' . "\n" - . ' <tr>' . "\n" - . ' <td bgcolor="' . $cfg['BgcolorOne'] . '"><input type="radio" name="nopass" value="1" id="radio_nopass_1" onclick="pma_pw.value=\'\'; pma_pw2.value=\'\';" /></td>' . "\n" - . ' <td bgcolor="' . $cfg['BgcolorOne'] . '" colspan="2"><label for="radio_nopass_1">' . $strNoPassword . '</label></td>' . "\n" - . ' </tr>' . "\n" - . ' <tr>' . "\n" - . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><input type="radio" name="nopass" value="0" id="radio_nopass_0" onclick="document.getElementById(\'pw_pma_pw\').focus();" /></td>' . "\n" - . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><label for="radio_nopass_0">' . $strPassword . ':</label></td>' . "\n" - . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><input type="password" name="pma_pw" id="pw_pma_pw" class="textfield" onchange="nopass[1].checked = true;" /></td>' . "\n" - . ' </tr>' . "\n" - . ' <tr>' . "\n" - . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"> </td>' . "\n" - . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><label for="pw_pma_pw2">' . $strReType . ':</label></td>' . "\n" - . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '"><input type="password" name="pma_pw2" id="pw_pma_pw2" class="textfield" onchange="nopass[1].checked = true;" /></td>' . "\n" - . ' </tr>' . "\n" - . ' <tr>' . "\n" - . ' <td colspan="3" align="right">' . "\n" - . ' <input type="submit" name="change_pw" value="' . $strGo . '" />' . "\n" - . ' </td>' . "\n" - . ' </tr>' . "\n" - . ' </table>' . "\n" - . ' </form>' . "\n" - . ' </li>' . "\n" - . ' <li>' . "\n" - . ' <form action="server_privileges.php" method="post" onsubmit="return checkPassword(this);">' . "\n" + . '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n" + . '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n" + . '<fieldset id="fieldset_change_password">' . "\n" + . ' <legend>' . $GLOBALS['strChangePassword'] . '</legnd>' . "\n" + . ' <table border="0" cellpadding="2" cellspacing="1">' . "\n" + . ' <tr>' . "\n" + . ' <td bgcolor="' . $GLOBALS['cfg']['BgcolorOne'] . '"><input type="radio" name="nopass" value="1" id="radio_nopass_1" onclick="pma_pw.value=\'\'; pma_pw2.value=\'\';" /></td>' . "\n" + . ' <td bgcolor="' . $GLOBALS['cfg']['BgcolorOne'] . '" colspan="2"><label for="radio_nopass_1">' . $GLOBALS['strNoPassword'] . '</label></td>' . "\n" + . ' </tr>' . "\n" + . ' <tr>' . "\n" + . ' <td bgcolor="' . $GLOBALS['cfg']['BgcolorTwo'] . '"><input type="radio" name="nopass" value="0" id="radio_nopass_0" onclick="document.getElementById(\'pw_pma_pw\').focus();" /></td>' . "\n" + . ' <td bgcolor="' . $GLOBALS['cfg']['BgcolorTwo'] . '"><label for="radio_nopass_0">' . $GLOBALS['strPassword'] . ':</label></td>' . "\n" + . ' <td bgcolor="' . $GLOBALS['cfg']['BgcolorTwo'] . '"><input type="password" name="pma_pw" id="pw_pma_pw" class="textfield" onchange="nopass[1].checked = true;" /></td>' . "\n" + . ' </tr>' . "\n" + . ' <tr>' . "\n" + . ' <td bgcolor="' . $GLOBALS['cfg']['BgcolorTwo'] . '"></td>' . "\n" + . ' <td bgcolor="' . $GLOBALS['cfg']['BgcolorTwo'] . '"><label for="pw_pma_pw2">' . $GLOBALS['strReType'] . ':</label></td>' . "\n" + . ' <td bgcolor="' . $GLOBALS['cfg']['BgcolorTwo'] . '"><input type="password" name="pma_pw2" id="pw_pma_pw2" class="textfield" onchange="nopass[1].checked = true;" /></td>' . "\n" + . ' </tr>' . "\n" + . ' </table>' . "\n" + . ' </fieldset>' . "\n" + . '<fieldset id="fieldset_change_password_footer" class="tblFooters">' . "\n" + . ' <input type="submit" name="change_pw" value="' . $GLOBALS['strGo'] . '" />' . "\n" + . '</fieldset>' . "\n" + . '</form>' . "\n" + . '<form action="server_privileges.php" method="post" onsubmit="return checkPassword(this);">' . "\n" . PMA_generate_common_hidden_inputs('', '', 3) - . ' <input type="hidden" name="old_username" value="' . htmlspecialchars($username) . '" />' . "\n" - . ' <input type="hidden" name="old_hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n" - . ' <b>' . $strChangeCopyUser . '</b><br />' . "\n" - . ' <table border="0" cellpadding="2" cellspacing="1">' . "\n"; - PMA_displayLoginInformationFields('change', 3); - echo ' </table>' . "\n" - . ' ' . $strChangeCopyMode . '<br />' . "\n" - . ' <input type="radio" name="mode" value="4" id="radio_mode_4" checked="checked" /><label for="radio_mode_4">' . "\n" - . ' ' . $strChangeCopyModeCopy . "\n" - . ' </label>' . "\n" - . ' <br />' . "\n" - . ' <input type="radio" name="mode" value="1" id="radio_mode_1" /><label for="radio_mode_1">' . "\n" - . ' ' . $strChangeCopyModeJustDelete . "\n" - . ' </label>' . "\n" - . ' <br />' . "\n" - . ' <input type="radio" name="mode" value="2" id="radio_mode_2" /><label for="radio_mode_2">' . "\n" - . ' ' . $strChangeCopyModeRevoke . "\n" - . ' </label>' . "\n" - . ' <br />' . "\n" - . ' <input type="radio" name="mode" value="3" id="radio_mode_3" /><label for="radio_mode_3">' . "\n" - . ' ' . $strChangeCopyModeDeleteAndReload . "\n" - . ' </label>' . "\n" - . ' <br />' . "\n" - . ' <input type="submit" name="change_copy" value="' . $strGo . '" />' . "\n" - . ' </form>' . "\n" - . ' </li>' . "\n"; + . '<input type="hidden" name="old_username" value="' . htmlspecialchars($username) . '" />' . "\n" + . '<input type="hidden" name="old_hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n" + . '<fieldset id="fieldset_change_copy_user">' . "\n" + . ' <legend>' . $GLOBALS['strChangeCopyUser'] . '</legend>' . "\n"; + PMA_displayLoginInformationFields('change', 3 ); + echo ' <fieldset>' . "\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" + . ' ' . $GLOBALS['strChangeCopyModeCopy'] . "\n" + . ' </label>' . "\n" + . ' <br />' . "\n" + . ' <input type="radio" name="mode" value="1" id="radio_mode_1" /><label for="radio_mode_1">' . "\n" + . ' ' . $GLOBALS['strChangeCopyModeJustDelete'] . "\n" + . ' </label>' . "\n" + . ' <br />' . "\n" + . ' <input type="radio" name="mode" value="2" id="radio_mode_2" /><label for="radio_mode_2">' . "\n" + . ' ' . $GLOBALS['strChangeCopyModeRevoke'] . "\n" + . ' </label>' . "\n" + . ' <br />' . "\n" + . ' <input type="radio" name="mode" value="3" id="radio_mode_3" /><label for="radio_mode_3">' . "\n" + . ' ' . $GLOBALS['strChangeCopyModeDeleteAndReload'] . "\n" + . ' </label>' . "\n" + . ' </fieldset>' . "\n" + . '</fieldset>' . "\n" + . '<fieldset id="fieldset_change_copy_user_footer" class="tblFooters">' . "\n" + . ' <input type="submit" name="change_copy" value="' . $GLOBALS['strGo'] . '" />' . "\n" + . '</fieldset>' . "\n" + . '</form>' . "\n"; } - echo '</ul>' . "\n"; } } else if (!empty($adduser)) { // Add a new user - $url_query .= '&adduser=1'; + $GLOBALS['url_query'] .= '&adduser=1'; echo '<h2>' . "\n" - . ($cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" border="0" hspace="2" align="middle" />' : '' ) - . ' ' . $strAddUser . "\n" + . ($GLOBALS['cfg']['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" border="0" hspace="2" align="middle" />' : '' ) + . ' ' . $GLOBALS['strAddUser'] . "\n" . '</h2>' . "\n" . '<form name="usersForm" action="server_privileges.php" method="post" onsubmit="return checkAddUser(this);">' . "\n" - . PMA_generate_common_hidden_inputs('', '', 1) - . ' <table border="0" cellpadding="2" cellspacing="1">' . "\n" - . ' <tr>' . "\n" - . ' <th colspan="3">' . "\n" - . ' ' . $strLoginInformation . "\n" - . ' </th>' . "\n" - . ' </tr>' . "\n"; + . PMA_generate_common_hidden_inputs('', '', 1); PMA_displayLoginInformationFields('new', 2); - echo ' </table><br />' . "\n"; PMA_displayPrivTable('*', '*', FALSE, 1); - echo ' <br />' . "\n" - . ' <input type="submit" name="adduser_submit" value="' . $strGo . '" />' . "\n" + echo ' <fieldset id="fieldset_add_user_footer" class="tblFooters">' . "\n" + . ' <input type="submit" name="adduser_submit" value="' . $GLOBALS['strGo'] . '" />' . "\n" + . ' </fieldset>' . "\n" . '</form>' . "\n"; } else { // check the privileges for a particular database. - echo '<h2>' . "\n" - . ($cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_usrcheck.png" width="16" height="16" border="0" hspace="2" align="middle" />' : '' ) - . ' ' . sprintf($strUsersHavingAccessToDb, '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' . htmlspecialchars($checkprivs) . '</a>') . "\n" - . '</h2>' . "\n" - . '<table border="0" cellpadding="2" cellspacing="1">' . "\n" + echo '<table border="0" cellpadding="2" cellspacing="1">' . "\n" + . '<caption class="tblHeaders">' . "\n" + . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img src="' . $pmaThemeImage . 'b_usrcheck.png" width="16" height="16" border="0" hspace="2" align="middle" />' . "\n" : '' ) + . ' ' . sprintf($GLOBALS['strUsersHavingAccessToDb'], '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' . htmlspecialchars($checkprivs) . '</a>') . "\n" + . '</caption>' . "\n" + . '<thead>' . "\n" . ' <tr>' . "\n" . ' <th>' . "\n" - . ' ' . $strUser . ' ' . "\n" + . ' ' . $GLOBALS['strUser'] . '' . "\n" . ' </th>' . "\n" . ' <th>' . "\n" - . ' ' . $strHost . ' ' . "\n" + . ' ' . $GLOBALS['strHost'] . '' . "\n" . ' </th>' . "\n" . ' <th>' . "\n" - . ' ' . $strType . ' ' . "\n" + . ' ' . $GLOBALS['strType'] . '' . "\n" . ' </th>' . "\n" . ' <th>' . "\n" - . ' ' . $strPrivileges . ' ' . "\n" + . ' ' . $GLOBALS['strPrivileges'] . '' . "\n" . ' </th>' . "\n" . ' <th>' . "\n" - . ' ' . $strGrantOption . ' ' . "\n" + . ' ' . $GLOBALS['strGrantOption'] . '' . "\n" . ' </th>' . "\n" . ' <th>' . "\n" - . ' ' . $strAction . ' ' . "\n" + . ' ' . $GLOBALS['strAction'] . '' . "\n" . ' </th>' . "\n" - . ' </tr>' . "\n"; + . ' </tr>' . "\n" + . '<t/head>' . "\n" + . '<tbody>' . "\n"; $useBgcolorOne = TRUE; unset($row); unset($row1); @@ -1490,7 +1488,7 @@ if (empty($adduser) && empty($checkprivs)) { $list_of_compared_privileges = PMA_convert_using('Select_priv') . ' = ' . $no . ' AND ' . PMA_convert_using('Insert_priv') . ' = ' . $no . ' AND ' . PMA_convert_using('Update_priv') . ' = ' . $no . ' AND ' . PMA_convert_using('Delete_priv') . ' = ' . $no . ' AND ' . PMA_convert_using('Create_priv') . ' = ' . $no . ' AND ' . PMA_convert_using('Drop_priv') . ' = ' . $no . ' AND ' . PMA_convert_using('Grant_priv') . ' = ' . $no . ' AND ' . PMA_convert_using('References_priv') . ' = ' . $no; - $sql_query = '(SELECT ' . PMA_convert_using('User') . ' AS User,' . PMA_convert_using('Host') . ' AS Host,' . PMA_convert_using('Db') . ' AS Db,' . $list_of_privileges . ' FROM `db` WHERE ' . PMA_convert_using($checkprivs, 'quoted') . ' LIKE ' . PMA_convert_using('Db') . ' AND NOT (' . $list_of_compared_privileges. ')) UNION (SELECT ' . PMA_convert_using('User') . ' AS User, ' . PMA_convert_using('Host') . ' AS Host, ' . PMA_convert_using('*', 'quoted') . ' AS Db, ' . $list_of_privileges . ' FROM `user` WHERE NOT (' . $list_of_compared_privileges . ')) ORDER BY User ASC, Host ASC, Db ASC;'; + $sql_query = '(SELECT ' . PMA_convert_using('User') . ' AS User,' . PMA_convert_using('Host') . ' AS Host,' . PMA_convert_using('Db') . ' AS Db,' . $list_of_privileges . ' FROM `mysql`.`db` WHERE ' . PMA_convert_using($checkprivs, 'quoted') . ' LIKE ' . PMA_convert_using('Db') . ' AND NOT (' . $list_of_compared_privileges. ')) UNION (SELECT ' . PMA_convert_using('User') . ' AS User, ' . PMA_convert_using('Host') . ' AS Host, ' . PMA_convert_using('*', 'quoted') . ' AS Db, ' . $list_of_privileges . ' FROM `mysql`.`user` WHERE NOT (' . $list_of_compared_privileges . ')) ORDER BY User ASC, Host ASC, Db ASC;'; $res = PMA_DBI_query($sql_query); $row = PMA_DBI_fetch_assoc($res); @@ -1499,10 +1497,10 @@ if (empty($adduser) && empty($checkprivs)) { } } else { // With MySQL 3, we need 2 seperate queries here. - $sql_query = 'SELECT * FROM `user` WHERE NOT (`Select_priv` = \'N\' AND `Insert_priv` = \'N\' AND `Update_priv` = \'N\' AND `Delete_priv` = \'N\' AND `Create_priv` = \'N\' AND `Drop_priv` = \'N\' AND `Grant_priv` = \'N\' AND `References_priv` = \'N\') ORDER BY `User` ASC, `Host` ASC;'; + $sql_query = 'SELECT * FROM `mysql`.`user` WHERE NOT (`Select_priv` = \'N\' AND `Insert_priv` = \'N\' AND `Update_priv` = \'N\' AND `Delete_priv` = \'N\' AND `Create_priv` = \'N\' AND `Drop_priv` = \'N\' AND `Grant_priv` = \'N\' AND `References_priv` = \'N\') ORDER BY `User` ASC, `Host` ASC;'; $res1 = PMA_DBI_query($sql_query); $row1 = PMA_DBI_fetch_assoc($res1); - $sql_query = 'SELECT * FROM `db` WHERE \'' . $checkprivs . '\' LIKE `Db` AND NOT (`Select_priv` = \'N\' AND `Insert_priv` = \'N\' AND `Update_priv` = \'N\' AND `Delete_priv` = \'N\' AND `Create_priv` = \'N\' AND `Drop_priv` = \'N\' AND `Grant_priv` = \'N\' AND `References_priv` = \'N\') ORDER BY `User` ASC, `Host` ASC;'; + $sql_query = 'SELECT * FROM `mysql`.`db` WHERE \'' . $checkprivs . '\' LIKE `Db` AND NOT (`Select_priv` = \'N\' AND `Insert_priv` = \'N\' AND `Update_priv` = \'N\' AND `Delete_priv` = \'N\' AND `Create_priv` = \'N\' AND `Drop_priv` = \'N\' AND `Grant_priv` = \'N\' AND `References_priv` = \'N\') ORDER BY `User` ASC, `Host` ASC;'; $res2 = PMA_DBI_query($sql_query); $row2 = PMA_DBI_fetch_assoc($res2); if ($row1 || $row2) { @@ -1542,39 +1540,39 @@ if (empty($adduser) && empty($checkprivs)) { if (count($current_privileges) > 1) { echo ' rowspan="' . count($current_privileges) . '"'; } - echo ' bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n" - . ' ' . (empty($current_user) ? '<span style="color: #FF0000">' . $strAny . '</span>' : htmlspecialchars($current_user)) . "\n" + echo ' bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . "\n" + . ' ' . (empty($current_user) ? '<span style="color: #FF0000">' . $GLOBALS['strAny'] . '</span>' : htmlspecialchars($current_user)) . "\n" . ' </td>' . "\n" . ' <td'; if (count($current_privileges) > 1) { echo ' rowspan="' . count($current_privileges) . '"'; } - echo ' bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n" + echo ' bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . "\n" . ' ' . htmlspecialchars($current_host) . "\n" . ' </td>' . "\n"; foreach ($current_privileges as $current) { - echo ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n" + echo ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . "\n" . ' '; if (!isset($current['Db']) || $current['Db'] == '*') { - echo $strGlobal; + echo $GLOBALS['strGlobal']; } else if ($current['Db'] == $checkprivs) { - echo $strDbSpecific; + echo $GLOBALS['strDbSpecific']; } else { - echo $strWildcard, ': <tt>' . htmlspecialchars($current['Db']) . '</tt>'; + echo $GLOBALS['strWildcard'], ': <tt>' . htmlspecialchars($current['Db']) . '</tt>'; } echo "\n" . ' </td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . "\n" . ' <tt>' . "\n" . ' ' . join(',' . "\n" . ' ', PMA_extractPrivInfo($current, TRUE)) . "\n" . ' <tt>' . "\n" . ' </td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n" - . ' ' . ($current['Grant_priv'] == 'Y' ? $strYes : $strNo) . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . "\n" + . ' ' . ($current['Grant_priv'] == 'Y' ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . "\n" . ' </td>' . "\n" - . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n" - . ' <a href="./server_privileges.php?' . $url_query . '&username=' . urlencode($current_user) . '&hostname=' . urlencode($current_host) . (!isset($current['Db']) || $current['Db'] == '*' ? '' : '&dbname=' . urlencode($current['Db'])) . '">' . "\n" - . ' ' . $strEdit . "\n" + . ' <td bgcolor="' . ($useBgcolorOne ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']) . '">' . "\n" + . ' <a href="./server_privileges.php?' . $GLOBALS['url_query'] . '&username=' . urlencode($current_user) . '&hostname=' . urlencode($current_host) . (!isset($current['Db']) || $current['Db'] == '*' ? '' : '&dbname=' . urlencode($current['Db'])) . '">' . "\n" + . ' ' . $GLOBALS['strEdit'] . "\n" . ' </a>' . "\n" . ' </td>' . "\n" . ' </tr>' . "\n"; @@ -1586,12 +1584,13 @@ if (empty($adduser) && empty($checkprivs)) { } } else { echo ' <tr>' . "\n" - . ' <td colspan="6" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" - . ' ' . $strNoUsersFound . "\n" + . ' <td colspan="6" bgcolor="' . $GLOBALS['cfg']['BgcolorTwo'] . '">' . "\n" + . ' ' . $GLOBALS['strNoUsersFound'] . "\n" . ' </td>' . "\n" . ' </tr>' . "\n"; } - echo '</table>' . "\n"; + echo '</tbody>' . "\n" + . '</table>' . "\n"; } // end if (empty($adduser) && empty($checkprivs)) ... else if ... else ... |