Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin...
[phpmyadmin/srajbr.git] / tbl_row_action.php
blobd44e808a3e240ef58833e0142c790dc6aaba6b11
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 require './sql.php';
31 require './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 case __('Kill'):
64 $submit_mult = 'row_delete';
65 break;
67 default:
68 case __('Edit'):
69 $submit_mult = 'row_edit';
70 break;
73 $GLOBALS['js_include'][] = 'tbl_change.js';
75 require_once './libraries/header.inc.php';
77 if (!empty($submit_mult)) {
78 switch($submit_mult) {
79 case 'row_edit':
80 // As we got the fields 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 foreach ($_REQUEST['rows_to_delete'] as $i_where_clause => $del_query) {
86 $where_clause[] = urldecode($i_where_clause);
89 $active_page = 'tbl_change.php';
90 include './tbl_change.php';
91 break;
93 case 'row_export':
94 // Needed to allow SQL export
95 $single_table = TRUE;
97 // As we got the fields to be edited from the
98 // 'rows_to_delete' checkbox, we use the index of it as the
99 // indicating WHERE clause. Then we build the array which is used
100 // for the tbl_change.php script.
101 $where_clause = array();
102 foreach ($_REQUEST['rows_to_delete'] as $i_where_clause => $del_query) {
103 $where_clause[] = urldecode($i_where_clause);
106 $active_page = 'tbl_export.php';
107 include './tbl_export.php';
108 break;
110 case 'row_delete':
111 default:
112 $action = 'tbl_row_action.php';
113 $err_url = 'tbl_row_action.php' . PMA_generate_common_url($GLOBALS['url_params']);
114 if (! isset($_REQUEST['mult_btn'])) {
115 $original_sql_query = $sql_query;
116 if (! empty($url_query)) {
117 $original_url_query = $url_query;
120 require './libraries/mult_submits.inc.php';
121 $_url_params = $GLOBALS['url_params'];
122 $_url_params['goto'] = 'tbl_sql.php';
123 $url_query = PMA_generate_common_url($_url_params);
127 * Show result of multi submit operation
129 // sql_query is not set when user does not confirm multi-delete
130 if ((!empty($submit_mult) || isset($_REQUEST['mult_btn'])) && ! empty($sql_query)) {
131 $disp_message = __('Your SQL query has been executed successfully');
132 $disp_query = $sql_query;
135 if (isset($original_sql_query)) {
136 $sql_query = $original_sql_query;
139 if (isset($original_url_query)) {
140 $url_query = $original_url_query;
143 // this is because sql.php could call tbl_structure
144 // which would think it needs to call mult_submits.inc.php:
145 unset($submit_mult, $_REQUEST['mult_btn']);
147 $active_page = 'sql.php';
148 require './sql.php';
151 * Displays the footer
153 require './libraries/footer.inc.php';
154 break;