Translated using Weblate (Indonesian)
[phpmyadmin.git] / tbl_row_action.php
blob498584b55942c50e4f59a4184c50096d313c8940
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 */
8 use PMA\libraries\URL;
9 use PMA\libraries\Response;
11 /**
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) {
39 case 'row_delete':
40 case 'row_edit':
41 case 'row_copy':
42 case 'row_export':
43 // leave as is
44 break;
46 case 'export':
47 $submit_mult = 'row_export';
48 break;
50 case 'delete':
51 $submit_mult = 'row_delete';
52 break;
54 case 'copy':
55 $submit_mult = 'row_copy';
56 break;
58 case 'edit':
59 default:
60 $submit_mult = 'row_edit';
61 break;
64 if (!empty($submit_mult)) {
66 if (isset($_REQUEST['goto'])
67 && (! isset($_REQUEST['rows_to_delete'])
68 || ! is_array($_REQUEST['rows_to_delete']))
69 ) {
70 $response = Response::getInstance();
71 $response->setRequestStatus(false);
72 $response->addJSON('message', __('No row selected.'));
75 switch($submit_mult) {
76 /** @noinspection PhpMissingBreakStatementInspection */
77 case 'row_copy':
78 $_REQUEST['default_action'] = 'insert';
79 // no break to allow for fallthough
80 case 'row_edit':
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'])
88 ) {
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';
95 break;
97 case 'row_export':
98 // Needed to allow SQL export
99 $single_table = true;
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';
115 break;
117 case 'row_delete':
118 default:
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
157 $db, // db
158 $table, // table
159 null, // find_real_end
160 null, // sql_query_for_bookmark
161 null, // extra_data
162 null, // message_to_show
163 null, // message
164 null, // sql_data
165 $goto, // goto
166 $pmaThemeImage, // pmaThemeImage
167 null, // disp_query
168 null, // disp_message
169 null, // query_type
170 $sql_query, // sql_query
171 null, // selectedTables
172 null // complete_query