Tan Style sheet Improvements
[openemr.git] / phpmyadmin / tbl_row_action.php
blobbb2eb6d17a469b0c9c53c9378e3e592060b86051
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_Response::getInstance();
70 $response->isSuccess(false);
71 $response->addJSON('message', __('No row selected.'));
74 switch($submit_mult) {
75 case 'row_copy':
76 $_REQUEST['default_action'] = 'insert';
77 // no break to allow for fallthough
78 case 'row_edit':
79 // As we got the rows to be edited from the
80 // 'rows_to_delete' checkbox, we use the index of it as the
81 // indicating WHERE clause. Then we build the array which is used
82 // for the tbl_change.php script.
83 $where_clause = array();
84 if (isset($_REQUEST['rows_to_delete'])
85 && is_array($_REQUEST['rows_to_delete'])
86 ) {
87 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
88 $where_clause[] = urldecode($i_where_clause);
91 $active_page = 'tbl_change.php';
92 include 'tbl_change.php';
93 break;
95 case 'row_export':
96 // Needed to allow SQL export
97 $single_table = true;
99 // As we got the rows to be exported from the
100 // 'rows_to_delete' checkbox, we use the index of it as the
101 // indicating WHERE clause. Then we build the array which is used
102 // for the tbl_change.php script.
103 $where_clause = array();
104 if (isset($_REQUEST['rows_to_delete'])
105 && is_array($_REQUEST['rows_to_delete'])
107 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
108 $where_clause[] = urldecode($i_where_clause);
111 $active_page = 'tbl_export.php';
112 include 'tbl_export.php';
113 break;
115 case 'row_delete':
116 default:
117 $action = 'tbl_row_action.php';
118 $err_url = 'tbl_row_action.php'
119 . PMA_URL_getCommon($GLOBALS['url_params']);
120 if (! isset($_REQUEST['mult_btn'])) {
121 $original_sql_query = $sql_query;
122 if (! empty($url_query)) {
123 $original_url_query = $url_query;
126 include 'libraries/mult_submits.inc.php';
127 $_url_params = $GLOBALS['url_params'];
128 $_url_params['goto'] = 'tbl_sql.php';
129 $url_query = PMA_URL_getCommon($_url_params);
133 * Show result of multi submit operation
135 // sql_query is not set when user does not confirm multi-delete
136 if ((! empty($submit_mult) || isset($_REQUEST['mult_btn']))
137 && ! empty($sql_query)
139 $disp_message = __('Your SQL query has been executed successfully.');
140 $disp_query = $sql_query;
143 if (isset($original_sql_query)) {
144 $sql_query = $original_sql_query;
147 if (isset($original_url_query)) {
148 $url_query = $original_url_query;
151 $active_page = 'sql.php';
153 * Parse and analyze the query
155 include_once 'libraries/parse_analyze.inc.php';
157 PMA_executeQueryAndSendQueryResponse(
158 $analyzed_sql_results, // analyzed_sql_results
159 false, // is_gotofile
160 $db, // db
161 $table, // table
162 null, // find_real_end
163 null, // sql_query_for_bookmark
164 null, // extra_data
165 null, // message_to_show
166 null, // message
167 null, // sql_data
168 $goto, // goto
169 $pmaThemeImage, // pmaThemeImage
170 null, // disp_query
171 null, // disp_message
172 null, // query_type
173 $sql_query, // sql_query
174 null, // selectedTables
175 null // complete_query