patch #1250935, interface improvements
[phpmyadmin/crack.git] / tbl_move_copy.php
blobcc60ff107fd51057c7ca935b17fa271c16986f38
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 /**
6 * Gets some core libraries
7 */
8 require_once('./libraries/grab_globals.lib.php');
9 require_once('./libraries/common.lib.php');
11 // Check parameters
13 PMA_checkParameters(array('db', 'table'));
15 require_once('./libraries/tbl_move_copy.php');
17 /**
18 * Defines the url to return to in case of error in a sql statement
20 $err_url = 'tbl_properties.php?' . PMA_generate_common_url($db, $table);
23 /**
24 * Selects the database to work with
26 PMA_DBI_select_db($db);
28 /**
29 * A target table name has been sent to this script -> do the work
31 if (isset($new_name) && trim($new_name) != '') {
32 if ($db == $target_db && $table == $new_name) {
33 $message = (isset($submit_move) ? $strMoveTableSameNames : $strCopyTableSameNames);
34 } else {
35 PMA_table_move_copy($db, $table, $target_db, $new_name, $what, isset($submit_move));
36 $js_to_run = 'functions.js';
37 $message = (isset($submit_move) ? $strMoveTableOK : $strCopyTableOK);
38 $message = sprintf($message, htmlspecialchars($table), htmlspecialchars($new_name));
39 $reload = 1;
40 /* Check: Work on new table or on old table? */
41 if (isset($submit_move)) {
42 $db = $target_db;
43 $table = $new_name;
44 } else {
45 $pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
46 if (isset($switch_to_new) && $switch_to_new == 'true') {
47 setcookie('pma_switch_to_new', 'true', 0, $GLOBALS['cookie_path'], '' , $GLOBALS['is_https']);
48 $db = $target_db;
49 $table = $new_name;
50 } else {
51 setcookie('pma_switch_to_new', '', 0, $GLOBALS['cookie_path'], '' , $GLOBALS['is_https']);
55 require_once('./header.inc.php');
56 } // end is target table name
59 /**
60 * No new name for the table!
62 else {
63 require_once('./header.inc.php');
64 PMA_mysqlDie($strTableEmpty, '', '', $err_url);
68 /**
69 * Back to the calling script
72 require('./tbl_properties.php');