Merge remote-tracking branch 'upstream/develop' into DutchTranslations

This commit is contained in:
patrick committed 2017-04-30 10:13:43 +02:00
commit b7fff7876d
36 files changed
+1429 -570

No files matched your search

+1 -1
View File
@@ -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', '');
+9 -7
View File
@@ -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;
--
+1 -1
View File
@@ -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));
+3
View File
@@ -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
+4 -3
View File
@@ -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;
+31 -22
View File
@@ -535,9 +535,9 @@ function graphs() {
array($host['id']));
if (sizeof($snmp_queries) > 0) {
foreach ($snmp_queries as $query) {
print "<option value='" . $query['id'] . "'"; if (get_request_var('graph_type') == $query['id']) { print ' selected'; } print '>' . $query['name'] . "</option>\n";
}
foreach ($snmp_queries as $query) {
print "<option value='" . $query['id'] . "'"; if (get_request_var('graph_type') == $query['id']) { print ' selected'; } print '>' . $query['name'] . "</option>\n";
}
}
?>
</select>
@@ -618,15 +618,6 @@ function graphs() {
<th class='tableSubHeaderCheckbox'><input class='checkbox' type='checkbox' name='all_cg' title='" . __('Select All') . "' onClick='SelectAll(\"sg\",this.checked)'></th>\n
</tr>\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 "<tr class='even'>
@@ -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 = '';
+1 -1
View File
@@ -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';
+1
View File
@@ -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(
+28 -5
View File
@@ -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'
)
);
+58 -10
View File
@@ -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 */
+158 -7
View File
@@ -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 {
+141 -6
View File
@@ -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;
+8 -1
View File
@@ -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{
+179 -17
View File
@@ -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;
+8 -1
View File
@@ -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{
+135 -21
View File
@@ -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;
}
}
+1
View File
@@ -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;
+134 -13
View File
@@ -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 {
+2 -3
View File
@@ -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)) {
+1 -1
View File
@@ -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
}
+48
View File
@@ -0,0 +1,48 @@
<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2017 The Cacti Group |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDTool-based Graphing Solution |
+-------------------------------------------------------------------------+
| This code is designed, written, and maintained by the Cacti Group. See |
| about.php and/or the AUTHORS file for specific developer information. |
+-------------------------------------------------------------------------+
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/
function upgrade_to_1_1_6() {
db_install_execute('ALTER TABLE `data_input`
MODIFY COLUMN `input_string` varchar(512) default NULL'
);
if (!db_index_exists('snmp_query_graph', 'graph_template_id_name')) {
db_install_execute("ALTER TABLE `snmp_query_graph`
ADD INDEX `graph_template_id_name` (`graph_template_id`, `name`)"
);
}
if (!db_index_exists('graph_templates', 'multiple_name')) {
db_install_execute(
"ALTER TABLE `graph_templates`
ADD `multiple` CHAR(2) NOT NULL DEFAULT '' AFTER `name`,
ADD KEY `multiple_name` (`multiple`, `name`)"
);
}
db_execute_prepared("UPDATE graph_templates
SET multiple = 'on'
WHERE hash = '010b90500e1fc6a05abfd542940584d0'"
);
}
+29
View File
@@ -522,3 +522,32 @@ function remote_update_config_file() {
return $written;
}
function import_colors() {
global $config;
if (! file_exists(dirname(__FILE__) . '/color.csv')) {
return false;
}
$contents = file(dirname(__FILE__) . '/colors.csv');
if (count($contents)) {
foreach($contents as $line) {
$line = trim($line);
$parts = explode(',',$line);
$natural = $parts[0];
$hex = $parts[1];
$name = $parts[2];
$id = db_fetch_cell("SELECT hex FROM colors WHERE hex='$hex'");
if (!empty($id)) {
db_execute("UPDATE colors SET name='$name', read_only='on' WHERE hex='$hex'");
}else{
db_execute("INSERT INTO colors (name, hex, read_only) VALUES ('$name', '$hex', 'on')");
}
}
}
return true;
}
-24
View File
@@ -1,24 +0,0 @@
<?php
$no_http_headers = true;
include(dirname(__FILE__) . '/../include/global.php');
$contents = file($config['base_path'] . '/install/colors.csv');
if (sizeof($contents)) {
foreach($contents as $line) {
$line = trim($line);
$parts = explode(',',$line);
$natural = $parts[0];
$hex = $parts[1];
$name = $parts[2];
$id = db_fetch_cell("SELECT hex FROM colors WHERE hex='$hex'");
if (!empty($id)) {
db_execute("UPDATE colors SET name='$name', read_only='on' WHERE hex='$hex'");
}else{
db_execute("INSERT INTO colors (name, hex, read_only) VALUES ('$name', '$hex', 'on')");
}
}
}
+6 -1
View File
@@ -45,7 +45,9 @@ $cacti_versions = array('0.8', '0.8.1', '0.8.2', '0.8.2a', '0.8.3', '0.8.3a', '0
'0.8.6', '0.8.6a', '0.8.6b', '0.8.6c', '0.8.6d', '0.8.6e', '0.8.6f', '0.8.6g', '0.8.6h', '0.8.6i', '0.8.6j', '0.8.6k',
'0.8.7', '0.8.7a', '0.8.7b', '0.8.7c', '0.8.7d', '0.8.7e', '0.8.7f', '0.8.7g', '0.8.7h', '0.8.7i',
'0.8.8', '0.8.8a', '0.8.8b', '0.8.8c', '0.8.8d', '0.8.8e', '0.8.8f', '0.8.8g', '0.8.8h', '1.0.0',
'1.0.1', '1.0.2', '1.0.3', '1.0.4', '1.0.5', '1.0.6', '1.1.0', '1.1.1', '1.1.2', '1.1.3', '1.1.4', '1.1.5');
'1.0.1', '1.0.2', '1.0.3', '1.0.4', '1.0.5', '1.0.6', '1.1.0',
'1.1.1', '1.1.2', '1.1.3', '1.1.4', '1.1.5', '1.1.6'
);
$old_cacti_version = db_fetch_cell('SELECT cacti FROM version');
@@ -449,6 +451,9 @@ if ($step == '7') {
}elseif ($cacti_versions[$i] == '1.1.5') {
include ('1_1_4_to_1_1_5.php');
upgrade_to_1_1_5();
}elseif ($cacti_versions[$i] == '1.1.6') {
include ('1_1_5_to_1_1_6.php');
upgrade_to_1_1_6();
}
}
+24 -7
View File
@@ -190,16 +190,33 @@ function api_duplicate_graph($_local_graph_id, $_graph_template_id, $graph_title
$graph_template_graph['title'] = str_replace('<graph_title>', $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('<template_title>', $graph_template['name'], $graph_title);
$save['id'] = 0;
$save['hash'] = get_hash_graph_template(0);
$save['name'] = str_replace('<template_title>', $graph_template['name'], $graph_title);
$save['multiple'] = $graph_template['multiple'];
$graph_template_id = sql_save($save, 'graph_templates');
}
+49 -58
View File
@@ -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");
}
+42 -38
View File
@@ -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']);
}
-10
View File
@@ -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;
+71 -105
View File
@@ -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 "<tr class='templateHeader'>
<td colspan='$columns' class='textHeaderDark'>
" . __('Graph Template:') . ' ' . htmlspecialchars($graph['graph_template_name']) . "
</td>
</tr>\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 "<td style='text-align:center;width:" . round(100 / $columns, 2) . "%;'></td>\n";
$i++;
}
print "</tr>\n";
}
print "<tr class='tableHeader'>
<td colspan='$columns' class='graphSubHeaderColumn textHeaderDark'>" . __('Data Query:') . ' ' . $graph['data_query_name'] . "</td>
</tr>\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 "<tr class='templateHeader'>
<td colspan='$columns' class='textHeaderDark'>
" . $graph['sort_field_value'] . "
</td>
</tr>\n";
$i = 0;
$j = 0;
}
}
if ($i == 0) {
print "<tr class='formRow'>\n";
$start = false;
print "<tr class='tableRow'>\n";
}
?>
@@ -195,24 +131,19 @@ function html_graph_area(&$graph_array, $no_graphs_message = '', $extra_url_args
<?php
$i++;
$k++;
if (($i % $columns) == 0 && ($k < $num_graphs)) {
$i=0;
$j++;
if (($i % $columns) == 0) {
$i = 0;
print "</tr>\n";
$start = true;
}
}
if (!$start) {
while(($i % $columns) != 0) {
print "<td style='text-align:center;width:" . round(100 / $columns, 2) . "%;'></td>";
$i++;
}
print "</tr>\n";
while(($i % $columns) != 0) {
print "<td style='text-align:center;width:" . round(100 / $columns, 2) . "%;'></td>";
$i++;
}
print "</tr>\n";
}else{
if ($no_graphs_message != '') {
print "<td><em>$no_graphs_message</em></td>";
@@ -293,7 +224,7 @@ function html_graph_thumbnail_area(&$graph_array, $no_graphs_message = '', $extr
}
if ($i == 0) {
print "<tr class='formRow'>\n";
print "<tr class='tableRow'>\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 '<th ' . ($tip != '' ? "title='" . htmlspecialchars($tip, ENT_QUOTES, 'UTF-8') . "'":'') . " style='padding:4px;text-align:$align;' " . ((($i+1) == count($header_items)) ? "colspan='$last_item_colspan' " : '') . '>' . $display_text . "</th>\n";
print '<th ' . ($tip != '' ? "title='" . htmlspecialchars($tip, ENT_QUOTES, 'UTF-8') . "'":'') . " class='$nohide $align' " . ((($i+1) == count($header_items)) ? "colspan='$last_item_colspan' " : '') . '>' . $display_text . "</th>\n";
}else{
print '<th ' . ($tip != '' ? "title='" . htmlspecialchars($tip, ENT_QUOTES, 'UTF-8') . "'":'') . " class='sortable" . ($isSort ? " $isSort":'') . "' style='padding:4px;text-align:$align;'>";
print '<th ' . ($tip != '' ? "title='" . htmlspecialchars($tip, ENT_QUOTES, 'UTF-8') . "'":'') . " class='sortable $align $nohide $isSort'>";
print "<div class='sortinfo' sort-page='" . ($url == '' ? htmlspecialchars(get_current_page(false)):$url) . "' sort-column='$db_column' sort-direction='$direction'><div class='textSubHeaderDark'>" . $display_text . "<i class='$icon'></i></div></div></th>\n";
}
@@ -615,7 +550,14 @@ function html_header_sort_checkbox($header_items, $sort_column, $sort_direction,
print "<tr class='tableHeader'>\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 '<th ' . ($tip != '' ? "title='" . htmlspecialchars($tip, ENT_QUOTES, 'UTF-8') . "'":'') . " style='text-align:$align;'>" . $display_text . "</th>\n";
print '<th ' . ($tip != '' ? "title='" . htmlspecialchars($tip, ENT_QUOTES, 'UTF-8') . "'":'') . " class='$align $nohide'>" . $display_text . "</th>\n";
}else{
print '<th ' . ($tip != '' ? "title='" . htmlspecialchars($tip, ENT_QUOTES, 'UTF-8') . "'":'') . " class='sortable" . ($isSort ? " $isSort":'') . "' style='text-align:$align;'>";
print '<th ' . ($tip != '' ? "title='" . htmlspecialchars($tip, ENT_QUOTES, 'UTF-8') . "'":'') . " class='sortable $align $nohide $isSort'>";
print "<div class='sortinfo' sort-page='" . htmlspecialchars($form_action, ENT_QUOTES, 'UTF-8') . "' sort-column='$db_column' sort-direction='$direction'><div class='textSubHeaderDark'>" . $display_text . "<i class='$icon'></i></div></div></th>\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 "<tr class='tableHeader " . (!$last_item_colspan > 1 ? 'tableFixed':'') . "'>\n";
for ($i=0; $i<count($header_items); $i++) {
if (is_array($header_items[$i])) {
print "<th style='text-align:" . $header_items[$i]['align'] . ";' " . ((($i+1) == count($header_items)) ? "colspan='$last_item_colspan' " : "") . ">" . $header_items[$i]['display'] . "</th>\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 "<th class='$nohide $align' " . ((($i+1) == count($header_items)) ? "colspan='$last_item_colspan' " : "") . ">" . $item['display'] . "</th>\n";
}else{
print "<th style='text-align:left;' " . ((($i+1) == count($header_items)) ? "colspan='$last_item_colspan' " : "") . ">" . $header_items[$i] . "</th>\n";
print "<th " . ((($i+1) == count($header_items)) ? "colspan='$last_item_colspan' " : "") . ">" . $item . "</th>\n";
}
$i++;
}
print "</tr>\n";
@@ -771,11 +725,23 @@ function html_header_checkbox($header_items, $include_form = true, $form_action
print "<tr class='tableHeader " . (!$resizable ? 'tableFixed':'') . "'>\n";
for ($i=0; $i<count($header_items); $i++) {
if (is_array($header_items[$i])) {
print "<th style='padding:4px;text-align:" . $header_items[$i]['align'] . ";'>" . $header_items[$i]['display'] . "</td>";
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 "<th class='$align $nohide'>" . $item['display'] . "</td>";
}else{
print "<th style='padding:4px;text-align:left;'>" . $header_items[$i] . "</th>\n";
print "<th class='left'>" . $item . "</th>\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 "<tr class='formRow'>\n";
print "<tr class='tableRow'>\n";
}else{
print "<tr class='$customClass'>";
print "<tr class='tableRow $customClass'>";
}
print '<td>';
@@ -1317,19 +1283,19 @@ function html_show_tabs_left() {
if (get_selected_theme() == 'classic') {
if ($show_console_tab == true) {
?><a href="<?php echo $config['url_path']; ?>index.php"><img src="<?php echo $config['url_path']; ?>images/tab_console<?php print (is_console_page(get_current_page()) ? '_down':'');?>.gif" alt="<?php print __('Console');?>"></a><?php
?><a <?php print (is_console_page(get_current_page()) ? " id='maintab-anchor" . rand() . "' class='selected'":"");?> href="<?php echo $config['url_path']; ?>index.php"><img src="<?php echo $config['url_path']; ?>images/tab_console<?php print (is_console_page(get_current_page()) ? '_down':'');?>.gif" alt="<?php print __('Console');?>"></a><?php
}
if (is_realm_allowed(7)) {
if ($config['poller_id'] > 1 && $config['connection'] != 'online') {
// Don't show graphs tab when offline
}else{
?><a href="<?php echo $config['url_path']; ?>graph_view.php"><img src="<?php echo $config['url_path']; ?>images/tab_graphs<?php
$file = get_current_page();
if ($file == "graph_view.php" || $file == "graph.php") {
print "_down";
print "<a id='maintab-anchor" . rand() . "' class='selected' href='" . htmlspecialchars($config['url_path'] . 'graph_view.php') . "'><img src='" . $config['url_path'] . "images/tab_graphs_down.gif' alt='" . __('Graphs') . "'></a>";
}else{
print "<a href='" . htmlspecialchars($config['url_path'] . 'graph_view.php') . "'><img src='" . $config['url_path'] . "images/tab_graphs.gif' alt='" . __('Graphs') . "'></a>";
}
print ".gif";?>" alt="Graphs"></a><?php
}
}
+48 -26
View File
@@ -41,44 +41,60 @@ function draw_edit_form($array) {
}
}
$i = 0;
if (sizeof($fields_array) > 0) {
if (!isset($config_array['no_form_tag'])) {
print "<form method='post' autocomplete='off' action='" . ((isset($config_array['post_to'])) ? $config_array['post_to'] : get_current_page()) . "'" . ((isset($config_array['form_name'])) ? " name='" . $config_array['form_name'] . "'" : '') . ((isset($config_array['enctype'])) ? " enctype='" . $config_array['enctype'] . "'" : '') . ">\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 "<tr style='display:none;'><td><form method='post' autocomplete='off' action='" . ((isset($config_array['post_to'])) ? $config_array['post_to'] : get_current_page()) . "'" . ((isset($config_array['form_name'])) ? " name='" . $config_array['form_name'] . "'" : '') . ((isset($config_array['enctype'])) ? " enctype='" . $config_array['enctype'] . "'" : '') . "></td></tr>\n";
}
}
if ($field_array['method'] == 'hidden') {
print '<div class="hidden formRow">';
form_hidden_box($field_name, $field_array['value'], ((isset($field_array['default'])) ? $field_array['default'] : ''), true);
print '</div>';
}elseif ($field_array['method'] == 'hidden_zero') {
print '<div class="hidden formRow">';
form_hidden_box($field_name, $field_array['value'], '0', true);
print '</div>';
}elseif ($field_array['method'] == 'spacer') {
if (isset($field_array['collapsible']) && $field_array['collapsible'] == 'true') {
$collapsible = true;
}else{
$collapsible = false;
if ($i > 0) {
print '</div>';
}
print "<tr class='spacer tableHeader" . ($collapsible ? ' collapsible':'') . "' id='row_$field_name'><td colspan='2' style='cursor:pointer;' class='tableSubHeaderColumn'>" . $field_array['friendly_name'] . ($collapsible ? "<div style='float:right;padding-right:4px;'><i class='fa fa-angle-double-up'></i></div>":'') . "</td></tr>\n";
$collapsible = (isset($field_array['collapsible']) && $field_array['collapsible'] == 'true');
print "<div class='spacer formHeader" . ($collapsible ? ' collapsible':'') . "' id='row_$field_name'><div class='formHeaderText'>" . $field_array['friendly_name'] . ($collapsible ? "<div class='formHeaderAnchor'><i class='fa fa-angle-double-up'></i></div>":'') . '</div></div>';
}else{
// Make a row using a div
if (isset($config_array['force_row_color'])) {
print "<tr class='formRow even-alternate'>";
print "<div id='row_$field_name' class='formRow even-alternate $row_class'>";
}else{
form_alternate_row('row_' . $field_name);
print "<div id='row_$field_name' class='formRow $row_class'>";
if ($row_class == 'even') {
$row_class = 'odd';
}else{
$row_class = 'even';
}
}
print "<td class='formRow' style='width:" . ((isset($config_array['left_column_width'])) ? $config_array['left_column_width'] . 'px;':'50%;') . "'>\n<span class='formItemName'>" . $field_array['friendly_name'] . "</span>\n";
// Make a form row
print "<div class='formColumnLeft'>";
print "<div class='formFieldName'>" . $field_array['friendly_name'];
if (read_config_option('hide_form_description') == 'on') {
print '<br><span class="formItemDescription">' . ((isset($field_array['description'])) ? $field_array['description'] : '') . "<br></span>\n";
print '<br><span class="formFieldDescription">' . ((isset($field_array['description'])) ? $field_array['description'] : '') . "</span>\n";
}else{
print '<div class="formTooltip">';
print display_tooltip((isset($field_array['description'])) ? $field_array['description'] : '');
print '</div>';
}
print '</div>';
if (isset($field_array['sub_checkbox'])) {
print "<br>\n";
print '<br>';
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 "</td>\n<td>\n";
// End form title column
print '</div>';
// New form column for content
print '<div class="formColumnRight"><div class="formData">';
draw_edit_control($field_name, $field_array);
print "</td>\n</tr>\n";
// End content column
print '</div></div>';
// End form row
print '</div>';
}
$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 '<em id="' . $field_name . '">' . htmlspecialchars($field_array['value'],ENT_QUOTES) . '</em>';
print '<em>' . htmlspecialchars($field_array['value'], ENT_QUOTES, 'UTF-8') . '</em>';
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 "<input role='button' type='button' " .
print "<input type='button' " .
"id='$form_name' " .
"name='$form_name' " .
"value='$value' " .
@@ -562,9 +586,7 @@ function form_hidden_box($form_name, $form_previous_value, $form_default_value,
$form_previous_value = $form_default_value;
}
print ($in_form) ? "<tr style='display:none;'><td colspan='2'>\n":'';
print "<input style='height:0px;' type='hidden' id='$form_name' name='$form_name' value='" . htmlspecialchars($form_previous_value, ENT_QUOTES) . "'>\n";
print ($in_form) ? "</td></tr>\n":'';
print "<div style='display:none;'><input style='height:0px;' type='hidden' id='$form_name' name='$form_name' value='" . htmlspecialchars($form_previous_value, ENT_QUOTES) . "'></div>";
}
/* 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 "<input role='radio' type='radio' id='$css_id' name='$form_name' value='$form_current_value'" . $class . $on_change . $checked . "><label for='$css_id'>$form_caption</label>\n";
print "<input type='radio' id='$css_id' name='$form_name' value='$form_current_value'" . $class . $on_change . $checked . "><label for='$css_id'>$form_caption</label>\n";
}
/* form_text_area - draws a standard html text area box
+4 -8
View File
@@ -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<li id='tbranch:" . $leaf['id'] . "_thost:" . $leaf['host_id'] . "' data-jstree='{ \"type\" : \"device\" }'>Device: " . htmlspecialchars($leaf['hostname']) . "</li>\n";
}elseif ($leaf['local_graph_id'] > 0) {
} elseif ($leaf['local_graph_id'] > 0) {
$dhtml_tree[] = "\t\t\t\t<li id='tbranch:" . $leaf['id'] . "_tgraph:" . $leaf['local_graph_id'] . "' data-jstree='{ \"type\" : \"graph\" }'>Graph: " . htmlspecialchars(get_graph_title($leaf['local_graph_id'])) . "</a></li>\n";
}else{ //It's not a host
} else { //It's not a host
$dhtml_tree[] = "\t\t\t\t<li class='jstree-closed' id='tbranch:" . $leaf['id'] . "'>" . htmlspecialchars($leaf['title']) . "</li>\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) {
+54 -69
View File
@@ -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 "<tr class='$class selectable formRow' id='$row_id'>\n";
}else{
print "<tr class='$class formRow'>\n";
if ($row_id != '') {
print "<tr class='$class selectable tableRow' id='$row_id'>\n";
} else {
print "<tr class='$class tableRow'>\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 "<tr class='$class selectable formRow' id='$row_id'>\n";
}elseif (substr($row_id,0,4) == 'row_') {
print "<tr class='$class formRow' id='$row_id'>\n";
}elseif (strlen($row_id)) {
print "<tr class='$class formRow' id='$row_id'>\n";
}else{
print "<tr class='$class formRow'>\n";
if ($row_id != '' && !$disabled && substr($row_id, 0, 4) != 'row_') {
print "<tr class='$class selectable tableRow' id='$row_id'>\n";
} elseif (substr($row_id, 0, 4) == 'row_') {
print "<tr class='$class tableRow' id='$row_id'>\n";
} elseif ($row_id != '') {
print "<tr class='$class tableRow' id='$row_id'>\n";
} else {
print "<tr class='$class tableRow'>\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 "<span class='deviceDisabled'>" . __('Disabled') . "</span>";
}else{
} else {
switch ($status) {
case HOST_DOWN:
return "<span class='deviceDown'>" . __('Down') . "</span>";
+4
View File
@@ -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');
+77 -72
View File
@@ -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)) {
+68 -31
View File
@@ -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'];
}
+1 -1
View File
@@ -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);