2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * handle row specific actions like edit, delete, export
8 declare(strict_types
=1);
10 use PhpMyAdmin\Response
;
17 require_once 'libraries/common.inc.php';
19 if (isset($_REQUEST['submit_mult'])) {
20 $submit_mult = $_REQUEST['submit_mult'];
21 // workaround for IE problem:
22 } elseif (isset($_REQUEST['submit_mult_delete_x'])) {
23 $submit_mult = 'row_delete';
24 } elseif (isset($_REQUEST['submit_mult_change_x'])) {
25 $submit_mult = 'row_edit';
26 } elseif (isset($_REQUEST['submit_mult_export_x'])) {
27 $submit_mult = 'row_export';
30 // If the 'Ask for confirmation' button was pressed, this can only come
31 // from 'delete' mode, so we set it straight away.
32 if (isset($_REQUEST['mult_btn'])) {
33 $submit_mult = 'row_delete';
36 if (! isset($submit_mult)) {
37 $submit_mult = 'row_edit';
40 switch ($submit_mult) {
49 $submit_mult = 'row_export';
53 $submit_mult = 'row_delete';
57 $submit_mult = 'row_copy';
62 $submit_mult = 'row_edit';
66 if (!empty($submit_mult)) {
67 if (isset($_REQUEST['goto'])
68 && (! isset($_REQUEST['rows_to_delete'])
69 ||
! is_array($_REQUEST['rows_to_delete']))
71 $response = Response
::getInstance();
72 $response->setRequestStatus(false);
73 $response->addJSON('message', __('No row selected.'));
76 switch ($submit_mult) {
77 /** @noinspection PhpMissingBreakStatementInspection */
79 $_REQUEST['default_action'] = 'insert';
80 // no break to allow for fallthough
82 // As we got the rows to be edited from the
83 // 'rows_to_delete' checkbox, we use the index of it as the
84 // indicating WHERE clause. Then we build the array which is used
85 // for the tbl_change.php script.
87 if (isset($_REQUEST['rows_to_delete'])
88 && is_array($_REQUEST['rows_to_delete'])
90 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
91 $where_clause[] = $i_where_clause;
94 $active_page = 'tbl_change.php';
95 include 'tbl_change.php';
99 // Needed to allow SQL export
100 $single_table = true;
102 // As we got the rows to be exported from the
103 // 'rows_to_delete' checkbox, we use the index of it as the
104 // indicating WHERE clause. Then we build the array which is used
105 // for the tbl_change.php script.
107 if (isset($_REQUEST['rows_to_delete'])
108 && is_array($_REQUEST['rows_to_delete'])
110 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
111 $where_clause[] = $i_where_clause;
114 $active_page = 'tbl_export.php';
115 include 'tbl_export.php';
120 $action = 'tbl_row_action.php';
121 $err_url = 'tbl_row_action.php'
122 . Url
::getCommon($GLOBALS['url_params']);
123 if (! isset($_REQUEST['mult_btn'])) {
124 $original_sql_query = $sql_query;
125 if (! empty($url_query)) {
126 $original_url_query = $url_query;
129 include 'libraries/mult_submits.inc.php';
130 $_url_params = $GLOBALS['url_params'];
131 $_url_params['goto'] = 'tbl_sql.php';
132 $url_query = Url
::getCommon($_url_params);
136 * Show result of multi submit operation
138 // sql_query is not set when user does not confirm multi-delete
139 if ((! empty($submit_mult) ||
isset($_REQUEST['mult_btn']))
140 && ! empty($sql_query)
142 $disp_message = __('Your SQL query has been executed successfully.');
143 $disp_query = $sql_query;
146 if (isset($original_sql_query)) {
147 $sql_query = $original_sql_query;
150 if (isset($original_url_query)) {
151 $url_query = $original_url_query;
154 $active_page = 'sql.php';
156 $sql->executeQueryAndSendQueryResponse(
157 null, // analyzed_sql_results
158 false, // is_gotofile
161 null, // find_real_end
162 null, // sql_query_for_bookmark
164 null, // message_to_show
168 $pmaThemeImage, // pmaThemeImage
170 null, // disp_message
172 $sql_query, // sql_query
173 null, // selectedTables
174 null // complete_query