patch #2709040 [doc] Wrong link in ChangeLog formatter
[phpmyadmin/crack.git] / tbl_row_action.php
blob912898b1bbf1be7843fe20d0dfbbdb1139d8cb75
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 // garvin: 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 'rows_to_delete'
83 // checkbox, we use the index of it as the
84 // indicating primary key. Then we built the array which is used for
85 // the tbl_change.php script.
86 /**
87 * urldecode should not be needed here
88 $primary_key = array();
89 foreach ($_REQUEST['rows_to_delete'] as $i_primary_key => $del_query) {
90 $primary_key[] = urldecode($i_primary_key);
93 $primary_key = array_keys($_REQUEST['rows_to_delete']);
95 $active_page = 'tbl_change.php';
96 include './tbl_change.php';
97 break;
99 case 'row_export':
100 // Needed to allow SQL export
101 $single_table = TRUE;
103 //$sql_query = urldecode($sql_query);
104 // garvin: As we got the fields to be edited from the 'rows_to_delete'
105 // checkbox, we use the index of it as the
106 // indicating primary key. Then we built the array which is used for
107 // the tbl_change.php script.
109 * urldecode should not be needed here
110 $primary_key = array();
111 foreach ($_REQUEST['rows_to_delete'] as $i_primary_key => $del_query) {
112 $primary_key[] = urldecode($i_primary_key);
115 $primary_key = array_keys($_REQUEST['rows_to_delete']);
117 $active_page = 'tbl_export.php';
118 include './tbl_export.php';
119 break;
121 case 'row_delete':
122 default:
123 $action = 'tbl_row_action.php';
124 $err_url = 'tbl_row_action.php' . PMA_generate_common_url($GLOBALS['url_params']);
125 if (! isset($_REQUEST['mult_btn'])) {
126 $original_sql_query = $sql_query;
127 $original_url_query = $url_query;
129 require './libraries/mult_submits.inc.php';
130 $_url_params = $GLOBALS['url_params'];
131 $_url_params['goto'] = 'tbl_sql.php';
132 $url_query = PMA_generate_common_url($_url_params);
136 * Show result of multi submit operation
138 // sql_query is not set when user does not confirm multi-delete
139 if ((!empty($submit_mult) || isset($_REQUEST['mult_btn'])) && ! empty($sql_query)) {
140 $disp_message = $strSuccess;
141 $disp_query = $sql_query;
144 if (isset($original_sql_query)) {
145 $sql_query = $original_sql_query;
148 if (isset($original_url_query)) {
149 $url_query = $original_url_query;
152 // this is because sql.php could call tbl_structure
153 // which would think it needs to call mult_submits.inc.php:
154 unset($submit_mult, $_REQUEST['mult_btn']);
156 $active_page = 'sql.php';
157 require './sql.php';
160 * Displays the footer
162 require_once './libraries/footer.inc.php';
163 break;