SqlController.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Holds the PhpMyAdmin\Controllers\Table\SqlController
  5. *
  6. * @package PhpMyAdmin\Controllers\Table
  7. */
  8. declare(strict_types=1);
  9. namespace PhpMyAdmin\Controllers\Table;
  10. use PhpMyAdmin\Config\PageSettings;
  11. use PhpMyAdmin\SqlQueryForm;
  12. /**
  13. * Table SQL executor
  14. * @package PhpMyAdmin\Controllers\Table
  15. */
  16. class SqlController extends AbstractController
  17. {
  18. /**
  19. * @param array $params Request parameters
  20. * @param SqlQueryForm $sqlQueryForm SqlQueryForm instance
  21. *
  22. * @return string HTML
  23. */
  24. public function index(array $params, SqlQueryForm $sqlQueryForm): string
  25. {
  26. global $url_query, $err_url, $goto, $back;
  27. PageSettings::showGroup('Sql');
  28. require ROOT_PATH . 'libraries/tbl_common.inc.php';
  29. $url_query .= '&amp;goto=tbl_sql.php&amp;back=tbl_sql.php';
  30. $err_url = 'tbl_sql.php' . $err_url;
  31. /**
  32. * After a syntax error, we return to this script
  33. * with the typed query in the textarea.
  34. */
  35. $goto = 'tbl_sql.php';
  36. $back = 'tbl_sql.php';
  37. return $sqlQueryForm->getHtml(
  38. $params['sql_query'] ?? true,
  39. false,
  40. isset($params['delimiter'])
  41. ? htmlspecialchars($params['delimiter'])
  42. : ';'
  43. );
  44. }
  45. }