2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * handle row specific actions like edit, delete, export
12 require_once 'libraries/common.inc.php';
13 require_once 'libraries/mysql_charsets.inc.php';
14 require_once 'libraries/sql.lib.php';
16 if (isset($_REQUEST['submit_mult'])) {
17 $submit_mult = $_REQUEST['submit_mult'];
18 // workaround for IE problem:
19 } elseif (isset($_REQUEST['submit_mult_delete_x'])) {
20 $submit_mult = 'row_delete';
21 } elseif (isset($_REQUEST['submit_mult_change_x'])) {
22 $submit_mult = 'row_edit';
23 } elseif (isset($_REQUEST['submit_mult_export_x'])) {
24 $submit_mult = 'row_export';
27 // If the 'Ask for confirmation' button was pressed, this can only come
28 // from 'delete' mode, so we set it straight away.
29 if (isset($_REQUEST['mult_btn'])) {
30 $submit_mult = 'row_delete';
33 if (! isset($submit_mult)) {
34 $submit_mult = 'row_edit';
37 switch($submit_mult) {
46 $submit_mult = 'row_export';
50 $submit_mult = 'row_delete';
54 $submit_mult = 'row_copy';
59 $submit_mult = 'row_edit';
63 if (!empty($submit_mult)) {
65 if (! isset($_REQUEST['rows_to_delete'])
66 ||
! is_array($_REQUEST['rows_to_delete'])
68 $response = PMA_Response
::getInstance();
69 $response->isSuccess(false);
70 $response->addJSON('message', __('No row selected.'));
73 switch($submit_mult) {
75 $_REQUEST['default_action'] = 'insert';
76 // no break to allow for fallthough
78 // As we got the rows to be edited from the
79 // 'rows_to_delete' checkbox, we use the index of it as the
80 // indicating WHERE clause. Then we build the array which is used
81 // for the tbl_change.php script.
82 $where_clause = array();
83 if (isset($_REQUEST['rows_to_delete'])
84 && is_array($_REQUEST['rows_to_delete'])
86 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
87 $where_clause[] = urldecode($i_where_clause);
90 $active_page = 'tbl_change.php';
91 include 'tbl_change.php';
95 // Needed to allow SQL export
98 // As we got the rows to be exported from the
99 // 'rows_to_delete' checkbox, we use the index of it as the
100 // indicating WHERE clause. Then we build the array which is used
101 // for the tbl_change.php script.
102 $where_clause = array();
103 if (isset($_REQUEST['rows_to_delete'])
104 && is_array($_REQUEST['rows_to_delete'])
106 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
107 $where_clause[] = urldecode($i_where_clause);
110 $active_page = 'tbl_export.php';
111 include 'tbl_export.php';
116 $action = 'tbl_row_action.php';
117 $err_url = 'tbl_row_action.php'
118 . PMA_URL_getCommon($GLOBALS['url_params']);
119 if (! isset($_REQUEST['mult_btn'])) {
120 $original_sql_query = $sql_query;
121 if (! empty($url_query)) {
122 $original_url_query = $url_query;
125 include 'libraries/mult_submits.inc.php';
126 $_url_params = $GLOBALS['url_params'];
127 $_url_params['goto'] = 'tbl_sql.php';
128 $url_query = PMA_URL_getCommon($_url_params);
132 * Show result of multi submit operation
134 // sql_query is not set when user does not confirm multi-delete
135 if ((! empty($submit_mult) ||
isset($_REQUEST['mult_btn']))
136 && ! empty($sql_query)
138 $disp_message = __('Your SQL query has been executed successfully.');
139 $disp_query = $sql_query;
142 if (isset($original_sql_query)) {
143 $sql_query = $original_sql_query;
146 if (isset($original_url_query)) {
147 $url_query = $original_url_query;
150 $active_page = 'sql.php';
152 * Parse and analyze the query
154 include_once 'libraries/parse_analyze.inc.php';
156 PMA_executeQueryAndSendQueryResponse(
157 $analyzed_sql_results, // 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