Skip to content

Commit

Permalink
More QA on 54eb643
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWitness committed Apr 6, 2024
1 parent 4d5ee72 commit 777f362
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions host.php
Expand Up @@ -1464,18 +1464,22 @@ function get_device_records(&$total_rows, $rows) {
if (get_request_var('host_status') == '-1') {
/* Show all items */
} elseif (get_request_var('host_status') == '-2') {
$sql_where .= ($sql_where != '' ? " AND host.disabled='on'" : " WHERE host.disabled='on'");
$sql_where .= ($sql_where == '' ? 'WHERE ':' AND ') . " host.disabled = 'on'";
} elseif (get_request_var('host_status') == '-3') {
$sql_where .= ($sql_where != '' ? " AND host.disabled=''" : " WHERE host.disabled=''");
$sql_where .= ($sql_where == '' ? 'WHERE ':' AND ') . " host.disabled = ''";
} elseif (get_request_var('host_status') == '-4') {
$sql_where .= ($sql_where != '' ? " AND (host.status!='3' OR host.disabled='on')" : " WHERE (host.status!='3' OR host.disabled='on')");
} else { // Host Down

if (db_column_exists('host', 'thold_failure_count')) {
$sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') .
"((host.status=" . get_request_var('host_status') . " OR (status != 2 AND thold_failure_count > 0 AND status_event_count > thold_failure_count) AND host.disabled = ''))";
$sql_where .= ($sql_where == '' ? 'WHERE ':' AND ') .
"(host.status != '3' OR host.disabled = 'on' OR (host.status != 2 AND thold_failure_count > 0 AND status_event_count >= thold_failure_count))";
} else {
$sql_where .= ($sql_where == '' ? 'WHERE ':' AND ') . " (host.status != '3' OR host.disabled = 'on')";
}
} else {
if (db_column_exists('host', 'thold_failure_count')) {
$sql_where .= ($sql_where == '' ? 'WHERE ':' AND ') .
"(host.status = " . get_request_var('host_status') . " OR (host.status != 2 AND thold_failure_count > 0 AND status_event_count >= thold_failure_count) AND host.disabled = '')";
} else {
$sql_where .= ($sql_where != '' ? ' AND (host.status=' . get_request_var('host_status') . " AND host.disabled = '')" : 'where (host.status=' . get_request_var('host_status') . " AND host.disabled = '')");
$sql_where .= ($sql_where == '' ? 'WHERE ':' AND ') . ' (host.status = ' . get_request_var('host_status') . " AND host.disabled = '')";
}
}

Expand Down

0 comments on commit 777f362

Please sign in to comment.