diff options
Diffstat (limited to 'frontends/php')
-rw-r--r-- | frontends/php/exp_imp.php | 20 | ||||
-rw-r--r-- | frontends/php/include/export.inc.php | 14 | ||||
-rw-r--r-- | frontends/php/include/import.inc.php | 15 | ||||
-rw-r--r-- | frontends/php/include/perm.inc.php | 15 |
4 files changed, 33 insertions, 31 deletions
diff --git a/frontends/php/exp_imp.php b/frontends/php/exp_imp.php index 42ee7cf5..19f7bcdc 100644 --- a/frontends/php/exp_imp.php +++ b/frontends/php/exp_imp.php @@ -207,7 +207,7 @@ include_once "include/page_header.php"; $el_table = new CTableInfo(S_ONLY_HOST_INFO); $sqls = array( S_TEMPLATE => !isset($templates[$host['hostid']]) ? null : - ' SELECT ht.hostid, h.host as info, count(distinct ht.hosttemplateid) as cnt '. + ' SELECT MIN(ht.hostid) as hostid, h.host as info, count(distinct ht.hosttemplateid) as cnt '. ' FROM hosts h, hosts_templates ht '. ' WHERE ht.templateid = h.hostid '. ' GROUP BY h.host', @@ -215,15 +215,17 @@ include_once "include/page_header.php"; ' select hostid, description as info, 1 as cnt from items'. ' where hostid='.$host['hostid'], S_TRIGGER => !isset($triggers[$host['hostid']]) ? null : - 'select i.hostid, t.description as info, count(distinct i.hostid) as cnt'. - ' from functions f, items i, triggers t'. - ' where t.triggerid=f.triggerid and f.itemid=i.itemid'. - ' group by f.triggerid, i.hostid, t.description', + 'SELECT i.hostid, t.description as info, count(distinct i.hostid) as cnt, f.triggerid '. + ' FROM functions f, items i, triggers t'. + ' WHERE t.triggerid=f.triggerid'. + ' AND f.itemid=i.itemid'. + ' GROUP BY f.triggerid, i.hostid, t.description', S_GRAPH => !isset($graphs[$host['hostid']]) ? null : - 'select g.name as info, i.hostid, count(distinct i.hostid) as cnt'. - ' from graphs_items gi, items i, graphs g '. - ' where g.graphid=gi.graphid and gi.itemid=i.itemid'. - ' group by gi.graphid, i.hostid' + 'SELECT MIN(g.name) as info, i.hostid, count(distinct i.hostid) as cnt, gi.graphid'. + ' FROM graphs_items gi, items i, graphs g '. + ' WHERE g.graphid=gi.graphid '. + ' AND gi.itemid=i.itemid'. + ' GROUP BY gi.graphid, i.hostid' ); foreach($sqls as $el_type => $sql) diff --git a/frontends/php/include/export.inc.php b/frontends/php/include/export.inc.php index 3b851e4f..ee69e083 100644 --- a/frontends/php/include/export.inc.php +++ b/frontends/php/include/export.inc.php @@ -84,7 +84,9 @@ 'show_triggers' => '', 'graphtype' => '', 'yaxismin' => '', - 'yaxismax' => '') + 'yaxismax' => '', + 'show_legend' => '', + 'show_3d' => '') ), XML_TAG_GRAPH_ELEMENT => array( 'attribures' => array( @@ -168,7 +170,7 @@ } foreach($map['elements'] as $db_name => $xml_name) { - if(empty($data[$db_name])) continue; + if(!isset($data[$db_name])) continue; if(empty($xml_name)) $xml_name = $db_name; zbx_xmlwriter_write_element ($memory, $xml_name, $data[$db_name]); } @@ -213,7 +215,7 @@ } foreach($map['elements'] as $db_name => $xml_name) { - if(empty($data[$db_name])) continue; + if(!isset($data[$db_name])) continue; if(empty($xml_name)) $xml_name = $db_name; zbx_xmlwriter_write_element ($memory, $xml_name, $data[$db_name]); @@ -242,7 +244,7 @@ } foreach($map['elements'] as $db_name => $xml_name) { - if(empty($data[$db_name])) continue; + if(!isset($data[$db_name])) continue; if(empty($xml_name)) $xml_name = $db_name; zbx_xmlwriter_write_element ($memory, $xml_name, $data[$db_name]); } @@ -267,7 +269,7 @@ } foreach($map['elements'] as $db_name => $xml_name) { - if(empty($data[$db_name])) continue; + if(!isset($data[$db_name])) continue; if(empty($xml_name)) $xml_name = $db_name; zbx_xmlwriter_write_element ($memory, $xml_name, $data[$db_name]); } @@ -300,7 +302,7 @@ } foreach($map['elements'] as $db_name => $xml_name) { - if(empty($data[$db_name])) continue; + if(!isset($data[$db_name])) continue; if(empty($xml_name)) $xml_name = $db_name; zbx_xmlwriter_write_element ($memory, $xml_name, $data[$db_name]); } diff --git a/frontends/php/include/import.inc.php b/frontends/php/include/import.inc.php index 571e2aff..d3d6a3c3 100644 --- a/frontends/php/include/import.inc.php +++ b/frontends/php/include/import.inc.php @@ -35,7 +35,7 @@ $this->item = array('exist' => 0, 'missed' => 0); $this->trigger = array('exist' => 0, 'missed' => 0); $this->graph = array('exist' => 0, 'missed' => 0); - + $this->accessible_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_WRITE, null, PERM_RES_IDS_ARRAY, get_current_nodeid()); @@ -117,7 +117,8 @@ break; // case } - if( count($this->accessible_nodes) > 0 ){ +// if( count($this->accessible_nodes) > 0 ){ + if(!in_array(get_current_nodeid(),$this->accessible_nodes)){ error('Host ['.$data['name'].'] skipped - Access deny.'); break; // case } @@ -492,6 +493,8 @@ if(!isset($data['graphtype'])) $data['graphtype'] = 0; if(!isset($data['yaxismin'])) $data['yaxismin'] = 0; if(!isset($data['yaxismax'])) $data['yaxismax'] = 0; + if(!isset($data['show_legend'])) $data['show_legend'] = 0; + if(!isset($data['show_3d'])) $data['show_3d'] = 0; if(!isset($data['items'])) $data['items'] = array(); if(!isset($this->data[XML_TAG_HOST]['hostid']) || !$this->data[XML_TAG_HOST]['hostid']) @@ -536,8 +539,9 @@ $data['show_work_period'], $data['show_triggers'], $data['graphtype'], + $data['show_legend'], + $data['show_3d'], $graph['templateid']); - DBexecute('delete from graphs_items where graphid='.$data['graphid']); } else @@ -563,7 +567,10 @@ $data['yaxismax'], $data['show_work_period'], $data['show_triggers'], - $data['graphtype']); + $data['graphtype'], + $data['show_legend'], + $data['show_3d'] + ); } foreach($data['items'] as $item) diff --git a/frontends/php/include/perm.inc.php b/frontends/php/include/perm.inc.php index 00d1f53f..5354e087 100644 --- a/frontends/php/include/perm.inc.php +++ b/frontends/php/include/perm.inc.php @@ -314,12 +314,6 @@ COpt::counter_up('perm'); $result= array(); - switch($perm_res) - { - case PERM_RES_DATA_ARRAY: $resdata = '$node_data'; break; - default: $resdata = '$node_data["nodeid"]'; break; - } - COpt::counter_up('perm_nodes['.$userid.','.$perm.','.$perm_mode.','.$perm_res.','.$nodeid.']'); COpt::counter_up('perm'); @@ -377,19 +371,16 @@ COpt::counter_up('perm'); } /* special processing for PERM_READ_LIST*/ - if(PERM_DENY == $node_data['permission'] && PERM_READ_LIST == $perm) - { + if(PERM_DENY == $node_data['permission'] && PERM_READ_LIST == $perm){ $groups = get_accessible_groups_by_user($user_data, $perm, PERM_MODE_GE,PERM_RES_DATA_ARRAY,$node_data['nodeid']); if(count($groups) == 0) continue; } - else - { + else{ if(eval('return ('.$node_data["permission"].' '.perm_mode2comparator($perm_mode).' '.$perm.')? 0 : 1;')) continue; } - - $result[$node_data["nodeid"]] = eval('return '.$resdata.';'); + $result[$node_data["nodeid"]]= ($perm_res == PERM_RES_DATA_ARRAY)?$node_data:$node_data["nodeid"]; } if($perm_res == PERM_RES_STRING_LINE) |