fixed bugs if dbs names in "only_db" contain "_" or "%" characters
This commit is contained in:
@@ -10,6 +10,8 @@ $Source$
|
|||||||
* main.php3:
|
* main.php3:
|
||||||
- lines 107-111: removed the socket used from the settings displayed;
|
- lines 107-111: removed the socket used from the settings displayed;
|
||||||
- line 342: cosmetic change.
|
- line 342: cosmetic change.
|
||||||
|
* libraries/common.lib.php3: fixed bugs if dbs names in "only_db" contain
|
||||||
|
"_" or "%" characters.
|
||||||
* lang/bulgarian.inc.php3, line 304: a ';' was missig at EOL.
|
* lang/bulgarian.inc.php3, line 304: a ';' was missig at EOL.
|
||||||
|
|
||||||
2001-10-27 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
2001-10-27 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
||||||
|
@@ -528,16 +528,16 @@ if (!defined('__LIB_COMMON__')){
|
|||||||
$dblist_cnt = count($dblist);
|
$dblist_cnt = count($dblist);
|
||||||
if ($dblist_cnt) {
|
if ($dblist_cnt) {
|
||||||
$true_dblist = array();
|
$true_dblist = array();
|
||||||
$re = '(^|(\\\\\\\\)+|[^\])(_|%)';
|
$is_show_dbs = TRUE;
|
||||||
for ($i = 0; $i < $dblist_cnt; $i++) {
|
for ($i = 0; $i < $dblist_cnt; $i++) {
|
||||||
if (ereg($re, $dblist[$i])) {
|
if ($is_show_dbs && ereg('(^|[^\])(_|%)', $dblist[$i])) {
|
||||||
$local_query = 'SHOW DATABASES LIKE \'' . $dblist[$i] . '\'';
|
$local_query = 'SHOW DATABASES LIKE \'' . $dblist[$i] . '\'';
|
||||||
$rs = mysql_query($local_query, $dbh);
|
$rs = mysql_query($local_query, $dbh);
|
||||||
// "SHOW DATABASES" statement is disabled
|
// "SHOW DATABASES" statement is disabled
|
||||||
if ($i == 0
|
if ($i == 0
|
||||||
&& (mysql_error() && mysql_errno() == 1045)) {
|
&& (mysql_error() && mysql_errno() == 1045)) {
|
||||||
$true_dblist = $dblist;
|
$true_dblist[] = str_replace('\\_', '_', str_replace('\\%', '%', $dblist[$i]));
|
||||||
break;
|
$is_show_dbs = FALSE;
|
||||||
}
|
}
|
||||||
// Debug
|
// Debug
|
||||||
// else if (mysql_error()) {
|
// else if (mysql_error()) {
|
||||||
@@ -548,10 +548,9 @@ if (!defined('__LIB_COMMON__')){
|
|||||||
} // end while
|
} // end while
|
||||||
if ($rs) {
|
if ($rs) {
|
||||||
mysql_free_result($rs);
|
mysql_free_result($rs);
|
||||||
unset($rs);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$true_dblist[] = $dblist[$i];
|
$true_dblist[] = str_replace('\\_', '_', str_replace('\\%', '%', $dblist[$i]));
|
||||||
} // end if... else...
|
} // end if... else...
|
||||||
} // end for
|
} // end for
|
||||||
$dblist = $true_dblist;
|
$dblist = $true_dblist;
|
||||||
@@ -685,15 +684,15 @@ if (!defined('__LIB_COMMON__')){
|
|||||||
if ($num_dbs) {
|
if ($num_dbs) {
|
||||||
$true_dblist = array();
|
$true_dblist = array();
|
||||||
for ($i = 0; $i < $num_dbs; $i++) {
|
for ($i = 0; $i < $num_dbs; $i++) {
|
||||||
$dblink = @mysql_select_db($dblist[$i]);
|
$dblink = @mysql_select_db($dblist[$i]);
|
||||||
if ($dblink) {
|
if ($dblink) {
|
||||||
$true_dblist[] = $dblist[$i];
|
$true_dblist[] = $dblist[$i];
|
||||||
} // end if
|
} // end if
|
||||||
} // end for
|
} // end for
|
||||||
unset($dblist);
|
unset($dblist);
|
||||||
$dblist = $true_dblist;
|
$dblist = $true_dblist;
|
||||||
unset($true_dblist);
|
unset($true_dblist);
|
||||||
$num_dbs = count($dblist);
|
$num_dbs = count($dblist);
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
// 2. Allowed database list is empty -> gets the list of all databases
|
// 2. Allowed database list is empty -> gets the list of all databases
|
||||||
|
Reference in New Issue
Block a user