3.3.2 release
[phpmyadmin/tyronm.git] / tbl_row_action.php
blobefcc74d7b28af88bfa55efaaeba614aa2e21b1c6
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * handle row specifc actions like edit, delete, export
6 * @version $Id$
7 * @package phpMyAdmin
8 */
11 /**
12 * do not globalize/import request variables
13 * can only be enabled if all included files are switched superglobals too
14 * but leave this here to show that this file is 'superglobalized'
15 define('PMA_NO_VARIABLES_IMPORT', true);
18 /**
21 require_once './libraries/common.inc.php';
22 require_once './libraries/mysql_charsets.lib.php';
24 /**
25 * No rows were selected => show again the query and tell that user.
27 if (! PMA_isValid($_REQUEST['rows_to_delete'], 'array')
28 && ! isset($_REQUEST['mult_btn'])) {
29 $disp_message = $strNoRowsSelected;
30 $disp_query = '';
31 require './sql.php';
32 require_once './libraries/footer.inc.php';
35 if (isset($_REQUEST['submit_mult'])) {
36 $submit_mult = $_REQUEST['submit_mult'];
37 // workaround for IE problem:
38 } elseif (isset($_REQUEST['submit_mult_delete_x'])) {
39 $submit_mult = 'row_delete';
40 } elseif (isset($_REQUEST['submit_mult_change_x'])) {
41 $submit_mult = 'row_edit';
42 } elseif (isset($_REQUEST['submit_mult_export_x'])) {
43 $submit_mult = 'row_export';
46 // If the 'Ask for confirmation' button was pressed, this can only come
47 // from 'delete' mode, so we set it straight away.
48 if (isset($_REQUEST['mult_btn'])) {
49 $submit_mult = 'row_delete';
52 switch($submit_mult) {
53 case 'row_delete':
54 case 'row_edit':
55 case 'row_export':
56 // leave as is
57 break;
59 case $GLOBALS['strExport']:
60 $submit_mult = 'row_export';
61 break;
63 case $GLOBALS['strDelete']:
64 case $GLOBALS['strKill']:
65 $submit_mult = 'row_delete';
66 break;
68 default:
69 case $GLOBALS['strEdit']:
70 $submit_mult = 'row_edit';
71 break;
74 $GLOBALS['js_include'][] = 'tbl_change.js';
75 $GLOBALS['js_include'][] = 'functions.js';
77 require_once './libraries/header.inc.php';
79 if (!empty($submit_mult)) {
80 switch($submit_mult) {
81 case 'row_edit':
82 // garvin: As we got the fields to be edited from the
83 // 'rows_to_delete' checkbox, we use the index of it as the
84 // indicating WHERE clause. Then we build the array which is used
85 // for the tbl_change.php script.
86 $where_clause = array();
87 foreach ($_REQUEST['rows_to_delete'] as $i_where_clause => $del_query) {
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 // garvin: As we got the fields to be edited 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 foreach ($_REQUEST['rows_to_delete'] as $i_where_clause => $del_query) {
105 $where_clause[] = urldecode($i_where_clause);
108 $active_page = 'tbl_export.php';
109 include './tbl_export.php';
110 break;
112 case 'row_delete':
113 default:
114 $action = 'tbl_row_action.php';
115 $err_url = 'tbl_row_action.php' . PMA_generate_common_url($GLOBALS['url_params']);
116 if (! isset($_REQUEST['mult_btn'])) {
117 $original_sql_query = $sql_query;
118 $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 = $strSuccess;
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_once './libraries/footer.inc.php';
154 break;