diff --git a/ChangeLog b/ChangeLog index a981f9c9a..5a84d9e1e 100755 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,8 @@ $Source$ libraries/config_import.lib.php, libraries/auth/config.auth.lib.php, libraries/auth/cookie.auth.lib.php: Allow simple blocking of root login (RFE #1012971), show just Access denied in case we denied it. + * db_operations.php, db_details_links.php, db_details_structure.php: + Separate operations from structure (RFE #808029). 2004-10-19 Marc Delisle * libraries/database_interface.lib.php: bug #1041667, correctly diff --git a/db_details_links.php b/db_details_links.php index c20eba6a6..2c3b3aa49 100644 --- a/db_details_links.php +++ b/db_details_links.php @@ -76,6 +76,7 @@ echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? ''.$strExport.'' : '') . $strExport, $lnk3, $arg3); echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? ''.$strSearch.'' : '') . $strSearch, $lnk4, $arg4); echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? ''.$strQBE.'' : '') . $strQBE, ($num_tables > 0) ? 'db_details_qbe.php' : '', $url_query); +echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? ''.$strOperations.'' : '') . $strOperations,'db_operations.php', $url_query); // Displays drop link if ($lnk5) { diff --git a/db_details_structure.php b/db_details_structure.php index 4e4f5b8fc..19c573913 100644 --- a/db_details_structure.php +++ b/db_details_structure.php @@ -6,75 +6,6 @@ require_once('./libraries/grab_globals.lib.php'); require_once('./libraries/common.lib.php'); require_once('./libraries/mysql_charsets.lib.php'); -/** - * Rename database - */ -if (isset($db) && isset($db_rename) && $db_rename == 'true') { - 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) { - $local_query = 'RENAME TABLE ' - . PMA_backquote($db) . '.' . PMA_backquote($table) - . ' TO ' - . PMA_backquote($newname) . '.' . PMA_backquote($table) - . ';'; - $sql_query .= "\n" . $local_query; - PMA_DBI_query($local_query); - } - $local_query = 'DROP DATABASE ' . PMA_backquote($db) . ';'; - $sql_query .= "\n" . $local_query; - PMA_DBI_query($local_query); - $reload = TRUE; - $message = sprintf($strRenameDatabaseOK, htmlspecialchars($db), htmlspecialchars($newname)); - - /* Update relations */ - require_once('./libraries/relation.lib.php'); - $cfgRelation = PMA_getRelationsParam(); - - if ($cfgRelation['commwork']) { - PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['column_info']) - . ' SET db_name = \'' . PMA_sqlAddslashes($newname) . '\'' - . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''); - } - if ($cfgRelation['bookmarkwork']) { - PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['bookmark']) - . ' SET dbase = \'' . PMA_sqlAddslashes($newname) . '\'' - . ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\''); - } - if ($cfgRelation['displaywork']) { - PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['table_info']) - . ' SET db_name = \'' . PMA_sqlAddslashes($newname) . '\'' - . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''); - } - - if ($cfgRelation['relwork']) { - PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['relation']) - . ' SET foreign_db = \'' . PMA_sqlAddslashes($newname) . '\'' - . ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''); - PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['relation']) - . ' SET master_db = \'' . PMA_sqlAddslashes($newname) . '\'' - . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''); - } - if ($cfgRelation['historywork']) { - PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['history']) - . ' SET db = \'' . PMA_sqlAddslashes($newname) . '\'' - . ' WHERE db = \'' . PMA_sqlAddslashes($db) . '\''); - } - if ($cfgRelation['pdfwork']) { - PMA_query_as_cu('UPDATE ' . PMA_backquote($cfgRelation['table_info']) - . ' SET db_name = \'' . PMA_sqlAddslashes($newname) . '\'' - . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''); - } - - /* Change database to be used */ - $db = $newname; - } -} /** * Prepares the tables list if the user where not redirected to this script * because there is no table in the database ($is_info is TRUE) @@ -147,13 +78,6 @@ function pma_TableHeader($alternate = FALSE) { require_once('./libraries/relation.lib.php'); $cfgRelation = PMA_getRelationsParam(); -/** - * Check if comments were updated - */ -if ($cfgRelation['commwork'] && isset($db_comment) && $db_comment == 'true') { - PMA_SetComment($db, '', '(db_comment)', $comment); -} - /** * Displays the tables list */ @@ -679,228 +603,8 @@ echo ' ' . ''; echo ' ' . ' ' . "\n"; -?> - - - - - - - - - - - '; - } - echo $strDBComment; - ?> -
- - - - - - - -
- - - - '; - } - echo $strDBRename.': '; - ?> -
- ' - . PMA_generate_common_hidden_inputs($db); - ?> - -
- -= 40101) { - // MySQL supports setting default charsets / collations for databases since - // version 4.1.1. - echo ' ' . "\n" - . ' ' . "\n" - . ' '; - if ($cfg['PropertiesIconic']) { - echo ''; - } - echo ' : ' . "\n" - . ' ' . "\n" - . '
' . "\n" - . ' ' - . PMA_generate_common_hidden_inputs($db, $table, 3) - . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'db_collation', 'select_db_collation', $db_collation, FALSE, 3) - . ' ' - . ' ' . "\n" - . ' ' . "\n" - . '
' . "\n" - . ' ' . "\n\n"; -} - -if ($num_tables > 0 - && !$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == FALSE) { - echo '' - . '
' . $strError . '
' - . '' - . sprintf(wordwrap($strRelationNotWorking,65,'
'), '', '') - . ''; -} // end if -?> - - -
- 0) { - $takeaway = $url_query . '&table=' . urlencode($table); -} - -if (($cfgRelation['pdfwork'] && $num_tables > 0) || - ($num_tables > 0 - && $cfgRelation['relwork'] && $cfgRelation['commwork'] - && isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir']) - )) { ?> -
- 0) { ?> - - - - - - - - - - - 0) { ?> - - - - - - - - - - - - - - - - - 0 - && $cfgRelation['relwork'] && $cfgRelation['commwork'] - && isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir']) - ) { -?> - - - - - 0) || - ($num_tables > 0 - && $cfgRelation['relwork'] && $cfgRelation['commwork'] - && isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir']) - )) { ?> -
- '; - } ?>PDF
- '; - if ($cfg['PropertiesIconic']) { - echo ''; - } - echo ''. $strEditPDFPages . ''; - ?> -
- '; - } - echo $strDisplayPDF; ?>:  -
  - -
- -
-
-
-
-
- - -
- - - -
   
- '; - if ($cfg['PropertiesIconic']) { - echo ''; - } - echo $strImportDocSQL . ''; - ?> -
-
- '; +echo ' '; /** * Displays the footer diff --git a/db_operations.php b/db_operations.php new file mode 100644 index 000000000..f28950cff --- /dev/null +++ b/db_operations.php @@ -0,0 +1,333 @@ += 40101) { + $db_collation = PMA_getDbCollation($db); +} + + +/** + * Settings for relations stuff + */ +require_once('./libraries/relation.lib.php'); +$cfgRelation = PMA_getRelationsParam(); + +/** + * Check if comments were updated + */ +if ($cfgRelation['commwork'] && isset($db_comment) && $db_comment == 'true') { + PMA_SetComment($db, '', '(db_comment)', $comment); +} + +echo ''; +if ($cfgRelation['commwork']) { +?> + + + + + + + + + + + + + + + + + + += 40101) { + // MySQL supports setting default charsets / collations for databases since + // version 4.1.1. + echo ' ' . "\n" + . ' ' . "\n" + . ' ' . "\n" + . ' ' . "\n" + . ' ' . "\n" + . ' ' . "\n" + . ' ' . "\n\n"; +} + +if ($num_tables > 0 + && !$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == FALSE) { + echo '' + . '' + . ''; +} // end if +?> +
'; + } + echo $strDBComment; + $comment = PMA_getComments($db); + ?>
+ + + + +
'; + } + echo $strDBRename.': '; + ?>
' + . PMA_generate_common_hidden_inputs($db); + ?>
'; + if ($cfg['PropertiesIconic']) { + echo ''; + } + echo ' : ' . "\n" + . '
' + . PMA_generate_common_hidden_inputs($db, $table, 3) + . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'db_collation', 'select_db_collation', $db_collation, FALSE, 3) + . ' ' + . ' ' . "\n" + . '
' . $strError . '
' + . sprintf(wordwrap($strRelationNotWorking,65,'
'), '', '') + . '
+ +
+ 0) { + $takeaway = $url_query . '&table=' . urlencode($table); +} + +if (($cfgRelation['pdfwork'] && $num_tables > 0) || + ($num_tables > 0 + && $cfgRelation['relwork'] && $cfgRelation['commwork'] + && isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir']) + )) { ?> +
+ 0) { ?> + + + + + + + + + + + 0) { ?> + + + + + + + + + + + + + + + + + 0 + && $cfgRelation['relwork'] && $cfgRelation['commwork'] + && isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir']) + ) { +?> + + + + + 0) || + ($num_tables > 0 + && $cfgRelation['relwork'] && $cfgRelation['commwork'] + && isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir']) + )) { ?> +
+ '; + } ?>PDF
+ '; + if ($cfg['PropertiesIconic']) { + echo ''; + } + echo ''. $strEditPDFPages . ''; + ?> +
+ '; + } + echo $strDisplayPDF; ?>:  +
  + +
+ +
+
+
+
+
+ + +
+ + + +
   
+ '; + if ($cfg['PropertiesIconic']) { + echo ''; + } + echo $strImportDocSQL . ''; + ?> +
+
+