Translated using Weblate (Norwegian Bokmål)
[phpmyadmin.git] / tbl_row_action.php
blob70423e141e24e4b21be5b5fb2437b44adffd302f
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)) {
64 switch($submit_mult) {
65 case 'row_copy':
66 $_REQUEST['default_action'] = 'insert';
67 // no break to allow for fallthough
68 case 'row_edit':
69 // As we got the rows to be edited from the
70 // 'rows_to_delete' checkbox, we use the index of it as the
71 // indicating WHERE clause. Then we build the array which is used
72 // for the tbl_change.php script.
73 $where_clause = array();
74 if (isset($_REQUEST['rows_to_delete'])
75 && is_array($_REQUEST['rows_to_delete'])
76 ) {
77 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
78 $where_clause[] = urldecode($i_where_clause);
81 $active_page = 'tbl_change.php';
82 include 'tbl_change.php';
83 break;
85 case 'row_export':
86 // Needed to allow SQL export
87 $single_table = true;
89 // As we got the rows to be exported from the
90 // 'rows_to_delete' checkbox, we use the index of it as the
91 // indicating WHERE clause. Then we build the array which is used
92 // for the tbl_change.php script.
93 $where_clause = array();
94 if (isset($_REQUEST['rows_to_delete'])
95 && is_array($_REQUEST['rows_to_delete'])
96 ) {
97 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
98 $where_clause[] = urldecode($i_where_clause);
101 $active_page = 'tbl_export.php';
102 include 'tbl_export.php';
103 break;
105 case 'row_delete':
106 default:
107 $action = 'tbl_row_action.php';
108 $err_url = 'tbl_row_action.php'
109 . PMA_URL_getCommon($GLOBALS['url_params']);
110 if (! isset($_REQUEST['mult_btn'])) {
111 $original_sql_query = $sql_query;
112 if (! empty($url_query)) {
113 $original_url_query = $url_query;
116 include 'libraries/mult_submits.inc.php';
117 $_url_params = $GLOBALS['url_params'];
118 $_url_params['goto'] = 'tbl_sql.php';
119 $url_query = PMA_URL_getCommon($_url_params);
123 * Show result of multi submit operation
125 // sql_query is not set when user does not confirm multi-delete
126 if ((! empty($submit_mult) || isset($_REQUEST['mult_btn']))
127 && ! empty($sql_query)
129 $disp_message = __('Your SQL query has been executed successfully.');
130 $disp_query = $sql_query;
133 if (isset($original_sql_query)) {
134 $sql_query = $original_sql_query;
137 if (isset($original_url_query)) {
138 $url_query = $original_url_query;
141 $active_page = 'sql.php';
143 * Parse and analyze the query
145 include_once 'libraries/parse_analyze.inc.php';
147 PMA_executeQueryAndSendQueryResponse(
148 $analyzed_sql_results, false, $db, $table, null, null, null, false, null,
149 null, null, $goto, $pmaThemeImage, null, null, null, $sql_query,
150 null, null