Translated using Weblate (Slovenian)
[phpmyadmin.git] / tbl_row_action.php
blob22a9ba72f94bb24ee7fcca72a16e12101da32d3f
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['goto'])
66 && (! isset($_REQUEST['rows_to_delete'])
67 || ! is_array($_REQUEST['rows_to_delete']))
68 ) {
69 $response = PMA\libraries\Response::getInstance();
70 $response->setRequestStatus(false);
71 $response->addJSON('message', __('No row selected.'));
74 switch($submit_mult) {
75 /** @noinspection PhpMissingBreakStatementInspection */
76 case 'row_copy':
77 $_REQUEST['default_action'] = 'insert';
78 // no break to allow for fallthough
79 case 'row_edit':
80 // As we got the rows to be edited from the
81 // 'rows_to_delete' checkbox, we use the index of it as the
82 // indicating WHERE clause. Then we build the array which is used
83 // for the tbl_change.php script.
84 $where_clause = array();
85 if (isset($_REQUEST['rows_to_delete'])
86 && is_array($_REQUEST['rows_to_delete'])
87 ) {
88 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
89 $where_clause[] = urldecode($i_where_clause);
92 $active_page = 'tbl_change.php';
93 include 'tbl_change.php';
94 break;
96 case 'row_export':
97 // Needed to allow SQL export
98 $single_table = true;
100 // As we got the rows to be exported from the
101 // 'rows_to_delete' checkbox, we use the index of it as the
102 // indicating WHERE clause. Then we build the array which is used
103 // for the tbl_change.php script.
104 $where_clause = array();
105 if (isset($_REQUEST['rows_to_delete'])
106 && is_array($_REQUEST['rows_to_delete'])
108 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
109 $where_clause[] = urldecode($i_where_clause);
112 $active_page = 'tbl_export.php';
113 include 'tbl_export.php';
114 break;
116 case 'row_delete':
117 default:
118 $action = 'tbl_row_action.php';
119 $err_url = 'tbl_row_action.php'
120 . PMA_URL_getCommon($GLOBALS['url_params']);
121 if (! isset($_REQUEST['mult_btn'])) {
122 $original_sql_query = $sql_query;
123 if (! empty($url_query)) {
124 $original_url_query = $url_query;
127 include 'libraries/mult_submits.inc.php';
128 $_url_params = $GLOBALS['url_params'];
129 $_url_params['goto'] = 'tbl_sql.php';
130 $url_query = PMA_URL_getCommon($_url_params);
134 * Show result of multi submit operation
136 // sql_query is not set when user does not confirm multi-delete
137 if ((! empty($submit_mult) || isset($_REQUEST['mult_btn']))
138 && ! empty($sql_query)
140 $disp_message = __('Your SQL query has been executed successfully.');
141 $disp_query = $sql_query;
144 if (isset($original_sql_query)) {
145 $sql_query = $original_sql_query;
148 if (isset($original_url_query)) {
149 $url_query = $original_url_query;
152 $active_page = 'sql.php';
154 * Parse and analyze the query
156 include_once 'libraries/parse_analyze.lib.php';
157 list(
158 $analyzed_sql_results,
159 $db,
160 $table
161 ) = PMA_parseAnalyze($sql_query, $db);
162 // @todo: possibly refactor
163 extract($analyzed_sql_results);
165 PMA_executeQueryAndSendQueryResponse(
166 $analyzed_sql_results, // analyzed_sql_results
167 false, // is_gotofile
168 $db, // db
169 $table, // table
170 null, // find_real_end
171 null, // sql_query_for_bookmark
172 null, // extra_data
173 null, // message_to_show
174 null, // message
175 null, // sql_data
176 $goto, // goto
177 $pmaThemeImage, // pmaThemeImage
178 null, // disp_query
179 null, // disp_message
180 null, // query_type
181 $sql_query, // sql_query
182 null, // selectedTables
183 null // complete_query