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['goto'])
66 && (! isset($_REQUEST['rows_to_delete'])
67 ||
! is_array($_REQUEST['rows_to_delete']))
69 $response = PMA_Response
::getInstance();
70 $response->isSuccess(false);
71 $response->addJSON('message', __('No row selected.'));
74 switch($submit_mult) {
76 $_REQUEST['default_action'] = 'insert';
77 // no break to allow for fallthough
79 // As we got the rows to be edited from the
80 // 'rows_to_delete' checkbox, we use the index of it as the
81 // indicating WHERE clause. Then we build the array which is used
82 // for the tbl_change.php script.
83 $where_clause = array();
84 if (isset($_REQUEST['rows_to_delete'])
85 && is_array($_REQUEST['rows_to_delete'])
87 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
88 $where_clause[] = urldecode($i_where_clause);
91 $active_page = 'tbl_change.php';
92 include 'tbl_change.php';
96 // Needed to allow SQL export
99 // As we got the rows to be exported from the
100 // 'rows_to_delete' checkbox, we use the index of it as the
101 // indicating WHERE clause. Then we build the array which is used
102 // for the tbl_change.php script.
103 $where_clause = array();
104 if (isset($_REQUEST['rows_to_delete'])
105 && is_array($_REQUEST['rows_to_delete'])
107 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
108 $where_clause[] = urldecode($i_where_clause);
111 $active_page = 'tbl_export.php';
112 include 'tbl_export.php';
117 $action = 'tbl_row_action.php';
118 $err_url = 'tbl_row_action.php'
119 . PMA_URL_getCommon($GLOBALS['url_params']);
120 if (! isset($_REQUEST['mult_btn'])) {
121 $original_sql_query = $sql_query;
122 if (! empty($url_query)) {
123 $original_url_query = $url_query;
126 include 'libraries/mult_submits.inc.php';
127 $_url_params = $GLOBALS['url_params'];
128 $_url_params['goto'] = 'tbl_sql.php';
129 $url_query = PMA_URL_getCommon($_url_params);
133 * Show result of multi submit operation
135 // sql_query is not set when user does not confirm multi-delete
136 if ((! empty($submit_mult) ||
isset($_REQUEST['mult_btn']))
137 && ! empty($sql_query)
139 $disp_message = __('Your SQL query has been executed successfully.');
140 $disp_query = $sql_query;
143 if (isset($original_sql_query)) {
144 $sql_query = $original_sql_query;
147 if (isset($original_url_query)) {
148 $url_query = $original_url_query;
151 $active_page = 'sql.php';
153 * Parse and analyze the query
155 include_once 'libraries/parse_analyze.inc.php';
157 PMA_executeQueryAndSendQueryResponse(
158 $analyzed_sql_results, // analyzed_sql_results
159 false, // is_gotofile
162 null, // find_real_end
163 null, // sql_query_for_bookmark
165 null, // message_to_show
169 $pmaThemeImage, // pmaThemeImage
171 null, // disp_message
173 $sql_query, // sql_query
174 null, // selectedTables
175 null // complete_query