3 // vim: expandtab sw=4 ts=4 sts=4:
7 * Prepares the work and runs some other scripts if required
9 if (!empty($submit_mult)
10 && (!empty($selected_db) ||
!empty($selected_tbl) ||
!empty($selected_fld))) {
12 if (get_magic_quotes_gpc()) {
13 $submit_mult = stripslashes($submit_mult);
15 if (!empty($selected_db)) {
16 $selected = $selected_db;
18 } else if (!empty($selected_tbl)) {
19 if ($submit_mult == $strPrintView) {
20 include('./tbl_printview.php3');
23 $selected = $selected_tbl;
24 switch ($submit_mult) {
31 case $strOptimizeTable:
33 $query_type = 'optimize_tbl';
34 $mult_btn = (get_magic_quotes_gpc() ?
addslashes($strYes) : $strYes);
38 $query_type = 'repair_tbl';
39 $mult_btn = (get_magic_quotes_gpc() ?
addslashes($strYes) : $strYes);
44 $selected = $selected_fld;
45 if ($submit_mult == $strDrop) {
48 include('./tbl_alter.php3');
56 * Displays the confirmation form if required
58 if (!empty($submit_mult) && !empty($what)) {
61 $selected_cnt = count($selected);
62 for ($i = 0; $i < $selected_cnt; $i++
) {
65 $full_query .= 'DROP DATABASE '
66 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
71 $full_query .= (empty($full_query) ?
'DROP TABLE ' : ', ')
72 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
73 . (($i == $selected_cnt - 1) ?
';<br />' : '');
77 if (PMA_MYSQL_INT_VERSION
>= 40000) {
78 $full_query .= 'TRUNCATE ';
80 $full_query .= 'DELETE FROM ';
82 $full_query .= PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
87 if ($full_query == '') {
88 $full_query .= 'ALTER TABLE '
89 . PMA_backquote(htmlspecialchars($table))
90 . '<br /> DROP '
91 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
94 $full_query .= '<br /> DROP '
95 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
98 if ($i == $selected_cnt-1) {
99 $full_query = ereg_replace(',$', ';<br />', $full_query);
106 echo $strDoYouReally . ' :<br />' . "\n";
107 echo '<tt>' . $full_query . '</tt> ?<br/>' . "\n";
109 <form action
="<?php echo $action; ?>" method
="post">
112 if (strpos(' ' . $action, 'db_details') == 1) {
113 echo PMA_generate_common_hidden_inputs($db);
114 } else if (strpos(' ' . $action, 'tbl_properties') == 1) {
115 echo PMA_generate_common_hidden_inputs($db,$table);
117 for ($i = 0; $i < $selected_cnt; $i++
) {
118 echo ' <input type="hidden" name="selected[]" value="' . htmlspecialchars($selected[$i]) . '" />' . "\n";
121 <input type
="hidden" name
="query_type" value
="<?php echo $what; ?>" />
122 <input type
="submit" name
="mult_btn" value
="<?php echo $strYes; ?>" />
123 <input type
="submit" name
="mult_btn" value
="<?php echo $strNo; ?>" />
128 include('./footer.inc.php3');
136 else if ((get_magic_quotes_gpc() && stripslashes($mult_btn) == $strYes)
137 ||
$mult_btn == $strYes) {
140 $selected_cnt = count($selected);
141 for ($i = 0; $i < $selected_cnt; $i++
) {
142 switch ($query_type) {
144 $a_query = 'DROP DATABASE '
145 . PMA_backquote(urldecode($selected[$i]));
150 $sql_query .= (empty($sql_query) ?
'DROP TABLE ' : ', ')
151 . PMA_backquote(urldecode($selected[$i]))
152 . (($i == $selected_cnt-1) ?
';' : '');
157 $sql_query .= (empty($sql_query) ?
'OPTIMIZE TABLE ' : ', ')
158 . PMA_backquote(urldecode($selected[$i]))
159 . (($i == $selected_cnt-1) ?
';' : '');
163 $sql_query .= (empty($sql_query) ?
'REPAIR TABLE ' : ', ')
164 . PMA_backquote(urldecode($selected[$i]))
165 . (($i == $selected_cnt-1) ?
';' : '');
169 $a_query = 'DELETE FROM '
170 . PMA_backquote(urldecode($selected[$i]));
174 $sql_query .= (empty($sql_query) ?
'ALTER TABLE ' . PMA_backquote($table) : ',')
175 . ' DROP ' . PMA_backquote(urldecode($selected[$i]))
176 . (($i == $selected_cnt-1) ?
';' : '');
180 // All "DROP TABLE","DROP FIELD", "OPTIMIZE TABLE" and "REPAIR TABLE"
181 // statements will be run at once below
182 if ($query_type != 'drop_tbl'
183 && $query_type != 'drop_fld'
184 && $query_type != 'repair_tbl'
185 && $query_type != 'optimize_tbl') {
186 $sql_query .= $a_query . ';' . "\n";
188 if ($query_type != 'drop_db') {
189 PMA_mysql_select_db($db);
191 $result = @PMA_mysql_query
($a_query) or PMA_mysqlDie('', $a_query, FALSE, $err_url);
195 if ($query_type == 'drop_tbl'
196 ||
$query_type == 'drop_fld'
197 ||
$query_type == 'repair_tbl'
198 ||
$query_type == 'optimize_tbl') {
199 PMA_mysql_select_db($db);
200 $result = @PMA_mysql_query
($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url);
203 PMA_showMessage($strSuccess);