Lines 1-5
Link Here
|
1 |
<?php |
1 |
<?php |
2 |
/* $Id: server_privileges.php,v 2.40 2004/11/21 13:11:26 lem9 Exp $ */ |
2 |
/* $Id: server_privileges.php,v 2.42 2005/02/18 02:57:30 lem9 Exp $ */ |
3 |
// vim: expandtab sw=4 ts=4 sts=4: |
3 |
// vim: expandtab sw=4 ts=4 sts=4: |
4 |
|
4 |
|
5 |
/** |
5 |
/** |
Lines 490-495
Link Here
|
490 |
. (empty($thishost) ? '' : 'else if (this.value == \'thishost\') { hostname.value = \'' . addslashes(htmlspecialchars($thishost)) . '\'; } ') |
490 |
. (empty($thishost) ? '' : 'else if (this.value == \'thishost\') { hostname.value = \'' . addslashes(htmlspecialchars($thishost)) . '\'; } ') |
491 |
. 'else if (this.value == \'hosttable\') { hostname.value = \'\'; } else if (this.value == \'userdefined\') { hostname.focus(); hostname.select(); }">' . "\n"; |
491 |
. 'else if (this.value == \'hosttable\') { hostname.value = \'\'; } else if (this.value == \'userdefined\') { hostname.focus(); hostname.select(); }">' . "\n"; |
492 |
unset($row); |
492 |
unset($row); |
|
|
493 |
|
494 |
// when we start editing a user, $GLOBALS['pred_hostname'] is not defined |
495 |
if (!isset($GLOBALS['pred_hostname']) && isset($GLOBALS['hostname'])) { |
496 |
switch (strtolower($GLOBALS['hostname'])) { |
497 |
case 'localhost': |
498 |
case '127.0.0.1': |
499 |
$GLOBALS['pred_hostname'] = 'localhost'; |
500 |
break; |
501 |
case '%': |
502 |
$GLOBALS['pred_hostname'] = 'any'; |
503 |
break; |
504 |
default: |
505 |
$GLOBALS['pred_hostname'] = 'userdefined'; |
506 |
break; |
507 |
} |
508 |
} |
493 |
echo $spaces . ' <option value="any"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'any') ? ' selected="selected"' : '') . '>' . $GLOBALS['strAnyHost'] . '</option>' . "\n" |
509 |
echo $spaces . ' <option value="any"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'any') ? ' selected="selected"' : '') . '>' . $GLOBALS['strAnyHost'] . '</option>' . "\n" |
494 |
. $spaces . ' <option value="localhost"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'localhost') ? ' selected="selected"' : '') . '>' . $GLOBALS['strLocalhost'] . '</option>' . "\n"; |
510 |
. $spaces . ' <option value="localhost"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'localhost') ? ' selected="selected"' : '') . '>' . $GLOBALS['strLocalhost'] . '</option>' . "\n"; |
495 |
if (!empty($thishost)) { |
511 |
if (!empty($thishost)) { |
Lines 713-730
Link Here
|
713 |
// escaping a wildcard character in a GRANT is only accepted at the global |
729 |
// escaping a wildcard character in a GRANT is only accepted at the global |
714 |
// or database level, not at table level; this is why I remove |
730 |
// or database level, not at table level; this is why I remove |
715 |
// the escaping character |
731 |
// the escaping character |
716 |
// Note: in the Database-specific privileges, we will have for example |
732 |
// Note: in the phpMyAdmin list of Database-specific privileges, |
|
|
733 |
// we will have for example |
717 |
// test\_db SELECT (this one is for privileges on a db level) |
734 |
// test\_db SELECT (this one is for privileges on a db level) |
718 |
// test_db USAGE (this one is for table-specific privileges) |
735 |
// test_db USAGE (this one is for table-specific privileges) |
719 |
// |
736 |
// |
720 |
// It looks curious but reflects IMO the way MySQL works |
737 |
// It looks curious but reflects the way MySQL works |
|
|
738 |
|
739 |
if (empty($dbname)) { |
740 |
$db_and_table = '*.*'; |
741 |
} else { |
742 |
if (!empty($tablename)) { |
743 |
$db_and_table = str_replace('\\','',PMA_backquote($dbname)) |
744 |
. '.' . PMA_backquote($tablename); |
745 |
} else { |
746 |
// do not remove the escaping character when working at db level |
747 |
$db_and_table = PMA_backquote($dbname) |
748 |
. '.*'; |
749 |
} |
750 |
} |
751 |
|
721 |
|
752 |
|
722 |
$db_and_table = empty($dbname) ? '*.*' : str_replace('\\','',PMA_backquote($dbname)) . '.' . (empty($tablename) ? '*' : PMA_backquote($tablename)); |
|
|
723 |
$sql_query0 = 'REVOKE ALL PRIVILEGES ON ' . $db_and_table . ' FROM \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\';'; |
753 |
$sql_query0 = 'REVOKE ALL PRIVILEGES ON ' . $db_and_table . ' FROM \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\';'; |
724 |
if (!isset($Grant_priv) || $Grant_priv != 'Y') { |
754 |
if (!isset($Grant_priv) || $Grant_priv != 'Y') { |
725 |
$sql_query1 = 'REVOKE GRANT OPTION ON ' . $db_and_table . ' FROM \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\';'; |
755 |
$sql_query1 = 'REVOKE GRANT OPTION ON ' . $db_and_table . ' FROM \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\';'; |
726 |
} |
756 |
} |
727 |
$sql_query2 = 'GRANT ' . join(', ', PMA_extractPrivInfo()) . ' ON ' . $db_and_table . ' TO \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\''; |
757 |
$sql_query2 = 'GRANT ' . join(', ', PMA_extractPrivInfo()) . ' ON ' . $db_and_table . ' TO \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\''; |
|
|
758 |
|
728 |
if ((isset($Grant_priv) && $Grant_priv == 'Y') || (empty($dbname) && PMA_MYSQL_INT_VERSION >= 40002 && (isset($max_questions) || isset($max_connections) || isset($max_updates)))) { |
759 |
if ((isset($Grant_priv) && $Grant_priv == 'Y') || (empty($dbname) && PMA_MYSQL_INT_VERSION >= 40002 && (isset($max_questions) || isset($max_connections) || isset($max_updates)))) { |
729 |
$sql_query2 .= 'WITH'; |
760 |
$sql_query2 .= 'WITH'; |
730 |
if (isset($Grant_priv) && $Grant_priv == 'Y') { |
761 |
if (isset($Grant_priv) && $Grant_priv == 'Y') { |