bug #2491017 [operations] ANSI mode not supported (db rename and table move)
[phpmyadmin/crack.git] / tbl_row_action.php
blobe6497783bb29db54fe94ba0cf8d71e5b2517dc24
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 */
10 /**
11 * do not globalize/import request variables
12 * can only be enabled if all included files are switched superglobals too
13 * but leave this here to show that this file is 'superglobalized'
14 define('PMA_NO_VARIABLES_IMPORT', true);
17 /**
20 require_once './libraries/common.inc.php';
21 require_once './libraries/mysql_charsets.lib.php';
23 /**
24 * No rows were selected => show again the query and tell that user.
26 if (! PMA_isValid($_REQUEST['rows_to_delete'], 'array')
27 && ! isset($_REQUEST['mult_btn'])) {
28 $disp_message = $strNoRowsSelected;
29 $disp_query = '';
30 require './sql.php';
31 require_once './libraries/footer.inc.php';
34 if (isset($_REQUEST['submit_mult'])) {
35 $submit_mult = $_REQUEST['submit_mult'];
36 // workaround for IE problem:
37 } elseif (isset($_REQUEST['submit_mult_delete_x'])) {
38 $submit_mult = 'row_delete';
39 } elseif (isset($_REQUEST['submit_mult_change_x'])) {
40 $submit_mult = 'row_edit';
41 } elseif (isset($_REQUEST['submit_mult_export_x'])) {
42 $submit_mult = 'row_export';
45 // garvin: If the 'Ask for confirmation' button was pressed, this can only come
46 // from 'delete' mode, so we set it straight away.
47 if (isset($_REQUEST['mult_btn'])) {
48 $submit_mult = 'row_delete';
51 switch($submit_mult) {
52 case 'row_delete':
53 case 'row_edit':
54 case 'row_export':
55 // leave as is
56 break;
58 case $GLOBALS['strExport']:
59 $submit_mult = 'row_export';
60 break;
62 case $GLOBALS['strDelete']:
63 case $GLOBALS['strKill']:
64 $submit_mult = 'row_delete';
65 break;
67 default:
68 case $GLOBALS['strEdit']:
69 $submit_mult = 'row_edit';
70 break;
73 $GLOBALS['js_include'][] = 'tbl_change.js';
74 $GLOBALS['js_include'][] = 'functions.js';
76 require_once './libraries/header.inc.php';
78 if (!empty($submit_mult)) {
79 switch($submit_mult) {
80 case 'row_edit':
81 // garvin: As we got the fields to be edited from the 'rows_to_delete'
82 // checkbox, we use the index of it as the
83 // indicating primary key. Then we built the array which is used for
84 // the tbl_change.php script.
85 /**
86 * urldecode should not be needed here
87 $primary_key = array();
88 foreach ($_REQUEST['rows_to_delete'] as $i_primary_key => $del_query) {
89 $primary_key[] = urldecode($i_primary_key);
92 $primary_key = array_keys($_REQUEST['rows_to_delete']);
94 $active_page = 'tbl_change.php';
95 include './tbl_change.php';
96 break;
98 case 'row_export':
99 // Needed to allow SQL export
100 $single_table = TRUE;
102 //$sql_query = urldecode($sql_query);
103 // garvin: As we got the fields to be edited from the 'rows_to_delete'
104 // checkbox, we use the index of it as the
105 // indicating primary key. Then we built the array which is used for
106 // the tbl_change.php script.
108 * urldecode should not be needed here
109 $primary_key = array();
110 foreach ($_REQUEST['rows_to_delete'] as $i_primary_key => $del_query) {
111 $primary_key[] = urldecode($i_primary_key);
114 $primary_key = array_keys($_REQUEST['rows_to_delete']);
116 $active_page = 'tbl_export.php';
117 include './tbl_export.php';
118 break;
120 case 'row_delete':
121 default:
122 $action = 'tbl_row_action.php';
123 $err_url = 'tbl_row_action.php' . PMA_generate_common_url($GLOBALS['url_params']);
124 if (! isset($_REQUEST['mult_btn'])) {
125 $original_sql_query = $sql_query;
126 $original_url_query = $url_query;
128 require './libraries/mult_submits.inc.php';
129 $_url_params = $GLOBALS['url_params'];
130 $_url_params['goto'] = 'tbl_sql.php';
131 $url_query = PMA_generate_common_url($_url_params);
135 * Show result of multi submit operation
137 // sql_query is not set when user does not confirm multi-delete
138 if ((!empty($submit_mult) || isset($_REQUEST['mult_btn'])) && ! empty($sql_query)) {
139 $disp_message = $strSuccess;
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 // this is because sql.php could call tbl_structure
152 // which would think it needs to call mult_submits.inc.php:
153 unset($submit_mult, $_REQUEST['mult_btn']);
155 $active_page = 'sql.php';
156 require './sql.php';
159 * Displays the footer
161 require_once './libraries/footer.inc.php';
162 break;