Translated using Weblate (Turkish)
[phpmyadmin.git] / tbl_row_action.php
blob2f6e5e92e81659544bd6b61909fff1b95b44ac1d
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * handle row specific actions like edit, delete, export
6 * @package PhpMyAdmin
7 */
9 /**
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) {
38 case 'row_delete':
39 case 'row_edit':
40 case 'row_copy':
41 case 'row_export':
42 // leave as is
43 break;
45 case 'export':
46 $submit_mult = 'row_export';
47 break;
49 case 'delete':
50 $submit_mult = 'row_delete';
51 break;
53 case 'copy':
54 $submit_mult = 'row_copy';
55 break;
57 case 'edit':
58 default:
59 $submit_mult = 'row_edit';
60 break;
63 if (!empty($submit_mult)) {
65 if (! isset($_REQUEST['rows_to_delete'])
66 || ! is_array($_REQUEST['rows_to_delete'])
67 ) {
68 $response = PMA_Response::getInstance();
69 $response->isSuccess(false);
70 $response->addJSON('message', __('No row selected.'));
73 switch($submit_mult) {
74 case 'row_copy':
75 $_REQUEST['default_action'] = 'insert';
76 // no break to allow for fallthough
77 case 'row_edit':
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'])
85 ) {
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';
92 break;
94 case 'row_export':
95 // Needed to allow SQL export
96 $single_table = true;
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';
112 break;
114 case 'row_delete':
115 default:
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
159 $db, // db
160 $table, // table
161 null, // find_real_end
162 null, // sql_query_for_bookmark
163 null, // extra_data
164 null, // message_to_show
165 null, // message
166 null, // sql_data
167 $goto, // goto
168 $pmaThemeImage, // pmaThemeImage
169 null, // disp_query
170 null, // disp_message
171 null, // query_type
172 $sql_query, // sql_query
173 null, // selectedTables
174 null // complete_query