* fixed a possible problem with invalid keys values in the $uva_mydbs array;
* taken into account the case where available databases names returned by MySQL is empty or '%' (ie all databases); * fixed an invalid regexp at line 494.
This commit is contained in:
@@ -5,6 +5,14 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2001-09-29 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
||||||
|
* libraries/common.lib.php3:
|
||||||
|
- fixed a possible problem with invalid keys values in the $uva_mydbs
|
||||||
|
array;
|
||||||
|
- taken into account the case where available databases names returned by
|
||||||
|
MySQL is empty or '%' (ie all databases);
|
||||||
|
- fixed an invalid regexp at line 494.
|
||||||
|
|
||||||
2001-09-28 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
2001-09-28 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
||||||
* main.php3: coding standards.
|
* main.php3: coding standards.
|
||||||
|
|
||||||
|
@@ -457,32 +457,53 @@ if (!defined('__LIB_COMMON__')){
|
|||||||
// database names instead of with regular
|
// database names instead of with regular
|
||||||
// expressions.
|
// expressions.
|
||||||
while ($row = mysql_fetch_array($rs)) {
|
while ($row = mysql_fetch_array($rs)) {
|
||||||
// loic1: avoid multiple entries for dbs
|
// loic1: all databases cases - part 1
|
||||||
|
if (empty($row['Db']) || $row['Db'] == '%') {
|
||||||
|
$uva_mydbs[md5('%')] = '%';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// loic1: avoid multiple entries for dbs and
|
||||||
|
// ensure the key value is valid
|
||||||
if (pmaIsInto($row['Db'], $dblist) == -1) {
|
if (pmaIsInto($row['Db'], $dblist) == -1) {
|
||||||
$uva_mydbs[$row['Db']] = 1;
|
$uva_mydbs[md5($row['Db'])] = $row['Db'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mysql_free_result($rs);
|
mysql_free_result($rs);
|
||||||
$uva_alldbs = mysql_list_dbs();
|
$uva_alldbs = mysql_list_dbs();
|
||||||
while ($uva_row = mysql_fetch_array($uva_alldbs)) {
|
// loic1: all databases cases - part 2
|
||||||
$uva_db = $uva_row[0];
|
if (isset($uva_mydbs[md5('%')])) {
|
||||||
if (isset($uva_mydbs[$uva_db]) && 1 == $uva_mydbs[$uva_db]) {
|
while ($uva_row = mysql_fetch_array($uva_alldbs)) {
|
||||||
$dblist[] = $uva_db;
|
$dblist[] = $uva_row[0];
|
||||||
$uva_mydbs[$uva_db] = 0;
|
} // end while
|
||||||
} else {
|
} // end if
|
||||||
reset($uva_mydbs);
|
else {
|
||||||
while (list($uva_matchpattern, $uva_value) = each($uva_mydbs)) {
|
while ($uva_row = mysql_fetch_array($uva_alldbs)) {
|
||||||
$uva_regex = ereg_replace('%', '.+', $uva_matchpattern);
|
$uva_db_key = md5($uva_row[0]);
|
||||||
// Fixed db name matching
|
if (!empty($uva_mydbs[$uva_db_key])) {
|
||||||
// 2000-08-28 -- Benjamin Gandon
|
$dblist[] = $uva_row[0];
|
||||||
if (ereg('^' . $uva_regex . '$', $uva_db)) {
|
$uva_mydbs[$uva_db_key] = '';
|
||||||
$dblist[] = $uva_db;
|
} else {
|
||||||
break;
|
reset($uva_mydbs);
|
||||||
}
|
while (list($uva_matchpattern, $uva_value) = each($uva_mydbs)) {
|
||||||
} // end while
|
// loic1: fixed bad regexp
|
||||||
} // end if ... else ....
|
// TODO: - slash before wildcards
|
||||||
} // end while
|
// may be itself slashed
|
||||||
|
// - db names may contain
|
||||||
|
// characters that are
|
||||||
|
// regexp instructions
|
||||||
|
$uva_regex = ereg_replace('[^\]%', '.*', ereg_replace('[^\]_', '.{1}', $uva_value));
|
||||||
|
// Fixed db name matching
|
||||||
|
// 2000-08-28 -- Benjamin Gandon
|
||||||
|
if (ereg('^' . $uva_regex . '$', $uva_row[0])) {
|
||||||
|
$dblist[] = $uva_row[0];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} // end while
|
||||||
|
} // end if ... else ....
|
||||||
|
} // end while
|
||||||
|
} // end else
|
||||||
mysql_free_result($uva_alldbs);
|
mysql_free_result($uva_alldbs);
|
||||||
|
unset($uva_mydbs);
|
||||||
} // end else
|
} // end else
|
||||||
} // end if
|
} // end if
|
||||||
} // end else
|
} // end else
|
||||||
|
Reference in New Issue
Block a user