Cleaned up the logout script
[openemr.git] / phpmyadmin / tbl_row_action.php
blobd55e5e0b03c5c3c386314acc8c238b99dbcb41f9
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * handle row specifc actions like edit, delete, export
6 * @package PhpMyAdmin
7 */
9 /**
12 require_once 'libraries/common.inc.php';
13 require_once 'libraries/mysql_charsets.lib.php';
15 /**
16 * No rows were selected => show again the query and tell that user.
18 if (! PMA_isValid($_REQUEST['rows_to_delete'], 'array')
19 && ! isset($_REQUEST['mult_btn'])
20 ) {
21 $disp_message = __('No rows selected');
22 $disp_query = '';
23 include 'sql.php';
24 exit;
27 if (isset($_REQUEST['submit_mult'])) {
28 $submit_mult = $_REQUEST['submit_mult'];
29 // workaround for IE problem:
30 } elseif (isset($_REQUEST['submit_mult_delete_x'])) {
31 $submit_mult = 'row_delete';
32 } elseif (isset($_REQUEST['submit_mult_change_x'])) {
33 $submit_mult = 'row_edit';
34 } elseif (isset($_REQUEST['submit_mult_export_x'])) {
35 $submit_mult = 'row_export';
38 // If the 'Ask for confirmation' button was pressed, this can only come
39 // from 'delete' mode, so we set it straight away.
40 if (isset($_REQUEST['mult_btn'])) {
41 $submit_mult = 'row_delete';
44 switch($submit_mult) {
45 case 'row_delete':
46 case 'row_edit':
47 case 'row_export':
48 // leave as is
49 break;
51 case 'export':
52 $submit_mult = 'row_export';
53 break;
55 case 'delete':
56 $submit_mult = 'row_delete';
57 break;
59 default:
60 case 'edit':
61 $submit_mult = 'row_edit';
62 break;
65 if (!empty($submit_mult)) {
66 switch($submit_mult) {
67 case 'row_edit':
68 // As we got the rows to be edited from the
69 // 'rows_to_delete' checkbox, we use the index of it as the
70 // indicating WHERE clause. Then we build the array which is used
71 // for the tbl_change.php script.
72 $where_clause = array();
73 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
74 $where_clause[] = urldecode($i_where_clause);
77 $active_page = 'tbl_change.php';
78 include 'tbl_change.php';
79 break;
81 case 'row_export':
82 // Needed to allow SQL export
83 $single_table = true;
85 // As we got the rows to be exported from the
86 // 'rows_to_delete' checkbox, we use the index of it as the
87 // indicating WHERE clause. Then we build the array which is used
88 // for the tbl_change.php script.
89 $where_clause = array();
90 foreach ($_REQUEST['rows_to_delete'] as $i => $i_where_clause) {
91 $where_clause[] = urldecode($i_where_clause);
94 $active_page = 'tbl_export.php';
95 include 'tbl_export.php';
96 break;
98 case 'row_delete':
99 default:
100 $action = 'tbl_row_action.php';
101 $err_url = 'tbl_row_action.php'
102 . PMA_generate_common_url($GLOBALS['url_params']);
103 if (! isset($_REQUEST['mult_btn'])) {
104 $original_sql_query = $sql_query;
105 if (! empty($url_query)) {
106 $original_url_query = $url_query;
109 include 'libraries/mult_submits.inc.php';
110 $_url_params = $GLOBALS['url_params'];
111 $_url_params['goto'] = 'tbl_sql.php';
112 $url_query = PMA_generate_common_url($_url_params);
116 * Show result of multi submit operation
118 // sql_query is not set when user does not confirm multi-delete
119 if ((! empty($submit_mult) || isset($_REQUEST['mult_btn']))
120 && ! empty($sql_query)
122 $disp_message = __('Your SQL query has been executed successfully');
123 $disp_query = $sql_query;
126 if (isset($original_sql_query)) {
127 $sql_query = $original_sql_query;
130 if (isset($original_url_query)) {
131 $url_query = $original_url_query;
134 // this is because sql.php could call tbl_structure
135 // which would think it needs to call mult_submits.inc.php:
136 unset($submit_mult, $_REQUEST['mult_btn']);
138 $active_page = 'sql.php';
139 include 'sql.php';
140 break;