tbl_row_action.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * handle row specific actions like edit, delete, export
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. /**
  9. *
  10. */
  11. require_once 'libraries/common.inc.php';
  12. require_once 'libraries/mysql_charsets.inc.php';
  13. require_once 'libraries/sql.lib.php';
  14. if (isset($_REQUEST['submit_mult'])) {
  15. $submit_mult = $_REQUEST['submit_mult'];
  16. // workaround for IE problem:
  17. } elseif (isset($_REQUEST['submit_mult_delete_x'])) {
  18. $submit_mult = 'row_delete';
  19. } elseif (isset($_REQUEST['submit_mult_change_x'])) {
  20. $submit_mult = 'row_edit';
  21. } elseif (isset($_REQUEST['submit_mult_export_x'])) {
  22. $submit_mult = 'row_export';
  23. }
  24. // If the 'Ask for confirmation' button was pressed, this can only come
  25. // from 'delete' mode, so we set it straight away.
  26. if (isset($_REQUEST['mult_btn'])) {
  27. $submit_mult = 'row_delete';
  28. }
  29. switch($submit_mult) {
  30. case 'row_delete':
  31. case 'row_edit':
  32. case 'row_export':
  33. // leave as is
  34. break;
  35. case 'export':
  36. $submit_mult = 'row_export';
  37. break;
  38. case 'delete':
  39. $submit_mult = 'row_delete';
  40. break;
  41. default:
  42. case 'edit':
  43. $submit_mult = 'row_edit';
  44. break;
  45. }
  46. if (!empty($submit_mult)) {
  47. switch($submit_mult) {
  48. case 'row_edit':
  49. // As we got the rows to be edited from the
  50. // 'rows_to_delete' checkbox, we use the index of it as the
  51. // indicating WHERE clause. Then we build the array which is used
  52. // for the tbl_change.php script.
  53. $where_clause = array();
  54. foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
  55. $where_clause[] = urldecode($i_where_clause);
  56. }
  57. $active_page = 'tbl_change.php';
  58. include 'tbl_change.php';
  59. break;
  60. case 'row_export':
  61. // Needed to allow SQL export
  62. $single_table = true;
  63. // As we got the rows to be exported from the
  64. // 'rows_to_delete' checkbox, we use the index of it as the
  65. // indicating WHERE clause. Then we build the array which is used
  66. // for the tbl_change.php script.
  67. $where_clause = array();
  68. foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
  69. $where_clause[] = urldecode($i_where_clause);
  70. }
  71. $active_page = 'tbl_export.php';
  72. include 'tbl_export.php';
  73. break;
  74. case 'row_delete':
  75. default:
  76. $action = 'tbl_row_action.php';
  77. $err_url = 'tbl_row_action.php'
  78. . PMA_URL_getCommon($GLOBALS['url_params']);
  79. if (! isset($_REQUEST['mult_btn'])) {
  80. $original_sql_query = $sql_query;
  81. if (! empty($url_query)) {
  82. $original_url_query = $url_query;
  83. }
  84. }
  85. include 'libraries/mult_submits.inc.php';
  86. $_url_params = $GLOBALS['url_params'];
  87. $_url_params['goto'] = 'tbl_sql.php';
  88. $url_query = PMA_URL_getCommon($_url_params);
  89. /**
  90. * Show result of multi submit operation
  91. */
  92. // sql_query is not set when user does not confirm multi-delete
  93. if ((! empty($submit_mult) || isset($_REQUEST['mult_btn']))
  94. && ! empty($sql_query)
  95. ) {
  96. $disp_message = __('Your SQL query has been executed successfully.');
  97. $disp_query = $sql_query;
  98. }
  99. if (isset($original_sql_query)) {
  100. $sql_query = $original_sql_query;
  101. }
  102. if (isset($original_url_query)) {
  103. $url_query = $original_url_query;
  104. }
  105. $active_page = 'sql.php';
  106. /**
  107. * Parse and analyze the query
  108. */
  109. include_once 'libraries/parse_analyze.inc.php';
  110. PMA_executeQueryAndSendQueryResponse(
  111. $analyzed_sql_results, false, $db, $table, null, null, null, false, null,
  112. null, null, null, $goto, $pmaThemeImage, null, null, null, $sql_query,
  113. null, null
  114. );
  115. }
  116. }
  117. ?>