From d5a817b4cf39573274de15014742bf0302321c71 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 13 Mar 2002 17:34:46 +0000 Subject: [PATCH] bug 528961 --- ChangeLog | 3 +++ libraries/common.lib.php3 | 31 +++++++++++++++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1dfc6fb63..3c3bd9324 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ phpMyAdmin - Changelog $Id$ $Source$ +2002-03-13 Marc Delisle + * libraries/common.lib.php3: bug 528961 safe_show_database + 2002-03-11 Marc Delisle * various lang updates * 2.2.5-rc1 released diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3 index 5efc9fbf9..4b028a3d8 100644 --- a/libraries/common.lib.php3 +++ b/libraries/common.lib.php3 @@ -538,21 +538,24 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){ // 'only_db' is empty for the current user... else { - // ... first checks whether the "safe_show_database" is on or not - $local_query = 'SHOW VARIABLES LIKE \'safe_show_database\''; - $rs = mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE); - $is_safe_show_dbs = mysql_result($rs, 0, 'Value'); + // ... first checks whether the "safe_show_database" + // is on or not (if MYSQL supports this) + if (PMA_MYSQL_INT_VERSION >= 32330) { + $local_query = 'SHOW VARIABLES LIKE \'safe_show_database\''; + $rs = mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE); + $is_safe_show_dbs = mysql_result($rs, 0, 'Value'); - // ... and if on, try get the available dbs list,.... - if ($is_safe_show_dbs && strtoupper($is_safe_show_dbs) != 'OFF') { - $uva_alldbs = mysql_list_dbs($userlink); - while ($uva_row = mysql_fetch_array($uva_alldbs)) { - $dblist[] = $uva_row[0]; - } // end while - $dblist_cnt = count($dblist); - unset($uva_alldbs); - mysql_free_result($rs); - } // end if ($is_safe_show_dbs) + // ... and if on, try to get the available dbs list + if ($is_safe_show_dbs && strtoupper($is_safe_show_dbs) != 'OFF') { + $uva_alldbs = mysql_list_dbs($userlink); + while ($uva_row = mysql_fetch_array($uva_alldbs)) { + $dblist[] = $uva_row[0]; + } // end while + $dblist_cnt = count($dblist); + unset($uva_alldbs); + mysql_free_result($rs); + } // end if ($is_safe_show_dbs) + } //end if (PMA_MYSQL_INT_VERSION) // ... else checks for available databases in the "mysql" db if (!$dblist_cnt) {