db_sql.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. *
  5. * @package PhpMyAdmin
  6. */
  7. /**
  8. *
  9. */
  10. require_once 'libraries/common.inc.php';
  11. /**
  12. * Runs common work
  13. */
  14. $response = PMA_Response::getInstance();
  15. $header = $response->getHeader();
  16. $scripts = $header->getScripts();
  17. $scripts->addFile('functions.js');
  18. $scripts->addFile('makegrid.js');
  19. $scripts->addFile('sql.js');
  20. require 'libraries/db_common.inc.php';
  21. require_once 'libraries/sql_query_form.lib.php';
  22. // After a syntax error, we return to this script
  23. // with the typed query in the textarea.
  24. $goto = 'db_sql.php';
  25. $back = 'db_sql.php';
  26. /**
  27. * Sets globals from $_GET
  28. */
  29. $get_params = array(
  30. 'db_query_force'
  31. );
  32. foreach ($get_params as $one_get_param) {
  33. if (isset($_GET[$one_get_param])) {
  34. $GLOBALS[$one_get_param] = $_GET[$one_get_param];
  35. }
  36. }
  37. /**
  38. * Gets informations about the database and, if it is empty, move to the
  39. * "db_structure.php" script where table can be created
  40. */
  41. require 'libraries/db_info.inc.php';
  42. if ($num_tables == 0 && empty($db_query_force)) {
  43. $sub_part = '';
  44. $is_info = true;
  45. include 'db_structure.php';
  46. exit();
  47. }
  48. /**
  49. * Query box, bookmark, insert data from textfile
  50. */
  51. PMA_sqlQueryForm(
  52. true, false,
  53. isset($_REQUEST['delimiter']) ? htmlspecialchars($_REQUEST['delimiter']) : ';'
  54. );
  55. ?>