make use of PMA_Message

return to tbl_operations.php in case of error and do not display empty error page
This commit is contained in:
Sebastian Mendel
2007-10-12 11:24:35 +00:00
parent 3f943b4704
commit eda10ae46a

View File

@@ -26,49 +26,54 @@ $err_url = 'tbl_sql.php?' . PMA_generate_common_url($db, $table);
*/ */
PMA_DBI_select_db($db); PMA_DBI_select_db($db);
$goto = $cfg['DefaultTabTable'];
/** /**
* A target table name has been sent to this script -> do the work * A target table name has been sent to this script -> do the work
*/ */
if (isset($new_name) && trim($new_name) != '') { if (PMA_isValid($_REQUEST['new_name'])) {
if ($db == $target_db && $table == $new_name) { if ($db == $_REQUEST['target_db'] && $table == $_REQUEST['new_name']) {
$message = (isset($submit_move) ? $strMoveTableSameNames : $strCopyTableSameNames); if (isset($_REQUEST['submit_move'])) {
} else { $message = PMA_Message::error('strMoveTableSameNames');
PMA_Table::moveCopy($db, $table, $target_db, $new_name, $what, isset($submit_move), 'one_table');
$GLOBALS['js_include'][] = '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 { } else {
$pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']); $message = PMA_Message::error('strCopyTableSameNames');
if (isset($switch_to_new) && $switch_to_new == 'true') {
PMA_setCookie('pma_switch_to_new', 'true');
$db = $target_db;
$table = $new_name;
} else {
PMA_removeCookie('pma_switch_to_new');
}
} }
$goto = './tbl_operations.php';
} else {
PMA_Table::moveCopy($db, $table, $_REQUEST['target_db'], $_REQUEST['new_name'],
$_REQUEST['what'], isset($_REQUEST['submit_move']), 'one_table');
if (isset($_REQUEST['submit_move'])) {
$message = PMA_Message::success('strMoveTableOK');
} else {
$message = PMA_Message::success('strCopyTableOK');
}
$message->addParam(htmlspecialchars($table));
$message->addParam(htmlspecialchars($_REQUEST['new_name']));
/* Check: Work on new table or on old table? */
if (isset($_REQUEST['submit_move']) || PMA_isValid($_REQUEST['switch_to_new'])) {
$db = $_REQUEST['target_db'];
$table = $_REQUEST['new_name'];
}
$reload = 1;
$disp_query = $sql_query;
$disp_message = $message;
unset($sql_query, $message);
$goto = $cfg['DefaultTabTable'];
} }
require_once './libraries/header.inc.php'; } else {
} // end is target table name /**
* No new name for the table!
*/
/** $message = PMA_Message::error('strTableEmpty');
* No new name for the table! $goto = './tbl_operations.php';
*/
else {
require_once './libraries/header.inc.php';
PMA_mysqlDie($strTableEmpty, '', '', $err_url);
} }
/** /**
* Back to the calling script * Back to the calling script
*/ */
require $goto;
require './tbl_sql.php';
?> ?>