Disable drop tab on mysql database (RFE #1327514).

This commit is contained in:
Michal Čihař
2005-10-16 15:27:43 +00:00
parent 6d4db4249d
commit aaefb8c518
2 changed files with 9 additions and 9 deletions

View File

@@ -5,6 +5,9 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2005-10-16 Michal Čihař <michal@cihar.com>
* db_details_links.php: Disable drop tab on mysql database (RFE #1327514).
2005-10-16 Marc Delisle <lem9@users.sourceforge.net> 2005-10-16 Marc Delisle <lem9@users.sourceforge.net>
* tbl_create.php: undefined $field_collation under MySQL < 4.1.x * tbl_create.php: undefined $field_collation under MySQL < 4.1.x
* tbl_properties_structure.php, libraries/sqlparser.lib.php: * tbl_properties_structure.php, libraries/sqlparser.lib.php:

View File

@@ -43,14 +43,9 @@ if ($is_superuser) {
} }
// Drop link if allowed // Drop link if allowed
if (!$GLOBALS['cfg']['AllowUserDropDatabase']) { // rabus: Don't even try to drop information_schema. You won't be able to. Believe me. You won't.
// Check if the user is a Superuser // nijel: Don't allow to easilly drop mysql database, RFE #1327514.
$GLOBALS['cfg']['AllowUserDropDatabase'] = $is_superuser; if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) && !(PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema') && ($db != 'mysql')) {
}
// rabus: Don't even try to drop information_schema. You won't be able to.
// Believe me. You won't.
$GLOBALS['cfg']['AllowUserDropDatabase'] = $GLOBALS['cfg']['AllowUserDropDatabase'] && !(PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema');
if ($GLOBALS['cfg']['AllowUserDropDatabase']) {
$tab_drop['link'] = 'sql.php'; $tab_drop['link'] = 'sql.php';
$tab_drop['args']['sql_query'] = 'DROP DATABASE ' . PMA_backquote($db); $tab_drop['args']['sql_query'] = 'DROP DATABASE ' . PMA_backquote($db);
$tab_drop['args']['zero_rows'] = sprintf($GLOBALS['strDatabaseHasBeenDropped'], htmlspecialchars(PMA_backquote($db))); $tab_drop['args']['zero_rows'] = sprintf($GLOBALS['strDatabaseHasBeenDropped'], htmlspecialchars(PMA_backquote($db)));
@@ -60,6 +55,8 @@ if ($GLOBALS['cfg']['AllowUserDropDatabase']) {
$tab_drop['args']['purge'] = 1; $tab_drop['args']['purge'] = 1;
$tab_drop['attr'] = 'onclick="return confirmLinkDropDB(this, \'DROP DATABASE ' . PMA_jsFormat($db) . '\')"'; $tab_drop['attr'] = 'onclick="return confirmLinkDropDB(this, \'DROP DATABASE ' . PMA_jsFormat($db) . '\')"';
$tab_drop['class'] = 'caution'; $tab_drop['class'] = 'caution';
} else {
$tab_drop['class'] = 'caution';
} }
// text // text
@@ -102,7 +99,7 @@ $tabs[] =& $tab_operation;
if ($is_superuser) { if ($is_superuser) {
$tabs[] =& $tab_privileges; $tabs[] =& $tab_privileges;
} }
if ($GLOBALS['cfg']['AllowUserDropDatabase']) { if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) {
$tabs[] =& $tab_drop; $tabs[] =& $tab_drop;
} }