bug #2363919 [display] Incorrect size for view
[phpmyadmin/crack.git] / tbl_move_copy.php
blob7885b7593352beef7beb318262775a8447e61598
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 */
8 /**
9 * Gets some core libraries
11 require_once './libraries/common.inc.php';
12 require_once './libraries/Table.class.php';
14 // Check parameters
16 PMA_checkParameters(array('db', 'table'));
18 /**
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);
24 /**
25 * Selects the database to work with
27 PMA_DBI_select_db($db);
29 $goto = $cfg['DefaultTabTable'];
31 /**
32 * $_REQUEST['target_db'] could be empty in case we came from an input field
33 * (when there are many databases, no drop-down)
35 if (empty($_REQUEST['target_db'])) {
36 $_REQUEST['target_db'] = $db;
39 /**
40 * A target table name has been sent to this script -> do the work
42 if (PMA_isValid($_REQUEST['new_name'])) {
43 if ($db == $_REQUEST['target_db'] && $table == $_REQUEST['new_name']) {
44 if (isset($_REQUEST['submit_move'])) {
45 $message = PMA_Message::error('strMoveTableSameNames');
46 } else {
47 $message = PMA_Message::error('strCopyTableSameNames');
49 $goto = './tbl_operations.php';
50 } else {
51 PMA_Table::moveCopy($db, $table, $_REQUEST['target_db'], $_REQUEST['new_name'],
52 $_REQUEST['what'], isset($_REQUEST['submit_move']), 'one_table');
54 if (isset($_REQUEST['submit_move'])) {
55 $message = PMA_Message::success('strMoveTableOK');
56 } else {
57 $message = PMA_Message::success('strCopyTableOK');
59 $old = PMA_backquote($db) . '.' . PMA_backquote($table);
60 $message->addParam($old);
61 $new = PMA_backquote($_REQUEST['target_db']) . '.' . PMA_backquote($_REQUEST['new_name']);
62 $message->addParam($new);
64 /* Check: Work on new table or on old table? */
65 if (isset($_REQUEST['submit_move']) || PMA_isValid($_REQUEST['switch_to_new'])) {
66 $db = $_REQUEST['target_db'];
67 $table = $_REQUEST['new_name'];
69 $reload = 1;
71 $disp_query = $sql_query;
72 $disp_message = $message;
73 unset($sql_query, $message);
75 $goto = $cfg['DefaultTabTable'];
77 } else {
78 /**
79 * No new name for the table!
81 $message = PMA_Message::error('strTableEmpty');
82 $goto = './tbl_operations.php';
85 /**
86 * Back to the calling script
88 require $goto;