diff --git a/ChangeLog b/ChangeLog index e766c441b..0c68db97a 100755 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,8 @@ $Source$ tbl_properties_links.php: - no drop, empty, operation, insert, import for information_schema tables - enabled export for views + * db_details_common.php, db_details_structure.php, db_details_links.php: + - no import, drop, rights, operation for information_schema 2005-11-04 Marc Delisle * lang/spanish: Updated, thanks to Daniel Hinostroza (hinostroza) diff --git a/db_details_common.php b/db_details_common.php index f29fb8b4f..4df8ed5ff 100644 --- a/db_details_common.php +++ b/db_details_common.php @@ -5,12 +5,18 @@ /** * Gets some core libraries */ -require_once('./libraries/grab_globals.lib.php'); require_once('./libraries/common.lib.php'); require_once('./libraries/bookmark.lib.php'); PMA_checkParameters(array('db')); +if ( PMA_MYSQL_INT_VERSION >= 50002 && $db == 'information_schema' ) { + $cfg['ShowStats'] = false; + $db_is_information_schema = true; +} else { + $db_is_information_schema = false; +} + /** * Defines the urls to return to in case of error in a sql statement */ diff --git a/db_details_links.php b/db_details_links.php index 76b4bbe76..6e13a3b1c 100644 --- a/db_details_links.php +++ b/db_details_links.php @@ -23,29 +23,10 @@ $is_superuser = PMA_DBI_try_query('SELECT COUNT(*) FROM mysql.user', NULL, PMA_D /** * Prepares links */ -// Export link if there is at least one table -if ($num_tables > 0) { - $tab_export['link'] = 'db_details_export.php'; - $tab_search['link'] = 'db_search.php'; - $tab_qbe['link'] = 'db_details_qbe.php'; -} -$tab_import['link'] = 'db_import.php'; -$tab_structure['link'] = 'db_details_structure.php'; -$tab_sql['link'] = 'db_details.php'; -$tab_sql['args']['db_query_force'] = 1; -$tab_operation['link'] = 'db_operations.php'; - -if ($is_superuser) { - $tab_privileges['link'] = 'server_privileges.php'; - $tab_privileges['args']['checkprivs'] = $db; - // stay on database view - $tab_privileges['args']['viewing_mode'] = 'db'; -} - // Drop link if allowed // rabus: Don't even try to drop information_schema. You won't be able to. Believe me. You won't. // nijel: Don't allow to easilly drop mysql database, RFE #1327514. -if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) && !(PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema') && ($db != 'mysql')) { +if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) && ! $db_is_information_schema && ($db != 'mysql')) { $tab_drop['link'] = 'sql.php'; $tab_drop['args']['sql_query'] = 'DROP DATABASE ' . PMA_backquote($db); $tab_drop['args']['zero_rows'] = sprintf($GLOBALS['strDatabaseHasBeenDropped'], htmlspecialchars(PMA_backquote($db))); @@ -54,35 +35,53 @@ if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) && !(PMA_MYSQL_I $tab_drop['args']['reload'] = 1; $tab_drop['args']['purge'] = 1; $tab_drop['attr'] = 'onclick="return confirmLinkDropDB(this, \'DROP DATABASE ' . PMA_jsFormat($db) . '\')"'; - $tab_drop['class'] = 'caution'; -} else { - $tab_drop['class'] = 'caution'; } -// text +/** + * export, search and qbe links if there is at least one table + */ +if ( $num_tables > 0 ) { + $tab_export['link'] = 'db_details_export.php'; + $tab_search['link'] = 'db_search.php'; + $tab_qbe['link'] = 'db_details_qbe.php'; +} + +$tab_structure['link'] = 'db_details_structure.php'; $tab_structure['text'] = $GLOBALS['strStructure']; -$tab_sql['text'] = $GLOBALS['strSQL']; -$tab_export['text'] = $GLOBALS['strExport']; -$tab_import['text'] = $GLOBALS['strImport']; -$tab_search['text'] = $GLOBALS['strSearch']; -$tab_drop['text'] = $GLOBALS['strDrop']; -$tab_qbe['text'] = $GLOBALS['strQBE']; -$tab_operation['text'] = $GLOBALS['strOperations']; -if ($is_superuser) { - $tab_privileges['text'] = $GLOBALS['strPrivileges']; -} - -// icons $tab_structure['icon'] = 'b_props.png'; + +$tab_sql['link'] = 'db_details.php'; +$tab_sql['args']['db_query_force'] = 1; +$tab_sql['text'] = $GLOBALS['strSQL']; $tab_sql['icon'] = 'b_sql.png'; + +$tab_export['text'] = $GLOBALS['strExport']; $tab_export['icon'] = 'b_export.png'; -$tab_import['icon'] = 'b_import.png'; +$tab_search['text'] = $GLOBALS['strSearch']; $tab_search['icon'] = 'b_search.png'; -$tab_drop['icon'] = 'b_deltbl.png'; + +$tab_qbe['text'] = $GLOBALS['strQBE']; $tab_qbe['icon'] = 's_db.png'; -$tab_operation['icon'] = 'b_tblops.png'; -if ($is_superuser) { - $tab_privileges['icon'] = 's_rights.png'; + + +if ( ! $db_is_information_schema ) { + $tab_import['link'] = 'db_import.php'; + $tab_import['text'] = $GLOBALS['strImport']; + $tab_import['icon'] = 'b_import.png'; + $tab_drop['text'] = $GLOBALS['strDrop']; + $tab_drop['icon'] = 'b_deltbl.png'; + $tab_drop['class'] = 'caution'; + $tab_operation['link'] = 'db_operations.php'; + $tab_operation['text'] = $GLOBALS['strOperations']; + $tab_operation['icon'] = 'b_tblops.png'; + if ( $is_superuser ) { + $tab_privileges['link'] = 'server_privileges.php'; + $tab_privileges['args']['checkprivs'] = $db; + // stay on database view + $tab_privileges['args']['viewing_mode'] = 'db'; + $tab_privileges['text'] = $GLOBALS['strPrivileges']; + $tab_privileges['icon'] = 's_rights.png'; + } } /** @@ -94,13 +93,15 @@ $tabs[] =& $tab_sql; $tabs[] =& $tab_search; $tabs[] =& $tab_qbe; $tabs[] =& $tab_export; -$tabs[] =& $tab_import; -$tabs[] =& $tab_operation; -if ($is_superuser) { - $tabs[] =& $tab_privileges; -} -if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) { - $tabs[] =& $tab_drop; +if ( ! $db_is_information_schema ) { + $tabs[] =& $tab_import; + $tabs[] =& $tab_operation; + if ( $is_superuser ) { + $tabs[] =& $tab_privileges; + } + if ( $is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase'] ) { + $tabs[] =& $tab_drop; + } } echo PMA_getTabs( $tabs ); diff --git a/db_details_structure.php b/db_details_structure.php index 77c013fae..5002bb439 100644 --- a/db_details_structure.php +++ b/db_details_structure.php @@ -25,14 +25,6 @@ if ( empty( $is_info ) ) { require('./db_details_db_info.php'); } -// rabus: disable statistics for information_schema. -if ( PMA_MYSQL_INT_VERSION >= 50002 && $db == 'information_schema' ) { - $cfg['ShowStats'] = false; - $db_is_information_schema = true; -} else { - $db_is_information_schema = false; -} - // 1. No tables if ( $num_tables == 0 ) { echo '

' . $strNoTablesFound . '

' . "\n";