if (isset($db_rename) && $db_rename == 'true') { $move = TRUE; } else { $move = FALSE; } if (!isset($newname) || empty($newname)) { $message = $strDatabaseEmpty; } else { $local_query = 'CREATE DATABASE ' . PMA_backquote($newname) . ';'; $sql_query = $local_query; PMA_DBI_query($local_query); $tables = PMA_DBI_get_tables($db); foreach ($tables as $table) { $back = $sql_query; $sql_query = ''; PMA_table_move_copy($db, $table, $newname, $table, isset($what) ? $what : 'data', $move); $sql_query = $back . $sql_query; } if ($move) { $local_query = 'DROP DATABASE ' . PMA_backquote($db) . ';'; $sql_query .= "\n" . $local_query; PMA_DBI_query($local_query); $message = sprintf($strRenameDatabaseOK, htmlspecialchars($db), htmlspecialchars($newname)); } else { $message = sprintf($strCopyDatabaseOK, htmlspecialchars($db), htmlspecialchars($newname)); } $reload = TRUE; /* Change database to be used */ if ($move) { $db = $newname; } else {
/** * Defines the url to return to in case of error in a sql statement */ $err_url = 'tbl_properties.php?' . PMA_generate_common_url($db, $table); /** * Selects the database to work with */ PMA_DBI_select_db($db); /** * A target table name has been sent to this script -> do the work */ if (isset($new_name) && trim($new_name) != '') { if ($db == $target_db && $table == $new_name) { $message = isset($submit_move) ? $strMoveTableSameNames : $strCopyTableSameNames; } else { PMA_table_move_copy($db, $table, $target_db, $new_name, $what, isset($submit_move)); $js_to_run = 'functions.js'; $message = isset($submit_move) ? $strMoveTableOK : $strCopyTableOK; $message = sprintf($message, htmlspecialchars($table), htmlspecialchars($new_name)); $reload = 1; /* Check: Work on new table or on old table? */ if (isset($submit_move)) { $db = $target_db; $table = $new_name; } else { $pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']); if (isset($switch_to_new) && $switch_to_new == 'true') { setcookie('pma_switch_to_new', 'true', 0, substr($pma_uri_parts['path'], 0, strrpos($pma_uri_parts['path'], '/')), '', $pma_uri_parts['scheme'] == 'https'); $db = $target_db; $table = $new_name; } else {