1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-18 04:11:27 +02:00

Notices: Use idx()

This commit is contained in:
Jakub Vrana
2025-03-26 07:55:30 +01:00
parent 1a2ae0e29e
commit c5f87110ff
5 changed files with 7 additions and 6 deletions

View File

@@ -61,8 +61,8 @@ function check_invalid_login() {
break;
}
}
$invalid = ($invalids ? $invalids[$adminer->bruteForceKey()] : array());
$next_attempt = (idx($invalid, 1) > 29 ? $invalid[0] - time() : 0); // allow 30 invalid attempts
$invalid = idx($invalids, $adminer->bruteForceKey(), array());
$next_attempt = ($invalid[1] > 29 ? $invalid[0] - time() : 0); // allow 30 invalid attempts
if ($next_attempt > 0) { //! do the same with permanent login
auth_error(lang('Too many unsuccessful logins, try again in %d minute(s).', ceil($next_attempt / 60)));
}

View File

@@ -66,6 +66,7 @@ function escape_string($val) {
}
/** Get a possibly missing item from a possibly missing array
* idx($row, $key) is better than $row[$key] ?? null because it reports error for undefined $row
* @param array|null
* @param string|int
* @param mixed
@@ -312,7 +313,7 @@ function where($where, $fields = array()) {
foreach ((array) $where["where"] as $key => $val) {
$key = bracket_escape($key, 1); // 1 - back
$column = escape_key($key);
$field = ($fields ? $fields[$key] : array());
$field = idx($fields, $key, array());
$field_type = $field["type"];
$return[] = $column
. (JUSH == "sql" && $field_type == "json" ? " = CAST(" . q($val) . " AS JSON)"