From 40d7efec17befcc430a726eea0641d746891008a Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Sat, 5 Nov 2005 23:55:15 +0000 Subject: [PATCH] - no drop, empty, operation, insert, import for information_schema tables - enabled export for views --- ChangeLog | 4 +++ tbl_properties_common.php | 7 ++++- tbl_properties_links.php | 55 +++++++++++++++++++++--------------- tbl_properties_structure.php | 7 ----- 4 files changed, 42 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b394de1a..e766c441b 100755 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,10 @@ $Source$ - always display db stats for MySQL 5 - fixed html output - replaced " with ' in some queries + * tbl_properties_structure.php, tbl_properties_common.php + tbl_properties_links.php: + - no drop, empty, operation, insert, import for information_schema tables + - enabled export for views 2005-11-04 Marc Delisle * lang/spanish: Updated, thanks to Daniel Hinostroza (hinostroza) diff --git a/tbl_properties_common.php b/tbl_properties_common.php index 5390b5e73..c008a9f6e 100644 --- a/tbl_properties_common.php +++ b/tbl_properties_common.php @@ -6,13 +6,18 @@ /** * Gets some core libraries */ -require_once('./libraries/grab_globals.lib.php'); require_once('./libraries/common.lib.php'); require_once('./libraries/bookmark.lib.php'); // Check parameters PMA_checkParameters(array('db','table')); +if ( PMA_MYSQL_INT_VERSION >= 50002 && $db === 'information_schema' ) { + $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/tbl_properties_links.php b/tbl_properties_links.php index eff21788a..6038e2a5d 100644 --- a/tbl_properties_links.php +++ b/tbl_properties_links.php @@ -34,19 +34,22 @@ $tabs['sql']['text'] = $strSQL; $tabs['search']['icon'] = 'b_search.png'; $tabs['search']['text'] = $strSearch; -$tabs['insert']['icon'] = 'b_insrow.png'; -$tabs['insert']['link'] = 'tbl_change.php'; -$tabs['insert']['text'] = $strInsert; +if ( ! $db_is_information_schema ) { + $tabs['insert']['icon'] = 'b_insrow.png'; + $tabs['insert']['link'] = 'tbl_change.php'; + $tabs['insert']['text'] = $strInsert; +} -/** - * Don't display "Export", "Import", "Operations" and "Empty" for views. - */ -if (!$tbl_is_view) { - $tabs['export']['icon'] = 'b_tblexport.png'; - $tabs['export']['link'] = 'tbl_properties_export.php'; - $tabs['export']['args']['single_table'] = 'true'; - $tabs['export']['text'] = $strExport; +$tabs['export']['icon'] = 'b_tblexport.png'; +$tabs['export']['link'] = 'tbl_properties_export.php'; +$tabs['export']['args']['single_table'] = 'true'; +$tabs['export']['text'] = $strExport; +/** + * Don't display , "Import", "Operations" and "Empty" + * for views and information_schema + */ +if ( ! $tbl_is_view && ! $db_is_information_schema ) { $tabs['import']['icon'] = 'b_tblimport.png'; $tabs['import']['link'] = 'tbl_import.php'; $tabs['import']['text'] = $strImport; @@ -69,18 +72,24 @@ if (!$tbl_is_view) { $tabs['empty']['icon'] = 'b_empty.png'; $tabs['empty']['text'] = $strEmpty; } -$tabs['drop']['icon'] = 'b_deltbl.png'; -$tabs['drop']['link'] = 'sql.php'; -$tabs['drop']['text'] = $strDrop; -$tabs['drop']['args']['reload'] = 1; -$tabs['drop']['args']['purge'] = 1; -$drop_command = 'DROP ' . ($tbl_is_view ? 'VIEW' : 'TABLE'); -$tabs['drop']['args']['sql_query'] = $drop_command . ' ' . PMA_backquote($table); -$tabs['drop']['args']['goto'] = 'db_details_structure.php'; -$tabs['drop']['args']['zero_rows'] = sprintf(($tbl_is_view ? $strViewHasBeenDropped : $strTableHasBeenDropped), htmlspecialchars($table)); -$tabs['drop']['attr'] = 'onclick="return confirmLink(this, \'' . $drop_command . ' ' . PMA_jsFormat($table) . '\')"'; -unset($drop_command); -$tabs['drop']['class'] = 'caution'; + +/** + * no drop in information_schema + */ +if ( ! $db_is_information_schema ) { + $tabs['drop']['icon'] = 'b_deltbl.png'; + $tabs['drop']['link'] = 'sql.php'; + $tabs['drop']['text'] = $strDrop; + $tabs['drop']['args']['reload'] = 1; + $tabs['drop']['args']['purge'] = 1; + $drop_command = 'DROP ' . ($tbl_is_view ? 'VIEW' : 'TABLE'); + $tabs['drop']['args']['sql_query'] = $drop_command . ' ' . PMA_backquote($table); + $tabs['drop']['args']['goto'] = 'db_details_structure.php'; + $tabs['drop']['args']['zero_rows'] = sprintf(($tbl_is_view ? $strViewHasBeenDropped : $strTableHasBeenDropped), htmlspecialchars($table)); + $tabs['drop']['attr'] = 'onclick="return confirmLink(this, \'' . $drop_command . ' ' . PMA_jsFormat($table) . '\')"'; + unset($drop_command); + $tabs['drop']['class'] = 'caution'; +} if ($table_info_num_rows > 0 || $tbl_is_view) { $tabs['browse']['link'] = 'sql.php'; diff --git a/tbl_properties_structure.php b/tbl_properties_structure.php index 3166bcc74..1821d5ff1 100644 --- a/tbl_properties_structure.php +++ b/tbl_properties_structure.php @@ -2,7 +2,6 @@ /* $Id$ */ // vim: expandtab sw=4 ts=4 sts=4: -require_once('./libraries/grab_globals.lib.php'); require_once('./libraries/common.lib.php'); require_once('./libraries/mysql_charsets.lib.php'); @@ -149,12 +148,6 @@ if ( $cfg['PropertiesIconic'] == true ) { $titles['Browse'] = $strBrowse; } -if ( PMA_MYSQL_INT_VERSION >= 50002 && $db === 'information_schema' ) { - $db_is_information_schema = true; -} else { - $db_is_information_schema = false; -} - /** * Displays the table structure ('show table' works correct since 3.23.03) */