17
16
$GLOBALS['js_include'][] = 'server_privileges.js';
18
17
$GLOBALS['js_include'][] = 'functions.js';
18
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
19
$_add_user_error = false;
19
21
require './libraries/server_common.inc.php';
23
if ($GLOBALS['cfg']['AjaxEnable']) {
24
$conditional_class = 'ajax';
26
$conditional_class = '';
30
* Messages are built using the message name
32
$strPrivDescAllPrivileges = __('Includes all privileges except GRANT.');
33
$strPrivDescAlter = __('Allows altering the structure of existing tables.');
34
$strPrivDescAlterRoutine = __('Allows altering and dropping stored routines.');
35
$strPrivDescCreateDb = __('Allows creating new databases and tables.');
36
$strPrivDescCreateRoutine = __('Allows creating stored routines.');
37
$strPrivDescCreateTbl = __('Allows creating new tables.');
38
$strPrivDescCreateTmpTable = __('Allows creating temporary tables.');
39
$strPrivDescCreateUser = __('Allows creating, dropping and renaming user accounts.');
40
$strPrivDescCreateView = __('Allows creating new views.');
41
$strPrivDescDelete = __('Allows deleting data.');
42
$strPrivDescDropDb = __('Allows dropping databases and tables.');
43
$strPrivDescDropTbl = __('Allows dropping tables.');
44
$strPrivDescEvent = __('Allows to set up events for the event scheduler');
45
$strPrivDescExecute = __('Allows executing stored routines.');
46
$strPrivDescFile = __('Allows importing data from and exporting data into files.');
47
$strPrivDescGrant = __('Allows adding users and privileges without reloading the privilege tables.');
48
$strPrivDescIndex = __('Allows creating and dropping indexes.');
49
$strPrivDescInsert = __('Allows inserting and replacing data.');
50
$strPrivDescLockTables = __('Allows locking tables for the current thread.');
51
$strPrivDescMaxConnections = __('Limits the number of new connections the user may open per hour.');
52
$strPrivDescMaxQuestions = __('Limits the number of queries the user may send to the server per hour.');
53
$strPrivDescMaxUpdates = __('Limits the number of commands that change any table or database the user may execute per hour.');
54
$strPrivDescMaxUserConnections = __('Limits the number of simultaneous connections the user may have.');
55
$strPrivDescProcess = __('Allows viewing processes of all users');
56
$strPrivDescReferences = __('Has no effect in this MySQL version.');
57
$strPrivDescReload = __('Allows reloading server settings and flushing the server\'s caches.');
58
$strPrivDescReplClient = __('Allows the user to ask where the slaves / masters are.');
59
$strPrivDescReplSlave = __('Needed for the replication slaves.');
60
$strPrivDescSelect = __('Allows reading data.');
61
$strPrivDescShowDb = __('Gives access to the complete list of databases.');
62
$strPrivDescShowView = __('Allows performing SHOW CREATE VIEW queries.');
63
$strPrivDescShutdown = __('Allows shutting down the server.');
64
$strPrivDescSuper = __('Allows connecting, even if maximum number of connections is reached; required for most administrative operations like setting global variables or killing threads of other users.');
65
$strPrivDescTrigger = __('Allows creating and dropping triggers');
66
$strPrivDescUpdate = __('Allows changing data.');
67
$strPrivDescUsage = __('No privileges.');
23
70
* Checks if a dropdown box has been used for selecting a database / table
131
180
* @param array $row the row
132
181
* @param boolean $enableHTML add <dfn> tag with tooltips
134
* @global ressource $user_link the database connection
183
* @global resource $user_link the database connection
138
187
function PMA_extractPrivInfo($row = '', $enableHTML = FALSE)
141
array('Select_priv', 'SELECT', $GLOBALS['strPrivDescSelect']),
142
array('Insert_priv', 'INSERT', $GLOBALS['strPrivDescInsert']),
143
array('Update_priv', 'UPDATE', $GLOBALS['strPrivDescUpdate']),
144
array('Delete_priv', 'DELETE', $GLOBALS['strPrivDescDelete']),
145
array('Create_priv', 'CREATE', $GLOBALS['strPrivDescCreateDb']),
146
array('Drop_priv', 'DROP', $GLOBALS['strPrivDescDropDb']),
147
array('Reload_priv', 'RELOAD', $GLOBALS['strPrivDescReload']),
148
array('Shutdown_priv', 'SHUTDOWN', $GLOBALS['strPrivDescShutdown']),
149
array('Process_priv', 'PROCESS', $GLOBALS['strPrivDescProcess']),
150
array('File_priv', 'FILE', $GLOBALS['strPrivDescFile']),
151
array('References_priv', 'REFERENCES', $GLOBALS['strPrivDescReferences']),
152
array('Index_priv', 'INDEX', $GLOBALS['strPrivDescIndex']),
153
array('Alter_priv', 'ALTER', $GLOBALS['strPrivDescAlter']),
154
array('Show_db_priv', 'SHOW DATABASES', $GLOBALS['strPrivDescShowDb']),
155
array('Super_priv', 'SUPER', $GLOBALS['strPrivDescSuper']),
156
array('Create_tmp_table_priv', 'CREATE TEMPORARY TABLES', $GLOBALS['strPrivDescCreateTmpTable']),
157
array('Lock_tables_priv', 'LOCK TABLES', $GLOBALS['strPrivDescLockTables']),
158
array('Repl_slave_priv', 'REPLICATION SLAVE', $GLOBALS['strPrivDescReplSlave']),
159
array('Repl_client_priv', 'REPLICATION CLIENT', $GLOBALS['strPrivDescReplClient']),
160
array('Create_view_priv', 'CREATE VIEW', $GLOBALS['strPrivDescCreateView']),
161
array('Event_priv', 'EVENT', $GLOBALS['strPrivDescEvent']),
162
array('Trigger_priv', 'TRIGGER', $GLOBALS['strPrivDescTrigger']),
164
array('Create View_priv', 'CREATE VIEW', $GLOBALS['strPrivDescCreateView']),
165
array('Show_view_priv', 'SHOW VIEW', $GLOBALS['strPrivDescShowView']),
167
array('Show view_priv', 'SHOW VIEW', $GLOBALS['strPrivDescShowView']),
168
array('Create_routine_priv', 'CREATE ROUTINE', $GLOBALS['strPrivDescCreateRoutine']),
169
array('Alter_routine_priv', 'ALTER ROUTINE', $GLOBALS['strPrivDescAlterRoutine']),
170
array('Create_user_priv', 'CREATE USER', $GLOBALS['strPrivDescCreateUser']),
171
array('Execute_priv', 'EXECUTE', $GLOBALS['strPrivDescExecute5']),
190
array('Select_priv', 'SELECT', __('Allows reading data.')),
191
array('Insert_priv', 'INSERT', __('Allows inserting and replacing data.')),
192
array('Update_priv', 'UPDATE', __('Allows changing data.')),
193
array('Delete_priv', 'DELETE', __('Allows deleting data.')),
194
array('Create_priv', 'CREATE', __('Allows creating new databases and tables.')),
195
array('Drop_priv', 'DROP', __('Allows dropping databases and tables.')),
196
array('Reload_priv', 'RELOAD', __('Allows reloading server settings and flushing the server\'s caches.')),
197
array('Shutdown_priv', 'SHUTDOWN', __('Allows shutting down the server.')),
198
array('Process_priv', 'PROCESS', __('Allows viewing processes of all users')),
199
array('File_priv', 'FILE', __('Allows importing data from and exporting data into files.')),
200
array('References_priv', 'REFERENCES', __('Has no effect in this MySQL version.')),
201
array('Index_priv', 'INDEX', __('Allows creating and dropping indexes.')),
202
array('Alter_priv', 'ALTER', __('Allows altering the structure of existing tables.')),
203
array('Show_db_priv', 'SHOW DATABASES', __('Gives access to the complete list of databases.')),
204
array('Super_priv', 'SUPER', __('Allows connecting, even if maximum number of connections is reached; required for most administrative operations like setting global variables or killing threads of other users.')),
205
array('Create_tmp_table_priv', 'CREATE TEMPORARY TABLES', __('Allows creating temporary tables.')),
206
array('Lock_tables_priv', 'LOCK TABLES', __('Allows locking tables for the current thread.')),
207
array('Repl_slave_priv', 'REPLICATION SLAVE', __('Needed for the replication slaves.')),
208
array('Repl_client_priv', 'REPLICATION CLIENT', __('Allows the user to ask where the slaves / masters are.')),
209
array('Create_view_priv', 'CREATE VIEW', __('Allows creating new views.')),
210
array('Event_priv', 'EVENT', __('Allows to set up events for the event scheduler')),
211
array('Trigger_priv', 'TRIGGER', __('Allows creating and dropping triggers')),
213
array('Create View_priv', 'CREATE VIEW', __('Allows creating new views.')),
214
array('Show_view_priv', 'SHOW VIEW', __('Allows performing SHOW CREATE VIEW queries.')),
216
array('Show view_priv', 'SHOW VIEW', __('Allows performing SHOW CREATE VIEW queries.')),
217
array('Create_routine_priv', 'CREATE ROUTINE', __('Allows creating stored routines.')),
218
array('Alter_routine_priv', 'ALTER ROUTINE', __('Allows altering and dropping stored routines.')),
219
array('Create_user_priv', 'CREATE USER', __('Allows creating, dropping and renaming user accounts.')),
220
array('Execute_priv', 'EXECUTE', __('Allows executing stored routines.')),
174
223
if (!empty($row) && isset($row['Table_priv'])) {
389
440
echo '<input type="hidden" name="grant_count" value="' . count($row) . '" />' . "\n"
390
441
. '<input type="hidden" name="column_count" value="' . count($columns) . '" />' . "\n"
391
442
. '<fieldset id="fieldset_user_priv">' . "\n"
392
. ' <legend>' . $GLOBALS['strTblPrivileges']
393
. PMA_showHint($GLOBALS['strEnglishPrivileges'])
443
. ' <legend>' . __('Table-specific privileges')
444
. PMA_showHint(__(' Note: MySQL privilege names are expressed in English '))
394
445
. '</legend>' . "\n";
398
449
// privs that are attached to a specific column
399
450
PMA_display_column_privs($columns, $row, 'Select_priv',
400
'SELECT', 'select', $GLOBALS['strPrivDescSelect'], 'Select');
451
'SELECT', 'select', __('Allows reading data.'), 'Select');
402
453
PMA_display_column_privs($columns, $row, 'Insert_priv',
403
'INSERT', 'insert', $GLOBALS['strPrivDescInsert'], 'Insert');
454
'INSERT', 'insert', __('Allows inserting and replacing data.'), 'Insert');
405
456
PMA_display_column_privs($columns, $row, 'Update_priv',
406
'UPDATE', 'update', $GLOBALS['strPrivDescUpdate'], 'Update');
457
'UPDATE', 'update', __('Allows changing data.'), 'Update');
408
459
PMA_display_column_privs($columns, $row, 'References_priv',
409
'REFERENCES', 'references', $GLOBALS['strPrivDescReferences'], 'References');
460
'REFERENCES', 'references', __('Has no effect in this MySQL version.'), 'References');
411
462
// privs that are not attached to a specific column
460
511
// g l o b a l o r d b - s p e c i f i c
513
$privTable_names = array(0 => __('Data'), 1 => __('Structure'), 2 => __('Administration'));
463
516
$privTable[0] = array(
464
array('Select', 'SELECT', $GLOBALS['strPrivDescSelect']),
465
array('Insert', 'INSERT', $GLOBALS['strPrivDescInsert']),
466
array('Update', 'UPDATE', $GLOBALS['strPrivDescUpdate']),
467
array('Delete', 'DELETE', $GLOBALS['strPrivDescDelete'])
517
array('Select', 'SELECT', __('Allows reading data.')),
518
array('Insert', 'INSERT', __('Allows inserting and replacing data.')),
519
array('Update', 'UPDATE', __('Allows changing data.')),
520
array('Delete', 'DELETE', __('Allows deleting data.'))
469
522
if ($db == '*') {
470
$privTable[0][] = array('File', 'FILE', $GLOBALS['strPrivDescFile']);
523
$privTable[0][] = array('File', 'FILE', __('Allows importing data from and exporting data into files.'));
473
526
// s t r u c t u r e
474
527
$privTable[1] = array(
475
array('Create', 'CREATE', ($table == '*' ? $GLOBALS['strPrivDescCreateDb'] : $GLOBALS['strPrivDescCreateTbl'])),
476
array('Alter', 'ALTER', $GLOBALS['strPrivDescAlter']),
477
array('Index', 'INDEX', $GLOBALS['strPrivDescIndex']),
478
array('Drop', 'DROP', ($table == '*' ? $GLOBALS['strPrivDescDropDb'] : $GLOBALS['strPrivDescDropTbl'])),
479
array('Create_tmp_table', 'CREATE TEMPORARY TABLES', $GLOBALS['strPrivDescCreateTmpTable']),
480
array('Show_view', 'SHOW VIEW', $GLOBALS['strPrivDescShowView']),
481
array('Create_routine', 'CREATE ROUTINE', $GLOBALS['strPrivDescCreateRoutine']),
482
array('Alter_routine', 'ALTER ROUTINE', $GLOBALS['strPrivDescAlterRoutine']),
483
array('Execute', 'EXECUTE', $GLOBALS['strPrivDescExecute5']),
528
array('Create', 'CREATE', ($table == '*' ? __('Allows creating new databases and tables.') : __('Allows creating new tables.'))),
529
array('Alter', 'ALTER', __('Allows altering the structure of existing tables.')),
530
array('Index', 'INDEX', __('Allows creating and dropping indexes.')),
531
array('Drop', 'DROP', ($table == '*' ? __('Allows dropping databases and tables.') : __('Allows dropping tables.'))),
532
array('Create_tmp_table', 'CREATE TEMPORARY TABLES', __('Allows creating temporary tables.')),
533
array('Show_view', 'SHOW VIEW', __('Allows performing SHOW CREATE VIEW queries.')),
534
array('Create_routine', 'CREATE ROUTINE', __('Allows creating stored routines.')),
535
array('Alter_routine', 'ALTER ROUTINE', __('Allows altering and dropping stored routines.')),
536
array('Execute', 'EXECUTE', __('Allows executing stored routines.')),
485
538
// this one is for a db-specific priv: Create_view_priv
486
539
if (isset($row['Create_view_priv'])) {
487
$privTable[1][] = array('Create_view', 'CREATE VIEW', $GLOBALS['strPrivDescCreateView']);
540
$privTable[1][] = array('Create_view', 'CREATE VIEW', __('Allows creating new views.'));
489
542
// this one is for a table-specific priv: Create View_priv
490
543
if (isset($row['Create View_priv'])) {
491
$privTable[1][] = array('Create View', 'CREATE VIEW', $GLOBALS['strPrivDescCreateView']);
544
$privTable[1][] = array('Create View', 'CREATE VIEW', __('Allows creating new views.'));
493
546
if (isset($row['Event_priv'])) {
495
$privTable[1][] = array('Event', 'EVENT', $GLOBALS['strPrivDescEvent']);
496
$privTable[1][] = array('Trigger', 'TRIGGER', $GLOBALS['strPrivDescTrigger']);
548
$privTable[1][] = array('Event', 'EVENT', __('Allows to set up events for the event scheduler'));
549
$privTable[1][] = array('Trigger', 'TRIGGER', __('Allows creating and dropping triggers'));
499
552
// a d m i n i s t r a t i o n
500
553
$privTable[2] = array(
501
array('Grant', 'GRANT', $GLOBALS['strPrivDescGrant']),
554
array('Grant', 'GRANT', __('Allows adding users and privileges without reloading the privilege tables.')),
503
556
if ($db == '*') {
504
$privTable[2][] = array('Super', 'SUPER', $GLOBALS['strPrivDescSuper']);
505
$privTable[2][] = array('Process', 'PROCESS', $GLOBALS['strPrivDescProcess']);
506
$privTable[2][] = array('Reload', 'RELOAD', $GLOBALS['strPrivDescReload']);
507
$privTable[2][] = array('Shutdown', 'SHUTDOWN', $GLOBALS['strPrivDescShutdown']);
508
$privTable[2][] = array('Show_db', 'SHOW DATABASES', $GLOBALS['strPrivDescShowDb']);
557
$privTable[2][] = array('Super', 'SUPER', __('Allows connecting, even if maximum number of connections is reached; required for most administrative operations like setting global variables or killing threads of other users.'));
558
$privTable[2][] = array('Process', 'PROCESS', __('Allows viewing processes of all users'));
559
$privTable[2][] = array('Reload', 'RELOAD', __('Allows reloading server settings and flushing the server\'s caches.'));
560
$privTable[2][] = array('Shutdown', 'SHUTDOWN', __('Allows shutting down the server.'));
561
$privTable[2][] = array('Show_db', 'SHOW DATABASES', __('Gives access to the complete list of databases.'));
510
$privTable[2][] = array('Lock_tables', 'LOCK TABLES', $GLOBALS['strPrivDescLockTables']);
511
$privTable[2][] = array('References', 'REFERENCES', $GLOBALS['strPrivDescReferences']);
563
$privTable[2][] = array('Lock_tables', 'LOCK TABLES', __('Allows locking tables for the current thread.'));
564
$privTable[2][] = array('References', 'REFERENCES', __('Has no effect in this MySQL version.'));
512
565
if ($db == '*') {
513
$privTable[2][] = array('Repl_client', 'REPLICATION CLIENT', $GLOBALS['strPrivDescReplClient']);
514
$privTable[2][] = array('Repl_slave', 'REPLICATION SLAVE', $GLOBALS['strPrivDescReplSlave']);
515
$privTable[2][] = array('Create_user', 'CREATE USER', $GLOBALS['strPrivDescCreateUser']);
566
$privTable[2][] = array('Repl_client', 'REPLICATION CLIENT', __('Allows the user to ask where the slaves / masters are.'));
567
$privTable[2][] = array('Repl_slave', 'REPLICATION SLAVE', __('Needed for the replication slaves.'));
568
$privTable[2][] = array('Create_user', 'CREATE USER', __('Allows creating, dropping and renaming user accounts.'));
517
570
echo '<input type="hidden" name="grant_count" value="'
518
571
. (count($privTable[0]) + count($privTable[1]) + count($privTable[2]) - (isset($row['Grant_priv']) ? 1 : 0))
521
574
. ' <legend>' . "\n"
524
? $GLOBALS['strGlobalPrivileges']
577
? __('Global privileges')
526
? $GLOBALS['strDbPrivileges']
527
: $GLOBALS['strTblPrivileges'])) . "\n"
579
? __('Database-specific privileges')
580
: __('Table-specific privileges'))) . "\n"
528
581
. ' (<a href="server_privileges.php?'
529
. $GLOBALS['url_query'] . '&checkall=1" onclick="setCheckboxes(\'usersForm\', true); return false;">'
530
. $GLOBALS['strCheckAll'] . '</a> /' . "\n"
582
. $GLOBALS['url_query'] . '&checkall=1" onclick="setCheckboxes(\'addUsersForm_' . $random_n . '\', true); return false;">'
583
. __('Check All') . '</a> /' . "\n"
531
584
. ' <a href="server_privileges.php?'
532
. $GLOBALS['url_query'] . '" onclick="setCheckboxes(\'usersForm\', false); return false;">'
533
. $GLOBALS['strUncheckAll'] . '</a>)' . "\n"
585
. $GLOBALS['url_query'] . '" onclick="setCheckboxes(\'addUsersForm_' . $random_n . '\', false); return false;">'
586
. __('Uncheck All') . '</a>)' . "\n"
534
587
. ' </legend>' . "\n"
535
. ' <p><small><i>' . $GLOBALS['strEnglishPrivileges'] . '</i></small></p>' . "\n"
536
. ' <fieldset>' . "\n"
537
. ' <legend>' . $GLOBALS['strData'] . '</legend>' . "\n";
538
foreach ($privTable[0] as $priv)
540
echo ' <div class="item">' . "\n"
541
. ' <input type="checkbox"'
542
. (empty($GLOBALS['checkall']) ? '' : ' checked="checked"')
543
. ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0]
544
. '_priv" value="Y" '
545
. ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '')
546
. 'title="' . $priv[2] . '"/>' . "\n"
547
. ' <label for="checkbox_' . $priv[0]
548
. '_priv"><tt><dfn title="' . $priv[2] . '">' . $priv[1]
549
. '</dfn></tt></label>' . "\n"
552
echo ' </fieldset>' . "\n"
553
. ' <fieldset>' . "\n"
554
. ' <legend>' . $GLOBALS['strStructure'] . '</legend>' . "\n";
555
foreach ($privTable[1] as $priv)
557
echo ' <div class="item">' . "\n"
558
. ' <input type="checkbox"'
559
. (empty($GLOBALS['checkall']) ? '' : ' checked="checked"')
560
. ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0]
561
. '_priv" value="Y" '
562
. ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '')
563
. 'title="' . $priv[2] . '"/>' . "\n"
564
. ' <label for="checkbox_' . $priv[0]
565
. '_priv"><tt><dfn title="' . $priv[2] . '">' . $priv[1]
566
. '</dfn></tt></label>' . "\n"
569
echo ' </fieldset>' . "\n"
570
. ' <fieldset>' . "\n"
571
. ' <legend>' . $GLOBALS['strAdministration'] . '</legend>' . "\n";
572
foreach ($privTable[2] as $priv)
574
echo ' <div class="item">' . "\n"
575
. ' <input type="checkbox"'
576
. (empty($GLOBALS['checkall']) ? '' : ' checked="checked"')
577
. ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0]
578
. '_priv" value="Y" '
579
. ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '')
580
. 'title="' . $priv[2] . '"/>' . "\n"
581
. ' <label for="checkbox_' . $priv[0]
582
. '_priv"><tt><dfn title="' . $priv[2] . '">' . $priv[1]
583
. '</dfn></tt></label>' . "\n"
587
echo ' </fieldset>' . "\n";
588
. ' <p><small><i>' . __(' Note: MySQL privilege names are expressed in English ') . '</i></small></p>' . "\n";
590
// Output the Global privilege tables with checkboxes
591
foreach($privTable as $i => $table) {
592
echo ' <fieldset>' . "\n"
593
. ' <legend>' . __($privTable_names[$i]) . '</legend>' . "\n";
594
foreach ($table as $priv)
596
echo ' <div class="item">' . "\n"
597
. ' <input type="checkbox"'
598
. ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0] . '_priv"'
599
. ' value="Y" title="' . $priv[2] . '"'
600
. ((!empty($GLOBALS['checkall']) || $row[$priv[0] . '_priv'] == 'Y') ? ' checked="checked"' : '')
602
. ' <label for="checkbox_' . $priv[0] . '_priv"><tt><dfn title="' . $priv[2] . '">'
603
. $priv[1] . '</dfn></tt></label>' . "\n"
606
echo ' </fieldset>' . "\n";
588
609
// The "Resource limits" box is not displayed for db-specific privs
589
610
if ($db == '*') {
590
611
echo ' <fieldset>' . "\n"
591
. ' <legend>' . $GLOBALS['strResourceLimits'] . '</legend>' . "\n"
592
. ' <p><small><i>' . $GLOBALS['strZeroRemovesTheLimit'] . '</i></small></p>' . "\n"
612
. ' <legend>' . __('Resource limits') . '</legend>' . "\n"
613
. ' <p><small><i>' . __('Note: Setting these options to 0 (zero) removes the limit.') . '</i></small></p>' . "\n"
593
614
. ' <div class="item">' . "\n"
594
615
. ' <label for="text_max_questions"><tt><dfn title="'
595
. $GLOBALS['strPrivDescMaxQuestions'] . '">MAX QUERIES PER HOUR</dfn></tt></label>' . "\n"
616
. __('Limits the number of queries the user may send to the server per hour.') . '">MAX QUERIES PER HOUR</dfn></tt></label>' . "\n"
596
617
. ' <input type="text" name="max_questions" id="text_max_questions" value="'
597
. $row['max_questions'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxQuestions'] . '" />' . "\n"
618
. $row['max_questions'] . '" size="11" maxlength="11" title="' . __('Limits the number of queries the user may send to the server per hour.') . '" />' . "\n"
598
619
. ' </div>' . "\n"
599
620
. ' <div class="item">' . "\n"
600
621
. ' <label for="text_max_updates"><tt><dfn title="'
601
. $GLOBALS['strPrivDescMaxUpdates'] . '">MAX UPDATES PER HOUR</dfn></tt></label>' . "\n"
622
. __('Limits the number of commands that change any table or database the user may execute per hour.') . '">MAX UPDATES PER HOUR</dfn></tt></label>' . "\n"
602
623
. ' <input type="text" name="max_updates" id="text_max_updates" value="'
603
. $row['max_updates'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxUpdates'] . '" />' . "\n"
624
. $row['max_updates'] . '" size="11" maxlength="11" title="' . __('Limits the number of commands that change any table or database the user may execute per hour.') . '" />' . "\n"
604
625
. ' </div>' . "\n"
605
626
. ' <div class="item">' . "\n"
606
627
. ' <label for="text_max_connections"><tt><dfn title="'
607
. $GLOBALS['strPrivDescMaxConnections'] . '">MAX CONNECTIONS PER HOUR</dfn></tt></label>' . "\n"
628
. __('Limits the number of new connections the user may open per hour.') . '">MAX CONNECTIONS PER HOUR</dfn></tt></label>' . "\n"
608
629
. ' <input type="text" name="max_connections" id="text_max_connections" value="'
609
. $row['max_connections'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxConnections'] . '" />' . "\n"
630
. $row['max_connections'] . '" size="11" maxlength="11" title="' . __('Limits the number of new connections the user may open per hour.') . '" />' . "\n"
610
631
. ' </div>' . "\n"
611
632
. ' <div class="item">' . "\n"
612
633
. ' <label for="text_max_user_connections"><tt><dfn title="'
613
. $GLOBALS['strPrivDescMaxUserConnections'] . '">MAX USER_CONNECTIONS</dfn></tt></label>' . "\n"
634
. __('Limits the number of simultaneous connections the user may have.') . '">MAX USER_CONNECTIONS</dfn></tt></label>' . "\n"
614
635
. ' <input type="text" name="max_user_connections" id="text_max_user_connections" value="'
615
. $row['max_user_connections'] . '" size="11" maxlength="11" title="' . $GLOBALS['strPrivDescMaxUserConnections'] . '" />' . "\n"
636
. $row['max_user_connections'] . '" size="11" maxlength="11" title="' . __('Limits the number of simultaneous connections the user may have.') . '" />' . "\n"
616
637
. ' </div>' . "\n"
617
638
. ' </fieldset>' . "\n";
723
744
echo ' <option value="any"'
724
745
. ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'any')
725
? ' selected="selected"' : '') . '>' . $GLOBALS['strAnyHost']
746
? ' selected="selected"' : '') . '>' . __('Any host')
726
747
. '</option>' . "\n"
727
748
. ' <option value="localhost"'
728
749
. ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'localhost')
729
? ' selected="selected"' : '') . '>' . $GLOBALS['strLocalhost']
750
? ' selected="selected"' : '') . '>' . __('Local')
730
751
. '</option>' . "\n";
731
752
if (!empty($thishost)) {
732
753
echo ' <option value="thishost"'
733
754
. ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'thishost')
734
? ' selected="selected"' : '') . '>' . $GLOBALS['strThisHost']
755
? ' selected="selected"' : '') . '>' . __('This Host')
735
756
. '</option>' . "\n";
737
758
unset($thishost);
738
759
echo ' <option value="hosttable"'
739
760
. ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'hosttable')
740
? ' selected="selected"' : '') . '>' . $GLOBALS['strUseHostTable']
761
? ' selected="selected"' : '') . '>' . __('Use Host Table')
741
762
. '</option>' . "\n"
742
763
. ' <option value="userdefined"'
743
764
. ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'userdefined')
744
765
? ' selected="selected"' : '')
745
. '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n"
766
. '>' . __('Use text field') . ':</option>' . "\n"
746
767
. ' </select>' . "\n"
747
768
. '</span>' . "\n"
748
769
. '<input type="text" name="hostname" maxlength="'
749
770
. $hostname_length . '" value="'
750
771
. htmlspecialchars(isset($GLOBALS['hostname']) ? $GLOBALS['hostname'] : '')
751
. '" title="' . $GLOBALS['strHost']
772
. '" title="' . __('Host')
752
773
. '" onchange="pred_hostname.value = \'userdefined\';" />' . "\n"
753
. PMA_showHint($GLOBALS['strHostTableExplanation'])
774
. PMA_showHint(__('When Host table is used, this field is ignored and values stored in Host table are used instead.'))
754
775
. '</div>' . "\n"
755
776
. '<div class="item">' . "\n"
756
777
. '<label for="select_pred_password">' . "\n"
757
. ' ' . $GLOBALS['strPassword'] . ':' . "\n"
778
. ' ' . __('Password') . ':' . "\n"
758
779
. '</label>' . "\n"
759
780
. '<span class="options">' . "\n"
760
781
. ' <select name="pred_password" id="select_pred_password" title="'
761
. $GLOBALS['strPassword'] . '"' . "\n"
782
. __('Password') . '"' . "\n"
762
783
. ' onchange="if (this.value == \'none\') { pma_pw.value = \'\'; pma_pw2.value = \'\'; } else if (this.value == \'userdefined\') { pma_pw.focus(); pma_pw.select(); }">' . "\n"
763
. ($mode == 'change' ? ' <option value="keep" selected="selected">' . $GLOBALS['strKeepPass'] . '</option>' . "\n" : '')
784
. ($mode == 'change' ? ' <option value="keep" selected="selected">' . __('Do not change the password') . '</option>' . "\n" : '')
764
785
. ' <option value="none"';
765
786
if (isset($GLOBALS['username']) && $mode != 'change') {
766
787
echo ' selected="selected"';
768
echo '>' . $GLOBALS['strNoPassword'] . '</option>' . "\n"
769
. ' <option value="userdefined"' . (isset($GLOBALS['username']) ? '' : ' selected="selected"') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n"
789
echo '>' . __('No Password') . '</option>' . "\n"
790
. ' <option value="userdefined"' . (isset($GLOBALS['username']) ? '' : ' selected="selected"') . '>' . __('Use text field') . ':</option>' . "\n"
770
791
. ' </select>' . "\n"
771
792
. '</span>' . "\n"
772
. '<input type="password" id="text_pma_pw" name="pma_pw" title="' . $GLOBALS['strPassword'] . '" onchange="pred_password.value = \'userdefined\';" />' . "\n"
793
. '<input type="password" id="text_pma_pw" name="pma_pw" title="' . __('Password') . '" onchange="pred_password.value = \'userdefined\';" />' . "\n"
773
794
. '</div>' . "\n"
774
. '<div class="item">' . "\n"
795
. '<div class="item" id="div_element_before_generate_password">' . "\n"
775
796
. '<label for="text_pma_pw2">' . "\n"
776
. ' ' . $GLOBALS['strReType'] . ':' . "\n"
797
. ' ' . __('Re-type') . ':' . "\n"
777
798
. '</label>' . "\n"
778
799
. '<span class="options"> </span>' . "\n"
779
. '<input type="password" name="pma_pw2" id="text_pma_pw2" title="' . $GLOBALS['strReType'] . '" onchange="pred_password.value = \'userdefined\';" />' . "\n"
781
. '<div class="item">' . "\n"
782
. '<label for="button_generate_password">' . "\n"
783
. ' ' . $GLOBALS['strGeneratePassword'] . ':' . "\n"
785
. '<span class="options">' . "\n"
786
. ' <input type="button" id="button_generate_password" value="' . $GLOBALS['strGenerate'] . '" onclick="suggestPassword(this.form)" />' . "\n"
788
. '<input type="text" name="generated_pw" id="generated_pw" />' . "\n"
800
. '<input type="password" name="pma_pw2" id="text_pma_pw2" title="' . __('Re-type') . '" onchange="pred_password.value = \'userdefined\';" />' . "\n"
802
// Generate password added here via jQuery
790
803
. '</fieldset>' . "\n";
791
804
} // end of the 'PMA_displayUserAndHostFields()' function
795
807
* Changes / copies a user, part I
1299
1323
if (isset($_REQUEST['flush_privileges'])) {
1300
1324
$sql_query = 'FLUSH PRIVILEGES;';
1301
1325
PMA_DBI_query($sql_query);
1302
$message = PMA_Message::success('strPrivilegesReloaded');
1326
$message = PMA_Message::success(__('The privileges were reloaded successfully.'));
1330
* defines some standard links
1332
$link_edit = '<a class="edit_user_anchor ' . $conditional_class . '" href="server_privileges.php?' . $GLOBALS['url_query']
1333
. '&username=%s'
1334
. '&hostname=%s'
1336
. '&tablename=%s">'
1337
. PMA_getIcon('b_usredit.png', __('Edit Privileges'))
1340
$link_revoke = '<a href="server_privileges.php?' . $GLOBALS['url_query']
1341
. '&username=%s'
1342
. '&hostname=%s'
1344
. '&tablename=%s'
1345
. '&revokeall=1">'
1346
. PMA_getIcon('b_usrdrop.png', __('Revoke'))
1349
$link_export = '<a class="export_user_anchor ' . $conditional_class . '" href="server_privileges.php?' . $GLOBALS['url_query']
1350
. '&username=%s'
1351
. '&hostname=%s'
1354
. PMA_getIcon('b_tblexport.png', __('Export'))
1358
* If we are in an Ajax request for Create User/Edit User/Revoke User/Flush Privileges,
1359
* show $message and exit.
1361
if( $GLOBALS['is_ajax_request'] && !isset($_REQUEST['export']) && (!isset($_REQUEST['adduser']) || $_add_user_error) && !isset($_REQUEST['initial']) && !isset($_REQUEST['showall']) && !isset($_REQUEST['edit_user_dialog'])) {
1363
if(isset($sql_query)) {
1364
$extra_data['sql_query'] = PMA_showMessage(NULL, $sql_query);
1367
if(isset($_REQUEST['adduser_submit']) || isset($_REQUEST['change_copy'])) {
1369
* generate html on the fly for the new user that was just created.
1371
$new_user_string = '<tr>'."\n"
1372
.'<td> <input type="checkbox" name="selected_usr[]" id="checkbox_sel_users_" value="' . htmlspecialchars($username) . '&#27;' . htmlspecialchars($hostname) . '" /> </td>'."\n"
1373
.'<td><label for="checkbox_sel_users_">' . (empty($username) ? '<span style="color: #FF0000">' . __('Any') . '</span>' : htmlspecialchars($username) ) . '</label></td>' . "\n"
1374
.'<td>' . htmlspecialchars($hostname) . '</td>' . "\n";
1375
$new_user_string .= '<td>';
1377
if(!empty($password) || isset($pma_pw)) {
1378
$new_user_string .= __('Yes');
1381
$new_user_string .= '<span style="color: #FF0000">' . __('No') . '</span>';
1384
$new_user_string .= '</td>'."\n";
1385
$new_user_string .= '<td><tt>' . join(', ', PMA_extractPrivInfo('', true)) . '</tt></td>'; //Fill in privileges here
1386
$new_user_string .= '<td>';
1388
if((isset($Grant_priv) && $Grant_priv == 'Y')) {
1389
$new_user_string .= __('Yes');
1392
$new_user_string .= __('No');
1395
$new_user_string .='</td>';
1397
$new_user_string .= '<td>'.sprintf($link_edit, urlencode($username), urlencode($hostname), '', '' ).'</td>'."\n";
1398
$new_user_string .= '<td>'.sprintf($link_export, urlencode($username), urlencode($hostname), (isset($initial) ? $initial : '')).'</td>'."\n";
1400
$new_user_string .= '</tr>';
1402
$extra_data['new_user_string'] = $new_user_string;
1405
* Generate the string for this alphabet's initial, to update the user
1408
$new_user_initial = strtoupper(substr($username, 0, 1));
1409
$new_user_initial_string = '<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&initial=' . $new_user_initial
1410
.'">' . $new_user_initial . '</a>';
1411
$extra_data['new_user_initial'] = $new_user_initial;
1412
$extra_data['new_user_initial_string'] = $new_user_initial_string;
1415
if(isset($update_privs)) {
1416
$extra_data['db_specific_privs'] = false;
1417
if (isset($dbname_is_wildcard)) {
1418
$extra_data['db_specific_privs'] = !$dbname_is_wildcard;
1420
$new_privileges = join(', ', PMA_extractPrivInfo('', true));
1422
$extra_data['new_privileges'] = $new_privileges;
1425
if ($message instanceof PMA_Message) {
1426
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
1307
1431
* Displays the links
1431
1551
* Displays the initials
1552
* In an Ajax request, we don't need to show this
1434
// initialize to FALSE the letters A-Z
1435
for ($letter_counter = 1; $letter_counter < 27; $letter_counter++) {
1436
if (! isset($array_initials[chr($letter_counter + 64)])) {
1437
$array_initials[chr($letter_counter + 64)] = FALSE;
1441
$initials = PMA_DBI_try_query('SELECT DISTINCT UPPER(LEFT(`User`,1)) FROM `user` ORDER BY `User` ASC', null, PMA_DBI_QUERY_STORE);
1442
while (list($tmp_initial) = PMA_DBI_fetch_row($initials)) {
1443
$array_initials[$tmp_initial] = TRUE;
1446
// Display the initials, which can be any characters, not
1447
// just letters. For letters A-Z, we add the non-used letters
1450
uksort($array_initials, "strnatcasecmp");
1452
echo '<table cellspacing="5"><tr>';
1453
foreach ($array_initials as $tmp_initial => $initial_was_found) {
1454
if ($initial_was_found) {
1455
echo '<td><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&initial=' . urlencode($tmp_initial) . '">' . $tmp_initial . '</a></td>' . "\n";
1457
echo '<td>' . $tmp_initial . '</td>';
1460
echo '<td><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&showall=1">[' . $GLOBALS['strShowAll'] . ']</a></td>' . "\n";
1461
echo '</tr></table>';
1555
if( $GLOBALS['is_ajax_request'] != true ) {
1557
// initialize to FALSE the letters A-Z
1558
for ($letter_counter = 1; $letter_counter < 27; $letter_counter++) {
1559
if (! isset($array_initials[chr($letter_counter + 64)])) {
1560
$array_initials[chr($letter_counter + 64)] = FALSE;
1564
$initials = PMA_DBI_try_query('SELECT DISTINCT UPPER(LEFT(`User`,1)) FROM `user` ORDER BY `User` ASC', null, PMA_DBI_QUERY_STORE);
1565
while (list($tmp_initial) = PMA_DBI_fetch_row($initials)) {
1566
$array_initials[$tmp_initial] = TRUE;
1569
// Display the initials, which can be any characters, not
1570
// just letters. For letters A-Z, we add the non-used letters
1573
uksort($array_initials, "strnatcasecmp");
1575
echo '<table id="initials_table" class="' . $conditional_class . '" <cellspacing="5"><tr>';
1576
foreach ($array_initials as $tmp_initial => $initial_was_found) {
1577
if ($initial_was_found) {
1578
echo '<td><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&initial=' . urlencode($tmp_initial) . '">' . $tmp_initial . '</a></td>' . "\n";
1580
echo '<td>' . $tmp_initial . '</td>';
1583
echo '<td><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&showall=1" class="nowrap">[' . __('Show all') . ']</a></td>' . "\n";
1584
echo '</tr></table>';
1464
1588
* Display the user overview
1537
1663
.'<img class="selectallarrow"'
1538
1664
.' src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png"'
1539
1665
.' width="38" height="22"'
1540
.' alt="' . $GLOBALS['strWithChecked'] . '" />' . "\n"
1666
.' alt="' . __('With selected:') . '" />' . "\n"
1541
1667
.'<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&checkall=1"'
1542
1668
.' onclick="if (markAllRows(\'usersForm\')) return false;">'
1543
. $GLOBALS['strCheckAll'] . '</a>' . "\n"
1669
. __('Check All') . '</a>' . "\n"
1545
1671
.'<a href="server_privileges.php?' . $GLOBALS['url_query'] . '"'
1546
1672
.' onclick="if (unMarkAllRows(\'usersForm\')) return false;">'
1547
. $GLOBALS['strUncheckAll'] . '</a>' . "\n";
1673
. __('Uncheck All') . '</a>' . "\n";
1549
1675
// add/delete user fieldset
1550
1676
echo ' <fieldset id="fieldset_add_user">' . "\n"
1551
. ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&adduser=1">' . "\n"
1677
. ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&adduser=1" class="' . $conditional_class . '">' . "\n"
1552
1678
. PMA_getIcon('b_usradd.png')
1553
. ' ' . $GLOBALS['strAddUser'] . '</a>' . "\n"
1679
. ' ' . __('Add a new User') . '</a>' . "\n"
1554
1680
. ' </fieldset>' . "\n"
1555
1681
. ' <fieldset id="fieldset_delete_user">'
1556
1682
. ' <legend>' . "\n"
1557
1683
. PMA_getIcon('b_usrdrop.png')
1558
. ' ' . $GLOBALS['strRemoveSelectedUsers'] . '' . "\n"
1684
. ' ' . __('Remove selected users') . '' . "\n"
1559
1685
. ' </legend>' . "\n"
1560
1686
. ' <input type="hidden" name="mode" value="2" />' . "\n"
1561
. '(' . $GLOBALS['strRevokeAndDelete'] . ')<br />' . "\n"
1562
. ' <input type="checkbox" title="' . $GLOBALS['strDropUsersDb'] . '" name="drop_users_db" id="checkbox_drop_users_db" />' . "\n"
1563
. ' <label for="checkbox_drop_users_db" title="' . $GLOBALS['strDropUsersDb'] . '">' . "\n"
1564
. ' ' . $GLOBALS['strDropUsersDb'] . "\n"
1687
. '(' . __('Revoke all active privileges from the users and delete them afterwards.') . ')<br />' . "\n"
1688
. ' <input type="checkbox" title="' . __('Drop the databases that have the same names as the users.') . '" name="drop_users_db" id="checkbox_drop_users_db" />' . "\n"
1689
. ' <label for="checkbox_drop_users_db" title="' . __('Drop the databases that have the same names as the users.') . '">' . "\n"
1690
. ' ' . __('Drop the databases that have the same names as the users.') . "\n"
1565
1691
. ' </label>' . "\n"
1566
1692
. ' </fieldset>' . "\n"
1567
1693
. ' <fieldset id="fieldset_delete_user_footer" class="tblFooters">' . "\n"
1568
. ' <input type="submit" name="delete" value="' . $GLOBALS['strGo'] . '" id="buttonGo" />' . "\n"
1694
. ' <input type="submit" name="delete" value="' . __('Go') . '" id="buttonGo" class="' . $conditional_class . '"/>' . "\n"
1569
1695
. ' </fieldset>' . "\n"
1570
1696
. '</form>' . "\n";
1574
1700
echo ' <fieldset id="fieldset_add_user">' . "\n"
1575
. ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&adduser=1">' . "\n"
1701
. ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&adduser=1" class="' . $conditional_class . '">' . "\n"
1576
1702
. PMA_getIcon('b_usradd.png')
1577
. ' ' . $GLOBALS['strAddUser'] . '</a>' . "\n"
1703
. ' ' . __('Add a new User') . '</a>' . "\n"
1578
1704
. ' </fieldset>' . "\n";
1579
1705
} // end if (display overview)
1580
$flushnote = new PMA_Message('strFlushPrivilegesNote', PMA_Message::NOTICE);
1581
$flushnote->addParam('<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&flush_privileges=1">', false);
1707
if( $GLOBALS['is_ajax_request'] ) {
1711
$flushnote = new PMA_Message(__('Note: phpMyAdmin gets the users\' privileges directly from MySQL\'s privilege tables. The content of these tables may differ from the privileges the server uses, if they have been changed manually. In this case, you should %sreload the privileges%s before you continue.'), PMA_Message::NOTICE);
1712
$flushnote->addParam('<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&flush_privileges=1" id="reload_privileges_anchor" class="' . $conditional_class . '">', false);
1582
1713
$flushnote->addParam('</a>', false);
1583
1714
$flushnote->display();
1944
2080
. '<input type="hidden" name="old_username" value="' . htmlspecialchars($username) . '" />' . "\n"
1945
2081
. '<input type="hidden" name="old_hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"
1946
2082
. '<fieldset id="fieldset_change_copy_user">' . "\n"
1947
. ' <legend>' . $GLOBALS['strChangeCopyUser'] . '</legend>' . "\n";
2083
. ' <legend>' . __('Change Login Information / Copy User') . '</legend>' . "\n";
1948
2084
PMA_displayLoginInformationFields('change');
1949
2085
echo ' <fieldset>' . "\n"
1950
. ' <legend>' . $GLOBALS['strChangeCopyMode'] . '</legend>' . "\n";
2086
. ' <legend>' . __('Create a new user with the same privileges and ...') . '</legend>' . "\n";
1951
2087
$choices = array(
1952
'4' => $GLOBALS['strChangeCopyModeCopy'],
1953
'1' => $GLOBALS['strChangeCopyModeJustDelete'],
1954
'2' => $GLOBALS['strChangeCopyModeRevoke'],
1955
'3' => $GLOBALS['strChangeCopyModeDeleteAndReload']);
2088
'4' => __('... keep the old one.'),
2089
'1' => __(' ... delete the old one from the user tables.'),
2090
'2' => __(' ... revoke all active privileges from the old one and delete it afterwards.'),
2091
'3' => __(' ... delete the old one from the user tables and reload the privileges afterwards.'));
1956
2092
PMA_display_html_radio('mode', $choices, '4', true);
1957
2093
unset($choices);
1959
2095
echo ' </fieldset>' . "\n"
1960
2096
. '</fieldset>' . "\n"
1961
2097
. '<fieldset id="fieldset_change_copy_user_footer" class="tblFooters">' . "\n"
1962
. ' <input type="submit" name="change_copy" value="' . $GLOBALS['strGo'] . '" />' . "\n"
2098
. ' <input type="submit" name="change_copy" value="' . __('Go') . '" />' . "\n"
1963
2099
. '</fieldset>' . "\n"
1964
2100
. '</form>' . "\n";
1967
2103
} elseif (isset($_REQUEST['adduser'])) {
1968
2105
// Add a new user
1969
2106
$GLOBALS['url_query'] .= '&adduser=1';
1970
2107
echo '<h2>' . "\n"
1971
. PMA_getIcon('b_usradd.png') . $GLOBALS['strAddUser'] . "\n"
2108
. PMA_getIcon('b_usradd.png') . __('Add a new User') . "\n"
1972
2109
. '</h2>' . "\n"
1973
. '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post" onsubmit="return checkAddUser(this);">' . "\n"
2110
. '<form name="usersForm" id="addUsersForm_' . $random_n . '" action="server_privileges.php" method="post">' . "\n"
1974
2111
. PMA_generate_common_hidden_inputs('', '');
1975
2112
PMA_displayLoginInformationFields('new');
1976
2113
echo '<fieldset id="fieldset_add_user_database">' . "\n"
1977
. '<legend>' . $GLOBALS['strCreateUserDatabase'] . '</legend>' . "\n";
2114
. '<legend>' . __('Database for user') . '</legend>' . "\n";
1979
2116
$default_choice = 0;
1980
2117
$choices = array(
1981
'0' => $GLOBALS['strCreateUserDatabaseNone'],
1982
'1' => $GLOBALS['strCreateUserDatabaseName'],
1983
'2' => $GLOBALS['strCreateUserDatabaseWildcard']);
2118
'0' => _pgettext('Create none database for user', 'None'),
2119
'1' => __('Create database with same name and grant all privileges'),
2120
'2' => __('Grant all privileges on wildcard name (username\\_%)'));
1985
2122
if ( !empty($dbname) ) {
1986
$choices['3'] = sprintf($GLOBALS['strCreateUserDatabasePrivileges'], htmlspecialchars($dbname));
2123
$choices['3'] = sprintf( __('Grant all privileges on database "%s"'), htmlspecialchars($dbname));
1987
2124
$default_choice = 3;
1988
2125
echo '<input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '" />' . "\n";
1998
2135
echo '</fieldset>' . "\n";
1999
2136
PMA_displayPrivTable('*', '*', FALSE);
2000
2137
echo ' <fieldset id="fieldset_add_user_footer" class="tblFooters">' . "\n"
2001
. ' <input type="submit" name="adduser_submit" value="' . $GLOBALS['strGo'] . '" />' . "\n"
2138
. ' <input type="submit" name="adduser_submit" value="' . __('Go') . '" />' . "\n"
2002
2139
. ' </fieldset>' . "\n"
2003
2140
. '</form>' . "\n";
2005
2142
// check the privileges for a particular database.
2006
echo '<table id="tablespecificuserrights" class="data">' . "\n"
2143
echo '<form id="usersForm"><table id="dbspecificuserrights" class="data">' . "\n"
2007
2144
. '<caption class="tblHeaders">' . "\n"
2008
2145
. PMA_getIcon('b_usrcheck.png')
2009
. ' ' . sprintf($GLOBALS['strUsersHavingAccessToDb'], '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' . htmlspecialchars($checkprivs) . '</a>') . "\n"
2146
. ' ' . sprintf(__('Users having access to "%s"'), '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' . htmlspecialchars($checkprivs) . '</a>') . "\n"
2010
2147
. '</caption>' . "\n"
2011
2148
. '<thead>' . "\n"
2012
. ' <tr><th>' . $GLOBALS['strUser'] . '</th>' . "\n"
2013
. ' <th>' . $GLOBALS['strHost'] . '</th>' . "\n"
2014
. ' <th>' . $GLOBALS['strType'] . '</th>' . "\n"
2015
. ' <th>' . $GLOBALS['strPrivileges'] . '</th>' . "\n"
2016
. ' <th>' . $GLOBALS['strGrantOption'] . '</th>' . "\n"
2017
. ' <th>' . $GLOBALS['strAction'] . '</th>' . "\n"
2149
. ' <tr><th>' . __('User') . '</th>' . "\n"
2150
. ' <th>' . __('Host') . '</th>' . "\n"
2151
. ' <th>' . __('Type') . '</th>' . "\n"
2152
. ' <th>' . __('Privileges') . '</th>' . "\n"
2153
. ' <th>' . __('Grant') . '</th>' . "\n"
2154
. ' <th>' . __('Action') . '</th>' . "\n"
2018
2155
. ' </tr>' . "\n"
2019
2156
. '</thead>' . "\n"
2020
2157
. '<tbody>' . "\n";