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