Select numeric database name in DB list (bug #580)

This commit is contained in:
Jakub Vrana 2018-01-19 17:39:27 +01:00
parent 34b03ef835
commit bc14e8432f

View file

@ -360,9 +360,10 @@ function get_vals($query, $column = 0) {
* @param string * @param string
* @param Min_DB * @param Min_DB
* @param float * @param float
* @param bool
* @return array * @return array
*/ */
function get_key_vals($query, $connection2 = null, $timeout = 0) { function get_key_vals($query, $connection2 = null, $timeout = 0, $set_keys = true) {
global $connection; global $connection;
if (!is_object($connection2)) { if (!is_object($connection2)) {
$connection2 = $connection; $connection2 = $connection;
@ -373,7 +374,11 @@ function get_key_vals($query, $connection2 = null, $timeout = 0) {
$connection2->timeout = 0; $connection2->timeout = 0;
if (is_object($result)) { if (is_object($result)) {
while ($row = $result->fetch_row()) { while ($row = $result->fetch_row()) {
$return[$row[0]] = $row[1]; if ($set_keys) {
$return[$row[0]] = $row[1];
} else {
$return[] = $row[0];
}
} }
} }
return $return; return $return;
@ -1261,13 +1266,13 @@ var timeout = setTimeout(function () {
} }
ob_flush(); ob_flush();
flush(); flush();
$return = @get_key_vals($query, $connection2, $timeout); // @ - may be killed $return = @get_key_vals($query, $connection2, $timeout, false); // @ - may be killed
if ($connection2) { if ($connection2) {
echo script("clearTimeout(timeout);"); echo script("clearTimeout(timeout);");
ob_flush(); ob_flush();
flush(); flush();
} }
return array_keys($return); return $return;
} }
/** Generate BREACH resistant CSRF token /** Generate BREACH resistant CSRF token