@@ -1195,15 +1202,14 @@ function clearFilter() {
}
// Include (UNION) Any
- $locations = db_fetch_assoc_prepared(
- "SELECT *
- FROM (
- SELECT DISTINCT IF(IFNULL(location,'') = '', ?, location) AS location
- FROM (SELECT location FROM host WHERE id = id $sql_where GROUP BY location) AS host
- UNION ALL
- SELECT location FROM (SELECT ? AS location ) AS tableany
- ) tableunion
- ORDER BY location",
+ $locations = db_fetch_assoc_prepared("SELECT *
+ FROM (
+ SELECT DISTINCT IF(IFNULL(location,'') = '', ?, location) AS location
+ FROM (SELECT location FROM host WHERE id = id $sql_where GROUP BY location) AS host
+ UNION ALL
+ SELECT location FROM (SELECT ? AS location ) AS tableany
+ ) tableunion
+ ORDER BY location",
array_merge([MAINT_HOST_FILTER_LOC_NONE], $sql_where_params, [MAINT_HOST_FILTER_LOC_ANY]),
);
@@ -1263,16 +1269,15 @@ function clearFilter() {
}
$sql_statement = "SELECT ht.id, ht.name
- FROM host_template AS ht
- WHERE ht.id IN (SELECT host_template_id FROM host WHERE id = id $sql_where)
- ORDER BY ht.name";
+ FROM host_template AS ht
+ WHERE ht.id IN (SELECT host_template_id FROM host WHERE id = id $sql_where)
+ ORDER BY ht.name";
$host_templates = db_fetch_assoc_prepared($sql_statement, $sql_where_params);
- $hosts_no_templates = db_fetch_assoc_prepared(
- "SELECT id
- FROM host WHERE host_template_id = 0 $sql_where
- LIMIT 1",
+ $hosts_no_templates = db_fetch_assoc_prepared("SELECT id
+ FROM host WHERE host_template_id = 0 $sql_where
+ LIMIT 1",
$sql_where_params,
);
@@ -1435,8 +1440,7 @@ function clearFilter() {
if ($schedule_created) {
$sql_params = array_merge([get_request_var('id')], $sql_where_params);
- $total_rows = db_fetch_cell_prepared(
- "SELECT COUNT(DISTINCT h.id)
+ $total_rows = db_fetch_cell_prepared("SELECT COUNT(DISTINCT h.id)
FROM host AS h
LEFT JOIN (SELECT DISTINCT host_id FROM thold_data) AS td
ON h.id = td.host_id
@@ -1519,7 +1523,7 @@ function clearFilter() {
print $nav;
- html_start_box('', '100%', '', '3', 'center', '');
+ html_start_box('', '100%', false, 3, 'center', '');
html_header_sort_checkbox($display_text, get_request_var('sort_column'), get_request_var('sort_direction'), false, 'maint.php?action=edit&tab=hosts&id=' . get_request_var('id'));
@@ -1535,12 +1539,13 @@ function clearFilter() {
$names = '';
}
- $lists = db_fetch_assoc_prepared(
- 'SELECT name
+ $lists = db_fetch_assoc_prepared('SELECT name
FROM plugin_maint_schedules
INNER JOIN plugin_maint_hosts
ON plugin_maint_schedules.id = plugin_maint_hosts.schedule
- WHERE type = ? AND host = ? AND plugin_maint_schedules.id != ?',
+ WHERE type = ?
+ AND host = ?
+ AND plugin_maint_schedules.id != ?',
[MAINT_HOST_TYPE_HOSTS, $host['id'], get_request_var('id')],
);
@@ -1638,7 +1643,7 @@ function webseer_urls(string $header_label): void {
$rows = get_request_var('rows');
}
- html_start_box(__esc("Associated Web URL's %s", $header_label, 'maint'), '100%', '', '3', 'center', '');
+ html_start_box(__esc("Associated Web URL's %s", $header_label, 'maint'), '100%', false, 3, 'center', '');
?>
@@ -1693,21 +1698,21 @@ function applyFilter() {
strURL += '&header=false';
loadPageNoHeader(strURL);
}
-
+
function clearFilter() {
strURL = 'maint.php?tab=webseer&action=edit&id=&clear=true&header=false';
loadPageNoHeader(strURL);
}
-
+
$(function() {
$('#rows, #associated').change(function() {
applyFilter();
});
-
+
$('#clear').click(function() {
clearFilter();
});
-
+
$('#form_webseer').submit(function(event) {
event.preventDefault();
applyFilter();
@@ -1742,13 +1747,12 @@ function clearFilter() {
if ($schedule_created) {
$sql_params = array_merge([get_request_var('id'), MAINT_HOST_TYPE_WEBSEER], $sql_where_params);
- $total_rows = db_fetch_cell_prepared(
- "SELECT COUNT(*)
+ $total_rows = db_fetch_cell_prepared("SELECT COUNT(*)
FROM plugin_webseer_urls AS u
LEFT JOIN plugin_maint_hosts AS pmh
- ON (u.id = pmh.host
- AND pmh.type = ?
- AND pmh.schedule = ?)
+ ON u.id = pmh.host
+ AND pmh.type = ?
+ AND pmh.schedule = ?
$sql_where",
$sql_params,
);
@@ -1759,9 +1763,9 @@ function clearFilter() {
pmh.type AS maint_type
FROM plugin_webseer_urls AS u
LEFT JOIN plugin_maint_hosts AS pmh
- ON (u.id = pmh.host
- AND pmh.type = ?
- AND pmh.schedule = ?)
+ ON u.id = pmh.host
+ AND pmh.type = ?
+ AND pmh.schedule = ?
$sql_where
LIMIT " . ($rows * (get_request_var('page') - 1)) . ',' . $rows;
@@ -1778,7 +1782,7 @@ function clearFilter() {
print $nav;
- html_start_box('', '100%', '', '3', 'center', '');
+ html_start_box('', '100%', false, 3, 'center', '');
$display_text = [
__('Description', 'maint'),
@@ -1794,7 +1798,7 @@ function clearFilter() {
if (cacti_sizeof($urls)) {
foreach ($urls as $url) {
form_alternate_row('line' . $url['id']);
- form_selectable_cell(filter_value($url['display_name'], get_request_var('filter')), $url['id'], 250);
+ form_selectable_cell(filter_value($url['display_name'], get_request_var('filter')), $url['id'], '250');
form_selectable_cell(round(($url['id']), 2), $url['id']);
if ($url['associated'] != '') {
@@ -1803,8 +1807,7 @@ function clearFilter() {
$names = '';
}
- $lists = db_fetch_assoc_prepared(
- 'SELECT name
+ $lists = db_fetch_assoc_prepared('SELECT name
FROM plugin_maint_schedules
INNER JOIN plugin_maint_hosts
ON plugin_maint_schedules.id = plugin_maint_hosts.schedule
@@ -1944,7 +1947,7 @@ function clearFilter() {
@@ -2022,13 +2025,12 @@ function clearFilter() {
if ($schedule_created) {
$sql_params = array_merge([get_request_var('id'), MAINT_HOST_TYPE_SERVCHECK], $sql_where_params);
- $total_rows = db_fetch_cell_prepared(
- "SELECT COUNT(*)
+ $total_rows = db_fetch_cell_prepared("SELECT COUNT(*)
FROM plugin_servcheck_test AS t
LEFT JOIN plugin_maint_hosts AS pmh
- ON (t.id = pmh.host
- AND pmh.type = ?
- AND pmh.schedule = ?)
+ ON t.id = pmh.host
+ AND pmh.type = ?
+ AND pmh.schedule = ?
$sql_where",
$sql_params,
);
@@ -2039,9 +2041,9 @@ function clearFilter() {
pmh.type AS maint_type
FROM plugin_servcheck_test AS t
LEFT JOIN plugin_maint_hosts AS pmh
- ON (t.id = pmh.host
- AND pmh.type = ?
- AND pmh.schedule = ?)
+ ON t.id = pmh.host
+ AND pmh.type = ?
+ AND pmh.schedule = ?
$sql_where
LIMIT " . ($rows * (get_request_var('page') - 1)) . ',' . $rows;
@@ -2058,7 +2060,7 @@ function clearFilter() {
print $nav;
- html_start_box('', '100%', '', '3', 'center', '');
+ html_start_box('', '100%', false, 3, 'center', '');
$display_text = [
__('Description', 'maint'),
@@ -2074,7 +2076,7 @@ function clearFilter() {
if (cacti_sizeof($tests)) {
foreach ($tests as $test) {
form_alternate_row('line' . $test['id']);
- form_selectable_cell(filter_value($test['display_name'], get_request_var('filter')), $test['id'], 250);
+ form_selectable_cell(filter_value($test['display_name'], get_request_var('filter')), $test['id'], '250');
form_selectable_cell(round(($test['id']), 2), $test['id']);
if ($test['associated'] != '') {
@@ -2083,8 +2085,7 @@ function clearFilter() {
$names = '';
}
- $lists = db_fetch_assoc_prepared(
- 'SELECT name
+ $lists = db_fetch_assoc_prepared('SELECT name
FROM plugin_maint_schedules
INNER JOIN plugin_maint_hosts
ON plugin_maint_schedules.id = plugin_maint_hosts.schedule
diff --git a/setup.php b/setup.php
index 8b495a9..20cff71 100644
--- a/setup.php
+++ b/setup.php
@@ -298,8 +298,8 @@ function maint_device_action_prepare(array $save): array {
}
// Load schedules to choose from
- $schedules = db_fetch_assoc('SELECT id, name, enabled, mtype, stime, etime, minterval
- FROM plugin_maint_schedules
+ $schedules = db_fetch_assoc('SELECT id, name, enabled, mtype, stime, etime, minterval
+ FROM plugin_maint_schedules
ORDER BY name');
$select = "