2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * handle row specific actions like edit, delete, export
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) {
45 $submit_mult = 'row_export';
49 $submit_mult = 'row_delete';
54 $submit_mult = 'row_edit';
58 if (!empty($submit_mult)) {
59 switch($submit_mult) {
61 // As we got the rows to be edited from the
62 // 'rows_to_delete' checkbox, we use the index of it as the
63 // indicating WHERE clause. Then we build the array which is used
64 // for the tbl_change.php script.
65 $where_clause = array();
66 if (isset($_REQUEST['rows_to_delete'])
67 && is_array($_REQUEST['rows_to_delete'])
69 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
70 $where_clause[] = urldecode($i_where_clause);
73 $active_page = 'tbl_change.php';
74 include 'tbl_change.php';
78 // Needed to allow SQL export
81 // As we got the rows to be exported from the
82 // 'rows_to_delete' checkbox, we use the index of it as the
83 // indicating WHERE clause. Then we build the array which is used
84 // for the tbl_change.php script.
85 $where_clause = array();
86 if (isset($_REQUEST['rows_to_delete'])
87 && is_array($_REQUEST['rows_to_delete'])
89 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
90 $where_clause[] = urldecode($i_where_clause);
93 $active_page = 'tbl_export.php';
94 include 'tbl_export.php';
99 $action = 'tbl_row_action.php';
100 $err_url = 'tbl_row_action.php'
101 . PMA_URL_getCommon($GLOBALS['url_params']);
102 if (! isset($_REQUEST['mult_btn'])) {
103 $original_sql_query = $sql_query;
104 if (! empty($url_query)) {
105 $original_url_query = $url_query;
108 include 'libraries/mult_submits.inc.php';
109 $_url_params = $GLOBALS['url_params'];
110 $_url_params['goto'] = 'tbl_sql.php';
111 $url_query = PMA_URL_getCommon($_url_params);
115 * Show result of multi submit operation
117 // sql_query is not set when user does not confirm multi-delete
118 if ((! empty($submit_mult) ||
isset($_REQUEST['mult_btn']))
119 && ! empty($sql_query)
121 $disp_message = __('Your SQL query has been executed successfully.');
122 $disp_query = $sql_query;
125 if (isset($original_sql_query)) {
126 $sql_query = $original_sql_query;
129 if (isset($original_url_query)) {
130 $url_query = $original_url_query;
133 $active_page = 'sql.php';
135 * Parse and analyze the query
137 include_once 'libraries/parse_analyze.inc.php';
139 PMA_executeQueryAndSendQueryResponse(
140 $analyzed_sql_results, false, $db, $table, null, null, null, false, null,
141 null, null, null, $goto, $pmaThemeImage, null, null, null, $sql_query,