Refactored ConfigFile class so that it is no longer a singleton
[phpmyadmin.git] / tbl_row_action.php
blob5801386df783e8c22e16d95739b7f98bccbd9100
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 switch($submit_mult) {
34 case 'row_delete':
35 case 'row_edit':
36 case 'row_export':
37 // leave as is
38 break;
40 case 'export':
41 $submit_mult = 'row_export';
42 break;
44 case 'delete':
45 $submit_mult = 'row_delete';
46 break;
48 default:
49 case 'edit':
50 $submit_mult = 'row_edit';
51 break;
54 if (!empty($submit_mult)) {
55 switch($submit_mult) {
56 case 'row_edit':
57 // As we got the rows to be edited from the
58 // 'rows_to_delete' checkbox, we use the index of it as the
59 // indicating WHERE clause. Then we build the array which is used
60 // for the tbl_change.php script.
61 $where_clause = array();
62 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
63 $where_clause[] = urldecode($i_where_clause);
66 $active_page = 'tbl_change.php';
67 include 'tbl_change.php';
68 break;
70 case 'row_export':
71 // Needed to allow SQL export
72 $single_table = true;
74 // As we got the rows to be exported from the
75 // 'rows_to_delete' checkbox, we use the index of it as the
76 // indicating WHERE clause. Then we build the array which is used
77 // for the tbl_change.php script.
78 $where_clause = array();
79 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
80 $where_clause[] = urldecode($i_where_clause);
83 $active_page = 'tbl_export.php';
84 include 'tbl_export.php';
85 break;
87 case 'row_delete':
88 default:
89 $action = 'tbl_row_action.php';
90 $err_url = 'tbl_row_action.php'
91 . PMA_URL_getCommon($GLOBALS['url_params']);
92 if (! isset($_REQUEST['mult_btn'])) {
93 $original_sql_query = $sql_query;
94 if (! empty($url_query)) {
95 $original_url_query = $url_query;
98 include 'libraries/mult_submits.inc.php';
99 $_url_params = $GLOBALS['url_params'];
100 $_url_params['goto'] = 'tbl_sql.php';
101 $url_query = PMA_URL_getCommon($_url_params);
105 * Show result of multi submit operation
107 // sql_query is not set when user does not confirm multi-delete
108 if ((! empty($submit_mult) || isset($_REQUEST['mult_btn']))
109 && ! empty($sql_query)
111 $disp_message = __('Your SQL query has been executed successfully');
112 $disp_query = $sql_query;
115 if (isset($original_sql_query)) {
116 $sql_query = $original_sql_query;
119 if (isset($original_url_query)) {
120 $url_query = $original_url_query;
123 $active_page = 'sql.php';
125 * Parse and analyze the query
127 include_once 'libraries/parse_analyze.inc.php';
129 PMA_executeQueryAndSendQueryResponse(
130 $analyzed_sql_results, false, $db, $table, null, null, null, false, null,
131 null, null, null, $goto, $pmaThemeImage, null, null, null, $sql_query,
132 null, null