diff --git a/auth_profile.php b/auth_profile.php index 6eb05122db..1a2829a367 100644 --- a/auth_profile.php +++ b/auth_profile.php @@ -233,7 +233,7 @@ function settings() { if (is_view_allowed('graph_settings') == true) { if (read_config_option('auth_method') != 0) { - $settings_user['tree']['default_tree_id']['sql'] = get_graph_tree_array(true); + $settings_user['tree']['default_tree_id']['sql'] = get_allowed_trees(false, true); } html_start_box( __('User Settings'), '100%', '', '3', 'center', ''); diff --git a/cacti.sql b/cacti.sql index 9e605fc319..fdc2460e27 100644 --- a/cacti.sql +++ b/cacti.sql @@ -1573,12 +1573,13 @@ CREATE TABLE graph_template_input_defs ( -- CREATE TABLE graph_templates ( - id mediumint(8) unsigned NOT NULL auto_increment, - hash char(32) NOT NULL default '', - name char(255) NOT NULL default '', - PRIMARY KEY (id)) - ENGINE=InnoDB - COMMENT='Contains each graph template name.'; + `id` mediumint(8) unsigned NOT NULL auto_increment, + `hash` char(32) NOT NULL default '', + `name` char(255) NOT NULL default '', + `multiple` char(2) NOT NULL default '', + PRIMARY KEY (`id`), + KEY `multiple_name` (`multiple`, `name`) +) ENGINE=InnoDB COMMENT='Contains each graph template name.'; -- -- Dumping data for table `graph_templates` @@ -2342,7 +2343,8 @@ CREATE TABLE snmp_query_graph ( snmp_query_id mediumint(8) unsigned NOT NULL default '0', name varchar(100) NOT NULL default '', graph_template_id mediumint(8) unsigned NOT NULL default '0', - PRIMARY KEY (id) + PRIMARY KEY (id), + KEY `graph_template_id_name` (`graph_template_id`, `name`) ) ENGINE=InnoDB; -- diff --git a/data_templates.php b/data_templates.php index 318cef74c8..8546b448ca 100644 --- a/data_templates.php +++ b/data_templates.php @@ -247,7 +247,7 @@ function form_save() { /* push out field mappings for the data collector */ /* its important to delete first due to the possibility that * the field names were changed */ - db_execute('DELETE FROM poller_data_template_field_mappings + db_execute_prepared('DELETE FROM poller_data_template_field_mappings WHERE data_template_id = ?', array($data_template_id)); diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 3db7a05e6e..e3e05c1ea9 100644 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -3,6 +3,7 @@ Cacti CHANGELOG 1.1.6 -issue#620: The table poller_data_template_field_mappings can get out of sync when manipulating data templates -issue#622: Can not connect to MySQL over a socket +-issue: List for creating a Graph type shows already added Graph Templates 1.1.5 -issue#580: Data collection warnings when using cmd.php @@ -17,6 +18,8 @@ Cacti CHANGELOG -issue#613: Network Automation, now requires a site or your are unable to save rules -issue#615: Data Input field length too short for longer scripts -issue#619: Export logging option in settings no longer used +-issue#635: Error when saving change to data template +-issue#637: When displaying tree graphs, use the same layout as preview mode 1.1.4 -issue#524: Reporting not working when Tree branch is device diff --git a/graph_templates.php b/graph_templates.php index 1b793c6742..2a1fe513b8 100644 --- a/graph_templates.php +++ b/graph_templates.php @@ -100,9 +100,10 @@ function form_save() { get_filter_request_var('graph_template_graph_id'); /* ==================================================== */ - $save1['id'] = $graph_template_id; - $save1['hash'] = get_hash_graph_template($graph_template_id); - $save1['name'] = form_input_validate(get_nfilter_request_var('name'), 'name', '', false, 3); + $save1['id'] = $graph_template_id; + $save1['hash'] = get_hash_graph_template($graph_template_id); + $save1['name'] = form_input_validate(get_nfilter_request_var('name'), 'name', '', false, 3); + $save1['multiple'] = isset_request_var('multiple') ? 'on':''; $save2['id'] = get_nfilter_request_var('graph_template_graph_id'); $save2['local_graph_template_graph_id'] = 0; diff --git a/graphs_new.php b/graphs_new.php index d5f830227b..0ca5f700aa 100644 --- a/graphs_new.php +++ b/graphs_new.php @@ -535,9 +535,9 @@ function graphs() { array($host['id'])); if (sizeof($snmp_queries) > 0) { - foreach ($snmp_queries as $query) { - print "\n"; - } + foreach ($snmp_queries as $query) { + print "\n"; + } } ?> @@ -618,15 +618,6 @@ function graphs() { \n \n"; - $graph_templates = db_fetch_assoc_prepared('SELECT - gt.id AS graph_template_id, - gt.name AS graph_template_name - FROM host_graph AS hg - INNER JOIN graph_templates AS gt - ON hg.graph_template_id=gt.id - WHERE hg.host_id = ? - ORDER BY gt.name', array(get_request_var('host_id'))); - if (!isempty_request_var('host_id')) { $template_graphs = db_fetch_assoc_prepared('SELECT gl.graph_template_id @@ -651,6 +642,17 @@ function graphs() { } } + $graph_templates = db_fetch_assoc_prepared('SELECT + gt.id AS graph_template_id, + gt.name AS graph_template_name + FROM host_graph AS hg + INNER JOIN graph_templates AS gt + ON hg.graph_template_id=gt.id + WHERE hg.host_id = ? + ORDER BY gt.name', + array(get_request_var('host_id')) + ); + /* create a row for each graph template associated with the host template */ if (sizeof($graph_templates)) { foreach ($graph_templates as $graph_template) { @@ -671,11 +673,21 @@ function graphs() { html_start_box('', '100%', '', '3', 'center', ''); - $available_graph_templates = db_fetch_assoc('SELECT - graph_templates.id, graph_templates.name - FROM snmp_query_graph RIGHT JOIN graph_templates - ON (snmp_query_graph.graph_template_id = graph_templates.id) - WHERE (((snmp_query_graph.name) Is Null)) ORDER BY graph_templates.name'); + $available_graph_templates = db_fetch_assoc_prepared(' + ( + SELECT graph_templates.id, graph_templates.name + FROM graph_templates + LEFT JOIN snmp_query_graph + ON snmp_query_graph.graph_template_id = graph_templates.id + WHERE snmp_query_graph.name IS NULL + AND graph_templates.id NOT IN (SELECT graph_template_id FROM host_graph WHERE host_id = ?) + AND graph_templates.multiple = "" + ) UNION ( + SELECT id, name FROM graph_templates WHERE multiple = "on" + ) + ORDER BY name', + array(get_request_var('host_id')) + ); /* create a row at the bottom that lets the user create any graph they choose */ print " @@ -756,8 +768,8 @@ function graphs() { $cg_ctr = 0; if (sizeof($created_graphs)) { foreach ($created_graphs as $created_graph) { - $script .= (($cg_ctr > 0) ? ',' : '') . "'" . encode_data_query_index($created_graph['snmp_index']) . "'"; - $cg_ctr++; + $script .= ($cg_ctr > 0 ? ',' : '') . "'" . encode_data_query_index($created_graph['snmp_index']) . "'"; + ++$cg_ctr; } } @@ -769,9 +781,6 @@ function graphs() { if ($xml_array != false) { $html_dq_header = ''; - $snmp_query_indexes = array(); - - reset($xml_array['fields']); /* if there is a where clause, get the matching snmp_indexes */ $sql_where = ''; diff --git a/include/global.php b/include/global.php index 2669d3d189..c4f5b07d75 100644 --- a/include/global.php +++ b/include/global.php @@ -348,5 +348,5 @@ if ($is_web) { api_plugin_hook('config_insert'); /* current cacti version */ -$config['cacti_version'] = '1.1.5'; +$config['cacti_version'] = '1.1.6'; diff --git a/include/global_arrays.php b/include/global_arrays.php index efbc461842..d5fc366dcd 100644 --- a/include/global_arrays.php +++ b/include/global_arrays.php @@ -965,6 +965,7 @@ $hash_version_codes = array( '1.1.3' => '0100', '1.1.4' => '0100', '1.1.5' => '0100', + '1.1.6' => '0101', ); $hash_type_names = array( diff --git a/include/global_form.php b/include/global_form.php index 3f5c157805..6deb78e5e8 100644 --- a/include/global_form.php +++ b/include/global_form.php @@ -933,6 +933,14 @@ $fields_graph_template_template_edit = array( 'max_length' => '150', 'size' => '80' ), + 'multiple' => array( + 'method' => 'checkbox', + 'friendly_name' => __('Multiple Instances'), + 'description' => __('Check this checkbox if there can be more than one Graph of this type per Device.'), + 'value' => '|arg1:multiple|', + 'default' => '', + 'form_id' => false + ), 'graph_template_id' => array( 'method' => 'hidden_zero', 'value' => '|arg2:graph_template_id|' @@ -1531,6 +1539,11 @@ $fields_user_user_edit_host = array( ); $export_types = array( + 'host_template' => array( + 'name' => __('Device Template'), + 'title_sql' => 'SELECT name FROM host_template WHERE id=|id|', + 'dropdown_sql' => 'SELECT id,name FROM host_template ORDER BY name' + ), 'graph_template' => array( 'name' => __('Graph Template'), 'title_sql' => 'SELECT name FROM graph_templates WHERE id=|id|', @@ -1541,15 +1554,25 @@ $export_types = array( 'title_sql' => 'SELECT name FROM data_template WHERE id=|id|', 'dropdown_sql' => 'SELECT id,name FROM data_template ORDER BY name' ), - 'host_template' => array( - 'name' => __('Device Template'), - 'title_sql' => 'SELECT name FROM host_template WHERE id=|id|', - 'dropdown_sql' => 'SELECT id,name FROM host_template ORDER BY name' - ), 'data_query' => array( 'name' => __('Data Query'), 'title_sql' => 'SELECT name FROM snmp_query WHERE id=|id|', 'dropdown_sql' => 'SELECT id,name FROM snmp_query ORDER BY name' + ), + 'automation_devices' => array( + 'name' => __('Discovery Rules'), + 'title_sql' => 'SELECT CONCAT(ht.name, " (", at.sysDescr, ")") AS name FROM automation_templates AS at INNER JOIN host_template AS ht ON ht.id=at.host_template WHERE at.id=|id|', + 'dropdown_sql' => 'SELECT at.id, CONCAT(ht.name, " (", at.sysDescr, ")") AS name FROM automation_templates AS at INNER JOIN host_template AS ht ON ht.id=at.host_template ORDER BY name' + ), + 'automation_graphs' => array( + 'name' => __('Graph Rules'), + 'title_sql' => 'SELECT name FROM automation_graph_rules WHERE id=|id|', + 'dropdown_sql' => 'SELECT id, name FROM automation_graph_rules ORDER BY name' + ), + 'automation_trees' => array( + 'name' => __('Tree Rules'), + 'title_sql' => 'SELECT name FROM automation_tree_rules WHERE id=|id|', + 'dropdown_sql' => 'SELECT id, name FROM automation_tree_rules ORDER BY name' ) ); diff --git a/include/layout.js b/include/layout.js index 64bba41063..166c56b237 100644 --- a/include/layout.js +++ b/include/layout.js @@ -44,6 +44,9 @@ var columnsHidden = 0; var lastColumnsHidden = {}; var lastWidth = {}; var lastMain = 0; +var resizeDelta = 100; +var resizeTime = 0; +var resizeTimeout = false; var isMobile = { Android: function() { @@ -589,7 +592,7 @@ function applySkin() { }); $.when.apply(this, showPage).done(function() { - responsiveMenu(null); + responsiveUI(null); }); } @@ -621,15 +624,33 @@ function setupResponsiveMenuAndTabs() { }); $(window).resize(function(event) { - responsiveMenu(event); + resizeTime = new Date(); + myEvent = event; + if (resizeTimeout === false) { + resizeTimeout = true; + setTimeout(function() { + responsiveUI(myEvent); + }, resizeDelta); + } }); $(window).on('orientationchange', function() { - responsiveMenu(null); + responsiveUI(null); }); } -function responsiveMenu(event) { +function responsiveUI(event) { + if (new Date() - resizeTime < resizeDelta) { + myEvent = event; + setTimeout(function() { + responsiveUI(myEvent); + }, resizeDelta); + + return false; + } else { + resizeTimeout = false; + } + if ($('.cactiTreeNavigationArea').length > 0) { tree = true; }else{ @@ -646,7 +667,7 @@ function responsiveMenu(event) { mainWidth = $('#main').width(); } - if ($(window).width() < 780) { + if ($(window).width() < 640) { menuHide(tree); menuHideResponsive = true; }else if (menuHideResponsive == true) { @@ -662,6 +683,33 @@ function responsiveMenu(event) { menuShow(tree); } + mainWidth = $('#main').width(); + + /* change textbox and textarea widths */ + if (event != null) { + $('input[type="text"], textarea').each(function() { + //console.log('Main:'+mainWidth+', Element:'+$(this).attr('id')+', Width:'+$(this).width()); + + if ($(this).attr('type') == 'text') { + offset = 20; + }else{ + offset = 5; + } + + if (mainWidth != 100) { + if ($(this).width() > mainWidth) { + $(this).css('max-width', (mainWidth - offset)+'px'); + }else{ + $(this).css('max-width', ''); + } + + if ($(this).width() > mainWidth) { + $(this).css('max-width', (mainWidth - offset)+'px'); + } + } + }); + } + if (event != null && !$(event.target).hasClass('ui-resizable')) { height = Math.max(document.body.scrollHeight, $(window).height()); if (tree) { @@ -718,7 +766,7 @@ function tuneTable(object, width) { minColumns = 2; } - $($(object).find('th').get().reverse()).each(function() { + $($(object).find('th').not('.noHide').get().reverse()).each(function() { if (!$(this).hasClass('tableSubHeaderCheckbox') && $(this).is(':visible')) { reducedWidth += parseInt($(this).width()); $('#'+id+' th:nth-child('+column+')').hide(); @@ -991,13 +1039,13 @@ function setupCollapsible() { id=$(this).attr('id')+'_cs'; if ($(this).find('i').hasClass('fa-angle-double-up')) { $(this).addClass('collapsed'); - $(this).nextUntil('tr.spacer').slideUp('slow'); + $(this).nextUntil('div.spacer').slideUp('slow'); $(this).find('i').removeClass('fa-angle-double-up').addClass('fa-angle-double-down'); storage.set(id, 'hide'); }else{ $(this).removeClass('collapsed'); - $(this).nextUntil('tr.spacer').slideDown('slow'); - $(this).nextUntil('tr.spacer').each(function(data) { + $(this).nextUntil('div.spacer').slideDown('slow'); + $(this).nextUntil('div.spacer').each(function(data) { $(this).find('input, select').change(); }); $(this).find('i').removeClass('fa-angle-double-down').addClass('fa-angle-double-up'); @@ -1280,7 +1328,7 @@ $(function() { }); } - responsiveMenu(null); + responsiveUI(null); }); /* Graph related javascript functions */ diff --git a/include/themes/classic/main.css b/include/themes/classic/main.css index 3d1629b2a4..c605cd8405 100755 --- a/include/themes/classic/main.css +++ b/include/themes/classic/main.css @@ -11,6 +11,15 @@ body, table, tr, td, textarea { font-size: 10px; } +textarea { + padding: 5px; + width: 400px; + height: 100px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + body { background-color: #ffffff; background-repeat: repeat-y; @@ -23,7 +32,7 @@ table { } td, th, select { - padding: 2px; + padding: 0px; margin: 0px; } @@ -62,6 +71,17 @@ th .fa { height: 100%; } +input { + padding: 0.4em; + font-size: 12px; + max-width: 400px; +} + +select { + padding: 0.5em 0.5em 0.5em 0.5em; + font-size: 12px; +} + tr.selected { background-color: khaki; } @@ -84,6 +104,8 @@ label { .center { text-align:center !important; + margin-left:auto; + margin-right:auto; } .usermenudown { @@ -146,6 +168,10 @@ label { } .running { + color:orange; +} + +.errored { color:red; font-weight:bold; } @@ -646,6 +672,7 @@ ul#breadcrumbs { } .cactiContent { + clear: both; width: 100%; height: 100%; vertical-align: top; @@ -790,7 +817,7 @@ legend { float: right; margin-top: 1px; margin-left: 3px; - display: table-cell; + display: table-column; } .actionsDropdownArrow { @@ -999,7 +1026,7 @@ legend { text-align: left; padding: 2px 0px; height: 16px; - display: table-cell; + display: table-column; width: 90%; background-color: #00438c; } @@ -1008,7 +1035,7 @@ legend { float: right; padding: 2px 0px; height: 16px; - display: table-cell; + display: table-column; text-align: right; width: 10%; background-color: #00438c; @@ -1030,13 +1057,131 @@ legend { .filterTable td:first-child { width:55px; + min-width:55px; } -.formItemDescription { +.filterTable td { + padding: 2px; } -.formItemName { +.formRow { + display: table; + width: 100%; + line-height: 30px; +} + +.formColumn { + float: left; + display: table-column; +} + +.formColumnLeft { + float: left; + display: table-column; + padding-left: 4px; + width: 28%; +} + +.formColumnRight { + float: left; + display: table-column; + width: 70%; +} + +.formData { + display: inline-block; + float: left; +} + +.formFieldName { + display: inline-block; + color: #444; + float: left; + text-align: left; + white-space: nowrap; +} + +.formFieldDescription { + float: left; + text-align: left; +} + +.formTooltip { + display: inline-block; + padding-left: 4px; +} + +.formHeader { + float: left; + width: 100%; + text-align: left; + line-height: 20px; + color: #ffffff; font-weight:bold; + cursor: pointer; + vertical-align:middle; + text-align:left; + border-right: 1px groove #efefef; + font-size:11px; + background-color: #6d88ad !important; +} + +.formHeaderText { + padding-left: 3px; +} + +.formHeaderAnchor { + float:right; + padding-right:4px; +} + +.hostInfoHeader { + width: 100%; +} + +@media screen and (max-width: 640px) { + .formRow { + display: table; + width: 100%; + line-height: 30px; + } + + .formColumn { + float: left; + display: table-row; + } + + .formColumnLeft { + float: left; + display: table-row; + width: 100%; + } + + .formColumnRight { + float: left; + display: table-row; + width: 100%; +} + + .formFieldName { + color: #444; + float: left; + text-align: left; + white-space: nowrap; + } + + .formData { + float: left; + } + + .hostInfoHeader { + overflow: hidden; + } + + .queryAdd, .templateAdd, .navBar, #ping_results { + display: none; +} + } .graphItem { @@ -1106,6 +1251,7 @@ legend { vertical-align:middle; text-align:left; cursor:pointer; + padding-left: 3px; } .graphSubHeaderColumn { @@ -1318,7 +1464,7 @@ legend { float:left !important; padding:5px 4px; text-decoration:none; - font-size: 11px; + font-size: 9px; border-color: #999 #666 !important; border-style: solid solid none; border-width: 1px 1px medium; @@ -1329,6 +1475,9 @@ div#tabs { padding-bottom: 0px; float: left; vertical-align: bottom; + height: 38px; + overflow: hidden; + width: 60%; } td#tabs { @@ -1347,6 +1496,8 @@ div#gtabs { padding-bottom: 0px; vertical-align: bottom; float:right; + height: 38px; + overflow: hidden; } .tabs { diff --git a/include/themes/dark/main.css b/include/themes/dark/main.css index dd0e102706..a45b818f26 100644 --- a/include/themes/dark/main.css +++ b/include/themes/dark/main.css @@ -19,12 +19,12 @@ html, body { height: 100%; width: 100%; margin: 0px; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } body { background: #161616 none repeat scroll 0 0; color: #bbbfc2; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 12px; } @@ -40,6 +40,11 @@ textarea { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1.0em; padding: 5px; + width: 400px; + height: 100px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } table { @@ -49,7 +54,7 @@ table { } td, th { - padding: 2px; + padding: 0px; margin: 0px; } @@ -96,7 +101,13 @@ th i.fa { z-index: 3; } -input, select { +input { + padding: 0.5em 0.5em 0.5em 0.5em; + font-size: 12px; + max-width: 400px; +} + +select { padding: 0.5em 0.5em 0.5em 0.5em; font-size: 12px; } @@ -1131,6 +1142,7 @@ legend { color: snow; font-weight: normal; padding: 2px; + white-space: nowrap; } .cactiTable { @@ -1156,6 +1168,10 @@ legend { background: linear-gradient(to bottom, #252426 0%, #0C0D0D 100%); } +.cactiTableTitle span { + padding-left: 3px; +} + .cactiTableButton { float: right; padding: 5px 0px; @@ -1184,11 +1200,119 @@ legend { min-width:55px; } -.formItemDescription { +.filterTable td { + padding: 2px; } -.formItemName { - color:snow; +.formRow { + display: table; + width: 100%; + line-height: 35px; +} + +.formColumn { + float: left; + display: table-column; +} + +.formColumnLeft { + float: left; + display: table-column; + width: 30%; +} + +.formColumnRight { + float: left; + display: table-column; + width: 70%; +} + +.formData { + display: inline-block; + float: left; +} + +.formFieldName { + display: inline-block; + color: snow; + float: left; + text-align: left; + white-space: nowrap; + padding-left: 3px; +} + +.formFieldDescription { + float: left; + text-align: left; +} + +.formTooltip { + display: inline-block; +} + +.formHeader { + float: left; + width: 100%; + text-align: left; + line-height: 25px; + background: -moz-linear-gradient(top, #45484d 0%, #000000 100%); /* FF3.6+ */ + background: -webkit-linear-gradient(top, #45484d 0%,#000000 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #45484d 0%,#000000 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #45484d 0%,#000000 100%); /* IE10+ */ +} + +.formHeaderAnchor { + float:right; + padding-right:4px; +} + +.hostInfoHeader { + width: 100%; +} + +@media screen and (max-width: 640px) { + .formRow { + display: table; + width: 100%; + line-height: 30px; + } + + .formColumn { + float: left; + display: table-row; + } + + .formColumnLeft { + float: left; + display: table-row; + width: 100%; + } + + .formColumnRight { + float: left; + display: table-row; + width: 100%; + } + + .formFieldName { + color: snow; + float: left; + text-align: left; + white-space: nowrap; + padding-left: 3px; + } + + .formData { + float: left; + } + + .hostInfoHeader { + overflow: hidden; + } + + .queryAdd, .templateAdd, .navBar, #ping_results { + display: none; + } } .graphItem { @@ -1271,6 +1395,7 @@ th.secondarySort { vertical-align:middle; text-align:left; cursor:pointer; + padding-left: 3px; } .graphSubHeaderColumn { @@ -1540,6 +1665,7 @@ div#tabs { vertical-align: bottom; position: fixed; top: 5px; + width: 70%; } td#tabs { @@ -1566,6 +1692,11 @@ div#gtabs { height: 30px; } +.maintabs { + overflow: hidden; + height: 25px; +} + .tabs a, .maintabs a { -moz-border-radius:5px 5px 0 0; border-radius:5px 5px 0 0; @@ -1764,6 +1895,10 @@ ul#nav { border: transparent; } +.ui-button-text-only .ui-button-text { + padding: 0.4em; +} + div.preformatted { color: snow !important; font-size: 11px !important; diff --git a/include/themes/dark/main.js b/include/themes/dark/main.js index 1666f92f52..de1dbb914c 100644 --- a/include/themes/dark/main.js +++ b/include/themes/dark/main.js @@ -82,6 +82,8 @@ function themeReady() { $('.import_text').html(fileText); } + maxWidth = 280; + $('select').each(function() { if ($(this).prop('multiple') != true) { $(this).selectmenu({ @@ -104,7 +106,12 @@ function themeReady() { }); minWidth+=80; - $('#'+id+'-button').css('min-width', minWidth+'px').css('max-width', '400px').css('width',''); + + if (minWidth > maxWidth) { + minWidth = maxWidth; + } + + $('#'+id+'-button').css('min-width', minWidth+'px').css('max-width', maxWidth+'px').css('width',''); $('#'+id+'-menu').css('max-height', '250px'); }); }else{ diff --git a/include/themes/modern/main.css b/include/themes/modern/main.css index 00f1255c85..f3c59b19d4 100755 --- a/include/themes/modern/main.css +++ b/include/themes/modern/main.css @@ -1,5 +1,20 @@ /* main styles */ +::-webkit-scrollbar { + width: 8px; +} + +::-webkit-scrollbar-track { + -webkit-box-shadow: inset 0 0 6px rgba(22,22,6,0.7); + border-radius: 6px; +} + +::-webkit-scrollbar-thumb { + border-radius: 6px; + background: rgba(49,68,43,0.8); + -webkit-box-shadow: inset 0 0 4px rgba(49,68,43,0.5); +} + html, body { height: 100%; width: 100%; @@ -14,6 +29,15 @@ body, table, tr, td, textarea { color: #000000; } +textarea { + padding: 5px; + width: 400px; + height: 100px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + body { background-color: snow; background-repeat: repeat-y; @@ -26,7 +50,7 @@ table { } td, th { - padding: 2px; + padding: 0px; margin: 0px; } @@ -35,6 +59,16 @@ img { vertical-align:middle; } +fieldset { + border: none; + padding: 0px; + margin: 0px; +} + +.reindex_methods span { + font-size: 9px; +} + /* links */ a, a:active, a:visited { @@ -62,8 +96,15 @@ th i.fa { z-index: 3; } -input, select { - padding: 0.4em 0.4em 0.4em 0.4em; +input { + padding: 0.4em; + font-size: 12px; + max-width: 400px; +} + +select { + padding: 0.5em 0.5em 0.5em 0.5em; + font-size: 12px; } *:focus { @@ -74,15 +115,6 @@ label { white-space:nowrap; } -fieldset { - border: none; - padding: 0px; - margin: 0px; -} - -.reindex_methods span { - font-size: 9px; -} .nowrap { white-space:nowrap; @@ -102,6 +134,8 @@ fieldset { .center { text-align:center !important; + margin-left:auto; + margin-right:auto; } .usermenudown { @@ -170,6 +204,10 @@ fieldset { } .running { + color:orange; +} + +.errored { color:red; } @@ -708,6 +746,7 @@ ul#breadcrumbs { } .cactiContent { + clear: both; width: 100%; vertical-align: top; padding-top: 56px; @@ -1080,7 +1119,6 @@ legend { background: -o-linear-gradient(top, rgba(76,76,76,1) 0%, rgba(89,89,89,1) 12%, rgba(102,102,102,1) 25%, rgba(71,71,71,1) 39%, rgba(44,44,44,1) 50%, rgba(0,0,0,1) 51%, rgba(17,17,17,1) 60%, rgba(43,43,43,1) 76%, rgba(28,28,28,1) 91%, rgba(19,19,19,1) 100%); background: -ms-linear-gradient(top, rgba(76,76,76,1) 0%, rgba(89,89,89,1) 12%, rgba(102,102,102,1) 25%, rgba(71,71,71,1) 39%, rgba(44,44,44,1) 50%, rgba(0,0,0,1) 51%, rgba(17,17,17,1) 60%, rgba(43,43,43,1) 76%, rgba(28,28,28,1) 91%, rgba(19,19,19,1) 100%); background: linear-gradient(to bottom, rgba(76,76,76,1) 0%, rgba(89,89,89,1) 12%, rgba(102,102,102,1) 25%, rgba(71,71,71,1) 39%, rgba(44,44,44,1) 50%, rgba(0,0,0,1) 51%, rgba(17,17,17,1) 60%, rgba(43,43,43,1) 76%, rgba(28,28,28,1) 91%, rgba(19,19,19,1) 100%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4c4c4c', endColorstr='#131313', GradientType=0 ); } .templateHeader td { @@ -1169,13 +1207,128 @@ legend { .filterTable td:first-child { width:55px; + min-width:55px; } -.formItemDescription { +.filterTable td { + padding: 2px; } -.formItemName { - font-weight:normal; +.formRow { + display: table; + width: 100%; + line-height: 30px; +} + +.formColumn { + float: left; + display: table-column; +} + +.formColumnLeft { + float: left; + display: table-column; + width: 30%; +} + +.formColumnRight { + float: left; + display: table-column; + width: 70%; +} + +.formData { + display: inline-block; + float: left; +} + +.formFieldName { + display: inline-block; + color: #444; + float: left; + text-align: left; + white-space: nowrap; + padding-left: 3px; +} + +.formFieldDescription { + float: left; + text-align: left; +} + +.formTooltip { + display: inline-block; + padding-left: 4px; +} + +.formHeader { + float: left; + width: 100%; + text-align: left; + line-height: 20px; + background: rgba(138,179,105,1); + background: -moz-linear-gradient(top, rgba(138,179,105,1) 0%, rgba(63,117,15,1) 100%); + background: -webkit-linear-gradient(top, rgba(138,179,105,1) 0%, rgba(63,117,15,1) 100%); + background: -o-linear-gradient(top, rgba(138,179,105,1) 0%, rgba(63,117,15,1) 100%); + background: -ms-linear-gradient(top, rgba(138,179,105,1) 0%, rgba(63,117,15,1) 100%); +} + +.formHeaderText { + padding-left: 3px; +} + +.formHeaderAnchor { + float:right; + padding-right:4px; +} + +.hostInfoHeader { + width: 100%; +} + +@media screen and (max-width: 640px) { + .formRow { + display: table; + width: 100%; + line-height: 30px; + } + + .formColumn { + float: left; + display: table-row; + } + + .formColumnLeft { + float: left; + display: table-row; + width: 100%; + } + + .formColumnRight { + float: left; + display: table-row; + width: 100%; + } + + .formFieldName { + color: #444; + float: left; + text-align: left; + white-space: nowrap; + padding-left: 3px; + } + + .formData { + float: left; + } + + .hostInfoHeader { + overflow: hidden; + } + + .queryAdd, .templateAdd, .navBar, #ping_results { + display: none; + } } .graphItem { @@ -1278,7 +1431,7 @@ th.secondarySort { background: linear-gradient(to bottom, rgba(138,179,105,1) 0%, rgba(63,117,15,1) 100%); } -.formRow { +.tableRow { line-height: 20px; } @@ -1567,6 +1720,11 @@ div#gtabs { height: 30px; } +.maintabs { + overflow: hidden; + height: 25px; +} + .tabs a, .maintabs a { -moz-border-radius:5px 5px 0 0; border-radius:5px 5px 0 0; @@ -1790,6 +1948,10 @@ ul#nav { border: transparent; } +.ui-button-text-only .ui-button-text { + padding: 0.4em; +} + div.preformatted { font-family: monospace; white-space: pre; diff --git a/include/themes/modern/main.js b/include/themes/modern/main.js index fda795a3e8..e8d0c5ba36 100644 --- a/include/themes/modern/main.js +++ b/include/themes/modern/main.js @@ -73,6 +73,8 @@ function themeReady() { $('.import_text').html(fileText); } + maxWidth = 280; + $('select').each(function() { if ($(this).prop('multiple') != true) { $(this).selectmenu({ @@ -95,7 +97,12 @@ function themeReady() { }); minWidth+=80; - $('#'+id+'-button').css('min-width', minWidth+'px').css('max-width', '400px').css('width',''); + + if (minWidth > maxWidth) { + minWidth = maxWidth; + } + + $('#'+id+'-button').css('min-width', minWidth+'px').css('max-width', maxWidth+'px').css('width',''); $('#'+id+'-menu').css('max-height', '250px'); }); }else{ diff --git a/include/themes/paper-plane/main.css b/include/themes/paper-plane/main.css index 49f5290ead..8daa92e201 100644 --- a/include/themes/paper-plane/main.css +++ b/include/themes/paper-plane/main.css @@ -36,6 +36,16 @@ img { vertical-align:middle; } +fieldset { + border: none; + padding: 0px; + margin: 0px; +} + +.reindex_methods span { + font-size: 9px; +} + /* links */ a, a:active, a:visited { @@ -91,15 +101,6 @@ label { white-space:nowrap; } -fieldset { - border: none; - padding: 0px; - margin: 0px; -} - -.reindex_methods span { - font-size: 9px; -} .nowrap { white-space:nowrap; @@ -502,7 +503,7 @@ fieldset { border: none; } -.odd.formRow{ +.odd.tableRow{ color: #000000; background: none repeat scroll 0 0 #fbfdff; } @@ -511,7 +512,7 @@ fieldset { border: none; } -.even.formRow{ +.even.tableRow{ color: #000000; background: none repeat scroll 0 0 #FFFFFF; } @@ -522,12 +523,12 @@ fieldset { #box-shadow: 0 0 1px rgba(0, 0, 0, 0.1); } -.even-alternate.formRow{ +.even-alternate.tableRow{ color: #000000; background: none repeat scroll 0 0 #FFFFFF; } -.formRow { +.tableRow { padding: 4px 5px !important; } @@ -996,11 +997,11 @@ legend { background: none !important; } -#graph_view_preview2 .formRow{ +#graph_view_preview2 .tableRow{ background: none !important; } -#graph_view_tree_content2 .formRow{ +#graph_view_tree_content2 .tableRow{ background: none !important; } @@ -1183,13 +1184,125 @@ table.cactiTable { .filterTable td:first-child { width:55px; + min-width:55px; } -.formItemDescription { +.filterTable td { + padding: 2px; } -.formItemName { - font-weight:bold; +.formRow { + display: table; + width: 100%; + line-height: 35px; +} + +.formColumn { + float: left; + display: table-column; +} + +.formColumnLeft { + float: left; + display: table-column; + width: 30%; +} + +.formColumnRight { + float: left; + display: table-column; + width: 70%; +} + +.formData { + display: inline-block; + float: left; +} + +.formFieldName { + display: inline-block; + color: snow; + float: left; + text-align: left; + white-space: nowrap; + padding-left: 3px; +} + +.formFieldDescription { + float: left; + text-align: left; +} + +.formTooltip { + display: inline-block; +} + +.formHeader { + float: left; + width: 100%; + text-align: left; + line-height: 25px; + text-transform: none; + background-image: -webkit-linear-gradient(top, #3a3b3c 0%, #100000 100%); + background-image: -moz-linear-gradient(top, #3a3b3c 0%, #100000 100%); + background-image: linear-gradient(to bottom, #3a3b3c 0%, #100000 100%); + background-repeat: repeat-x; + border-bottom: 1px solid #000; +} + +.formHeaderAnchor { + float:right; + padding-right:4px; +} + +.hostInfoHeader { + width: 100%; +} + +@media screen and (max-width: 640px) { + .formRow { + display: table; + width: 100%; + line-height: 30px; + } + + .formColumn { + float: left; + display: table-row; + } + + .formColumnLeft { + float: left; + display: table-row; + width: 100%; + } + + .formColumnRight { + float: left; + display: table-row; + width: 100%; + } + + .formFieldName { + color: snow; + color: #000000; + float: left; + text-align: left; + white-space: nowrap; + padding-left: 3px; + } + + .formData { + float: left; + } + + .hostInfoHeader { + overflow: hidden; + } + + .queryAdd, .templateAdd, .navBar, #ping_results { + display: none; + } } .graphItem { @@ -1593,8 +1706,9 @@ div#gtabs { .maintabs { line-height: 32px; float: left; - width:50%; - overflow:hidden; + width: 50%; + overflow: hidden; + height: 32px; } .maintabs a { @@ -2012,4 +2126,4 @@ tr#realtime td:first-child { .hostInfoHeader { background: none repeat scroll 0 0 #fbfdff; -} \ No newline at end of file +} diff --git a/include/themes/paw/jquery-ui.css b/include/themes/paw/jquery-ui.css index 275d9e1967..9df62f879c 100644 --- a/include/themes/paw/jquery-ui.css +++ b/include/themes/paw/jquery-ui.css @@ -637,6 +637,7 @@ button.ui-button::-moz-focus-inner { position: relative; text-decoration: none; cursor: pointer; + vertical-align: middle; } .ui-selectmenu-button span.ui-icon { right: 0.5em; diff --git a/include/themes/paw/main.css b/include/themes/paw/main.css index 6c913bdadc..5735712030 100644 --- a/include/themes/paw/main.css +++ b/include/themes/paw/main.css @@ -14,6 +14,17 @@ body { overflow: hidden; } +textarea { + font-family: 'Segoe UI', 'Segoe UI Web Regular', 'Segoe UI Symbol', 'Helvetica Neue', 'BBAlpha Sans', 'S60 Sans', Arial, sans-serif; + font-size: 1.0em; + padding: 5px; + width: 400px; + height: 100px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + table { border-collapse: collapse; border-spacing: 0; border: none; @@ -21,7 +32,7 @@ table { } td, th { - padding: 2px; + padding: 0px; margin: 0px; } @@ -34,6 +45,16 @@ img { vertical-align:middle; } +fieldset { + border: none; + padding: 0px; + margin: 0px; +} + +.reindex_methods span { + font-size: 9px; +} + /* links */ a, a:active, a:visited { @@ -69,15 +90,6 @@ label { white-space:nowrap; } -fieldset { - border: none; - padding: 0px; - margin: 0px; -} - -.reindex_methods span { - font-size: 9px; -} .nowrap { white-space:nowrap; @@ -1026,13 +1038,122 @@ legend { .filterTable td:first-child { width:55px; + min-width:55px; } -.formItemDescription { +.filterTable td { + padding: 2px; } -.formItemName { - font-weight:bold; +.formRow { + display: table; + width: 100%; + line-height: 40px; +} + +.formColumn { + float: left; + display: table-column; +} + +.formColumnLeft { + float: left; + display: table-column; + width: 30%; +} + +.formColumnRight { + float: left; + display: table-column; + width: 70%; +} + +.formData { + display: inline-block; + float: left; +} + +.formFieldName { + display: inline-block; + color: #000000; + float: left; + text-align: left; + white-space: nowrap; + padding-left: 3px; +} + +.formFieldDescription { + float: left; + text-align: left; +} + +.formTooltip { + display: inline-block; +} + +.formHeader { + float: left; + width: 100%; + text-align: left; + line-height: 25px; + +} + +.formHeaderAnchor { + float:right; + padding-right:4px; +} + +.hostInfoHeader { + width: 100%; +} + +@media screen and (max-width: 640px) { + .formRow { + display: table; + width: 100%; + line-height: 30px; + } + + .formColumn { + float: left; + display: table-row; + color: #000000; + } + + .formColumnLeft { + float: left; + display: table-row; + width: 100%; + color: #000000; + } + + .formColumnRight { + float: left; + display: table-row; + width: 100%; + color: #000000; + } + + .formFieldName { + color: snow; + float: left; + text-align: left; + white-space: nowrap; + padding-left: 3px; + } + + .formData { + float: left; +} + + .hostInfoHeader { + overflow: hidden; + } + + .queryAdd, .templateAdd, .navBar, #ping_results { + display: none; + } } .graphItem { diff --git a/install/0_8_8h_to_1_0_0.php b/install/0_8_8h_to_1_0_0.php index fb282d2a7d..68f8eb738b 100644 --- a/install/0_8_8h_to_1_0_0.php +++ b/install/0_8_8h_to_1_0_0.php @@ -1251,9 +1251,8 @@ function upgrade_to_1_0_0() { db_install_add_column ('colors', array('name' => 'name', 'type' => 'varchar(40)', 'default' => '', 'after' => 'id')); db_install_add_column ('colors', array('name' => 'read_only', 'type' => 'char(2)', 'default' => '', 'after' => 'hex')); - if (file_exists(dirname(__FILE__) . '/import_colors.php')) { - shell_exec('php -q ' . dirname(__FILE__) . '/import_colors.php'); - } + // import remaining colors into database + import_colors(); db_install_execute("ALTER TABLE settings MODIFY COLUMN value varchar(2048) NOT NULL default ''"); if (db_table_exists('settings_graphs', false)) { diff --git a/install/1_1_4_to_1_1_5.php b/install/1_1_4_to_1_1_5.php index d3d0357d83..dbfb2d7218 100644 --- a/install/1_1_4_to_1_1_5.php +++ b/install/1_1_4_to_1_1_5.php @@ -23,5 +23,5 @@ */ function upgrade_to_1_1_5() { - db_install_execute('ALTER TABLE data_input MODIFY COLUMN input_string varchar(512) default NULL'); + //Queries failed in upgrade to 1.1.5 -> Moved to 1.1.6 } diff --git a/install/1_1_5_to_1_1_6.php b/install/1_1_5_to_1_1_6.php new file mode 100644 index 0000000000..94758bd13d --- /dev/null +++ b/install/1_1_5_to_1_1_6.php @@ -0,0 +1,48 @@ +', $graph_template_graph['title'], $graph_title); }elseif (!empty($_graph_template_id)) { - $graph_template = db_fetch_row_prepared('SELECT * FROM graph_templates WHERE id = ?', array($_graph_template_id)); - $graph_template_graph = db_fetch_row_prepared('SELECT * FROM graph_templates_graph WHERE graph_template_id = ? AND local_graph_id=0', array($_graph_template_id)); + $graph_template = db_fetch_row_prepared('SELECT * + FROM graph_templates + WHERE id = ?', + array($_graph_template_id)); - $graph_template_items = db_fetch_assoc_prepared('SELECT * FROM graph_templates_item WHERE graph_template_id = ? AND local_graph_id=0', array($_graph_template_id)); - $graph_template_inputs = db_fetch_assoc_prepared('SELECT * FROM graph_template_input WHERE graph_template_id = ?', array($_graph_template_id)); + $graph_template_graph = db_fetch_row_prepared('SELECT * + FROM graph_templates_graph + WHERE graph_template_id = ? + AND local_graph_id=0', + array($_graph_template_id)); + + $graph_template_items = db_fetch_assoc_prepared('SELECT * + FROM graph_templates_item + WHERE graph_template_id = ? + AND local_graph_id=0', + array($_graph_template_id)); + + $graph_template_inputs = db_fetch_assoc_prepared('SELECT * + FROM graph_template_input + WHERE graph_template_id = ?', + array($_graph_template_id)); /* create new entry: graph_templates */ - $save['id'] = 0; - $save['hash'] = get_hash_graph_template(0); - $save['name'] = str_replace('', $graph_template['name'], $graph_title); + $save['id'] = 0; + $save['hash'] = get_hash_graph_template(0); + $save['name'] = str_replace('', $graph_template['name'], $graph_title); + $save['multiple'] = $graph_template['multiple']; $graph_template_id = sql_save($save, 'graph_templates'); } diff --git a/lib/auth.php b/lib/auth.php index 01e0a23b86..52cbe4f813 100644 --- a/lib/auth.php +++ b/lib/auth.php @@ -665,16 +665,16 @@ function get_allowed_tree_content($tree_id, $parent = 0, $sql_where = '', $order if ($sql_where != '') { $sql_where = "WHERE gti.local_graph_id=0 AND gti.parent=$parent AND gti.graph_tree_id=$tree_id AND (" . $sql_where . ')'; - }else{ + } else { $sql_where = "WHERE gti.local_graph_id=0 AND gti.parent=$parent AND gti.graph_tree_id=$tree_id"; } - if ($tree_id > 0) { - $trees = array_rekey( - get_allowed_trees(false, false, '', '', '', $total_rows, $user), - 'id', 'name' - ); + $trees = array_rekey( + get_allowed_trees(false, false, '', '', '', $total_rows, $user), + 'id', 'name' + ); + if ($tree_id > 0) { if (sizeof($trees)) { $sql_where .= ' AND gt.id IN (' . implode(', ', array_keys($trees)) . ')'; } @@ -688,21 +688,13 @@ function get_allowed_tree_content($tree_id, $parent = 0, $sql_where = '', $order ON h.id = gti.host_id $sql_where ORDER BY gti.position"); - }else{ - $trees = array_rekey( - get_allowed_trees(false, false, '', '', '', $total_rows, $user), - 'id', 'name' - ); - - if (sizeof($trees)) { - $heirarchy = db_fetch_assoc("SELECT gt.id AS tree_id, '0' AS id, gt.name AS title, '0' AS host_id, - '0' AS local_graph_id, '1' AS host_grouping_type, '' AS hostname - FROM graph_tree AS gt - WHERE enabled='on' - AND gt.id IN (" . implode(', ', array_keys($trees)) . ") - ORDER BY gt.sequence"); - }else{ - } + } elseif (sizeof($trees)) { + $heirarchy = db_fetch_assoc("SELECT gt.id AS tree_id, '0' AS id, gt.name AS title, '0' AS host_id, + '0' AS local_graph_id, '1' AS host_grouping_type, '' AS hostname + FROM graph_tree AS gt + WHERE enabled='on' + AND gt.id IN (" . implode(', ', array_keys($trees)) . ") + ORDER BY gt.sequence"); } if (read_config_option('auth_method') != 0) { @@ -713,20 +705,20 @@ function get_allowed_tree_content($tree_id, $parent = 0, $sql_where = '', $order if (is_device_allowed($h['host_id'])) { $new_heirarchy[] = $h; } - }elseif ($h['id'] == 0) { + } elseif ($h['id'] == 0) { if (!is_tree_branch_empty($h['tree_id'], $h['id'])) { if (is_tree_allowed($h['tree_id'])) { $new_heirarchy[] = $h; } } - }elseif (!is_tree_branch_empty($h['tree_id'], $h['id'])) { + } elseif (!is_tree_branch_empty($h['tree_id'], $h['id'])) { $new_heirarchy[] = $h; } } } return $new_heirarchy; - }else{ + } else { return $heirarchy; } } @@ -740,20 +732,15 @@ function get_allowed_tree_header_graphs($tree_id, $leaf_id = 0, $sql_where = '', $order_by = "ORDER BY $order_by"; } - if (strlen($sql_where)) { + if ($sql_where != '') { $sql_where = " AND ($sql_where)"; } $sql_where = "WHERE (gti.graph_tree_id=$tree_id AND gti.parent=$leaf_id)" . $sql_where; - $i = 0; - $sql_having = ''; - $sql_select = ''; - $sql_join = ''; - if ($user == -1) { $auth_method = 0; - }else{ + } else { $auth_method = read_config_option('auth_method'); } @@ -761,14 +748,14 @@ function get_allowed_tree_header_graphs($tree_id, $leaf_id = 0, $sql_where = '', if ($user == 0) { if (isset($_SESSION['sess_user_id'])) { $user = $_SESSION['sess_user_id']; - }else{ + } else { return array(); } } if (read_config_option('graph_auth_method') == 1) { $sql_operator = 'OR'; - }else{ + } else { $sql_operator = 'AND'; } @@ -789,36 +776,41 @@ function get_allowed_tree_header_graphs($tree_id, $leaf_id = 0, $sql_where = '', WHERE id = ?", array($user) ); - + + $i = 0; + $sql_having = ''; + $sql_select = ''; + $sql_join = ''; + foreach($policies as $policy) { if ($policy['policy_graphs'] == 1) { - $sql_having .= (strlen($sql_having) ? ' OR ':'') . "(user$i IS NULL"; - }else{ - $sql_having .= (strlen($sql_having) ? ' OR ':'') . "(user$i IS NOT NULL"; + $sql_having .= ($sql_having != '' ? ' OR ':'') . "(user$i IS NULL"; + } else { + $sql_having .= ($sql_having != '' ? ' OR ':'') . "(user$i IS NOT NULL"; } $sql_join .= 'LEFT JOIN user_auth_' . ($policy['type'] == 'user' ? '':'group_') . "perms AS uap$i ON (gl.id=uap$i.item_id AND uap$i.type=1 AND uap$i." . $policy['type'] . "_id=" . $policy['id'] . ") "; - $sql_select .= (strlen($sql_select) ? ', ':'') . "uap$i." . $policy['type'] . "_id AS user$i"; + $sql_select .= ($sql_select != '' ? ', ':'') . "uap$i." . $policy['type'] . "_id AS user$i"; $i++; if ($policy['policy_hosts'] == 1) { $sql_having .= " OR (user$i IS NULL"; - }else{ + } else { $sql_having .= " OR (user$i IS NOT NULL"; } $sql_join .= 'LEFT JOIN user_auth_' . ($policy['type'] == 'user' ? '':'group_') . "perms AS uap$i ON (gl.host_id=uap$i.item_id AND uap$i.type=3 AND uap$i." . $policy['type'] . "_id=" . $policy['id'] . ") "; - $sql_select .= (strlen($sql_select) ? ', ':'') . "uap$i." . $policy['type'] . "_id AS user$i"; + $sql_select .= ($sql_select != '' ? ', ':'') . "uap$i." . $policy['type'] . "_id AS user$i"; $i++; if ($policy['policy_graph_templates'] == 1) { $sql_having .= " $sql_operator user$i IS NULL))"; - }else{ + } else { $sql_having .= " $sql_operator user$i IS NOT NULL))"; } $sql_join .= 'LEFT JOIN user_auth_' . ($policy['type'] == 'user' ? '':'group_') . "perms AS uap$i ON (gl.graph_template_id=uap$i.item_id AND uap$i.type=4 AND uap$i." . $policy['type'] . "_id=" . $policy['id'] . ") "; - $sql_select .= (strlen($sql_select) ? ', ':'') . "uap$i." . $policy['type'] . "_id AS user$i"; + $sql_select .= ($sql_select != '' ? ', ':'') . "uap$i." . $policy['type'] . "_id AS user$i"; $i++; } @@ -1221,14 +1213,9 @@ function get_allowed_trees($edit = false, $return_sql = false, $sql_where = '', $order_by = "ORDER BY $order_by"; } - $i = 0; - $sql_where1 = ''; - $sql_select = ''; - $sql_join = ''; - if ($user == -1) { $auth_method = 0; - }else{ + } else { $auth_method = read_config_option('auth_method'); } @@ -1248,11 +1235,15 @@ function get_allowed_trees($edit = false, $return_sql = false, $sql_where = '', WHERE uag.enabled = 'on' AND uagm.user_id = ?", array($user)); $policies[] = db_fetch_row_prepared("SELECT id, 'user' as type, policy_trees FROM user_auth WHERE id = ?", array($user)); + $i = 0; + $sql_where1 = ''; + $sql_join = ''; + foreach($policies as $policy) { if ($policy['policy_trees'] == '1') { - $sql_where1 .= (strlen($sql_where1) ? ' OR':'') . " uap$i." . $policy['type'] . "_id IS NULL"; - }elseif ($policy['policy_trees'] == '2') { - $sql_where1 .= (strlen($sql_where1) ? ' OR':'') . " uap$i." . $policy['type'] . "_id IS NOT NULL"; + $sql_where1 .= ($sql_where1 != '' ? ' OR':'') . " uap$i." . $policy['type'] . "_id IS NULL"; + } elseif ($policy['policy_trees'] == '2') { + $sql_where1 .= ($sql_where1 != '' ? ' OR':'') . " uap$i." . $policy['type'] . "_id IS NOT NULL"; } $sql_join .= 'LEFT JOIN user_auth_' . ($policy['type'] == 'group' ? 'group_':'') . "perms AS uap$i @@ -1261,9 +1252,9 @@ function get_allowed_trees($edit = false, $return_sql = false, $sql_where = '', $i++; } - if (strlen($sql_where)) { + if ($sql_where != '') { $sql_where = 'WHERE ' . ($edit == false ? '(gt.enabled="on") AND ':'') . '(' . $sql_where . ') AND (' . $sql_where1 . ')'; - }else{ + } else { $sql_where = 'WHERE ' . ($edit == false ? '(gt.enabled="on") AND ':'') . '(gt.enabled="on") AND (' . $sql_where1 . ')'; } @@ -1276,7 +1267,7 @@ function get_allowed_trees($edit = false, $return_sql = false, $sql_where = '', if ($return_sql) { return $sql; - }else{ + } else { $trees = db_fetch_assoc($sql); $total_rows = db_fetch_cell("SELECT COUNT(gt.id) @@ -1284,16 +1275,16 @@ function get_allowed_trees($edit = false, $return_sql = false, $sql_where = '', $sql_join $sql_where"); } - }else{ - if (strlen($sql_where)) { + } else { + if ($sql_where != '') { $sql_where = "WHERE enabled='on' AND $sql_where"; - }else{ + } else { $sql_where = "WHERE enabled='on'"; } if ($return_sql) { return "SELECT id, name FROM graph_tree $sql_where $order_by"; - }else{ + } else { $trees = db_fetch_assoc("SELECT id, name FROM graph_tree AS gt $sql_where $order_by"); $total_rows = db_fetch_cell("SELECT COUNT(*) FROM graph_tree AS gt $sql_where"); } diff --git a/lib/data_query.php b/lib/data_query.php index e26821ed5b..a5e1a7326d 100644 --- a/lib/data_query.php +++ b/lib/data_query.php @@ -26,14 +26,14 @@ function run_data_query($host_id, $snmp_query_id) { global $config, $input_types; /* don't run/rerun the query if the host is down, or disabled */ - $status = db_fetch_row_prepared('SELECT status, disabled FROM host WHERE id = ?', array($host_id)); + $status = db_fetch_row_prepared('SELECT status, disabled, poller_id FROM host WHERE id = ?', array($host_id)); if (!sizeof($status)) { return false; - }elseif ($status['status'] == HOST_DOWN || $status['disabled'] == 'on') { + } elseif ($status['status'] == HOST_DOWN || $status['disabled'] == 'on') { return true; } - $poller_id = db_fetch_cell_prepared('SELECT poller_id FROM host WHERE id = ?', array($host_id)); + $poller_id = $status['poller_id']; if ($poller_id != $config['poller_id']) { $hostname = db_fetch_cell_prepared('SELECT hostname FROM poller WHERE id = ?', array($poller_id)); @@ -70,7 +70,9 @@ function run_data_query($host_id, $snmp_query_id) { ON snmp_query.data_input_id=data_input.id WHERE snmp_query.id = ?', array($snmp_query_id)); - if (isset($input_types[$type_id])) query_debug_timer_offset('data_query', "Found type = '" . $type_id . "' [" . $input_types[$type_id] . "]."); + if (isset($input_types[$type_id])) { + query_debug_timer_offset('data_query', "Found type = '" . $type_id . "' [" . $input_types[$type_id] . "]."); + } if ($type_id == DATA_INPUT_TYPE_SNMP_QUERY) { $result = query_snmp_host($host_id, $snmp_query_id); @@ -105,22 +107,23 @@ function run_data_query($host_id, $snmp_query_id) { dl.snmp_index, dtd.local_data_id, dtd.data_input_id, did.data_template_data_id, did.data_input_field_id, did.value FROM data_local AS dl - LEFT JOIN data_template_data AS dtd - ON dl.id=dtd.local_data_id - LEFT JOIN data_input_fields AS dif + INNER JOIN data_template_data AS dtd + ON dl.id = dtd.local_data_id + INNER JOIN data_input_fields AS dif ON dtd.data_input_id = dif.data_input_id LEFT JOIN data_input_data AS did ON dtd.id = did.data_template_data_id AND dif.id = did.data_input_field_id - WHERE dif.type_code="output_type" + WHERE dif.type_code = "output_type" AND dl.snmp_query_id = ? AND dl.host_id = ?', array($host_id, $snmp_query_id)); + $bestDataQueryIndexType = get_best_data_query_index_type($host_id, $snmp_query_id); if (sizeof($data_queries)) { foreach($data_queries as $data_query) { /* build array required for function call */ - $data_query['snmp_index_on'] = get_best_data_query_index_type($host_id, $snmp_query_id); + $data_query['snmp_index_on'] = $bestDataQueryIndexType; /* as we request the output_type, 'value' gives the snmp_query_graph_id */ $data_query['snmp_query_graph_id'] = $data_query['value']; @@ -1054,7 +1057,9 @@ function update_data_source_data_query_cache($local_data_id, $host_id = '', $dat FROM data_template_data WHERE data_template_data.local_data_id = ?', array($local_data_id))); - if (empty($field)) { return; } + if (empty($field)) { + return; + } if (empty($data_query_id)) { $data_query_id = db_fetch_cell_prepared('SELECT snmp_query_id FROM snmp_query_graph WHERE id = ?', array($field['output_type'])); @@ -1205,7 +1210,8 @@ function get_ordered_index_type_list($host_id, $data_query_id, $data_query_index FROM host_snmp_cache WHERE host_id = ? AND snmp_query_id = ? - AND field_name = ? AND $sql_or", + AND field_name = ? + AND $sql_or", array($host_id, $data_query_id, $field_name)); } @@ -1378,18 +1384,18 @@ function verify_index_order($raw_xml) { */ function update_snmp_index_order($data_query) { if (sizeof($data_query)) { - $data_input_field = array_rekey(db_fetch_assoc_prepared('SELECT + $data_input_field = array_rekey(db_fetch_assoc_prepared("SELECT data_input_fields.id, - data_input_fields.type_code - FROM (snmp_query,data_input,data_input_fields) - WHERE snmp_query.data_input_id=data_input.id - AND data_input.id=data_input_fields.data_input_id - AND (data_input_fields.type_code="index_type" - OR data_input_fields.type_code="index_value" - OR data_input_fields.type_code="output_type") - AND snmp_query.id = ?', + data_input_fields.type_code + FROM snmp_query + INNER JOIN data_input + ON snmp_query.data_input_id = data_input.id + INNER JOIN data_input_fields + ON data_input.id = data_input_fields.data_input_id + WHERE data_input_fields.type_code IN('index_type', 'index_value', 'output_type') + AND snmp_query.id = ?", array($data_query['snmp_query_id'])), 'type_code', 'id'); - + $snmp_cache_value = db_fetch_cell_prepared('SELECT field_value FROM host_snmp_cache WHERE host_id = ? @@ -1397,25 +1403,23 @@ function update_snmp_index_order($data_query) { AND field_name = ? AND snmp_index = ?', array($data_query['host_id'], $data_query['snmp_query_id'], $data_query['snmp_index_on'], $data_query['snmp_index'])); - - /* save the value to index on (ie. ifindex, ifip, etc) */ + db_execute_prepared('REPLACE INTO data_input_data (data_input_field_id, data_template_data_id, t_value, value) - VALUES (?, ?, "", ?)', - array($data_input_field['index_type'], $data_query['data_template_data_id'], $data_query['snmp_index_on'])); - - /* save the actual value (ie. 3, 192.168.1.101, etc) */ - db_execute_prepared('REPLACE INTO data_input_data - (data_input_field_id,data_template_data_id,t_value,value) - VALUES (?, ?, "", ?)', - array($data_input_field['index_value'], $data_query['data_template_data_id'], $snmp_cache_value)); - - /* set the expected output type (ie. bytes, errors, packets) */ - db_execute_prepared('REPLACE INTO data_input_data - (data_input_field_id,data_template_data_id,t_value,value) - VALUES (?, ?, "", ?)', - array($data_input_field['output_type'], $data_query['data_template_data_id'], $data_query['snmp_query_graph_id'])); - + VALUES + (?, ?, "", ?), + (?, ?, "", ?), + (?, ?, "", ?)', + array( + /* save the value to index on (ie. ifindex, ifip, etc) */ + $data_input_field['index_type'], $data_query['data_template_data_id'], $data_query['snmp_index_on'], + /* save the actual value (ie. 3, 192.168.1.101, etc) */ + $data_input_field['index_value'], $data_query['data_template_data_id'], $snmp_cache_value, + /* set the expected output type (ie. bytes, errors, packets) */ + $data_input_field['output_type'], $data_query['data_template_data_id'], $data_query['snmp_query_graph_id'] + ) + ); + /* now that we have put data into the 'data_input_data' table, update the snmp cache for ds's */ update_data_source_data_query_cache($data_query['local_data_id']); } diff --git a/lib/functions.php b/lib/functions.php index 0fe12e0e78..9145e7021d 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1768,16 +1768,6 @@ function get_web_browser() { } } -/* get_graph_tree_array - returns a list of graph trees taking permissions into account if - necessary - @arg $return_sql - (bool) Whether to return the SQL to create the dropdown rather than an array - @arg $force_refresh - (bool) Force the refresh of the array from the database - @arg $edit - (bool) Shows the content even though the graph may not be published - @returns - (array) an array containing a list of graph trees */ -function get_graph_tree_array($return_sql = false, $force_refresh = false, $edit = false) { - return get_allowed_trees($edit, $return_sql); -} - /* draw_login_status - provides a consistent login status page for all pages that use it */ function draw_login_status($using_guest_account = false) { global $config; diff --git a/lib/html.php b/lib/html.php index 2ae3793772..06028a7945 100644 --- a/lib/html.php +++ b/lib/html.php @@ -107,73 +107,9 @@ function html_graph_area(&$graph_array, $no_graphs_message = '', $extra_url_args print $header; } - $start = true; foreach ($graph_array as $graph) { - if (isset($graph['graph_template_name'])) { - if (isset($prev_graph_template_name)) { - if ($prev_graph_template_name != $graph['graph_template_name']) { - $print = true; - $prev_graph_template_name = $graph['graph_template_name']; - }else{ - $print = false; - } - }else{ - $print = true; - $prev_graph_template_name = $graph['graph_template_name']; - } - - if ($print) { - print " - - " . __('Graph Template:') . ' ' . htmlspecialchars($graph['graph_template_name']) . " - - \n"; - $i = 0; - } - }elseif (isset($graph['data_query_name'])) { - if (isset($prev_data_query_name)) { - if ($prev_data_query_name != $graph['data_query_name']) { - $print = true; - $prev_data_query_name = $graph['data_query_name']; - }else{ - $print = false; - } - }else{ - $print = true; - $prev_data_query_name = $graph['data_query_name']; - } - - if ($print) { - if (!$start) { - while(($i % $columns) != 0) { - print "\n"; - $i++; - } - - print "\n"; - } - - print " - " . __('Data Query:') . ' ' . $graph['data_query_name'] . " - \n"; - $i = 0; - } - - if (!isset($prev_sort_field_value) || $prev_sort_field_value != $graph['sort_field_value']){ - $prev_sort_field_value = $graph['sort_field_value']; - print " - - " . $graph['sort_field_value'] . " - - \n"; - $i = 0; - $j = 0; - } - } - if ($i == 0) { - print "\n"; - $start = false; + print "\n"; } ?> @@ -195,24 +131,19 @@ function html_graph_area(&$graph_array, $no_graphs_message = '', $extra_url_args \n"; - $start = true; } } - if (!$start) { - while(($i % $columns) != 0) { - print ""; - $i++; - } - - print "\n"; + while(($i % $columns) != 0) { + print ""; + $i++; } + + print "\n"; }else{ if ($no_graphs_message != '') { print "$no_graphs_message"; @@ -293,7 +224,7 @@ function html_graph_thumbnail_area(&$graph_array, $no_graphs_message = '', $extr } if ($i == 0) { - print "\n"; + print "\n"; $start = false; } @@ -459,6 +390,13 @@ function html_header_sort($header_items, $sort_column, $sort_direction, $last_it $i = 1; foreach ($header_items as $db_column => $display_array) { + $isSort = ''; + if (isset($display_array['nohide'])) { + $nohide = 'nohide'; + }else{ + $nohide = ''; + } + if (array_key_exists('display', $display_array)) { $display_text = $display_array['display']; if ($sort_column == $db_column) { @@ -491,8 +429,6 @@ function html_header_sort($header_items, $sort_column, $sort_direction, $last_it }else{ $direction = 'ASC'; } - - $isSort = false; } } @@ -539,7 +475,6 @@ function html_header_sort($header_items, $sort_column, $sort_direction, $last_it } $display_text = $display_array[0]; - $isSort = false; } $align = 'left'; @@ -555,9 +490,9 @@ function html_header_sort($header_items, $sort_column, $sort_direction, $last_it } if (($db_column == '') || (substr_count($db_column, 'nosort'))) { - print '' . $display_text . "\n"; + print '' . $display_text . "\n"; }else{ - print '"; + print '"; print "
" . $display_text . "
\n"; } @@ -615,7 +550,14 @@ function html_header_sort_checkbox($header_items, $sort_column, $sort_direction, print "\n"; foreach($header_items as $db_column => $display_array) { - $icon = ''; + $isSort = ''; + if (isset($display_array['nohide'])) { + $nohide = 'nohide'; + }else{ + $nohide = ''; + } + + $icon = ''; if (array_key_exists('display', $display_array)) { $display_text = $display_array['display']; if ($sort_column == $db_column) { @@ -642,8 +584,7 @@ function html_header_sort_checkbox($header_items, $sort_column, $sort_direction, $isSort = 'secondarySort'; } }else{ - $icon = ''; - $isSort = false; + $icon = ''; if (isset($display_array['sort'])) { $direction = $display_array['sort']; }else{ @@ -690,9 +631,7 @@ function html_header_sort_checkbox($header_items, $sort_column, $sort_direction, $isSort = 'secondarySort'; } }else{ - $icon = ''; - $isSort = false; - + $icon = ''; $direction = $display_array[1]; } @@ -712,9 +651,9 @@ function html_header_sort_checkbox($header_items, $sort_column, $sort_direction, } if (($db_column == '') || (substr_count($db_column, 'nosort'))) { - print '" . $display_text . "\n"; + print '" . $display_text . "\n"; }else{ - print '"; + print '"; print "
" . $display_text . "
\n"; } } @@ -732,12 +671,27 @@ function html_header_sort_checkbox($header_items, $sort_column, $sort_direction, function html_header($header_items, $last_item_colspan = 1) { print "\n"; - for ($i=0; $i" . $header_items[$i]['display'] . "\n"; + $i = 0; + foreach($header_items as $item) { + if (is_array($item)) { + if (isset($item['nohide'])) { + $nohide = 'nohide'; + }else{ + $nohide = ''; + } + + if (isset($item['align'])) { + $align = $item['align']; + }else{ + $align = 'left'; + } + + print "" . $item['display'] . "\n"; }else{ - print "" . $header_items[$i] . "\n"; + print "" . $item . "\n"; } + + $i++; } print "\n"; @@ -771,11 +725,23 @@ function html_header_checkbox($header_items, $include_form = true, $form_action print "\n"; - for ($i=0; $i" . $header_items[$i]['display'] . ""; + foreach($header_items as $item) { + if (is_array($item)) { + if (isset($item['nohide'])) { + $nohide = 'nohide'; + } else { + $nohide = ''; + } + + if (isset($item['align'])) { + $align = $item['align']; + } else { + $align = 'left'; + } + + print "" . $item['display'] . ""; }else{ - print "" . $header_items[$i] . "\n"; + print "" . $item . "\n"; } } @@ -907,9 +873,9 @@ function draw_graph_items_list($item_list, $filename, $url_data, $disable_contro /* alternating row color */ if ($use_custom_class == false) { - print "\n"; + print "\n"; }else{ - print ""; + print ""; } print ''; @@ -1317,19 +1283,19 @@ function html_show_tabs_left() { if (get_selected_theme() == 'classic') { if ($show_console_tab == true) { - ?><?php print __('Console');?> href="index.php"><?php print __('Console');?> 1 && $config['connection'] != 'online') { // Don't show graphs tab when offline }else{ - ?>" . __("; + }else{ + print "" . __("; } - print ".gif";?>" alt="Graphs"> 0) { + if (!isset($config_array['no_form_tag'])) { + print "
\n"; + } + + $i = 0; + $row_class = 'odd'; + foreach ($fields_array as $field_name => $field_array) { - if ($i == 0) { - if (!isset($config_array['no_form_tag'])) { - print "\n"; - } - } - if ($field_array['method'] == 'hidden') { + print ''; }elseif ($field_array['method'] == 'hidden_zero') { + print ''; }elseif ($field_array['method'] == 'spacer') { - if (isset($field_array['collapsible']) && $field_array['collapsible'] == 'true') { - $collapsible = true; - }else{ - $collapsible = false; + if ($i > 0) { + print ''; } - print "" . $field_array['friendly_name'] . ($collapsible ? "
":'') . "\n"; + $collapsible = (isset($field_array['collapsible']) && $field_array['collapsible'] == 'true'); + + print "
" . $field_array['friendly_name'] . ($collapsible ? "
":'') . '
'; }else{ + // Make a row using a div if (isset($config_array['force_row_color'])) { - print ""; + print "
"; }else{ - form_alternate_row('row_' . $field_name); + print "
"; + if ($row_class == 'even') { + $row_class = 'odd'; + }else{ + $row_class = 'even'; + } } - print "\n" . $field_array['friendly_name'] . "\n"; + // Make a form row + print "
"; + + print "
" . $field_array['friendly_name']; if (read_config_option('hide_form_description') == 'on') { - print '
' . ((isset($field_array['description'])) ? $field_array['description'] : '') . "
\n"; + print '
' . ((isset($field_array['description'])) ? $field_array['description'] : '') . "\n"; }else{ + print '
'; print display_tooltip((isset($field_array['description'])) ? $field_array['description'] : ''); + print '
'; } + print '
'; if (isset($field_array['sub_checkbox'])) { - print "
\n"; + print '
'; form_checkbox($field_array['sub_checkbox']['name'], $field_array['sub_checkbox']['value'], $field_array['sub_checkbox']['friendly_name'], @@ -88,11 +104,19 @@ function draw_edit_form($array) { ((isset($field_array['sub_checkbox']['on_change'])) ? $field_array['sub_checkbox']['on_change'] : '')); } - print "\n\n"; + // End form title column + print '
'; + + // New form column for content + print '
'; draw_edit_control($field_name, $field_array); - print "\n\n"; + // End content column + print '
'; + + // End form row + print '
'; } $i++; @@ -291,7 +315,7 @@ function draw_edit_control($field_name, &$field_array) { form_color_dropdown( $field_name, $field_array['value'], - 'None', + __('None'), ((isset($field_array['default'])) ? $field_array['default'] : ''), ((isset($field_array['class'])) ? $field_array['class'] : ''), ((isset($field_array['on_change'])) ? $field_array['on_change'] : '') @@ -387,7 +411,7 @@ function draw_edit_control($field_name, &$field_array) { break; default: - print '' . htmlspecialchars($field_array['value'],ENT_QUOTES) . ''; + print '' . htmlspecialchars($field_array['value'], ENT_QUOTES, 'UTF-8') . ''; form_hidden_box($field_name, $field_array['value'], '', true); @@ -401,7 +425,7 @@ function draw_edit_control($field_name, &$field_array) { @arg $title - the hover title for the button @arg $action - the onClick action for the button */ function form_button($form_name, $value, $title = '', $action = '') { - print "\n":''; - print "\n"; - print ($in_form) ? "\n":''; + print "
"; } /* form_dropdown - draws a standard html dropdown box @@ -805,7 +827,7 @@ function form_radio_button($form_name, $form_previous_value, $form_current_value $css_id = $form_name . '_' . $form_current_value; - print "\n"; + print "\n"; } /* form_text_area - draws a standard html text area box diff --git a/lib/html_tree.php b/lib/html_tree.php index 4a61343156..8f7a20bf94 100644 --- a/lib/html_tree.php +++ b/lib/html_tree.php @@ -337,9 +337,7 @@ function get_tree_path() { } } -function draw_dhtml_tree_level($tree_id, $parent = 0, $graphing = false) { - global $config; - +function draw_dhtml_tree_level($tree_id, $parent = 0) { $dhtml_tree = array(); $heirarchy = get_allowed_tree_level($tree_id, $parent); @@ -349,9 +347,9 @@ function draw_dhtml_tree_level($tree_id, $parent = 0, $graphing = false) { foreach ($heirarchy as $leaf) { if ($leaf['host_id'] > 0) { //It's a host $dhtml_tree[] = "\t\t\t\t
  • Device: " . htmlspecialchars($leaf['hostname']) . "
  • \n"; - }elseif ($leaf['local_graph_id'] > 0) { + } elseif ($leaf['local_graph_id'] > 0) { $dhtml_tree[] = "\t\t\t\t
  • Graph: " . htmlspecialchars(get_graph_title($leaf['local_graph_id'])) . "
  • \n"; - }else{ //It's not a host + } else { //It's not a host $dhtml_tree[] = "\t\t\t\t
  • " . htmlspecialchars($leaf['title']) . "
  • \n"; } } @@ -466,11 +464,9 @@ function draw_dhtml_tree_level_graphing($tree_id, $parent = 0) { } function create_dhtml_tree() { - global $config; - $dhtml_tree = array(); - $tree_list = get_graph_tree_array(); + $tree_list = get_allowed_trees(); if (sizeof($tree_list)) { foreach ($tree_list as $tree) { diff --git a/lib/html_utility.php b/lib/html_utility.php index 1c80abc1e9..cd88e01c9d 100644 --- a/lib/html_utility.php +++ b/lib/html_utility.php @@ -42,42 +42,42 @@ function inject_form_variables(&$form_array, $arg1 = array(), $arg2 = array(), $ /* loop through each available field */ if (sizeof($form_array)) { - foreach ($form_array as $field_name => $field_array) { - /* loop through each sub-field that we are going to check for variables */ - foreach ($check_fields as $field_to_check) { - if (isset($field_array[$field_to_check]) && (is_array($form_array[$field_name][$field_to_check]))) { - /* if the field/sub-field combination is an array, resolve it recursively */ - $form_array[$field_name][$field_to_check] = inject_form_variables($form_array[$field_name][$field_to_check], $arg1); - }elseif (isset($field_array[$field_to_check]) && (!is_array($field_array[$field_to_check])) && (preg_match('/\|(arg[123]):([a-zA-Z0-9_]*)\|/', $field_array[$field_to_check], $matches))) { - $string = $field_array[$field_to_check]; - while ( 1 ) { - /* an empty field name in the variable means don't treat this as an array */ - if ($matches[2] == '') { - if (is_array(${$matches[1]})) { - /* the existing value is already an array, leave it alone */ - $form_array[$field_name][$field_to_check] = ${$matches[1]}; - break; - }else{ - /* the existing value is probably a single variable */ - $form_array[$field_name][$field_to_check] = str_replace($matches[0], ${$matches[1]}, $field_array[$field_to_check]); - break; - } - }else{ - /* copy the value down from the array/key specified in the variable */ - $string = str_replace($matches[0], ((isset(${$matches[1]}{$matches[2]})) ? ${$matches[1]}{$matches[2]} : ''), $string); + foreach ($form_array as $field_name => $field_array) { + /* loop through each sub-field that we are going to check for variables */ + foreach ($check_fields as $field_to_check) { + if (isset($field_array[$field_to_check]) && is_array($form_array[$field_name][$field_to_check])) { + /* if the field/sub-field combination is an array, resolve it recursively */ + $form_array[$field_name][$field_to_check] = inject_form_variables($form_array[$field_name][$field_to_check], $arg1); + } elseif (isset($field_array[$field_to_check]) && !is_array($field_array[$field_to_check]) && preg_match('/\|(arg[123]):([a-zA-Z0-9_]*)\|/', $field_array[$field_to_check], $matches)) { + $string = $field_array[$field_to_check]; + while ( 1 ) { + /* an empty field name in the variable means don't treat this as an array */ + if ($matches[2] == '') { + if (is_array(${$matches[1]})) { + /* the existing value is already an array, leave it alone */ + $form_array[$field_name][$field_to_check] = ${$matches[1]}; + break; + } else { + /* the existing value is probably a single variable */ + $form_array[$field_name][$field_to_check] = str_replace($matches[0], ${$matches[1]}, $field_array[$field_to_check]); + break; + } + } else { + /* copy the value down from the array/key specified in the variable */ + $string = str_replace($matches[0], (isset(${$matches[1]}{$matches[2]}) ? ${$matches[1]}{$matches[2]} : ''), $string); - $matches = array(); - preg_match('/\|(arg[123]):([a-zA-Z0-9_]*)\|/', $string, $matches); - if (!sizeof($matches)) { - $form_array[$field_name][$field_to_check] = $string; - break; + $matches = array(); + preg_match('/\|(arg[123]):([a-zA-Z0-9_]*)\|/', $string, $matches); + if (!sizeof($matches)) { + $form_array[$field_name][$field_to_check] = $string; + break; + } } } } } } } - } return $form_array; } @@ -90,22 +90,22 @@ function inject_form_variables(&$form_array, $arg1 = array(), $arg2 = array(), $ @arg $row_id - used to allow js and ajax actions on this object @returns - the background color used for this particular row */ function form_alternate_row_color($row_color1, $row_color2, $row_value, $row_id = '') { - if (($row_value % 2) == 1) { + if ($row_value % 2 == 1) { $class='odd'; $current_color = $row_color1; - }else{ + } else { if ($row_color2 == '' || $row_color2 == 'E5E5E5') { $class = 'even'; - }else{ + } else { $class = 'even-alternate'; } $current_color = $row_color1; } - if (strlen($row_id)) { - print "\n"; - }else{ - print "\n"; + if ($row_id != '') { + print "\n"; + } else { + print "\n"; } return $current_color; @@ -118,26 +118,24 @@ function form_alternate_row_color($row_color1, $row_color2, $row_value, $row_id function form_alternate_row($row_id = '', $light = false, $disabled = false) { static $i = 1; - if (($i % 2) == 1) { + if ($i % 2 == 1) { $class = 'odd'; - }else{ - if ($light) { - $class = 'even-alternate'; - }else{ - $class = 'even'; - } + } elseif ($light) { + $class = 'even-alternate'; + } else { + $class = 'even'; } $i++; - if (strlen($row_id) && substr($row_id,0,4) != 'row_' && !$disabled) { - print "\n"; - }elseif (substr($row_id,0,4) == 'row_') { - print "\n"; - }elseif (strlen($row_id)) { - print "\n"; - }else{ - print "\n"; + if ($row_id != '' && !$disabled && substr($row_id, 0, 4) != 'row_') { + print "\n"; + } elseif (substr($row_id, 0, 4) == 'row_') { + print "\n"; + } elseif ($row_id != '') { + print "\n"; + } else { + print "\n"; } } @@ -206,11 +204,7 @@ function form_confim_buttons($post_variable, $item_array, $save_message, $return @arg $html_boolean - the value of the HTML checkbox @returns - true or false based on the value of the HTML checkbox */ function html_boolean($html_boolean) { - if ($html_boolean == "on") { - return true; - }else{ - return false; - } + return ($html_boolean == "on"); } /* html_boolean_friendly - returns the natural language equivalent of an HTML @@ -221,7 +215,7 @@ function html_boolean($html_boolean) { function html_boolean_friendly($html_boolean) { if ($html_boolean == "on") { return "Selected"; - }else{ + } else { return "Not Selected"; } } @@ -238,11 +232,9 @@ function get_checkbox_style() { @arg $default - The default action is not set @returns - null */ function set_default_action($default = '') { - global $_CACTI_REQUEST; - - if (!isset_request_var('action')) { + if (!isset_request_var('action')) { set_request_var('action', $default); - }else{ + } else { set_request_var('action', $_REQUEST['action']); } } @@ -791,16 +783,9 @@ function load_current_session_value($request_var_name, $session_var_name, $defau @arg $status - the status type of the device as defined in global_constants.php @returns - a string containing html that represents the device's current status */ function get_colored_device_status($disabled, $status) { - $status_colors = array( - HOST_DOWN => 'deviceDown', - HOST_ERROR => 'deviceError', - HOST_RECOVERING => 'deviceRecovering', - HOST_UP => 'deviceUp' - ); - if ($disabled) { return "" . __('Disabled') . ""; - }else{ + } else { switch ($status) { case HOST_DOWN: return "" . __('Down') . ""; diff --git a/lib/import.php b/lib/import.php index 9df6a89d7f..2bdc5bf0ec 100644 --- a/lib/import.php +++ b/lib/import.php @@ -282,6 +282,10 @@ function xml_to_graph_template($hash, &$xml_array, &$hash_cache, $hash_version, $save['hash'] = $hash; $save['name'] = $xml_array['name']; + if (isset($xml_array['multiple'])) { + $save['multiple'] = $xml_array['multiple']; + } + /* check for status changes */ $status += compare_data($save, $previous_data, 'graph_templates'); diff --git a/lib/utility.php b/lib/utility.php index 7af043eb86..67415340e0 100644 --- a/lib/utility.php +++ b/lib/utility.php @@ -328,12 +328,12 @@ function update_poller_cache($data_source, $commit = false) { if (sizeof($host_fields)) { if (sizeof($data_template_fields)) { - foreach($data_template_fields as $key => $value) { - if (!isset($host_fields[$key])) { - $host_fields[$key] = $value; + foreach($data_template_fields as $key => $value) { + if (!isset($host_fields[$key])) { + $host_fields[$key] = $value; + } } } - } } elseif (sizeof($data_template_fields)) { $host_fields = $data_template_fields; } @@ -390,13 +390,14 @@ function update_poller_cache($data_source, $commit = false) { } function push_out_data_input_method($data_input_id) { - $data_sources = db_fetch_assoc_prepared('SELECT ' . SQL_NO_CACHE . ' * FROM data_local - WHERE id IN ( + $data_sources = db_fetch_assoc_prepared('SELECT ' . SQL_NO_CACHE . ' data_local.* + FROM data_local + INNER JOIN ( SELECT DISTINCT local_data_id FROM data_template_data WHERE data_input_id = ? - AND local_data_id>0 - )', array($data_input_id)); + AND local_data_id > 0 + ) AS data_template_data ON data_template_data.local_data_id = data_local.id', array($data_input_id)); $poller_items = array(); $_my_local_data_ids = array(); @@ -466,30 +467,32 @@ function poller_update_poller_cache_from_buffer($local_data_ids, &$poller_items) $buffer = ''; if (sizeof($poller_items)) { - foreach($poller_items AS $record) { - /* take care of invalid entries */ - if (strlen($record) == 0) continue; + foreach($poller_items as $record) { + /* take care of invalid entries */ + if (strlen($record) == 0) { + continue; + } - if ($buf_count == 0) { - $delim = ' '; - } else { - $delim = ', '; + if ($buf_count == 0) { + $delim = ' '; + } else { + $delim = ', '; + } + + $buffer .= $delim . $record; + + $buf_len += strlen($record); + + if ($overhead + $buf_len > $max_packet - 1024) { + db_execute($sql_prefix . $buffer . $sql_suffix); + + $buffer = ''; + $buf_len = 0; + $buf_count = 0; + } else { + $buf_count++; + } } - - $buffer .= $delim . $record; - - $buf_len += strlen($record); - - if (($overhead + $buf_len) > ($max_packet - 1024)) { - db_execute($sql_prefix . $buffer . $sql_suffix); - - $buffer = ''; - $buf_len = 0; - $buf_count = 0; - } else { - $buf_count++; - } - } } if ($buf_count > 0) { @@ -548,54 +551,56 @@ function push_out_host($host_id, $local_data_id = 0, $data_template_id = 0) { /* loop through each matching data source */ if (sizeof($data_sources)) { - foreach ($data_sources as $data_source) { - /* set the host information */ - if (!isset($hosts[$data_source['host_id']])) { - $hosts[$data_source['host_id']] = db_fetch_row_prepared('SELECT * FROM host WHERE id = ?', array($data_source['host_id'])); - } - $host = $hosts[$data_source['host_id']]; + foreach ($data_sources as $data_source) { + /* set the host information */ + if (!isset($hosts[$data_source['host_id']])) { + $hosts[$data_source['host_id']] = db_fetch_row_prepared('SELECT * FROM host WHERE id = ?', array($data_source['host_id'])); + } + $host = $hosts[$data_source['host_id']]; - /* get field information FROM the data template */ - if (!isset($template_fields{$data_source['local_data_template_data_id']})) { - $template_fields{$data_source['local_data_template_data_id']} = db_fetch_assoc_prepared('SELECT ' . SQL_NO_CACHE . ' - did.value, did.t_value, dif.id, dif.type_code - FROM data_input_fields AS dif - LEFT JOIN data_input_data AS did - ON dif.id=did.data_input_field_id - WHERE dif.data_input_id = ? - AND did.data_template_data_id = ? - AND (did.t_value="" OR did.t_value is null) - AND dif.input_output="in"', - array($data_source['data_input_id'], $data_source['local_data_template_data_id'])); - } + /* get field information FROM the data template */ + if (!isset($template_fields{$data_source['local_data_template_data_id']})) { + $template_fields{$data_source['local_data_template_data_id']} = db_fetch_assoc_prepared('SELECT ' . SQL_NO_CACHE . ' + did.value, did.t_value, dif.id, dif.type_code + FROM data_input_fields AS dif + LEFT JOIN data_input_data AS did + ON dif.id=did.data_input_field_id + WHERE dif.data_input_id = ? + AND did.data_template_data_id = ? + AND (did.t_value="" OR did.t_value is null) + AND dif.input_output="in"', + array($data_source['data_input_id'], $data_source['local_data_template_data_id'])); + } - /* loop through each field contained in the data template and push out a host value if: - - the field is a valid "host field" - - the value of the field is empty - - the field is set to 'templated' */ - if (sizeof($template_fields{$data_source['local_data_template_data_id']})) { - foreach ($template_fields[$data_source['local_data_template_data_id']] as $template_field) { - if ((preg_match('/^' . VALID_HOST_FIELDS . '$/i', $template_field['type_code'])) && ($template_field['value'] == '') && ($template_field['t_value'] == '')) { - // handle special case type_code - if ($template_field['type_code'] == 'host_id') $template_field['type_code'] = 'id'; + /* loop through each field contained in the data template and push out a host value if: + - the field is a valid "host field" + - the value of the field is empty + - the field is set to 'templated' */ + if (sizeof($template_fields{$data_source['local_data_template_data_id']})) { + foreach ($template_fields[$data_source['local_data_template_data_id']] as $template_field) { + if (preg_match('/^' . VALID_HOST_FIELDS . '$/i', $template_field['type_code']) && $template_field['value'] == '' && $template_field['t_value'] == '') { + // handle special case type_code + if ($template_field['type_code'] == 'host_id') { + $template_field['type_code'] = 'id'; + } - db_execute_prepared('REPLACE INTO data_input_data - (data_input_field_id, data_template_data_id, value) - VALUES (?, ?, ?)', - array($template_field['id'], $data_source['id'], $host[$template_field['type_code']])); + db_execute_prepared('REPLACE INTO data_input_data + (data_input_field_id, data_template_data_id, value) + VALUES (?, ?, ?)', + array($template_field['id'], $data_source['id'], $host[$template_field['type_code']])); + } } } + + /* flag an update to the poller cache as well */ + $local_data_ids[] = $data_source['local_data_id']; + + /* create a new compatible structure */ + $data = $data_source; + $data['id'] = $data['local_data_id']; + + $poller_items = array_merge($poller_items, update_poller_cache($data)); } - - /* flag an update to the poller cache as well */ - $local_data_ids[] = $data_source['local_data_id']; - - /* create a new compatible structure */ - $data = $data_source; - $data['id'] = $data['local_data_id']; - - $poller_items = array_merge($poller_items, update_poller_cache($data)); - } } if (sizeof($local_data_ids)) { diff --git a/lib/variables.php b/lib/variables.php index 10cb4a00ca..3720d9bfc8 100644 --- a/lib/variables.php +++ b/lib/variables.php @@ -168,45 +168,82 @@ function substitute_host_data($string, $l_escape_string, $r_escape_string, $host $_SESSION['sess_host_cache_array'][$host_id] = $host; } - $string = str_replace($l_escape_string . 'host_management_ip' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['hostname'], $string); /* for compatability */ - $string = str_replace($l_escape_string . 'host_hostname' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['hostname'], $string); - $string = str_replace($l_escape_string . 'host_description' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['description'], $string); - $string = str_replace($l_escape_string . 'host_notes' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['notes'], $string); - $string = str_replace($l_escape_string . 'host_polling_time' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['polling_time'], $string); - $string = str_replace($l_escape_string . 'host_avg_time' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['avg_time'], $string); - $string = str_replace($l_escape_string . 'host_cur_time' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['cur_time'], $string); - $string = str_replace($l_escape_string . 'host_availability' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['availability'], $string); + $search = array(); + $replace = array(); + + $search[] = $l_escape_string . 'host_management_ip' . $r_escape_string; /* for compatibility */ + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['hostname']; /* for compatibility */ + + $search[] = $l_escape_string . 'host_hostname' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['hostname']; + $search[] = $l_escape_string . 'host_description' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['description']; + $search[] = $l_escape_string . 'host_notes' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['notes']; + $search[] = $l_escape_string . 'host_polling_time' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['polling_time']; + $search[] = $l_escape_string . 'host_avg_time' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['avg_time']; + $search[] = $l_escape_string . 'host_cur_time' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['cur_time']; + $search[] = $l_escape_string . 'host_availability' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['availability']; /* snmp connectivity information */ - $string = str_replace($l_escape_string . 'host_snmp_community' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_community'], $string); - $string = str_replace($l_escape_string . 'host_snmp_version' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_version'], $string); - $string = str_replace($l_escape_string . 'host_snmp_username' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_username'], $string); - $string = str_replace($l_escape_string . 'host_snmp_password' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_password'], $string); - $string = str_replace($l_escape_string . 'host_snmp_auth_protocol' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_auth_protocol'], $string); - $string = str_replace($l_escape_string . 'host_snmp_priv_passphrase' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_priv_passphrase'], $string); - $string = str_replace($l_escape_string . 'host_snmp_priv_protocol' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_priv_protocol'], $string); - $string = str_replace($l_escape_string . 'host_snmp_context' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_context'], $string); - $string = str_replace($l_escape_string . 'host_snmp_engine_id' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_engine_id'], $string); - $string = str_replace($l_escape_string . 'host_snmp_port' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_port'], $string); - $string = str_replace($l_escape_string . 'host_snmp_timeout' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_timeout'], $string); + $search[] = $l_escape_string . 'host_snmp_community' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_community']; + $search[] = $l_escape_string . 'host_snmp_version' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_version']; + $search[] = $l_escape_string . 'host_snmp_username' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_username']; + $search[] = $l_escape_string . 'host_snmp_password' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_password']; + $search[] = $l_escape_string . 'host_snmp_auth_protocol' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_auth_protocol']; + $search[] = $l_escape_string . 'host_snmp_priv_passphrase' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_priv_passphrase']; + $search[] = $l_escape_string . 'host_snmp_priv_protocol' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_priv_protocol']; + $search[] = $l_escape_string . 'host_snmp_context' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_context']; + $search[] = $l_escape_string . 'host_snmp_engine_id' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_engine_id']; + $search[] = $l_escape_string . 'host_snmp_port' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_port']; + $search[] = $l_escape_string . 'host_snmp_timeout' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_timeout']; /* snmp system information */ - $string = str_replace($l_escape_string . 'host_snmp_sysDescr' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_sysDescr'], $string); - $string = str_replace($l_escape_string . 'host_snmp_sysObjectID' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_sysObjectID'], $string); - $string = str_replace($l_escape_string . 'host_snmp_sysContact' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_sysContact'], $string); - $string = str_replace($l_escape_string . 'host_snmp_sysLocation' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_sysLocation'], $string); - $string = str_replace($l_escape_string . 'host_snmp_sysName' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_sysName'], $string); - $string = str_replace($l_escape_string . 'host_snmp_sysUpTimeInstance' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['snmp_sysUpTimeInstance'], $string); + $search[] = $l_escape_string . 'host_snmp_sysDescr' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_sysDescr']; + $search[] = $l_escape_string . 'host_snmp_sysObjectID' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_sysObjectID']; + $search[] = $l_escape_string . 'host_snmp_sysContact' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_sysContact']; + $search[] = $l_escape_string . 'host_snmp_sysLocation' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_sysLocation']; + $search[] = $l_escape_string . 'host_snmp_sysName' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_sysName']; + $search[] = $l_escape_string . 'host_snmp_sysUpTimeInstance' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['snmp_sysUpTimeInstance']; - $string = str_replace($l_escape_string . 'host_ping_retries' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['ping_retries'], $string); - $string = str_replace($l_escape_string . 'host_max_oids' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['max_oids'], $string); - $string = str_replace($l_escape_string . 'host_id' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['id'], $string); + $search[] = $l_escape_string . 'host_ping_retries' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['ping_retries']; + $search[] = $l_escape_string . 'host_max_oids' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['max_oids']; + $search[] = $l_escape_string . 'host_id' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['id']; /* handle the external id */ - $string = str_replace($l_escape_string . 'host_external_id' . $r_escape_string, $_SESSION['sess_host_cache_array'][$host_id]['external_id'], $string); + $search[] = $l_escape_string . 'host_external_id' . $r_escape_string; + $replace[] = $_SESSION['sess_host_cache_array'][$host_id]['external_id']; - $temp = api_plugin_hook_function('substitute_host_data', - array('string' => $string, 'l_escape_string' => $l_escape_string, 'r_escape_string' => $r_escape_string, 'host_id' => $host_id)); + $string = str_replace($search, $replace, $string); + + $temp = api_plugin_hook_function( + 'substitute_host_data', + array('string' => $string, 'l_escape_string' => $l_escape_string, 'r_escape_string' => $r_escape_string, 'host_id' => $host_id) + ); $string = $temp['string']; } diff --git a/rrdcleaner.php b/rrdcleaner.php index 58bc78a85f..b15e7c03cb 100644 --- a/rrdcleaner.php +++ b/rrdcleaner.php @@ -241,7 +241,7 @@ function get_files() { * Display all rrd file entries */ function list_rrd() { - global $config, $item_rows, $ds_actions, $rra_path, $hash_version_codes; + global $config, $item_rows, $ds_actions, $rra_path; /* suppress warnings */ error_reporting(0);