diff --git a/.gitignore b/.gitignore index 6621d40..f857b7e 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ .git* locales/po/*.mo +.omc/ diff --git a/hmib.php b/hmib.php index b5670eb..48676a8 100644 --- a/hmib.php +++ b/hmib.php @@ -1,4 +1,6 @@ array( + 'rows' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1' - ), - 'page' => array( + ], + 'page' => [ 'filter' => FILTER_VALIDATE_INT, 'default' => '1' - ), - 'template' => array( + ], + 'template' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), - 'device' => array( + ], + 'device' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), - 'ostype' => array( + ], + 'ostype' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), + ], 'process' => array( 'filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '-1', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), - 'filter' => array( + 'filter' => [ 'filter' => FILTER_DEFAULT, 'pageset' => true, 'default' => '' - ), + ], 'sort_column' => array( 'filter' => FILTER_CALLBACK, 'default' => 'name', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'sort_direction' => array( 'filter' => FILTER_CALLBACK, 'default' => 'ASC', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ) ); @@ -315,7 +317,7 @@ function clearFilter() { } $sql_where = "WHERE hrswls.name!='' AND hrswls.name!='System Idle Process'"; - $sql_params = array(); + $sql_params = []; $sql_limit = ' LIMIT ' . ($num_rows*(get_request_var('page')-1)) . ',' . $num_rows; $sql_order = get_order_string(); @@ -466,51 +468,51 @@ function hmib_running() { /* ================= input validation and session storage ================= */ $filters = array( - 'rows' => array( + 'rows' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1' - ), - 'page' => array( + ], + 'page' => [ 'filter' => FILTER_VALIDATE_INT, 'default' => '1' - ), - 'template' => array( + ], + 'template' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), - 'device' => array( + ], + 'device' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), - 'ostype' => array( + ], + 'ostype' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), + ], 'filter' => array( 'filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'process' => array( 'filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '-1', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'sort_column' => array( 'filter' => FILTER_CALLBACK, 'default' => 'name', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'sort_direction' => array( 'filter' => FILTER_CALLBACK, 'default' => 'ASC', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ) ); @@ -685,7 +687,7 @@ function clearFilter() { $sql_limit = ' LIMIT ' . ($num_rows*(get_request_var('page')-1)) . ',' . $num_rows; $sql_where = "WHERE hrswr.name != '' AND hrswr.name != 'System Idle Process'"; - $sql_params = array(); + $sql_params = []; $sql_order = get_order_string(); if (get_request_var('template') != '-1') { @@ -866,56 +868,56 @@ function hmib_hardware() { /* ================= input validation and session storage ================= */ $filters = array( - 'rows' => array( + 'rows' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1' - ), - 'page' => array( + ], + 'page' => [ 'filter' => FILTER_VALIDATE_INT, 'default' => '1' - ), - 'template' => array( + ], + 'template' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), - 'device' => array( + ], + 'device' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), - 'type' => array( + ], + 'type' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), - 'ostype' => array( + ], + 'ostype' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), + ], 'process' => array( 'filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '-1', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'filter' => array( 'filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'sort_column' => array( 'filter' => FILTER_CALLBACK, 'default' => 'hrd.description', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'sort_direction' => array( 'filter' => FILTER_CALLBACK, 'default' => 'ASC', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ) ); @@ -1088,7 +1090,7 @@ function clearFilter() { } $sql_where = "WHERE (hrd.description IS NOT NULL AND hrd.description!='')"; - $sql_params = array(); + $sql_params = []; $sql_limit = ' LIMIT ' . ($num_rows*(get_request_var('page')-1)) . ',' . $num_rows; $sql_order = get_order_string(); @@ -1219,56 +1221,56 @@ function hmib_storage() { /* ================= input validation and session storage ================= */ $filters = array( - 'rows' => array( + 'rows' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1' - ), - 'page' => array( + ], + 'page' => [ 'filter' => FILTER_VALIDATE_INT, 'default' => '1' - ), - 'template' => array( + ], + 'template' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), - 'device' => array( + ], + 'device' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), - 'type' => array( + ], + 'type' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), - 'ostype' => array( + ], + 'ostype' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), + ], 'process' => array( 'filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '-1', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'filter' => array( 'filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'sort_column' => array( 'filter' => FILTER_CALLBACK, 'default' => 'hrsto.description', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'sort_direction' => array( 'filter' => FILTER_CALLBACK, 'default' => 'ASC', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ) ); @@ -1444,7 +1446,7 @@ function clearFilter() { } $sql_where = "WHERE (hrsto.description IS NOT NULL AND hrsto.description!='')"; - $sql_params = array(); + $sql_params = []; $sql_limit = ' LIMIT ' . ($num_rows*(get_request_var('page')-1)) . ',' . $num_rows; $sql_order = get_order_string(); @@ -1593,51 +1595,51 @@ function hmib_devices() { /* ================= input validation and session storage ================= */ $filters = array( - 'rows' => array( + 'rows' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1' - ), - 'page' => array( + ], + 'page' => [ 'filter' => FILTER_VALIDATE_INT, 'default' => '1' - ), - 'template' => array( + ], + 'template' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), + ], 'process' => array( 'filter' => FILTER_CALLBACK, - 'options' => array('options' => 'sanitize_search_string'), + 'options' => ['options' => 'sanitize_search_string'], 'pageset' => true, 'default' => '-1', ), - 'status' => array( + 'status' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), - 'ostype' => array( + ], + 'ostype' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), + ], 'filter' => array( 'filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'sort_column' => array( 'filter' => FILTER_CALLBACK, 'default' => 'description', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'sort_direction' => array( 'filter' => FILTER_CALLBACK, 'default' => 'ASC', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ) ); @@ -1745,7 +1747,7 @@ function hmib_devices() { INNER JOIN plugin_hmib_hrSystem ON host.id=plugin_hmib_hrSystem.host_id'); - $statuses = array_merge($statuses, array('-2' => array('status' => '-2'))); + $statuses = array_merge($statuses, array('-2' => ['status' => '-2'])); if (cacti_sizeof($statuses)) { foreach($statuses AS $s) { @@ -1829,7 +1831,7 @@ function clearFilter() { $sql_limit = ' LIMIT ' . ($num_rows*(get_request_var('page')-1)) . ',' . $num_rows; $sql_where = ''; - $sql_params = array(); + $sql_params = []; $sql_order = get_order_string(); if (get_request_var('template') != '-1') { @@ -2112,50 +2114,50 @@ function hmib_software() { /* ================= input validation and session storage ================= */ $filters = array( - 'rows' => array( + 'rows' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1' - ), - 'page' => array( + ], + 'page' => [ 'filter' => FILTER_VALIDATE_INT, 'default' => '1' - ), - 'template' => array( + ], + 'template' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), - 'device' => array( + ], + 'device' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), - 'type' => array( + ], + 'type' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), - 'ostype' => array( + ], + 'ostype' => [ 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1', - ), + ], 'filter' => array( 'filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'sort_column' => array( 'filter' => FILTER_CALLBACK, 'default' => 'name', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'sort_direction' => array( 'filter' => FILTER_CALLBACK, 'default' => 'ASC', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ) ); @@ -2332,7 +2334,7 @@ function clearFilter() { $sql_limit = ' LIMIT ' . ($num_rows*(get_request_var('page')-1)) . ',' . $num_rows; $sql_where = ''; - $sql_params = array(); + $sql_params = []; $sql_order = get_order_string(); if (get_request_var('template') != '-1') { @@ -2506,24 +2508,24 @@ function hmib_summary() { 'pageset' => true, 'default' => read_config_option('hmib_top_processes') ), - 'page' => array( + 'page' => [ 'filter' => FILTER_VALIDATE_INT, 'default' => '1' - ), - 'filter' => array( + ], + 'filter' => [ 'filter' => FILTER_DEFAULT, 'pageset' => true, 'default' => '' - ), + ], 'sort_column' => array( 'filter' => FILTER_CALLBACK, 'default' => 'maxCpu', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'sort_direction' => array( 'filter' => FILTER_CALLBACK, 'default' => 'DESC', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ) ); @@ -2569,12 +2571,12 @@ function hmib_summary() { 'sort_column' => array( 'filter' => FILTER_CALLBACK, 'default' => 'upHosts', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ), 'sort_direction' => array( 'filter' => FILTER_CALLBACK, 'default' => 'DESC', - 'options' => array('options' => 'sanitize_search_string') + 'options' => ['options' => 'sanitize_search_string'] ) ); @@ -2888,7 +2890,7 @@ function clearHostFilter() {