Merge remote-tracking branch 'pootle/master' into QA_3_5
[phpmyadmin.git] / tbl_row_action.php
blob537e4f25d426c1b493fabd21029d4fb5bb5f6dcf
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * handle row specifc actions like edit, delete, export
6 * @package PhpMyAdmin
7 */
10 /**
11 * do not globalize/import request variables
12 * can only be enabled if all included files are switched superglobals too
13 * but leave this here to show that this file is 'superglobalized'
14 define('PMA_NO_VARIABLES_IMPORT', true);
17 /**
20 require_once './libraries/common.inc.php';
21 require_once './libraries/mysql_charsets.lib.php';
23 /**
24 * No rows were selected => show again the query and tell that user.
26 if (! PMA_isValid($_REQUEST['rows_to_delete'], 'array')
27 && ! isset($_REQUEST['mult_btn'])) {
28 $disp_message = __('No rows selected');
29 $disp_query = '';
30 include './sql.php';
31 include './libraries/footer.inc.php';
34 if (isset($_REQUEST['submit_mult'])) {
35 $submit_mult = $_REQUEST['submit_mult'];
36 // workaround for IE problem:
37 } elseif (isset($_REQUEST['submit_mult_delete_x'])) {
38 $submit_mult = 'row_delete';
39 } elseif (isset($_REQUEST['submit_mult_change_x'])) {
40 $submit_mult = 'row_edit';
41 } elseif (isset($_REQUEST['submit_mult_export_x'])) {
42 $submit_mult = 'row_export';
45 // If the 'Ask for confirmation' button was pressed, this can only come
46 // from 'delete' mode, so we set it straight away.
47 if (isset($_REQUEST['mult_btn'])) {
48 $submit_mult = 'row_delete';
51 switch($submit_mult) {
52 case 'row_delete':
53 case 'row_edit':
54 case 'row_export':
55 // leave as is
56 break;
58 case 'export':
59 $submit_mult = 'row_export';
60 break;
62 case 'delete':
63 $submit_mult = 'row_delete';
64 break;
66 default:
67 case 'edit':
68 $submit_mult = 'row_edit';
69 break;
72 if (!empty($submit_mult)) {
73 switch($submit_mult) {
74 case 'row_edit':
75 // As we got the rows to be edited from the
76 // 'rows_to_delete' checkbox, we use the index of it as the
77 // indicating WHERE clause. Then we build the array which is used
78 // for the tbl_change.php script.
79 $where_clause = array();
80 foreach ($_REQUEST['rows_to_delete'] as $i_where_clause => $del_query) {
81 $where_clause[] = urldecode($i_where_clause);
84 $active_page = 'tbl_change.php';
85 include './tbl_change.php';
86 break;
88 case 'row_export':
89 // Needed to allow SQL export
90 $single_table = true;
92 // As we got the rows to be exported from the
93 // 'rows_to_delete' checkbox, we use the index of it as the
94 // indicating WHERE clause. Then we build the array which is used
95 // for the tbl_change.php script.
96 $where_clause = array();
97 foreach ($_REQUEST['rows_to_delete'] as $i_where_clause => $del_query) {
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' . PMA_generate_common_url($GLOBALS['url_params']);
109 if (! isset($_REQUEST['mult_btn'])) {
110 $original_sql_query = $sql_query;
111 if (! empty($url_query)) {
112 $original_url_query = $url_query;
115 include './libraries/mult_submits.inc.php';
116 $_url_params = $GLOBALS['url_params'];
117 $_url_params['goto'] = 'tbl_sql.php';
118 $url_query = PMA_generate_common_url($_url_params);
122 * Show result of multi submit operation
124 // sql_query is not set when user does not confirm multi-delete
125 if ((!empty($submit_mult) || isset($_REQUEST['mult_btn'])) && ! empty($sql_query)) {
126 $disp_message = __('Your SQL query has been executed successfully');
127 $disp_query = $sql_query;
130 if (isset($original_sql_query)) {
131 $sql_query = $original_sql_query;
134 if (isset($original_url_query)) {
135 $url_query = $original_url_query;
138 // this is because sql.php could call tbl_structure
139 // which would think it needs to call mult_submits.inc.php:
140 unset($submit_mult, $_REQUEST['mult_btn']);
142 $active_page = 'sql.php';
143 include './sql.php';
146 * Displays the footer
148 include './libraries/footer.inc.php';
149 break;