2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * handle row specific actions like edit, delete, export
9 use PMA\libraries\Response
;
14 require_once 'libraries/common.inc.php';
15 require_once 'libraries/sql.lib.php';
17 if (isset($_REQUEST['submit_mult'])) {
18 $submit_mult = $_REQUEST['submit_mult'];
19 // workaround for IE problem:
20 } elseif (isset($_REQUEST['submit_mult_delete_x'])) {
21 $submit_mult = 'row_delete';
22 } elseif (isset($_REQUEST['submit_mult_change_x'])) {
23 $submit_mult = 'row_edit';
24 } elseif (isset($_REQUEST['submit_mult_export_x'])) {
25 $submit_mult = 'row_export';
28 // If the 'Ask for confirmation' button was pressed, this can only come
29 // from 'delete' mode, so we set it straight away.
30 if (isset($_REQUEST['mult_btn'])) {
31 $submit_mult = 'row_delete';
34 if (! isset($submit_mult)) {
35 $submit_mult = 'row_edit';
38 switch($submit_mult) {
47 $submit_mult = 'row_export';
51 $submit_mult = 'row_delete';
55 $submit_mult = 'row_copy';
60 $submit_mult = 'row_edit';
64 if (!empty($submit_mult)) {
66 if (isset($_REQUEST['goto'])
67 && (! isset($_REQUEST['rows_to_delete'])
68 ||
! is_array($_REQUEST['rows_to_delete']))
70 $response = Response
::getInstance();
71 $response->setRequestStatus(false);
72 $response->addJSON('message', __('No row selected.'));
75 switch($submit_mult) {
76 /** @noinspection PhpMissingBreakStatementInspection */
78 $_REQUEST['default_action'] = 'insert';
79 // no break to allow for fallthough
81 // As we got the rows to be edited from the
82 // 'rows_to_delete' checkbox, we use the index of it as the
83 // indicating WHERE clause. Then we build the array which is used
84 // for the tbl_change.php script.
85 $where_clause = array();
86 if (isset($_REQUEST['rows_to_delete'])
87 && is_array($_REQUEST['rows_to_delete'])
89 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
90 $where_clause[] = $i_where_clause;
93 $active_page = 'tbl_change.php';
94 include 'tbl_change.php';
98 // Needed to allow SQL export
101 // As we got the rows to be exported from the
102 // 'rows_to_delete' checkbox, we use the index of it as the
103 // indicating WHERE clause. Then we build the array which is used
104 // for the tbl_change.php script.
105 $where_clause = array();
106 if (isset($_REQUEST['rows_to_delete'])
107 && is_array($_REQUEST['rows_to_delete'])
109 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
110 $where_clause[] = $i_where_clause;
113 $active_page = 'tbl_export.php';
114 include 'tbl_export.php';
119 $action = 'tbl_row_action.php';
120 $err_url = 'tbl_row_action.php'
121 . URL
::getCommon($GLOBALS['url_params']);
122 if (! isset($_REQUEST['mult_btn'])) {
123 $original_sql_query = $sql_query;
124 if (! empty($url_query)) {
125 $original_url_query = $url_query;
128 include 'libraries/mult_submits.inc.php';
129 $_url_params = $GLOBALS['url_params'];
130 $_url_params['goto'] = 'tbl_sql.php';
131 $url_query = URL
::getCommon($_url_params);
135 * Show result of multi submit operation
137 // sql_query is not set when user does not confirm multi-delete
138 if ((! empty($submit_mult) ||
isset($_REQUEST['mult_btn']))
139 && ! empty($sql_query)
141 $disp_message = __('Your SQL query has been executed successfully.');
142 $disp_query = $sql_query;
145 if (isset($original_sql_query)) {
146 $sql_query = $original_sql_query;
149 if (isset($original_url_query)) {
150 $url_query = $original_url_query;
153 $active_page = 'sql.php';
154 PMA_executeQueryAndSendQueryResponse(
155 null, // analyzed_sql_results
156 false, // is_gotofile
159 null, // find_real_end
160 null, // sql_query_for_bookmark
162 null, // message_to_show
166 $pmaThemeImage, // pmaThemeImage
168 null, // disp_message
170 $sql_query, // sql_query
171 null, // selectedTables
172 null // complete_query