Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 154 lines (134 sloc) 4.411 kB
526dce6 @lem9 3.3
lem9 authored
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
957a204 @lem9 Fix typos
lem9 authored
4 * handle row specific actions like edit, delete, export
526dce6 @lem9 3.3
lem9 authored
5 *
e56949f @nijel Use package name PhpMyAdmin
nijel authored
6 * @package PhpMyAdmin
526dce6 @lem9 3.3
lem9 authored
7 */
8
9 /**
10 *
11 */
b2fd866 Leading ./ paths for includes can be omitted, part 2
Jo Michael authored
12 require_once 'libraries/common.inc.php';
d23aad1 @xmujay refactor mysql_charsets.inc.php
xmujay authored
13 require_once 'libraries/mysql_charsets.inc.php';
6a053b5 @scnakandala replace include 'sql.php' with method calls to sql.lib.php
scnakandala authored
14 require_once 'libraries/sql.lib.php';
526dce6 @lem9 3.3
lem9 authored
15
16 if (isset($_REQUEST['submit_mult'])) {
17 $submit_mult = $_REQUEST['submit_mult'];
9088532 @madhuracj Fix indentation
madhuracj authored
18 // workaround for IE problem:
526dce6 @lem9 3.3
lem9 authored
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';
25 }
26
0f6215f @lem9 testing before merge
lem9 authored
27 // If the 'Ask for confirmation' button was pressed, this can only come
526dce6 @lem9 3.3
lem9 authored
28 // from 'delete' mode, so we set it straight away.
29 if (isset($_REQUEST['mult_btn'])) {
30 $submit_mult = 'row_delete';
31 }
32
8e95b3f @nijel Provide sane fallback value
nijel authored
33 if (! isset($submit_mult)) {
34 $submit_mult = 'row_edit';
35 }
36
526dce6 @lem9 3.3
lem9 authored
37 switch($submit_mult) {
9088532 @madhuracj Fix indentation
madhuracj authored
38 case 'row_delete':
39 case 'row_edit':
0b57843 @madhuracj rfe #1651 Allow copying mutiple rows
madhuracj authored
40 case 'row_copy':
9088532 @madhuracj Fix indentation
madhuracj authored
41 case 'row_export':
42 // leave as is
43 break;
526dce6 @lem9 3.3
lem9 authored
44
9088532 @madhuracj Fix indentation
madhuracj authored
45 case 'export':
46 $submit_mult = 'row_export';
47 break;
526dce6 @lem9 3.3
lem9 authored
48
9088532 @madhuracj Fix indentation
madhuracj authored
49 case 'delete':
50 $submit_mult = 'row_delete';
51 break;
526dce6 @lem9 3.3
lem9 authored
52
0b57843 @madhuracj rfe #1651 Allow copying mutiple rows
madhuracj authored
53 case 'copy':
54 $submit_mult = 'row_copy';
55 break;
56
9088532 @madhuracj Fix indentation
madhuracj authored
57 case 'edit':
0b57843 @madhuracj rfe #1651 Allow copying mutiple rows
madhuracj authored
58 default:
9088532 @madhuracj Fix indentation
madhuracj authored
59 $submit_mult = 'row_edit';
60 break;
526dce6 @lem9 3.3
lem9 authored
61 }
62
63 if (!empty($submit_mult)) {
64 switch($submit_mult) {
0b57843 @madhuracj rfe #1651 Allow copying mutiple rows
madhuracj authored
65 case 'row_copy':
66 $_REQUEST['default_action'] = 'insert';
67 // no break to allow for fallthough
9088532 @madhuracj Fix indentation
madhuracj authored
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();
33dfef3 @D-storm RFE-759 Use aliases in SQL export for tables and columns
D-storm authored
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);
79 }
9088532 @madhuracj Fix indentation
madhuracj authored
80 }
81 $active_page = 'tbl_change.php';
82 include 'tbl_change.php';
83 break;
526dce6 @lem9 3.3
lem9 authored
84
9088532 @madhuracj Fix indentation
madhuracj authored
85 case 'row_export':
86 // Needed to allow SQL export
87 $single_table = true;
88
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();
33dfef3 @D-storm RFE-759 Use aliases in SQL export for tables and columns
D-storm authored
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);
99 }
9088532 @madhuracj Fix indentation
madhuracj authored
100 }
101 $active_page = 'tbl_export.php';
102 include 'tbl_export.php';
103 break;
526dce6 @lem9 3.3
lem9 authored
104
9088532 @madhuracj Fix indentation
madhuracj authored
105 case 'row_delete':
106 default:
107 $action = 'tbl_row_action.php';
108 $err_url = 'tbl_row_action.php'
0a3d1d5 @nijel Better names for URL generating functions
nijel authored
109 . PMA_URL_getCommon($GLOBALS['url_params']);
9088532 @madhuracj Fix indentation
madhuracj authored
110 if (! isset($_REQUEST['mult_btn'])) {
111 $original_sql_query = $sql_query;
112 if (! empty($url_query)) {
113 $original_url_query = $url_query;
526dce6 @lem9 3.3
lem9 authored
114 }
9088532 @madhuracj Fix indentation
madhuracj authored
115 }
116 include 'libraries/mult_submits.inc.php';
117 $_url_params = $GLOBALS['url_params'];
118 $_url_params['goto'] = 'tbl_sql.php';
0a3d1d5 @nijel Better names for URL generating functions
nijel authored
119 $url_query = PMA_URL_getCommon($_url_params);
9088532 @madhuracj Fix indentation
madhuracj authored
120
121
122 /**
123 * Show result of multi submit operation
124 */
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)
128 ) {
77caf61 @nijel Correct punctuation for sentences
nijel authored
129 $disp_message = __('Your SQL query has been executed successfully.');
9088532 @madhuracj Fix indentation
madhuracj authored
130 $disp_query = $sql_query;
131 }
132
133 if (isset($original_sql_query)) {
134 $sql_query = $original_sql_query;
135 }
136
137 if (isset($original_url_query)) {
138 $url_query = $original_url_query;
139 }
140
141 $active_page = 'sql.php';
6a053b5 @scnakandala replace include 'sql.php' with method calls to sql.lib.php
scnakandala authored
142 /**
143 * Parse and analyze the query
144 */
9c141ee @nijel Various coding style fixes
nijel authored
145 include_once 'libraries/parse_analyze.inc.php';
6a053b5 @scnakandala replace include 'sql.php' with method calls to sql.lib.php
scnakandala authored
146
147 PMA_executeQueryAndSendQueryResponse(
148 $analyzed_sql_results, false, $db, $table, null, null, null, false, null,
629e08c @lem9 Code cleanup: $disp_mode was always empty at this point
lem9 authored
149 null, null, $goto, $pmaThemeImage, null, null, null, $sql_query,
6a053b5 @scnakandala replace include 'sql.php' with method calls to sql.lib.php
scnakandala authored
150 null, null
151 );
526dce6 @lem9 3.3
lem9 authored
152 }
153 }
Something went wrong with that request. Please try again.