2 /* vim: set expandtab sw=4 ts=4 sts=4: */
9 * Gets some core libraries
11 require_once './libraries/common.inc.php';
12 require_once './libraries/Table.class.php';
16 PMA_checkParameters(array('db', 'table'));
19 * Defines the url to return to in case of error in a sql statement
21 $err_url = 'tbl_sql.php?' . PMA_generate_common_url($db, $table);
25 * Selects the database to work with
27 PMA_DBI_select_db($db);
29 $goto = $cfg['DefaultTabTable'];
32 * A target table name has been sent to this script -> do the work
34 if (PMA_isValid($_REQUEST['new_name'])) {
35 if ($db == $_REQUEST['target_db'] && $table == $_REQUEST['new_name']) {
36 if (isset($_REQUEST['submit_move'])) {
37 $message = PMA_Message
::error('strMoveTableSameNames');
39 $message = PMA_Message
::error('strCopyTableSameNames');
41 $goto = './tbl_operations.php';
43 PMA_Table
::moveCopy($db, $table, $_REQUEST['target_db'], $_REQUEST['new_name'],
44 $_REQUEST['what'], isset($_REQUEST['submit_move']), 'one_table');
46 if (isset($_REQUEST['submit_move'])) {
47 $message = PMA_Message
::success('strMoveTableOK');
49 $message = PMA_Message
::success('strCopyTableOK');
51 $old = PMA_backquote($db) . '.' . PMA_backquote($table);
52 $message->addParam($old);
53 $new = PMA_backquote($_REQUEST['target_db']) . '.' . PMA_backquote($_REQUEST['new_name']);
54 $message->addParam($new);
56 /* Check: Work on new table or on old table? */
57 if (isset($_REQUEST['submit_move']) ||
PMA_isValid($_REQUEST['switch_to_new'])) {
58 $db = $_REQUEST['target_db'];
59 $table = $_REQUEST['new_name'];
63 $disp_query = $sql_query;
64 $disp_message = $message;
65 unset($sql_query, $message);
67 $goto = $cfg['DefaultTabTable'];
71 * No new name for the table!
73 $message = PMA_Message
::error('strTableEmpty');
74 $goto = './tbl_operations.php';
78 * Back to the calling script