check_user_privileges.inc.php 838 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Get user's global privileges and some db-specific privileges
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. if (! defined('PHPMYADMIN')) {
  9. exit;
  10. }
  11. use PhpMyAdmin\CheckUserPrivileges;
  12. $checkUserPrivileges = new CheckUserPrivileges($GLOBALS['dbi']);
  13. list($username, $hostname) = $GLOBALS['dbi']->getCurrentUserAndHost();
  14. if ($username === '') { // MySQL is started with --skip-grant-tables
  15. $GLOBALS['is_create_db_priv'] = true;
  16. $GLOBALS['is_reload_priv'] = true;
  17. $GLOBALS['db_to_create'] = '';
  18. $GLOBALS['dbs_where_create_table_allowed'] = array('*');
  19. $GLOBALS['dbs_to_test'] = false;
  20. $GLOBALS['db_priv'] = true;
  21. $GLOBALS['col_priv'] = true;
  22. $GLOBALS['table_priv'] = true;
  23. $GLOBALS['proc_priv'] = true;
  24. } else {
  25. $checkUserPrivileges->analyseShowGrant();
  26. }