rte_main.inc.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Common code for Routines, Triggers and Events.
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. use PhpMyAdmin\Response;
  9. use PhpMyAdmin\Rte\Events;
  10. use PhpMyAdmin\Rte\Routines;
  11. use PhpMyAdmin\Rte\Triggers;
  12. use PhpMyAdmin\Url;
  13. if (! defined('PHPMYADMIN')) {
  14. exit;
  15. }
  16. $response = Response::getInstance();
  17. if (! $response->isAjax()) {
  18. /**
  19. * Displays the header and tabs
  20. */
  21. if (! empty($table) && in_array($table, $GLOBALS['dbi']->getTables($db))) {
  22. include_once './libraries/tbl_common.inc.php';
  23. } else {
  24. $table = '';
  25. include_once './libraries/db_common.inc.php';
  26. list(
  27. $tables,
  28. $num_tables,
  29. $total_num_tables,
  30. $sub_part,
  31. $is_show_stats,
  32. $db_is_system_schema,
  33. $tooltip_truename,
  34. $tooltip_aliasname,
  35. $pos
  36. ) = PhpMyAdmin\Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');
  37. }
  38. } else {
  39. /**
  40. * Since we did not include some libraries, we need
  41. * to manually select the required database and
  42. * create the missing $url_query variable
  43. */
  44. if (strlen($db) > 0) {
  45. $GLOBALS['dbi']->selectDb($db);
  46. if (! isset($url_query)) {
  47. $url_query = Url::getCommon(
  48. array(
  49. 'db' => $db, 'table' => $table
  50. )
  51. );
  52. }
  53. }
  54. }
  55. /**
  56. * Create labels for the list
  57. */
  58. $titles = PhpMyAdmin\Util::buildActionTitles();
  59. /**
  60. * Keep a list of errors that occurred while
  61. * processing an 'Add' or 'Edit' operation.
  62. */
  63. $errors = array();
  64. /**
  65. * Call the appropriate main function
  66. */
  67. switch ($_PMA_RTE) {
  68. case 'RTN':
  69. $type = null;
  70. if (isset($_REQUEST['type'])) {
  71. $type = $_REQUEST['type'];
  72. }
  73. Routines::main($type);
  74. break;
  75. case 'TRI':
  76. Triggers::main();
  77. break;
  78. case 'EVN':
  79. Events::main();
  80. break;
  81. }