From f029aea260850726cc64e5b5f3c4502d5a1aa26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Sat, 8 Oct 2005 16:11:46 +0000 Subject: [PATCH] Use common code for superuser detection. --- ChangeLog | 1 + sql.php | 13 +++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0c8e83145..3820e083b 100755 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,7 @@ $Source$ * tbl_properties_operations.php: Use strError instead of non existing strFailure. * lang/*: Remove unused messages. + * sql.php: Use common code for superuser detection. 2005-10-07 Marc Delisle * libraries/check_user_privileges.lib.php: bug #1313821, dbname containing a diff --git a/sql.php b/sql.php index 5548c6f0b..ade11d530 100644 --- a/sql.php +++ b/sql.php @@ -8,6 +8,7 @@ require_once('./libraries/grab_globals.lib.php'); require_once('./libraries/common.lib.php'); require_once('./libraries/tbl_indexes.lib.php'); +require_once('./libraries/check_user_privileges.lib.php'); /** * Defines the url to return to in case of error in a sql statement @@ -57,14 +58,10 @@ $is_drop_database = preg_match('@DROP[[:space:]]+DATABASE[[:space:]]+@i', $sql_q */ if (!defined('PMA_CHK_DROP') && !$cfg['AllowUserDropDatabase'] - && $is_drop_database) { - // Checks if the user is a Superuser - // TODO: set a global variable with this information - // loic1: optimized query - if (!($result = PMA_DBI_select_db('mysql'))) { - require_once('./header.inc.php'); - PMA_mysqlDie($strNoDropDatabases, '', '', $err_url); - } // end if + && $is_drop_database + && !$is_superuser) { + require_once('./header.inc.php'); + PMA_mysqlDie($strNoDropDatabases, '', '', $err_url); } // end if