lint.php 931 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Represents the interface between the linter and the query editor.
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. /**
  9. * Loading common files. Used to check for authorization, localization and to
  10. * load the parsing library.
  11. */
  12. require_once 'libraries/common.inc.php';
  13. /**
  14. * Loads the linter.
  15. */
  16. require_once 'libraries/Linter.class.php';
  17. /**
  18. * The SQL query to be analyzed.
  19. *
  20. * This does not need to be checked again XSS or MySQL injections because it is
  21. * never executed, just parsed.
  22. *
  23. * The client, which will recieve the JSON response will decode the message and
  24. * and any HTML fragments that are displayed to the user will be encoded anyway.
  25. *
  26. * @var string
  27. */
  28. $sql_query = !empty($_POST['sql_query']) ? $_POST['sql_query'] : '';
  29. // Disabling standard response.
  30. PMA_Response::getInstance()->disable();
  31. PMA_headerJSON();
  32. echo json_encode(PMA_Linter::lint($sql_query));